Return Activity is used when bounded task flow completes and send control flow back to caller.Return activity works only with the bounded task flow.Return task flow's reentry is option is set only if the task flow's reentry-outcome-dependent is set.End transaction option is available for the Return activity for transaction commit and rollback.Also we can set the restore save point option to either true or false.
Create a called task flow as below
return_called_view1.jsff
Create a called task flow as below
return_called_view1.jsff
<?xml
version='1.0' encoding='UTF-8'?>
<jsp:root
xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<af:panelGroupLayout
id="pgl1">
<af:outputText value="Return Activity
Calling TF" id="ot1"/>
<af:button text="button 1"
id="b1" action="testOutCome"/>
</af:panelGroupLayout>
</jsp:root>
return_called_view1.jsff :
<jsp:root
xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<af:panelGroupLayout
id="pgl1">
<af:outputText value="Called Task
Flow" id="ot1"/>
<af:button text="Calling
Retun" id="b1" action="toReturn"/>
</af:panelGroupLayout>
</jsp:root>
Task flow return activity options are as shown below
The outcome "goToView2" is the control flow case defined in the calling task flow. Also look at the other options like Reentry,End Transaction and Restore Save Point.
Calling Task flow:
Also set the listeners for the task flow call activity. Below the managed bean for the before and after listener for the task flow call activity.
package
test.view;
public
class TFCallActivityListeners {
public TFCallActivityListeners() {
super();
}
public void beforeListerner() {
System.out.println("Before
listener called ");
}
public void afterListener() {
System.out.println("After listener
called ");
}
}
The code for the jspx files in the calling task flow
return_view1.jspx
<?xml
version='1.0' encoding='UTF-8'?>
<jsp:root
xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<af:panelGroupLayout
id="pgl1">
<af:outputText value="Return activity"
id="ot1"/>
<af:button text="button 1"
id="b1" action="tocall"/>
</af:panelGroupLayout>
</jsp:root>
return_view2.jspx
<?xml
version='1.0' encoding='UTF-8'?>
<jsp:root
xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<af:panelGroupLayout
id="pgl1">
<af:outputText value="To
view2" id="ot1"/>
</af:panelGroupLayout>
</jsp:root>
Drag and drop the calling task flow to a jspx file as a region and run the page. Click through the command buttons to reach the final view in the UI.Check the jdeveloper log to see the after listeners are executed.
No comments:
Post a Comment