title: WSRP Portlets in Oracle WebCenter: transforming task flows(ADF) in portlets
body: <p>I am doing some research on the portlets offered by WebCenter, but I have some problems related with transferring parameters between them. My idea was to create 2 portlets: a department portlet where I can chose a departmentId which is sent as a parameter to the second portlet, employees, so I will have a table with the corresponding employees from the specified department. These 2 portlets are constructed based on some page flows. The department portlet works fine, but with the employees portlet, I have some problems.</p>
  
  <p>The JSP page fragment corresponding to the employees has a table based on a ViewObject which has behind him a query based on a bind variable. I have created an EmployeesBean, where I have the method that takes the received parameter and executes the query with this bind variable. Here is the code:</p>
  
  <pre><code>import javax.el.ELContext;
  import javax.el.ExpressionFactory;
  import javax.el.ValueExpression;
  
  import javax.faces.application.Application;
  import javax.faces.context.FacesContext;
  
  import oracle.adf.view.rich.context.AdfFacesContext;
  
  import oracle.jbo.ApplicationModule;
  import oracle.jbo.Row;
  import oracle.jbo.ViewObject;
  
  public class EmployeesBean {
      private static final String DEPARTMENT_NUMBER_KEY = "DEPTNO";
      private static final int DEPARTMENT_NUMBER_NULL_VALUE = -1;   
  
      public EmployeesBean() {
          super();
      }
  
      public void getEmployees(String deptno) {
          System.out.println("enters in getEmployees()");
          int filterDeptno = findDepartmentValue(deptno);
          FacesContext facesContext = FacesContext.getCurrentInstance();
          Application app = facesContext.getApplication();
          ExpressionFactory elFactory = app.getExpressionFactory();
          ELContext elContext = facesContext.getELContext();
          ValueExpression valueExp =
              elFactory.createValueExpression(elContext, "#{data.AppModuleDataControl.dataProvider}",
                                          Object.class);
          ApplicationModule am = (ApplicationModule)valueExp.getValue(elContext);
          ViewObject emplVO;
          emplVO = am.findViewObject("EmployeesVO1");       
          emplVO.setNamedWhereClauseParam("deptno", filterDeptno);
          emplVO.executeQuery();
          Row r = emplVO.first();
          System.out.println(r.getAttribute("FirstName"));
      }
  
      public void setDepartmentNumber(String deptno) {
          selectDepartment(deptno);       
      }
  
      public void selectDepartment(String deptno) {
          System.out.println("aici e problema");
          AdfFacesContext afContext = AdfFacesContext.getCurrentInstance();
          System.out.println(deptno);        
          afContext.getPageFlowScope().put(DEPARTMENT_NUMBER_KEY, deptno);
      }
  
      public int findDepartmentValue(String defaultValue) {
          AdfFacesContext afContext = AdfFacesContext.getCurrentInstance();
          String deptno =
              (defaultValue == null ? (String)afContext.getPageFlowScope().get(DEPARTMENT_NUMBER_KEY) :
           defaultValue);
          return (deptno == null ? DEPARTMENT_NUMBER_NULL_VALUE :
              Integer.valueOf(deptno));
      }
  }
  </code></pre>
  
  <p>I have also dragged on the employees.jsff the getEmployees() method so if I go to page definition I have there a  binding, which will determine the getEmployees method to be executed every time an event appears. All this mixed with the departments.jsff works in a .jspx page if I create the Event mapping</p>
  
  <p>Now I am trying to transform this task flow into a portlet. After I create a portlet entry for the page flow, I need to create a navigational parameter, and I am doing this in the employees.xml:</p>
  
  <pre><code>&lt;input-parameter-definition&gt;
      &lt;description&gt;Main context parameter&lt;/description&gt;
      &lt;display-name&gt;Department Number&lt;/display-name&gt;
      &lt;name&gt;deptno&lt;/name&gt;
      &lt;value&gt;#{pageFlowScope.contextProvider.departmentNumber}&lt;/value&gt;
      &lt;class&gt;java.lang.String&lt;/class&gt;
  &lt;/input-parameter-definition&gt;
  &lt;managed-bean&gt;
      &lt;managed-bean-name&gt;contextProvider&lt;/managed-bean-name&gt;
      &lt;managed-bean-class&gt;view.EmployeesBean&lt;/managed-bean-class&gt;
      &lt;managed-bean-scope&gt;pageFlow&lt;/managed-bean-scope&gt;
  &lt;/managed-bean&gt;
  </code></pre>
  
  <p>Everything works fine, but when I am trying to use this as a portlet in a WebCenter application, when I select a department the departmentId is transferred to the employees portlet, the selectDepartment is called, but the getEmployees() is never called(the event is not propagated), so no data is returned in my table. I'm a beginner in portlets and I can't see what the problem is. Can anyone give me some ideas?</p>