Sunday, August 28, 2011

Get value from ADF selectOneChoice


    public void selectOneChoice1_valueChangeListener(ValueChangeEvent valueChangeEvent) {
	  //for iterator name click binding tab in the jsf page
        DCIteratorBinding  listIter = getBindingsForDCB().findIteratorBinding("yourViewObj1Iterator");                  
        int curIndex = (Integer)valueChangeEvent.getNewValue(); 
        Row datRow = listIter.getRowAtRangeIndex(curIndex);
        String name = (String)datRow.getAttribute("Code"); //as in data control
    }

Wednesday, August 10, 2011

ADF tableLayouts


A TableLayout is a thin wrapper around the HTML < table > element. It contains a series of row layout elements.

Example:

<afh:tableLayout width="75%"
             borderWidth="3"
             cellSpacing="10"
             halign="center">
  <afh:rowLayout>
     First Column

    <afh:cellFormat valign="bottom">
      SecondColumn
    </afh:cellFormat>

    <af:panelGroup layout="horizontal">
      Third Column
      <af:objectSpacer height="100" width="1"/>
    </af:panelGroup>

  </afh:rowLayout>

  <afh:rowLayout>
    <af:panelHeader text="ADF Faces Components"/>
    <afh:cellFormat columnSpan="2">
      <af:panelHeader text="Faces Servlet"/>
    </afh:cellFormat>
  </afh:rowLayout>
</afh:tableLayout>
               

Sunday, July 24, 2011

what are the differences between methodValidator and setter method ?


  1. methodValidator are called during the validation rule stage (i.e. at some point during the execution of setAttributeInternal method). On the other hand, business rule inside the setter may or may not call setAttributeInternal method.
  2. use setter validation If you want your business rule validation comes before other validations. But if you want it to come after some validations rules use a methodValidator.
  3. methodValidator can be used for several attributes, as an example the previously mentioned validatePhoneNumber method can be used for WorkPhone and HomePhone attributes.
First Part.
The first part of this example is to add a business rule using  validatePhoneNumber method as shown below.
/**
     * Validation method for PhoneNumber.
     */
public boolean validatePhoneNumber(String phonenumber) {
        if (phonenumber.length() < 9)
            return false;
        else
            return true;
    }
What happen when we run our application?
when we run the application and set the phone number field, the following steps take place:
  1. the view object layer calls setAttribute(“PhoneNumber”,”123456789″)method.
  2. setAttribute(“PhoneNumber”,”123456789″) method callssetPhoneNumber(String value) method in our EmployeesEntityImpl class.
  3. setPhoneNumber(String value) callssetAttributeInternal(PHONENUMBER, value) where PHONENUMBER is an integer to identify PhoneNumber attribute.
  4. setAttributeInternal(PHONENUMBER, value) method callsvalidatePhoneNumber(String phonenumber) method.
  5. if validatePhoneNumber(String phonenumber) method returns true, then PhoneNumber attribute is set with the passed value.
As we can see that at some point during the execution setPhoneNumber(String value) method calls setAttributeInternal(PHONENUMBER, value) which in turns calls the validatePhoneNumber(String phonenumber) method. The difference between setAttributeInternal(PHONENUMBER, value) andsetAttribute(“PhoneNumber”,”123456789″) methods is thatsetAttribute(“PhoneNumber”,”123456789″) invokes the set method for this attribute in a subclass of this Entity Object (if a subclass is generated). The setmethod name is derived from the attribute name: for example, the method setPhoneNumber pertains to an attribute named “PhoneNumber”.ButsetAttributeInternal(PHONENUMBER, value) validates and sets the value of an attribute by index, it sets an attribute value after validating the value against declarative-validators set for that attribute.
Second Part.
In this part we will add our business rule to the attribute’s setter method as shown below:
/**
     * If you write validation code in a setter method,
     * you have to throw an exception yourself
     */  
public void setPhoneNumber(String value) throws oracle.jbo.JboException {
        if (value.length() >= 9)
            setAttributeInternal(PHONENUMBER, value);
        else
            throw new oracle.jboJboException(“Phone number should be at least 9 digits”);
    }
What happen when we run our application?
The setter method just described implements exactly the same business rule as the validatePhoneNumber method. When we run the application and set the phone number field, the following steps take place:
  1. the view object layer calls setAttribute(“PhoneNumber”,”123456789″)method.
  2. setAttribute(“PhoneNumber”,”123456789″) method callssetPhoneNumber(String value) method in our EmployeesEntityImpl class.
  3. now the business rule is checked in the setter method, if passed then it callssetAttributeInternal(PHONENUMBER, value) method, otherwise it throws the exception and notifies the user with business rule violation.

Sunday, July 17, 2011

ADF Seminars Replays from Virtual Developer Days

http://blogs.oracle.com/shay/date/20110714

Converting ADF Pages to Reusable Page Fragments

ADF has some great reusability features for JSF pages in the form of TaskFlows, Page Fragments and Regions. And even if you didn't plan ahead of time to use those, you can still get your page to become a pagefragment and be included in other pages quite easily with the JDeveloper convert options for taskflows.

Saturday, June 11, 2011

What is SXML ?



 That store sensitive or confidential information on computer systems, data protection is extremely important. A number of software programs and technologies are used for data protection, one of which is the .sxml file.

Source

  • A file with the .sxml file extension is associated with Oracle Information Rights Management technology.


Sunday, May 29, 2011

ADF Calendar Event in jdeveloper



The ADF Faces calendar component displays created activities in daily, weekly, monthly, or list view for a given provider or providers where the provider is the owner of an activity. 
ADF Faces Calendar Showing Weekly View
Calendar Event Documents:


ADF Calendar step-by-step implementation