Wednesday, 25 January 2017
Thursday, 19 January 2017
ADF : Serializable
ADF : Serializable
All the managed beans should be serializable because the container may occassionally serialize and passivate the beans or send it over the network. This occurs in situations
such as heavy load (our case) or when clustering is enabled.
Another tip:
- The managed beans with pageFlow or session scope are required to be serialized while backingBean or request scope are not required to be serialized.
- The ADF/JSF Rich UI components are not serializable and hence they should not be present in pageFlow scope managed beans.
Response: Your pageFlowScope bean should implements Serializable.
such as heavy load (our case) or when clustering is enabled.
Another tip:
- The managed beans with pageFlow or session scope are required to be serialized while backingBean or request scope are not required to be serialized.
- The ADF/JSF Rich UI components are not serializable and hence they should not be present in pageFlow scope managed beans.
Response: Your pageFlowScope bean should implements Serializable.
Eg:
Possibility 1:

Possibility 4:
Report
By setting this in java option we will get to know the issues in diagnostic or em logs.
-Dorg.apache.myfaces.trinidad.CHECK_STATE_SERIALIZATION=all
check : http://hasamali.blogspot.in/2011/09/adf-jsf-adfc-scope-object-serialization.html
About - serialVersionUID
The serialVersionUID is used as a version control in a Serializable class. If you do not explicitly declare a serialVersionUID, JVM will do it for you automatically, based on various aspects of your Serializable class
Check - https://www.mkyong.com/java-best-practices/understand-the-serialversionuid/
How Server does Serialization and Deserialization
A simple way to write / serialize the UserBean object into a file – “c:\\UserBean.ser”.
FileOutputStream fout = new FileOutputStream("c:\\UserBean.ser");
ObjectOutputStream oos = new ObjectOutputStream(fout);
oos.writeObject(UserBean Obj);
A simple way to read / deserialize the UserBean object from file – “c:\\UserBean.ser”.
FileInputStream fin = new FileInputStream("c:\\UserBean.ser");
ObjectInputStream ois = new ObjectInputStream(fin);
UserBean = (UserBean) ois.readObject();
Thursday, 12 January 2017
Wednesday, 4 January 2017
Saturday, 17 December 2016
ADF : Treetable - SelectionListner and onLoad execution
ADF : Treetable - SelectionListner and onLoad execution
On
Selection Listner – Store data into pageflowscope
public void
fileImpotObjectsTreeSelectionListener(SelectionEvent selectionEvent){
ADFUtil.invokeEL("#{ApplicationsTreeBean.treeSelectionHandler}",
new Class[] {
SelectionEvent.class },
new Object[] {
selectionEvent });
CollectionModel treeModel =
(CollectionModel)
fileImpotObjectsTreeTable.getValue();
RowKeySet rs =
getFileImpotObjectsTreeTable().getSelectedRowKeys();
RichTreeTable fileImpotObjectsTreeTable
= this.getFileImpotObjectsTreeTable();
Object oldKey = fileImpotObjectsTreeTable.getRowKey();
Map attributeMap = new HashMap();
if(rs != null){
Iterator it = rs.iterator();
if (it.hasNext()){
List rowKey = (List) it.next();
if (rowKey.size() > 0){
//Key k = (Key) rowKey.get(0);
//ADFUtil.setEL("#{pageFlowScope.selectedTerrKey}", k);
fileImpotObjectsTreeTable.setRowKey(treeModel.getRowKey());
JUCtrlHierNodeBinding
rowData =
(JUCtrlHierNodeBinding)
fileImpotObjectsTreeTable.getRowData();
if (rowData != null) {
Row r =
rowData.getRow();
ADFUtil.setEL("#{pageFlowScope.selectedObjectDetailId}",
r.getAttribute("ObjectDetailId"));
attributeMap.put("alternatekey",
r.getAttribute("AlternateKeys"));
attributeMap.put("mandatoryattr",
r.getAttribute("MandatoryAttrs"));
attributeMap.put("mandatorygrpattr",
r.getAttribute("MandatoryGroupAttrs"));
ADFUtil.setEL("#{pageFlowScope.attributeMap}", attributeMap);
ADFUtil.invokeEL("#{bindings.filterObjectAttributesByObjectDetail.execute}");
AdfFacesContext.getCurrentInstance().addPartialTarget(this.fileImpotObjectsAttributeTable);
}
}
}
}
}
On Page
load – Store data into pageflowscope
public Object getRowKeysOnPageLoad() {
RichTreeTable fileImpotObjectsTreeTable
= this.getFileImpotObjectsTreeTable();
if (fileImpotObjectsTreeTable != null)
{
Object oldKey =
fileImpotObjectsTreeTable.getRowKey();
Object key = null;
Map attributeMap = new HashMap();
CollectionModel treeModel =
(CollectionModel)
fileImpotObjectsTreeTable.getValue();
if (treeModel != null) {
RowKeySet selectedRowKeySet =
fileImpotObjectsTreeTable.getSelectedRowKeys();
if (selectedRowKeySet != null)
{
Iterator
selectedRowKeySetIterator =
selectedRowKeySet.iterator();
fileImpotObjectsTreeTable.setRowIndex(0);
key =
fileImpotObjectsTreeTable.getRowKey();
fileImpotObjectsTreeTable.setRowKey(treeModel.getRowKey());
//Add the first row to the
selection list
fileImpotObjectsTreeTable.getSelectedRowKeys().add(treeModel.getRowKey());
//Add the first row to the
disclosed list, so that the tree is expanded on page load
fileImpotObjectsTreeTable.getDisclosedRowKeys().add(treeModel.getRowKey());
//retrieve the data of the
first row
JUCtrlHierNodeBinding
rowData =
(JUCtrlHierNodeBinding)
fileImpotObjectsTreeTable.getRowData();
if (rowData != null) {
Row row =
rowData.getRow();
DCIteratorBinding
parentObjectDetailsIterator =
this.findIterator("ParentObjectDetailsIterator");
if
(parentObjectDetailsIterator != null) {
RowSetIterator rsi
=
parentObjectDetailsIterator.getRowSetIterator();
Row[] selectedRow =
rsi.getFilteredRows("ObjectDetailId",
row.getAttribute("ObjectDetailId"));
if
(selectedRow.length > 0) {
rsi.setCurrentRow(selectedRow[0]);
ADFUtil.setEL("#{pageFlowScope.selectedObjectDetailId}",
row.getAttribute("ObjectDetailId"));
attributeMap.put("alternatekey",
row.getAttribute("AlternateKeys"));
attributeMap.put("mandatoryattr",
row.getAttribute("MandatoryAttrs"));
attributeMap.put("mandatorygrpattr",
row.getAttribute("MandatoryGroupAttrs"));
ADFUtil.setEL("#{pageFlowScope.attributeMap}", attributeMap);
ADFUtil.invokeEL("#{bindings.filterObjectAttributesByObjectDetail.execute}");
AdfFacesContext.getCurrentInstance().addPartialTarget(this.fileImpotObjectsAttributeTable);
}
}
}
}
}
fileImpotObjectsTreeTable.setRowKey(oldKey);
return key != null? key:
fileImpotObjectsTreeTable.getRowKey();
}
return null;
}
Reuse
Stored data from pageflowscope
public void
loadTableList(ActionEvent actionEvent) {
List<FileImportValidationMessage> thisValidationMessageList =
(List<FileImportValidationMessage>)ADFUtil.evaluateEL("#{pageFlowScope.keyTableList}");
if (thisValidationMessageList != null)
{
Object alternateKey =
resolvElDC("#{row.TaskDetails14}");
if(alternateKey != null
&& !"".equalsIgnoreCase(alternateKey.toString())){
FileImportValidationMessage fileImportValidationMessage = null;
List<FileImportValidationMessage>
keyTableList = new ArrayList<FileImportValidationMessage>();
String
alternamteKeyStr = alternateKey.toString();
String keys[] =
alternamteKeyStr.split("|");
Integer count = 1;
for(int i = 0; i
< keys.length; i++) {
fileImportValidationMessage = new
FileImportValidationMessage(count.toString(),keys[i]);
keyTableList.add(fileImportValidationMessage);
}
this.keyTableList =
keyTableList;
ADFUtil.setEL("#{pageFlowScope.keyTableList}", keyTableList);
}
}
}
JSFF code
<af:treeTable
value="#{bindings.ParentObjectDetails1.treeModel}"
var="node" rowSelection="single"
selectionListener="#{backingBeanScope.FileImportManageImportObjects.fileImpotObjectsTreeSelectionListener}"
id="ATTt1" initiallyExpanded="true"
expandAllEnabled="true" autoHeightRows="10"
displayRowKey="#{backingBeanScope.FileImportManageImportObjects.rowKeysOnPageLoad}"
binding="#{backingBeanScope.FileImportManageImportObjects.fileImpotObjectsTreeTable}"
rowBandingInterval="0" columnStretching="last"
contentDelivery="immediate"
summary="#{MktCommonMarketingGenBundle['OLabel.TargetObjects']}"
>
<f:facet
name="nodeStamp">
<af:column
headerText="#{MktCommonMarketingGenBundle['OLabel.DisplayName6']}"
id="c1" sortable="true" width="200"
rowHeader="unstyled">
<af:panelGroupLayout id="pgl5"
layout="horizontal">
<af:image source="/images/qual_checkmark_16.png"
rendered="#{node.IsCustomObject}"
shortDesc="#{MktCommonMarketingGenBundle['OLabel.CustomObject']}"
id="i1"/>
<af:spacer width="10"
rendered="#{node.IsCustomObject}"
height="10"
id="s2"/>
<af:outputText value="#{node.ObjectNamePathDisplayLabel}"
id="ot1"/>
</af:panelGroupLayout>
</af:column>
</f:facet>
<f:facet
name="pathStamp">
<af:group id="g22">
<af:panelGroupLayout id="pgl544"
layout="horizontal">
<af:image source="/images/qual_checkmark_16.png"
rendered="#{node.IsCustomObject}"
shortDesc="#{MktCommonMarketingGenBundle['OLabel.CustomObject']}"
id="i133"/>
<af:spacer width="10" rendered="#{node.IsCustomObject}"
height="10"
id="s233"/>
<af:outputText value="#{node.ObjectNamePathDisplayLabel}"
id="ot2"/>
</af:panelGroupLayout>
</af:group>
</f:facet>
<af:column
headerText="#{MktCommonMarketingGenBundle['Header.LanguageIndependentCode.LanguageIndependentObjectAttri']}"
id="c2"
sortable="true" width="200">
<af:outputText value="#{node.ViewObjectInstanceName}"
id="ot3"/>
</af:column>
<af:column
headerText="Alternatekey"
id="c222" sortable="true" width="100">
<af:commandImageLink
id="cil1"
icon="/images/key_dwn.png">
<af:showPopupBehavior popupId=":::p1"
triggerType="click"/>
</af:commandImageLink>
</af:column>
<af:column
headerText="Required fields"
id="c233" sortable="true" width="100">
<af:commandImageLink
id="cil2"
icon="/images/fuse-icon-checkmark.png">
<af:showPopupBehavior
popupId=":::popup1" triggerType="click"/>
</af:commandImageLink>
</af:column>
<!--
<af:column
headerText="#{MktCommonMarketingGenBundle['OLabel.CustomObject']}"
id="c3" sortable="true" width="200"
align="center">
<af:switcher
defaultFacet="false"
facetName="#{node.IsCustomObject}"
id="s1">
<f:facet name="true">
<af:image source="/images/qual_checkmark_16.png"
shortDesc="#{MktCommonMarketingGenBundle['OLabel.CustomObject']}"
id="i1"/>
</f:facet>
<f:facet name="false"/>
</af:switcher>
</af:column>
-->
<af:column
sortable="true"
headerText="#{MktCommonMarketingAttrBundle['ColAttr.Description.ImportMappingDescription.MKTIMPMAP.DESCTEXT']}"
id="c10">
<af:outputText value="#{node.Description}"
id="ot10"/>
</af:column>
</af:treeTable>
Subscribe to:
Posts (Atom)




















