def METHOD_NAME(application_id):
    ap = models.Application.pull(application_id)
    if ap is None:
        abort(404)
    auth_svc = DOAJ.authorisationService()
    try:
        auth_svc.can_edit_application(current_user._get_current_object(), ap)
    except exceptions.AuthoriseException:
        abort(401)
    try:
        lockinfo = lock.lock(constants.LOCK_APPLICATION, application_id, current_user.id)
    except lock.Locked as l:
        return render_template("editor/application_locked.html", METHOD_NAME=ap, lock=l.lock)
    form_diff, current_journal = ApplicationFormXWalk.update_request_diff(ap)
    # Edit role is either associate_editor or editor, depending whether the user is group leader
    eg = models.EditorGroup.pull_by_key("name", ap.editor_group)
    role = 'editor' if eg is not None and eg.editor == current_user.id else 'associate_editor'
    fc = ApplicationFormFactory.context(role, extra_param=exparam_editing_user())
    if request.method == "GET":
        fc.processor(source=ap)
        return fc.render_template(obj=ap, lock=lockinfo, form_diff=form_diff, current_journal=current_journal,
                                  lcc_tree=lcc_jstree)
    elif request.method == "POST":
        processor = fc.processor(formdata=request.form, source=ap)
        if processor.validate():
            try:
                processor.finalise()
                flash('Application updated.', 'success')
                for a in processor.alert:
                    flash_with_url(a, "success")
                return redirect(url_for("editor.application", application_id=ap.id, _anchor='done'))
            except Exception as e:
                flash(str(e))
                return fc.render_template(obj=ap, lock=lockinfo, form_diff=form_diff, current_journal=current_journal,
                                  lcc_tree=lcc_jstree)
        else:
            return fc.render_template(obj=ap, lock=lockinfo, form_diff=form_diff, current_journal=current_journal,
                                  lcc_tree=lcc_jstree)