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;
}
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
I don't understand below line. It gives me error. Can you please explain it further.
OperationBinding opr = getOperation("ExecuteWithParams");
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;
}