简体   繁体   English

Oracle WebCenter中的WSRP Portlet:在Portlet中转换任务流(ADF)

[英]WSRP Portlets in Oracle WebCenter: transforming task flows(ADF) in portlets

I am doing some research on the portlets offered by WebCenter, but I have some problems related with transferring parameters between them. 我正在研究WebCenter提供的Portlet,但是在它们之间传递参数方面存在一些问题。 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. 我的想法是创建2个Portlet:部门Portlet,我可以在其中选择一个DepartmentId,该ID作为参数发送到第二个Portlet,即employees,因此我将获得一个包含来自指定部门的相应员工的表。 These 2 portlets are constructed based on some page flows. 这2个Portlet是基于某些页面流构造的。 The department portlet works fine, but with the employees portlet, I have some problems. 部门portlet可以正常工作,但是对于员工portlet,我有一些问题。

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. 与员工相对应的JSP页面片段具有一个基于ViewObject的表,该表在其后具有一个基于绑定变量的查询。 I have created an EmployeesBean, where I have the method that takes the received parameter and executes the query with this bind variable. 我创建了一个EmployeesBean,其中有采用接收的参数并使用此绑定变量执行查询的方法。 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 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. 我还拖动了employee.jsff的getEmployees()方法,因此,如果我转到页面定义,我就有一个绑定,它将确定每次事件出现时都要执行的getEmployees方法。 All this mixed with the departments.jsff works in a .jspx page if I create the Event mapping 如果创建事件映射,则所有这些与department.jsff混合在一起的内容都可以在.jspx页面中使用

Now I am trying to transform this task flow into a portlet. 现在,我正在尝试将此任务流转换为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: 在为页面流创建portlet条目之后,我需要创建一个导航参数,并在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 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. 一切正常,但是当我尝试将其用作WebCenter应用程序中的Portlet时,当我选择一个部门时,将DepartmentId转移到员工Portlet中,将调用selectDepartment,但是从不调用getEmployees()(该事件不会传播),因此我的表中没有返回任何数据。 I'm a beginner in portlets and I can't see what the problem is. 我是Portlet的初学者,我看不出问题所在。 Can anyone give me some ideas? 谁能给我一些想法?

when you consume the employee portlet , it creates the page parameter in the page def. 当您使用employee portlet时,它将在page def中创建page参数。 You will have to pass the data to that parameter 您将必须将数据传递给该参数

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM