If you have requirement to call the Data Control method from managed bean, Use AdfmfJavaUtilities.invokeDataControlMethod(). Below is complete code
Data Control method name is calculateDays with three argument of String type. In below method "iHCMWSClient" (name of the data control).
List pnames1 = new ArrayList();
List params1 = new ArrayList();
List ptypes1 = new ArrayList();
pnames1.add("arg0"); //start date
ptypes1.add(String.class);
params1.add(TimeShift.convertStringToDate(startDate));
pnames1.add("arg1"); //endDate
ptypes1.add(String.class);
params1.add(TimeShift.convertStringToDate(endDate));
pnames1.add("arg2"); //personID
ptypes1.add(String.class);
params1.add(new AbsenceRequest().getpID());
System.out.println("%%%%% result" + noOfDays);
try {
noOfDays =
(String)AdfmfJavaUtilities.invokeDataControlMethod("iHCMWSClient", null, "calculateDays", pnames1, params1, ptypes1);
System.out.println("%%%%% result" + noOfDays);
} catch (AdfInvocationException e) {
throw new AdfException("error ", AdfException.ERROR);
}
List pnames1 = new ArrayList();
List params1 = new ArrayList();
List ptypes1 = new ArrayList();
pnames1.add("arg0"); //start date
ptypes1.add(String.class);
params1.add(TimeShift.convertStringToDate(startDate));
pnames1.add("arg1"); //endDate
ptypes1.add(String.class);
params1.add(TimeShift.convertStringToDate(endDate));
pnames1.add("arg2"); //personID
ptypes1.add(String.class);
params1.add(new AbsenceRequest().getpID());
System.out.println("%%%%% result" + noOfDays);
try {
noOfDays =
(String)AdfmfJavaUtilities.invokeDataControlMethod("iHCMWSClient", null, "calculateDays", pnames1, params1, ptypes1);
System.out.println("%%%%% result" + noOfDays);
} catch (AdfInvocationException e) {
throw new AdfException("error ", AdfException.ERROR);
}
No comments:
Post a Comment