Search in sources :

Example 1 with WorkflowBean

use of org.alfresco.web.bean.workflow.WorkflowBean in project acs-community-packaging by Alfresco.

the class ManageTaskDialogCommand method execute.

/**
 * @see org.alfresco.web.app.servlet.command.Command#execute(org.alfresco.service.ServiceRegistry, java.util.Map)
 */
public Object execute(ServiceRegistry serviceRegistry, Map<String, Object> properties) {
    ServletContext sc = (ServletContext) properties.get(PROP_SERVLETCONTEXT);
    ServletRequest req = (ServletRequest) properties.get(PROP_REQUEST);
    ServletResponse res = (ServletResponse) properties.get(PROP_RESPONSE);
    FacesContext fc = FacesHelper.getFacesContext(req, res, sc, "/jsp/close.jsp");
    WorkflowBean wfBean = (WorkflowBean) FacesHelper.getManagedBean(fc, WorkflowBean.BEAN_NAME);
    // setup dialog context from url args in properties map
    String taskId = (String) properties.get(PROP_TASKID);
    ParameterCheck.mandatoryString(PROP_TASKID, taskId);
    String taskType = (String) properties.get(PROP_TASKTYPE);
    ParameterCheck.mandatoryString(PROP_TASKTYPE, taskType);
    wfBean.setupTaskDialog(taskId, taskType);
    NavigationHandler navigationHandler = fc.getApplication().getNavigationHandler();
    navigationHandler.handleNavigation(fc, null, "dialog:manageTask");
    String viewId = fc.getViewRoot().getViewId();
    try {
        sc.getRequestDispatcher(BaseServlet.FACES_SERVLET + viewId).forward(req, res);
    } catch (Exception e) {
        throw new AlfrescoRuntimeException("Unable to forward to viewId: " + viewId, e);
    }
    return null;
}
Also used : ServletRequest(javax.servlet.ServletRequest) ServletResponse(javax.servlet.ServletResponse) FacesContext(javax.faces.context.FacesContext) ServletContext(javax.servlet.ServletContext) WorkflowBean(org.alfresco.web.bean.workflow.WorkflowBean) AlfrescoRuntimeException(org.alfresco.error.AlfrescoRuntimeException) NavigationHandler(javax.faces.application.NavigationHandler) AlfrescoRuntimeException(org.alfresco.error.AlfrescoRuntimeException)

Aggregations

NavigationHandler (javax.faces.application.NavigationHandler)1 FacesContext (javax.faces.context.FacesContext)1 ServletContext (javax.servlet.ServletContext)1 ServletRequest (javax.servlet.ServletRequest)1 ServletResponse (javax.servlet.ServletResponse)1 AlfrescoRuntimeException (org.alfresco.error.AlfrescoRuntimeException)1 WorkflowBean (org.alfresco.web.bean.workflow.WorkflowBean)1