Friday, March 30, 2012

Get the selected Value from SelectOneChoice(LOV) in Bean

To get the selected Value from selectOneChoice (LOV) in Bean


<af:selectOneChoice value="#{row.bindings.LevelType.inputValue}"
 id="soc3"
label="#{row.bindings.LevelType.label}"
valueChangeListener="#{backingBeanScope.GroupingBean.onSubtypLvllTypValChnge}"
autoSubmit="true">
<f:selectItems value="#{row.bindings.LevelType.items}" id="si3"/>
<f:attribute name="rowIndexVal" value="#{row.bindings.LevelType.items[row.bindings.LevelType.inputValue].label}"/>
</af:selectOneChoice>




public void onSubtypLvllTypValChnge(ValueChangeEvent valueChangeEvent) {

        valueChangeEvent.getComponent().processUpdates(FacesContext.getCurrentInstance());
        Map p = ((UIComponent)valueChangeEvent.getSource()).getAttributes();
        System.out.println("Selected Value"+p.get("rowIndexVal"));
  }


One can find a different other approaches here..
http://mjabr.wordpress.com/2011/03/19/reading-the-selected-value-of-a-select-list-in-java/
http://myadfnotebook.blogspot.com/2010/09/getting-string-value-or-item-code-of.html

Tuesday, March 27, 2012

Access Resource Bundle in Bean

   
    To access resource bundle in bean

    public String getTextProp(){
        String bundle_name= "com.gppsuite.view.ViewControllerBundle";
        ResourceBundle resourceBundle =   BundleFactory.getBundle(bundle_name);
        String txt =null;
        if(resourceBundle != null)
        {
        txt = resourceBundle.getString("string_id");
        }
        return txt;
    }


Thanks Lakshman for your comments.
Including your comments in the post for the benefit of others.

2)

We can also use
java.util.ResourceBundle rb = ResourceBundle.getBundle("com/oracle/,,,,/Bundle1");
String txt = rb.getString("prop1");

3)
public String readPropertiesFile(String property){
String configureURL = null;
try{
InputStream is = ConfigureBean.class.getResourceAsStream("Engenio.properties");
Properties prop = new Properties();
prop.load(is);
configureURL = prop.getProperty(property);
is.close();
/* code to use values read from the file*/
}catch(Exception e){
e.printStackTrace();

}
return configureURL;
}

Monday, March 26, 2012

Sources for WebServices with ADF learning

Building and Using Web Services With JDeveloper 11g

Here is the one which talks discusses.. WebServices at galance



Other articles can be found here.. Those are nice

http://st-curriculum.oracle.com/obe/jdev/obe11jdev/11/index.html

Index


http://st-curriculum.oracle.com/obe/jdev/obe11jdev/ps1/ria_application/developriaapplication_long.htm

Developing RIA Web Applications with Oracle ADF

 

 

ADF best practice to give webservice calls: A good read

https://groups.google.com/d/topic/adf-methodology/9NPM6J64f0E/discussion 
 

Web Services with Complex Data Types in ADF 11g

https://blogs.oracle.com/shay/entry/web_services_with_complex_data
http://www.oracle.com/technetwork/testcontent/adf11g-agile-131400.pdf
http://www.oracle.com/technetwork/developer-tools/adf/learnmore/54-ws-complex-input-type-169197.pdf

Getting old/previous value of an ADF BC attribute

Getting old/previous value of an attribute notes from the Source  Oracle Insider Article

Groovy expression to get old value:

1) Create a transient attribute and generate eoimpl or voimpl. Override the getter method with the following

return getPostedAttribute(model.EmployeeImpl.SALARY)

Posted value is which is submitted.

2) To use as part of validations we can use implicit objects available as part of groovy expression.

sample:

newValue - OldValue < oldValue *.1

Tuesday, January 31, 2012

ADF integration with Configurator

Following posts  are very nice for integrating Configurator with ADF application.

Configurator Overview
http://apps2fusion.com/at/pb/276-oracle-configurator-articles-i

Embedding Oracle Configurator in WebCenter / ADF Applications
http://www.oracle.com/technetwork/topics/newtojava/overview/ofm-ebs-blog-postings-096286.html



ADF tries to launch a URL from the taskflow. Usually the url will be a servlet which acts as mediator for calling Configurator page.
Places the user credentials and landing page info as parameters in the request  and invokes a Configurator app.
Once the task is done with Configurator, it returns a value.

Soon I will try to attach the sample that I am working on.

Thursday, December 22, 2011

10 things to consider before developing ADF UI

I like this article from ADF EMG, and it is worth reading as and when we about to build an application.

10 things to consider before developing ADF UI

-Create a Database Design properly from Business Requirement

-Think 10 times before starting Taskflow development and make sure you have considered all point of
  handling Transaction , Scope , Fragments GUI look and Feel , Regions , Dynamic Regions etc. ,

- If you have generic business function using many EO/VO which may or may not be related then please create that method in AppModule
  which can be expose as client method and used from managed bean, taskflow , jsff and more.

- If you have business function related to MasterVO/ChildVO then please create custom method in VOImpl.java and expose it as client method
  to be used from JSFF ,managed bean , taskflow.

- If you have common validation then please create CUSTOMVALIDATOR CLASS in java

- Write generic Error Handler for ADF Page in DataControl.cpx file

- if you have common control Hint Please create Custom Domain and Property Set

- if you have common VO/EO then please create new project for that and utilize in our ADF project as adflib.

- if you have common java script then create javascript library and use it as Resource in JSFF pages.

- Look at DoDml() , Create() , PrepareModel , validateentity() method in EOImpl.java

- Use Groovy as much as possible in EO/VO to get rid of Client based validation

- Use Custom Links and Association to get rid of relationship based on contextual event or partial trigger.

- Try not to make your application too complex


PS:ADF EMG is a great source for get to know Best Practices, design considerations and latest happenings.

Wednesday, October 19, 2011

Add Javascript from Bean in ADF Page

Add Javascript from Bean

FacesContext facesContext = FacesContext.getCurrentInstance();

org.apache.myfaces.trinidad.render.ExtendedRenderKitService service = org.apache.myfaces.trinidad.util.Service.getRenderKitService(facesContext, ExtendedRenderKitService.class);

service.addScript(facesContext, "alert('Hi');window.close();");
Protected by Copyscape Unique Content Check