Search in sources :

Example 1 with JscriptWorkflowInstance

use of org.alfresco.repo.workflow.jscript.JscriptWorkflowInstance in project alfresco-repository by Alfresco.

the class ScriptNode method getActiveWorkflows.

// ------------------------------------------------------------------------------
// Workflow methods
/**
 * Get active workflow instances this node belongs to
 *
 * @return the active workflow instances this node belongs to
 */
public Scriptable getActiveWorkflows() {
    if (this.activeWorkflows == null) {
        WorkflowService workflowService = this.services.getWorkflowService();
        List<WorkflowInstance> workflowInstances = workflowService.getWorkflowsForContent(this.nodeRef, true);
        Object[] jsWorkflowInstances = new Object[workflowInstances.size()];
        int index = 0;
        for (WorkflowInstance workflowInstance : workflowInstances) {
            jsWorkflowInstances[index++] = new JscriptWorkflowInstance(workflowInstance, this.services, this.scope);
        }
        this.activeWorkflows = Context.getCurrentContext().newArray(this.scope, jsWorkflowInstances);
    }
    return this.activeWorkflows;
}
Also used : JscriptWorkflowInstance(org.alfresco.repo.workflow.jscript.JscriptWorkflowInstance) WorkflowService(org.alfresco.service.cmr.workflow.WorkflowService) JSONObject(org.json.JSONObject) ScriptableObject(org.mozilla.javascript.ScriptableObject) WorkflowInstance(org.alfresco.service.cmr.workflow.WorkflowInstance) JscriptWorkflowInstance(org.alfresco.repo.workflow.jscript.JscriptWorkflowInstance)

Aggregations

JscriptWorkflowInstance (org.alfresco.repo.workflow.jscript.JscriptWorkflowInstance)1 WorkflowInstance (org.alfresco.service.cmr.workflow.WorkflowInstance)1 WorkflowService (org.alfresco.service.cmr.workflow.WorkflowService)1 JSONObject (org.json.JSONObject)1 ScriptableObject (org.mozilla.javascript.ScriptableObject)1