Thursday, August 22, 2013

ADF Mobile - Get REST WebService based form values in managed bean

In my previous blog entry I went over "Get ADF Mobile Form values in managed bean using Accessor Iterator", In this entry we'll see how to get Rest WebService based form values in managed bean programmatically.

Below is one of the way to access Rest WebService based form values, here is the code below.
ValueExpression ve =
            AdfmfJavaUtilities.getValueExpression("#{bindings.editEmployeeIterator.currentRow.dataProvider}",
                                                  Object.class);
        Object obj = ve.getValue(AdfmfJavaUtilities.getAdfELContext());
  if (obj instanceof VirtualJavaBeanObject) {
            VirtualJavaBeanObject vjbo = (VirtualJavaBeanObject)obj;
            if (vjbo.getAttributeInfoCount() > 0) {
                int count = vjbo.getAttributeInfoCount();
                for (int i = 0; i > count; i++) {
                    AttributeInfo fieldName = vjbo.getAttributeInfo(i);
                    String fieldValue = vjbo.getAttribute(fieldName.name).toString();
                    System.out.println(fieldName.name + " :" + fieldValue);
                }
            }
        }

No comments:

Post a Comment