WSRP Portlets in Oracle WebCenter: Converting Task Flows (ADF) in Portlets

I am researching the portlets offered by WebCenter, but I have some problems passing parameters between them. My idea was to create 2 portlets: a department portlet where I can select 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 built on top of some page streams. The department portlet works fine, but I have some problems with the employee portlet.

The snippet of the JSP page corresponding to the employees has a table based on the ViewObject that has a query behind it based on the binding variable. I created an EmployeesBean where I have a method that takes the parameter it receives and executes a query against that binding variable. Here is the 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));
    }
}

      

I've also dragged employee.jsff to the getEmployees () method, so if I go to the page definition, I have a binding that will define the getEmployees method that will run every time the event occurs. All this mixed with department.jsff works in the .jspx page if I create an event mapping

I am now trying to convert this task flow to a portlet. After I create a portlet entry for a page flow, I need to create a navigation parameter, and I do this in employee.xml:

<input-parameter-definition>
    <description>Main context parameter</description>
    <display-name>Department Number</display-name>
    <name>deptno</name>
    <value>#{pageFlowScope.contextProvider.departmentNumber}</value>
    <class>java.lang.String</class>
</input-parameter-definition>
<managed-bean>
    <managed-bean-name>contextProvider</managed-bean-name>
    <managed-bean-class>view.EmployeesBean</managed-bean-class>
    <managed-bean-scope>pageFlow</managed-bean-scope>
</managed-bean>

      

Everything works fine, but when I try to use it as a portlet in the WebCenter app, when I select a department, the DepartmentId is transferred to the employee portlet, selectDepartment is called, but getEmployees () is never called (event is not propagated), so no data is returned in my table ... I'm new to portlets and I don't understand what the problem is. Can anyone give me some ideas?

+2


a source to share


1 answer


when you use employee portlet it creates page parameter on def page. You will need to pass data to this parameter



0


a source







All Articles