ADF lifecycle phases difference

南楼画角 提交于 2019-12-04 15:32:13
Frank Nimphius-Oracle

ADF initContext and prepareModel,since both preparing data by executing buisness service

This is not quite correct. The initContext sets up the BindingContext, which ensures the content of DataBindings.cpx is initialized and the binding container for the page to be prepared. The prepareModel is an execution point for data queries.

The other execution point, as Timo's answer shows, is PrepareRender. Recommendation though is to keep the iterator default setting, which is "deferred" in which case only those iterators are refreshed and queried that have UI dependency.

Timo Hahn

The ADF model life cycle phases:

  • initContext sets up the life cycle, working out what PageDefs to load.
  • prepareModel creates the bindings object and adds it to the HTTP request. Parameters are also evaluated at this point.
  • applyInputValues processes the values posted from the page and builds up an internal list of bindings to update and methods to execute as required.
  • validateInputValues applies the client-side validators to the list of updates presented by the applyInputValues phase. These validators are defined as nested f:validator and af:convertNumber components within an input component.
  • processUpdateModel sends the validated changes to bound objects to the model layer.
  • validateModelUpdates manages validation errors from the Model layer.
  • processComponentEvents processes any listeners and action events queued up from the applyInputValues phase.
  • metadataCommit manages part of the runtime customization capabilities of the framework.If the user has customized the page in some way such as moving components on the screen or adding in task flows via WebCenter, then those personalizations to the screen are saved away to the metadata repository (MDS) at this point.
  • prepareRender is the last phase to execute before the page is displayed.

Note that in some situations (such as a modal dialog), the following code will not necessarily fire after the page has been rendered:

  public void afterPhase(PagePhaseEvent pagePhaseEvent) {
    if (pagePhaseEvent.getPhaseId() == Lifecycle.PREPARE_RENDER_ID) {
      injectRedirect();
    }
  }

This prevents the server code from being able to examine the af:document immediately after the document is rendered. For example the following will fail because there is no document available:

  return context.getViewRoot().getChildren().get(0).getClientId().equals("doc0");
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!