Search in sources :

Example 1 with BPMEngineRegistry

use of org.alfresco.repo.workflow.BPMEngineRegistry in project acs-community-packaging by Alfresco.

the class StartWorkflowEvaluator method evaluate.

/**
 * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
 */
public boolean evaluate(Node node) {
    FacesContext facesContext = FacesContext.getCurrentInstance();
    NavigationBean nav = (NavigationBean) FacesHelper.getManagedBean(facesContext, NavigationBean.BEAN_NAME);
    // determine whether the workflow services are active
    boolean workflowPresent = false;
    WebApplicationContext springContext = FacesContextUtils.getRequiredWebApplicationContext(facesContext);
    BPMEngineRegistry bpmReg = (BPMEngineRegistry) springContext.getBean(BPM_ENGINE_BEAN_NAME);
    if (bpmReg != null) {
        String[] components = bpmReg.getWorkflowComponents();
        workflowPresent = (components != null && components.length > 0);
    }
    return (workflowPresent && nav.getIsGuest() == false && node.hasAspect(ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION) == false);
}
Also used : FacesContext(javax.faces.context.FacesContext) BPMEngineRegistry(org.alfresco.repo.workflow.BPMEngineRegistry) NavigationBean(org.alfresco.web.bean.NavigationBean) WebApplicationContext(org.springframework.web.context.WebApplicationContext)

Aggregations

FacesContext (javax.faces.context.FacesContext)1 BPMEngineRegistry (org.alfresco.repo.workflow.BPMEngineRegistry)1 NavigationBean (org.alfresco.web.bean.NavigationBean)1 WebApplicationContext (org.springframework.web.context.WebApplicationContext)1