use of org.alfresco.repo.jscript.ValueConverter in project alfresco-repository by Alfresco.
the class JscriptWorkflowPath method getTasks.
/**
* Get all tasks associated with this workflow path
*
* @return all the tasks associated with this workflow path instance
*/
public Scriptable getTasks() {
WorkflowService workflowService = serviceRegistry.getWorkflowService();
List<WorkflowTask> cmrTasks = workflowService.getTasksForWorkflowPath(id);
ArrayList<Serializable> tasks = new ArrayList<Serializable>();
for (WorkflowTask cmrTask : cmrTasks) {
tasks.add(new JscriptWorkflowTask(cmrTask, this.serviceRegistry, this.scope));
}
Scriptable tasksScriptable = (Scriptable) new ValueConverter().convertValueForScript(this.serviceRegistry, scope, null, tasks);
return tasksScriptable;
}
use of org.alfresco.repo.jscript.ValueConverter in project alfresco-repository by Alfresco.
the class WorkflowManager method getAssignedTasksByState.
/**
* Get tasks assigned to the current user, filtered by workflow task state.
* Only tasks having the specified state will be returned.
*
* @param state workflow task state to filter assigned tasks by
* @return the list of assigned tasks, filtered by state
*/
private Scriptable getAssignedTasksByState(WorkflowTaskState state) {
WorkflowService workflowService = services.getWorkflowService();
String currentUser = services.getAuthenticationService().getCurrentUserName();
List<WorkflowTask> cmrAssignedTasks = workflowService.getAssignedTasks(currentUser, state);
ArrayList<Serializable> assignedTasks = new ArrayList<Serializable>();
for (WorkflowTask cmrTask : cmrAssignedTasks) {
assignedTasks.add(new JscriptWorkflowTask(cmrTask, services, getScope()));
}
return (Scriptable) new ValueConverter().convertValueForScript(services, getScope(), null, assignedTasks);
}
use of org.alfresco.repo.jscript.ValueConverter in project alfresco-repository by Alfresco.
the class WorkflowManager method getLatestDefinitions.
/**
* Gets the latest versions of the deployed, workflow definitions
*
* @return the latest versions of the deployed workflow definitions
*/
public Scriptable getLatestDefinitions() {
List<WorkflowDefinition> cmrDefinitions = services.getWorkflowService().getDefinitions();
ArrayList<Serializable> workflowDefs = new ArrayList<Serializable>();
for (WorkflowDefinition cmrDefinition : cmrDefinitions) {
workflowDefs.add(new JscriptWorkflowDefinition(cmrDefinition, services, getScope()));
}
return (Scriptable) new ValueConverter().convertValueForScript(services, getScope(), null, workflowDefs);
}
use of org.alfresco.repo.jscript.ValueConverter in project alfresco-repository by Alfresco.
the class JscriptWorkflowInstance method getPaths.
/**
* Get all paths for the specified workflow instance
*/
public Scriptable getPaths() {
WorkflowService workflowService = serviceRegistry.getWorkflowService();
List<WorkflowPath> cmrPaths = workflowService.getWorkflowPaths(this.id);
ArrayList<Serializable> paths = new ArrayList<Serializable>();
for (WorkflowPath cmrPath : cmrPaths) {
paths.add(new JscriptWorkflowPath(cmrPath, this.serviceRegistry, this.scope));
}
Scriptable pathsScriptable = (Scriptable) new ValueConverter().convertValueForScript(this.serviceRegistry, this.scope, null, paths);
return pathsScriptable;
}
use of org.alfresco.repo.jscript.ValueConverter in project alfresco-repository by Alfresco.
the class WorkflowManager method getAllDefinitions.
/**
* Gets all versions of the deployed workflow definitions
*
* @return all versions of the deployed workflow definitions
*/
public Scriptable getAllDefinitions() {
List<WorkflowDefinition> cmrDefinitions = services.getWorkflowService().getAllDefinitions();
ArrayList<Serializable> workflowDefs = new ArrayList<Serializable>();
for (WorkflowDefinition cmrDefinition : cmrDefinitions) {
workflowDefs.add(new JscriptWorkflowDefinition(cmrDefinition, services, getScope()));
}
return (Scriptable) new ValueConverter().convertValueForScript(services, getScope(), null, workflowDefs);
}
Aggregations