Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Define DefName attribute of NodeDefinition in PageDefs at runtime

santiago_ncNov 14 2014 — edited Dec 5 2014

In my application I recreate each ViewObject Instances at runtime with a a new ViewDef which is a copy of original ViewDef with several customizations (hints and other properties of its attributes, modifications in its where clauses. etc, Meta Data is defined in the DB).

Example:

VO Instance NameViewDef (FullName)
OriginalmyVoInstanceNamemyPackage.myVoInstanceName
Customized (at runtime)myVoInstanceNamemyPackage.impl.randomName.myVoInstanceName

When I drop a ViewObject from my DataControl in a Page/PageFragment, It is created a new Node with this definition (tree, gantt, calendar, ...). Each of this node has a child named <nodeDefinition DefName="myPackage.myVoInstanceName">

I find this post https://blogs.oracle.com/groundside/entry/towards_ultra_reusability_for_adf a close solution to my current problem. Simply, I could remove the DefName attribute in the NodeDefinition.

I have found in this "ADF Code Corner The Oracle JDeveloper Forum Harvest 10 / 2010", a better explanation of DefName attribute. In this PDF is explained that It is neccessary when you have a TreeTable with polymorphic ViewObjects, in other cases is optional.


I have found another errors with Gantt and Calendar component.


If you remove the DefName in a calendar Definition, simply It renders empty.


If you remove the DefName in a Gantt It fires a faces error at runtime.

To resolve this errors I have checked that If I change this DefName with my new Name (myPackage.impl.randomName.myVoInstanceName), the component use my custom VOInstance  all works fine, but I don't Know how can I change this at runtime. (In this case, I have change the random name for a constant).

My next step was set the variable "myPackage.impl.randomName.myVoInstanceName" into pageDef variable and write this in the DefName attribute.

Steps

1). In a TaskFlow I have executed a MethodCall of DataControl in which I return a Map with the VOInstanceName and ViewDefFullName.

public Map getViewDefsAtRuntime() {

    Map<String,String> mapVOsViewDef = new HashMap<String,String>();

    ViewObject[] vos = this.getViewObjects();

    for (ViewObject vo : vos) {

        String voName = vo.getName();

        ViewObjectImpl voImpl = (ViewObjectImpl) vo;

        String viewDefName = voImpl.getDef().getFullName();

        mapVOsViewDef.put(voName,viewDefName);

    }

    return mapVOsViewDef;

}

2). In the return value property of Method Call I have put this:

#{pageFlowScope.mapViewDefs}

3). In the Page/PageFragment I could check that the map has the correct values:

<?xml version='1.0' encoding='UTF-8'?>

<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:af="http://xmlns.oracle.com/adf/faces/rich"

                xmlns:f="http://java.sun.com/jsf/core">

  <af:panelGroupLayout id="pgl1">

    <af:inputText label="All VOs Defs" id="it1" rows="10" value="#{pageFlowScope.mapViewDefs}" readOnly="true"/>

    <af:inputText label="One VO Defs" id="it2" value="#{pageFlowScope.mapViewDefs['myVoName']}" readOnly="true"/>

   <af:table ...>...</af:table>

  </af:panelGroupLayout>

</ui:composition>

4) At this point I have try with this: (MyPageFragmentPageDef.xml)

...

<tree IterBinding="DepartmentsIterator" id="Departments">

  <nodeDefinition DefName="#{pageFlowScope.mapViewDefs['Departments']}" Name="VOName0">

    <AttrNames>

      <Item Value="DepartmentId"/>

      <Item Value="DepartmentName"/>

    </AttrNames>

  </nodeDefinition>

</tree>

...

But this doesn't work. The DefName doesn't support EL. How can I solve this?

PS:

I have found another option in this post:

http://adfpractice-fedor.blogspot.com.es/2013/02/dynamic-tree-binding-definition.html

But I cant recreate the binding for Calendar and Gantt and I have an issue if in the TaskFlow is executed a ExecuteWithParams in the VO before is Rendered in the Page. (a Required Not Null error is fired).

This was my first aproximation but I think that it is more dificult resolve all of my issues with it.

jDeveloper 12c (12.1.2.0)

Comments

santiago_nc

I don't fix this yet.

santiago_nc

Any help?

Hi,

Why not use MDS? Why you've to re-create the VO just for changing it's UI hints and properties?

Check out this sample : http://andrejusb.blogspot.in/2014/04/mds-seeded-customization-approach-with.html

-Arun

santiago_nc

Hi,

I have to recreate the VO at runtime since I could change the query, add different LOV to an attribute at runtime, etc Really, the ViewObject created by jDveloper is a template which I could change at runtime with meta-data saved in DataBase.

Each application is a TaskFlow pageFragment based which is rendered as a Region. Then, It could show same application in two regions, showing different ViewObject Instances at runtime.

1 - 4
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jan 2 2015
Added on Nov 14 2014
4 comments
324 views