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

Protected by Copyscape Unique Content Check