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.

Dynamic labels for attributes in Entity object

Ravi4-OracleMay 15 2015 — edited May 27 2015

Hi,

I am trying to set the labels on the entity attributes by getting the value from Database. Here is a article I am referring  -

https://technology.amis.nl/2012/08/10/implement-resource-bundles-for-adf-applications-in-a-database-table

But this article is getting dynamic labels at the viewcontroller.

I want to do the same thing at the Model layer so that the labels are set on the entity object attribute (in the UI Hints tab) so that wherever this attribute is used the labels get reflected in all the pages.

I am not able to find how to use groovy expression or set the label dynamically on the entity attribute.

Can this be achieved ?

If anyone has tried it before or any pointers will be helpful.

Thanks.

JDev - 11.1.2.4

Comments

Ruben Rodriguez

Hello,

I have never done this in the model, but you could try to do the same but in the DBResourceBundle.java class call AM method getResourceBundle like this:


getResourceBundle(String locale){

     String amDef = "your.fully.qualified.class.name.of.the.application.module";
     String config = "the_configuration_name_to_use";
     ApplicationModule am = Configuration.createRootApplicationModule(amDef, config);
     Map map = am.getResourceBundle(locale);
     Configuration.releaseApplicationModule(am, false);

          return map;

}

Then, in your entity.xml you should have this reference:

     <ResourceBundle>

         <JavaResourceBundle MsgBundleClass="path.to.DBResourceBundle"/>

      </ResourceBundle>

and in the attribute something like this:

     <Attribute

         Name="AttrName"

         ...>

         <Properties>

           <SchemaBasedProperties>

             <LABEL ResId="LABEL_KEY_IN_DB"/>

           </SchemaBasedProperties>

         </Properties>

      </Attribute>

regards,

Ruben

Ravi4-Oracle

Hi Ruben,

Thanks for the code. Will give it a try.

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

Post Details

Locked on Jun 24 2015
Added on May 15 2015
2 comments
2,605 views