how to get the value of a parameter "of OperationBinding" at runtime

Hi
This method is used to retrieve the input value of a parameter of an Operation


    public String viewScannedDocumentAction() {
        String outcome = null;
        Long doctype = null;
        String yer = null;
        DCIteratorBinding scanedDocIter = ADFUtils.findIterator("DocTransDocDtlVoIterator");
        DCIteratorBinding currentIterator = ADFUtils.findIterator("DocTransDocCountIterator");
        OperationBinding opr = getOperation("ExecuteWithParams");
        Row row = currentIterator.getCurrentRow();
        if (row != null) {
         //   Map operationParamsMap = opr.getParamsMap();
            DCInvokeMethod method = (DCInvokeMethod) opr.getOperationInfo();
            if (method != null) {
                DCInvokeMethodDef methodDef = method.getDef();
                if (methodDef != null) {
                    OperationParameter[] operationParameters = null;
                    operationParameters = methodDef.getParameters();
                    if (operationParameters != null) {
                        for (OperationParameter operationParameter : operationParameters) {
                            String argumentName = operationParameter.getName();
                            Object argumentType = operationParameter.getTypeName();
                            Object defaultValue = operationParameter.getValue();                        
                            if (argumentName.equals("p_doc_type")) {
                                doctype = (Long) JSFUtils.resolveExpression((String) defaultValue);
                               
                            } else if (argumentName.equals("p_year")) {
                                yer = (String) JSFUtils.resolveExpression((String) defaultValue);
                               
                            }
                        }
                    }
                }
            }

            if (doctype != null & yer != null) {
                ViewObject vo = scanedDocIter.getViewObject();            
                vo.setNamedWhereClauseParam("p_doc_type", doctype);
                vo.setNamedWhereClauseParam("p_year",yer.replaceAll("\\s", ""));
               String month = (String) row.getAttribute("MonthDisplay");            
                vo.setNamedWhereClauseParam("p_month", month.replaceAll("\\s",""));
                vo.executeQuery();            
                outcome="viewScannedDocument";
            } else {
                JSFUtils.addFacesErrorMessage("Please select document type and a year and press execute first");
            }
        }

        return outcome;
    }

Comments

Anonymous said…
Hello Tarek,

I don't understand below line. It gives me error. Can you please explain it further.

OperationBinding opr = getOperation("ExecuteWithParams");
Tarek Fathy said…
getOperation is another method that return OperationBinding
this is the method body
import oracle.binding.OperationBinding;

private OperationBinding getOperation(String oprName){
DCBindingContainer bc = (DCBindingContainer) BindingContext.getCurrent().getCurrentBindingsEntry();
OperationBinding opr = bc.getOperationBinding(oprName);
return opr;
}

Popular posts from this blog

Another user has changed the row with primary key oracle.jbo.Key[12 ].

Working With File Throgh WebUtill

weblogic windows JPS-01050: Opening of wallet based credential store failed. Reason java.io.IOException: Failed to lock cwallet.sso.lck