Created
September 28, 2011 18:20
-
-
Save biemond/1248752 to your computer and use it in GitHub Desktop.
Get the PageFlowScope of a Region Bounded Task Flow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test.adf.global.beans; | |
import javax.faces.event.ActionEvent; | |
import java.util.Map; | |
import oracle.adf.controller.ControllerContext; | |
import oracle.adf.model.BindingContext; | |
import oracle.adf.model.binding.DCBindingContainer; | |
import oracle.adf.view.rich.context.AdfFacesContext; | |
import oracle.adf.controller.internal.binding.DCTaskFlowBinding; | |
import oracle.adfinternal.controller.state.ChildViewPortContextImpl; | |
import oracle.adfinternal.controller.state.RootViewPortContextImpl; | |
import test.adf.global.interfaces.BeanInt; | |
public class MainBean { | |
public MainBean() { | |
} | |
private String name = "main"; | |
public void setName(String name) { | |
this.name = name; | |
} | |
public String getName() { | |
return name; | |
} | |
// dump current Task Flow pageFlowScope | |
public void dumpPageFlowScope(ActionEvent actionEvent) { | |
AdfFacesContext facesCtx= null; | |
facesCtx= AdfFacesContext.getCurrentInstance(); | |
Map<String, Object> scopeVar= facesCtx.getPageFlowScope(); | |
for ( String key : scopeVar.keySet() ) { | |
System.out.println("key: "+key); | |
System.out.println("value: "+scopeVar.get(key)); | |
} | |
} | |
// dump the child Task Flow pageFlowScope | |
public void dumpChildPageFlowScope(ActionEvent actionEvent) { | |
// get the current BindingContainer | |
BindingContext bctx = BindingContext.getCurrent(); | |
DCBindingContainer mainViewPageBinding = (DCBindingContainer) | |
bctx.getCurrentBindingsEntry(); | |
// find the task flow pagedef binding, see the pageDef | |
DCTaskFlowBinding tf = (DCTaskFlowBinding) | |
mainViewPageBinding.findExecutableBinding("child1"); | |
System.out.println(tf.getFullName()); | |
ControllerContext conn = ControllerContext.getInstance(); | |
RootViewPortContextImpl rootViewPort = | |
(RootViewPortContextImpl) conn.getCurrentRootViewPort(); | |
ChildViewPortContextImpl childView = (ChildViewPortContextImpl) | |
rootViewPort.getChildViewPortByClientId(tf.getFullName()); | |
// get pageFlowScope | |
Map<String, Object> scopeVar= childView.getPageFlowScopeMap(); | |
for ( String key : scopeVar.keySet() ) { | |
System.out.println("key: "+key); | |
System.out.println("value: "+scopeVar.get(key)); | |
} | |
BeanInt bean = (BeanInt)scopeVar.get("childBean"); | |
System.out.println(bean.getName()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cool! THX!