I have created an ADF coding standard document template,please refer below URL for that. Hope it will help and please give your feedback about that.
Thursday, September 23, 2010
Friday, August 27, 2010
Bounded Task Flow In Popup and Resetting Field data in Popup using popupFetchListener
In my older post (Insert Into Multiple Tables using Bounded TaskFlow in ADF ) the use case I had shown is having a drawback like data from table got automatically populated (as Shown Below) as user navigates to the bounded taskflow region from main page for creating a new Employee. In this blog I am trying to make some modification in my ViewController project so that the issue got resolved.
Step1: Create a Bounded task flow and make sure that 'Create Train' is selected.
Step 2: Drag View from Component palate and rename it likes below. Please follow my previous post (Insert Into Multiple Tables using Bounded TaskFlow in ADF and refer Figure 2 to Figure 6 ) to create those pages. Make sure those page extension should be *.jsff instead of *.jspx.
Add train Button and Train Button Bar for all pages in Task Flow like below
After completing all jsff pages bounded task flow will look like below.
Add valid name for all View id in Task Flow document source (task-flow-definition.xml)
Step 3: Modify Employee.jspx page
In my previous post (Insert Into Multiple Tables using Bounded TaskFlow in ADF) we have used Command Links for creating Employees Please refer to Figure 1 for this post. Now we can make it more fancy by using images and user can click on it to navigate to taskflows.
I have used images like for (AddProfile.PNG) Adding Employee,
for searching Employee,
for editing Employee
We can use popupFetchListener and attach it to our managed Bean using a method so that the method will execute at the time the popup rendered
- public void fetchPopupListener( PopupFetchEvent popupFetchEvent) {
- System.out. println ("In Fetch PopUP Listener"); //Create Insert For Baisc Info
- BindingContainer bindingsbasic = BindingContext . getCurrent() . getCurrentBindingsEntry() ;
- OperationBinding operationBindingbasic = bindingsbasic. getOperationBinding ("CreateInsertBasic");
- Object resultbasic = operationBindingbasic. execute() ; //Create Insert For Contact Info
- BindingContainer bindingscontact = BindingContext . getCurrent() . getCurrentBindingsEntry() ;
- OperationBinding operationBindingcontact = bindingscontact. getOperationBinding ("CreateInsertContact");
- Object resultcontact = operationBindingcontact. execute() ; //Create Insert For Master Info
- BindingContainer bindingsmaster = BindingContext . getCurrent() . getCurrentBindingsEntry() ;
- OperationBinding operationBindingmaster = bindingsmaster. getOperationBinding ("CreateInsertMaster");
- Object resultmaster = operationBindingmaster. execute() ; //Create Insert For Baisc Info
- BindingContainer bindingsedu = BindingContext . getCurrent() . getCurrentBindingsEntry() ;
- OperationBinding operationBindingedu = bindingsedu. getOperationBinding ("CreateInsertEducation");
- Object resultedu = operationBindingedu. execute() ; //Create Insert For Job Info
- BindingContainer bindingsjob = BindingContext . getCurrent() . getCurrentBindingsEntry() ;
- OperationBinding operationBindingjob = bindingsjob. getOperationBinding ("CreateInsertJob");
- Object resultjob = operationBindingjob. execute() ;
- }
But Make sure that you are having below bindings created in
Drag newly created task-flow-definition to the dialog and it will display the dialog below
We can test the page and it comes like this
Sunday, August 15, 2010
ADF tree navigation to third level and Workaround for “ADF Tree Not Inside Container”
Figure: 1
Create view object "CategoryViewObj" based upon below query on above product table.
Figure: 2
Create view object "ProducerViewObj" based upon below query on above product table.
Figure: 3
Create view object "ProductViewObj" based upon below query on above product table.
Figure: 4
Step 2: Create view link between CategoryViewObj and ProducerViewObj using CategoryId and ProducerViewObj and ProductViewObj using ProducerCode
Figure: 5
Figure: 6
Step 3: Wrap all ViewObjects and ViewLinks in application module like below.
Drag "CategoryViewObj" under ProductAppModule and named it CategoryViewInstance. Drag the viewlink immediate below it and put it under CategoryViewInstance and renamed it to "ProducerInstance" and drag the view link immediate below of "ProducerViewObj" and put it under "ProducerInstance".
Figure: 7
Step 4: Create ADF tree table by dragging "CategoryViewInstance" from data control palate and add its two level of children by clicking green add button adjacent to it. We can select our own display attributes for each level like below.
Figure: 8
Figure: 9
Figure: 10
Modify nodestamp facet under ADF treetable component like below.
Figure: 11
Add columns like below
Figure: 12
While testing the page we face this error.
<RegistrationConfigurator><handleError> Server Exception during PPR, #1
java.lang.IllegalStateException: ADFv: Not inside a container.
at oracle.adfinternal.view.faces.model.binding.FacesCtrlHierBinding$FacesModel.exitContainer(FacesCtrlHierBinding.java:672) at oracle.adfinternal.view.faces.model.FlattenedTreeCollectionModel.getRowIndex(FlattenedTreeCollectionModel.java:109)
at oracle.adfinternal.view.faces.renderkit.rich.TreeRendererUtils$1.getRowIndex(TreeRendererUtils.java:552)
at oracle.adfinternal.view.faces.renderkit.rich.TreeTableRenderer.handleExpand(TreeTableRenderer.java:520)
This will come because we did not set any key attribute in our view objects and ADF tree table is not able to find row index. So we need to set key attributes to our view objects like below.
Figure: 13
Figure: 14
Figure: 15
While testing we get our desired output.
Sunday, July 18, 2010
Display Data as Tree format using Popup in ADF
Step1: Setting up Database Objects
Figure 1: Datbase Details
Step 2: Creating EntityObjects, ViewObjects, ViewLinks
Step 2.1 Create Entity Objects (JavaTopicEntityObject, TopicDetailsEntityObject)
Create Entity Objects for JAVATOPIC database table.
Create Entity Objects for JAVA_TOPIC_DETAILS database table.
Step 2.2: Create View Objects (JavaTopicEntityObjectView, TopicDetailsEntityObjectView)
Create View object for JavaTopicEntityObject
Figure 4: Create View for JavaTopicEntityObject
Create view object for TopicDetailsEntityObject
Figure 5: Create TopicDetailsEntityObjectView view object
Step 2.3 Create ViewLink
We can create a view link between two created views shown in step 2.2. Corresponding query will be
Select b.sub1 from JAVATOPIC a, java_topic_details b where a.topicindex = b.topicindex and a.topicindex = :topicindex
Step 3: Wrap ViewObjects and ViewLinks in ApplicationModule
Step 4: Create a Popup and attach it with CommandLink
- <af:popup id ="trainpopup"> //Add contents here </af:popup> //Step 4.2 Attach a Command Link with a PopUp
- <af:commandLink text ="Training Contents" binding ="#{TrainingFeedbackBean.showContent}">
- <af:showPopupBehavior popupId ="trainpopup" align ="afterStart"/>
- </af:commandLink>
Tree Model for Source Data
Figure 6: Create ADF Binding Tree
Tree Model for Target Data
- <tree IterBinding ="JavaTopicEntityObjectView2Iterator" id ="JavaTopicEntityObjectView2"> //Parent Node Definition
- <nodeDefinition DefName ="com.emerson.javatraining.model.view.JavaTopicEntityObjectView" Name ="JavaTopicEntityObjectView20">
- <AttrNames>
- <Item Value ="Topicname"/>
- </AttrNames>
- <Accessors>
- <Item Value ="TopicDetailsEntityObjectView"/>
- </Accessors>
- </nodeDefinition> //Child Node Definition
- <nodeDefinition DefName = "com.emerson.javatraining.model.view.TopicDetailsEntityObjectView" Name ="JavaTopicEntityObjectView21">
- <AttrNames>
- <Item Value ="Sub1"/>
- </AttrNames>
- </nodeDefinition>
- </tree>
Step 6: Use Tree Binding in Popup
- <af:popup id ="trainpopup">
- <af:dialog okVisible ="false" cancelVisible ="false">
- <af:panelHeader text ="Training Contents" inlineStyle ="height:379px;width:400px;">
- <af:tree value ="#{bindings.JavaTopicEntityObjectView2.treeModel}"
- var ="node" selectionListener ="#{bindings.JavaTopicEntityObjectView2.treeModel.makeCurrent}"
- rowSelection ="single" id ="t1" visible ="true">
- <f:facet name ="nodeStamp">
- <af:outputText value ="#{node}" id ="ot1"/>
- <f:facet>
- </af:tree>
- </af:panelHeader>
- </af:dialog>
- </af:popup>
Step 7: Output:
Figure 7: View Output
Please try to find similarity between data displayed as child node with Java_topic_details and data displayed as Root node with javatopic database objects (refer figure 1).
Sunday, July 4, 2010
Updatable View and Read Only View in ADF 11.1.1.2.0
Difference in Components
Both Types of views have some common components like ViewAttribute and DesignTime .Updatable View uses Underlying Entity objects where as Read only view doesn't require any underlying Entity Object as it uses SQL Query. Below snap shows the difference between an Updatable view based on "ExpertiseAreas" database object and a read only view for same (ExpertiseAreas) object from its component's stand point.
DesignTime components are common in both types of view but <Attr> is having different values.
Updatable View | Read Only View |
<DesignTime> <Attr Name="_codeGenFlag2" Value="Access|VarAccess"/> </DesignTime> | <DesignTime> <Attr Name="_isExpertMode" Value="true"/> </DesignTime> |
Updatable View uses Underlying Entity objects where as Read only view doesn't require any underlying Entity Object as it uses SQL Query.
Updatable View | Read Only View |
<EntityUsage Name="ExpertiesAreas" Entity="model.ExpertiesAreas"/> |
<![CDATA[SELECT ExpertiesAreas.PROD_ID, ExpertiesAreas.USER_ID, ExpertiesAreas.EXPERTISE_LEVEL, ExpertiesAreas.NOTES FROM EXPERTISE_AREAS ExpertiesAreas]]> </SQLQuery> |
As it is a read only view it contains two attributes IsUpdateable and IsPersistent and their value is set to false. Updatable view have EntityAttrName and EntityUsage as it is dependent on underlying entity Objects to represent a column where as Read Only View is using Type, ColumnType, Expression and SQLType to represent same. Please refer below table where an Updatable View having column ProdId represents it and same thing is represented in Read Only View.
Updatable View | Read Only View |
<ViewAttribute Name="ProdId" IsNotNull="true" PrecisionRule="true"
EntityUsage="ExpertiesAreas" AliasName="PROD_ID"> </ViewAttribute> | <ViewAttribute Name="ProdId" IsNotNull="true" PrecisionRule="true"
IsPersistent="false"
ColumnType="NUMBER" AliasName="PROD_ID"
SQLType="NUMERIC"> <DesignTime> <Attr Name="_DisplaySize" Value="22"/> </DesignTime> </ViewAttribute> |
Sunday, June 27, 2010
Weblogic throws "java.sql.SQLException: ORA-01005: null password given" Work Around
note: please click on each image to get full size
As work around I have used property (-Djps.app.credential.overwrite.allowed = true) in JAVA_PROPERTY section of setDomainEnv.sh script file in $WLS_HOME/user_projects/domain/<domain_name>/bin directory.
After modifying Weblogic server needs to be restarted.
And I get my desire output
Monday, June 21, 2010
Changing Rich Components during Runtime in ADF 11g
The Query as follows
SELECT Order_Number, Order_line_number, Order_type, Line_type, creation_date, Quantity, Price, Model_NBR
FROM cci_order_monitor_points
WHERE TRUNC (creation_date) BETWEEN TO_DATE (:frmdate, 'MM/DD/YYYY') AND TO_DATE (:todate, 'MM/DD/YYYY') AND
division = :division AND
destinationsystem = :destination AND
monitor_ref = :ref AND
originatingsystem = :origin
Now in User Interface we need to have
- one <af:commandLink> or <af:commandButton> for firing event
- two RichInputDate one for frmdate and another for todate.
- Other values can be feed using RichInputText or RichSelectOneChoice as per designer choice.
When that Command Button is pressed or Command Link is clicked then its corresponding ActionListener method will execute and this is the place where we can evaluate all validation and check whether right input is feed to that query or not.
So First of all we need to get hold of those Rich components. Select the rich component and go to it's property
We can create a new Managed bean or use an existing one ; it will create one Private variable and two methods one for setter and another for getter of the same.
In the method for that Action Listener public void actionListenerImpl(ActionEvent actionEvent) we can refer that property and create our own validation logic.