I had a recent requirement to populate database table values to BPM payload based on certain selections user makes in a human task UI. To add to the complication, there could be multiple rows that are associated with the user selection on UI and hence my BPM object had to be an array. Creating array objects and automatically populating them turned out quite tricky.
One way to solve this is by generating the payload as DOM and updating the BPM with java API.
A lesser complicated approach is to make use of ADF bindings. This article explains the steps.
1. Create the BPM project
2. Create the ADF Model for database
3. Generate the ADF UI for human task. This can be done using the auto-generate wizard.
4. Find the bindings for 'CreateInsert' button for the array object and the array UI table.
5. Comment out the source code for the button and table mentioned above.
6. From BPM data control, drag and drop the children of array object on to the jspx page.
7. This will create bindings the attributes of array object. We now have bindings for 'CreateInsert' button, the array itself and the array object attributes.
8. Comment out the array object attributes UI elements. We are only interested in the bindings. Not the source. You could always create bindings from the page definition file.
9. Construct the UI for database objects with action components. In my case, it was a select one choice drop down with a selectionListener.
10. From within the action listener in my backing bean (this could be a submit button as well), use an EL helper class to invoke 'CreateInsert' and then set array attributes with the database selected values. In between you could do any kind of operation, like calling another AM method to retrieve additional details.
11. In the back end we are creating the array object and populating it every time user makes a selection. In some scenarios you might want to delay this until user 'submit's the form. But either ways, the process of calling 'CreateInsert' setters will work.
For more complicated scenarios, working with human task API is the only option.
Monday, October 21, 2013
Sunday, September 29, 2013
Get that good looking ADF RichTable
Here are some suggestions to build a good looking ADF table.
1. Use a panelBox for the table. It makes the table stand out from the background.
2. Put a panelCollection inside the panelBox. This will provide some very neat out of the box features- like column selection, detach, column ordering, etc. Detach is very useful when displaying large number of columns under space constraint. It will let the table open up in a popup occupying the entire page width. PanelCollection will also open up a good toolbar area where actions can be added.
3. Use that toolbar facet inside panelCollection and add action components there.
4. Set 'AFStretchWidth' styleClass to panelCollection.
5. Add the table to the panelCollection and pick required columns.
6. Set a column or 'last' for columnStretching property of the table
7. Set contentDelivery as immediate and autoHeightRows to an appropr1ate value. This setting will display the vertical scrollbar when required based on autoHeightRows value.
8. Set a width for all columns except for the column picked for columnStretching. eg: width="200px"
9. Set column width using the inlineStyle property of column. eg: inlineStyle="height:25px"
This should provide the basic framework for a nicely formatted ADF table. Work with other visual attributes like horizontalGridVisible, inlineStyle, etc. to make the table even better.
Code for the basic layout options mentioned above:
<af:panelbox id="pb1" text="My Company Contacts">
<f:facet name="toolbar">
<af:panelcollection id="pc1" styleclass="AFStretchWidth">
<f:facet name="menus">
<f:facet name="toolbar">
<af:toolbar id="t4">
<af:activecommandtoolbarbutton icon="/resources/edit.png" id="actb4" text="Edit Person">
<af:activecommandtoolbarbutton icon="/resources/delete.png" id="actb5" text="Remove Person">
<af:activecommandtoolbarbutton icon="/resources/add.png" id="actb6" text="Add Person">
</af:activecommandtoolbarbutton></af:activecommandtoolbarbutton></af:activecommandtoolbarbutton></af:toolbar>
</f:facet>
<f:facet name="statusbar">
<af:table autoheightrows="20" columnstretching="last" contentdelivery="immediate" emptytext="#{bindings.XXX.viewable ? 'No data to display.' : 'Access Denied.'}" fetchsize="#{bindings.XXX.rangeSize}" horizontalgridvisible="true" id="t3" partialtriggers=":::soc1" rowbandinginterval="1" rows="#{bindings.XXX.rangeSize}" rowselection="single" selectedrowkeys="#{bindings.XXX.collectionModel.selectedRow}" selectionlistener="#{bindings.XXX.collectionModel.makeCurrent}" value="#{bindings.XXX.collectionModel}" var="row" verticalgridvisible="false">
<af:column headertext="#{bindings.XXX.hints.FirstName.label}" id="c5" inlinestyle="height:25px" sortable="true" sortproperty="FirstName" width="200px">
<af:outputtext id="ot4" value="#{row.FirstName}">
</af:outputtext></af:column>
</af:table></f:facet></f:facet></af:panelcollection></f:facet></af:panelbox>
End product:
Thursday, September 12, 2013
AIA Configuration Reload Error MDS-00557
Ran into MDS-00557 today while trying to update an AIA configuration to MDS. In my case the error was happening when running an ant with UpdateMetadata.xml for AIA.
The error
[deployComposite] ---->response code=500, error:Error during deployment: Data transfer error in MDS.:
[deployComposite] MDS-00001: exception in Metadata Services layer
[deployComposite] MDS-00522: failure to save document /apps/META-INF/MANIFEST.MF to the metadata repository
[deployComposite] MDS-00557: Resource /apps/META-INF/MANIFEST.MF is already locked or is being modified.
[deployComposite]
[deployComposite] MDS-00001: exception in Metadata Services layer
[deployComposite] MDS-00522: failure to save document /apps/AIAMetaData/config/AIAConfigurationProperties.xml to the metadata repository
[deployComposite] MDS-00557: Resource /apps/AIAMetaData/config/AIAConfigurationProperties.xml is already locked or is being modified.
The error
[deployComposite] ---->response code=500, error:Error during deployment: Data transfer error in MDS.:
[deployComposite] MDS-00001: exception in Metadata Services layer
[deployComposite] MDS-00522: failure to save document /apps/META-INF/MANIFEST.MF to the metadata repository
[deployComposite] MDS-00557: Resource /apps/META-INF/MANIFEST.MF is already locked or is being modified.
[deployComposite]
[deployComposite] MDS-00001: exception in Metadata Services layer
[deployComposite] MDS-00522: failure to save document /apps/AIAMetaData/config/AIAConfigurationProperties.xml to the metadata repository
[deployComposite] MDS-00557: Resource /apps/AIAMetaData/config/AIAConfigurationProperties.xml is already locked or is being modified.
Solution
This error happens when there is a lock file in the Reload process. Look for any .lck files inside Reload process and delete them.
rm ./Infrastructure/CAVS/ReloadProcess/classes/.data/00000000/je.lck ./Infrastructure/CAVS/ReloadProcess/SCA-INF/classes/.data/00000000/je.lck
If the above solution doesn't help, check the database and make sure there are no orphaned sessions locking the MDS tables.
select * from v$session s, v$process p where s.paddr = p.addr and s.sid in (select SESSION_ID from v$locked_object);
alter system kill session 'sid,serial' immediate;
Subscribe to:
Posts (Atom)