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!

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

781417
bzip2 is the native compression available in 11gr1, you are NOT using advanced compression
If you were to use zlib as the compression algorithm, then you would require the advanced compression option.

see http://download.oracle.com/docs/cd/B28359_01/backup.111/b28270/rcmconfa.htm#BRADV89466
611900
Thanks Craig for the prompt reply.

I have another 11.2 database and it's compression is set to -

CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default

Does it mean that "BASIC" is also the native comression and it defaults to BZIP2.

May be value of LOW, MEDIUM and HIGH will be the Advanced Compression Option.

Please confirm.

Thanks!
781417
I'll be honest I don't know what compression algorithm is used by the BASIC setting in 11gR2, but I would assume it is BZIP2, and hence there is no cost to using the BASIC setting.
Yes, if you choose LOW, MEDIUM or HIGH then you would need to purchase the advanced compression option

see http://download.oracle.com/docs/cd/E11882_01/backup.112/e10642/rcmconfa.htm#CHDEHCEB
611900
Yes, looks like we are good. Found one of the post by Kevin Kemph and he states -

If you don’t have Advanced Compression, you set it to BASIC.

If you do have Advanced Compression enabled, you can choose between HIGH, MEDIUM and LOW.

In reality, these terms map out as follows:

HIGH = unmodified BZIP2
MEDIUM = ZLIB
LOW = LZO
BASIC = BZIP2

What does this mean to the average person?

If you’re not using advanced compression, or are already using bzip2 and you wish to continue to use compression, simply do one of the following

configure compression algorithm basic;
configure compression algorithm clear;

If you are using advanced compression and have bzip2 or zlib set, you need to select a level before running backup to avoid an ORA- error:

configure compression algorithm [high/medium/low];
configure compression algorithm clear;

Thanks Craig once again!
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
335 views