ADF Invoke operation manually from code

痞子三分冷 提交于 2019-12-02 08:56:32

问题


I want to execute a data control operation (CreateInsert and Delete) from a buttons ActionListener. I am aware a data control button can be inserted from the Data Controls menu, but for various reasons I need to do it this way, a prominent one being I need to perform extra runtime checks.

I found the following code:

      OperationBinding operation = bindings.getOperationBinding("operation_name");
      operation.getParamsMap().put("parameter_name", parameterValue);
      operation.execute();

But don't know which variables to use for myself. First of all, I don't know which binding I should use. Then, the operation name should, as far as I know, be CreateInsert, and for the next button, CreateInsert1. Thats whats used for UIBinding now (which I will remove).

The Data control I want to use the operation of is 'ARNG1'.

So in short, I need to know how to manually invoke this Data control's CreateInsert operation.

Thanks in advance.


回答1:


See if this will help you: https://blogs.oracle.com/shay/entry/doing_two_declarative_operatio




回答2:


the code you want to execute an operation behind a actionlistener:

        public BindingContainer getBindings() {
          if (this.bindings == null) {
              FacesContext fc = FacesContext.getCurrentInstance();
              this.bindings = (BindingContainer)fc.getApplication().
                  evaluateExpressionGet(fc, "#{bindings}", BindingContainer.class);
          }
          return this.bindings;
      }

BindingContainer bindings = getBindings();
    OperationBinding operationBinding =
    bindings.getOperationBinding("doQueryResultReset");
    operationBinding.execute();



回答3:


Similar to Joe's answer but does not use EL Expression evaluator and uses direct access instead to get the BindingContainer

//Get binding container BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();

// get an Action or MethodAction
OperationBinding method = bindings.getOperationBinding("methodAction");
method.execute();
List errors = method.getErrors();



来源:https://stackoverflow.com/questions/9991671/adf-invoke-operation-manually-from-code

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