Tuesday, October 14, 2014

Changing ViewCriteria Operators on fly - Used to filter TreeTable elements

In this scenario I developed a search form that would filter treeTable elements based on parent child view access link.

I have Parent viewCriteria used in the page as AF:Query along with TreeTable, There is also a child viewCriteria applied to the child view, the parent view has the same query in the exists clause to filter parent items.

Parent View:
Child View:

Then use this code to filter and change view Criteria operators by passing the change of the operators from the parent view criteria to the detail one:

Monday, October 6, 2014

Make DynamicForm survive passivation/Activation - Error javax.el.PropertyNotFoundException: Target Unreachable, 'DynamicForm_dynamic_VO_form1' returned null

This was very wired error when creating viewObjects and ViewDef Objects on the fly and using dynamicForm tag.

I just used the code mentioned in Thirumalaisamy blog and created a method used as a common method when creating Def Objects.

public ViewDefImpl createDynamicViewDef(String packagePath, String viewName) {
PackageDefImpl newPackage;
java.lang.reflect.Method setParentMth;
try {
java.lang.reflect.Method mth =
MetaObjectManager.class.getDeclaredMethod("createContainerDefObject", new Class[] { boolean.class });
setParentMth = oracle.jbo.server.DefObject.class.getDeclaredMethod("setParent", new Class[] { oracle.jbo.common.NamedObjectImpl.class });
newPackage = (PackageDefImpl)mth.invoke(MetaObjectManager.getSingleton(), new Object[] { true });
} catch (Exception ex) {
         throw new JboException(ex);
MetaObjectManager.insertSessionMetaObject(newPackage.getFullName(), newPackage);
ViewDefImpl reportParamsViewDef = new ViewDefImpl(packagePath + "." + viewName);
reportParamsViewDef.setFullName(packagePath + "." + viewName);
try {
    setParentMth.invoke(reportParamsViewDef, new Object[] { newPackage });
   } catch (Exception ex) {
   throw new JboException(ex);
  return reportParamsViewDef;

Many thanks to  who started the whole topic with oracle support