Feb 27, 2016

Passing parameter in dynamic region using managed bean

For Demo Purpose I have created 2 application having same Input parameter.

1.)  First Application :-
   

   

I have created a Taskflow with Input Parameter name Parameter1.





I have used page show value the input parameter of










2.) Same as first application I have created second application with same input parameter.


















Now create ADF jar file of both application and call this two application in Master application.


3.) Create Master App

  •  Create a jspx page in Master Application to call above applications.



  • Now drag and drop task flow of Demo app 1



    Select Dynamic Region



    Now Select a Managed bean or create new.


  • Now drag and drop taskflow of another application as link and then first one also.

  • Now next step is to set parameter of taskflow using Hash Map.

    For same we have to declare a Map type variable in bean.

    private Map<String, Object> parameterMap = new HashMap<String, Object>();

    and create its Accessors.
  • Now set its value using below code.





  • Now pass hash map value to parameter.

    import java.io.Serializable;
    import java.util.HashMap;
    import java.util.Map;
    import oracle.adf.controller.TaskFlowId;
    
    public class DRBean implements Serializable {
    
        private String taskFlowId = "/WEB-INF/task-flow-definition1.xml#task-flow-definition1";
    
        private Map<String, Object> parameterMap = new HashMap<String, Object>();
    
        public void setParameterMap(Map<String, Object> parameterMap) {
           this.parameterMap = parameterMap;
        }
    
        String srt = "Default First App";
    
        public Map<String, Object> getParameterMap() {
            return parameterMap;
        }
    
        public DRBean() {
            setParameterVal();
        }  
        public TaskFlowId getDynamicTaskFlowId() {      
            return TaskFlowId.parse(taskFlowId);
        }
        public void setDynamicTaskFlowId(String taskFlowId) {
            this.taskFlowId = taskFlowId;
        }
        public String taskflowdefinition2() {
            srt = "Call Application 2";
            setParameterVal();
            setDynamicTaskFlowId("/WEB-INF/task-flow-definition2.xml#task-flow-definition2");
         
            return null;
        }
    
        public String taskflowdefinition1() {
            srt = "Call Application 1";
            setParameterVal();
            setDynamicTaskFlowId("/WEB-INF/task-flow-definition1.xml#task-flow-definition1");
         
            return null;
        }
    
        private void setParameterVal() {
            parameterMap.put("Parameter1", srt);
    
        }
    }
    

    Goto Page Binding and edit taskflow binding .





    select hash map from expression builder.




    Now run application.

    When we run application




    After Clicking on Call Application 1 Link



    And after clicking on Call Application 2 Link


    We have passed value of input parameter of Task flow using managed bean.