use of org.alfresco.service.cmr.workflow.WorkflowService in project acs-community-packaging by Alfresco.
the class EndTaskCommand 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) {
String taskId = (String) properties.get(PROP_TASK_ID);
if (taskId == null) {
throw new IllegalArgumentException("Unable to execute EndTaskCommand - mandatory parameter not supplied: " + PROP_TASK_ID);
}
String transition = (String) properties.get(PROP_TRANSITION);
// end task
WorkflowService workflowService = serviceRegistry.getWorkflowService();
return workflowService.endTask(taskId, transition);
}
use of org.alfresco.service.cmr.workflow.WorkflowService in project acs-community-packaging by Alfresco.
the class UINodeWorkflowInfo method encodeBegin.
@Override
@SuppressWarnings("unchecked")
public void encodeBegin(FacesContext context) throws IOException {
if (!isRendered())
return;
// get the node to display the information for
Node node = getValue();
if (node != null) {
// get the services we need
NodeService nodeService = Repository.getServiceRegistry(context).getNodeService();
DictionaryService ddService = Repository.getServiceRegistry(context).getDictionaryService();
WorkflowService workflowService = Repository.getServiceRegistry(context).getWorkflowService();
ResponseWriter out = context.getResponseWriter();
ResourceBundle bundle = Application.getBundle(context);
// render simple workflow info
renderSimpleWorkflowInfo(context, node, nodeService, ddService, out, bundle);
// render advanced workflow info
renderAdvancedWorkflowInfo(context, node, nodeService, ddService, workflowService, out, bundle);
}
}
use of org.alfresco.service.cmr.workflow.WorkflowService in project acs-community-packaging by Alfresco.
the class WorkflowUtil method isTaskEditable.
public static boolean isTaskEditable(String taskId, ServletContext sc) {
if (taskId == null || taskId.isEmpty()) {
return false;
}
ServiceRegistry serviceRegistry = Repository.getServiceRegistry(sc);
String username = serviceRegistry.getAuthenticationService().getCurrentUserName();
WorkflowService workflowService = serviceRegistry.getWorkflowService();
WorkflowTask task = workflowService.getTaskById(taskId);
return workflowService.isTaskEditable(task, username);
}
use of org.alfresco.service.cmr.workflow.WorkflowService in project acs-community-packaging by Alfresco.
the class WorkflowDefinitionImageServlet method doGet.
/* (non-Javadoc)
* @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// retrieve workflow definition id
String uri = request.getRequestURI();
uri = uri.substring(request.getContextPath().length());
StringTokenizer t = new StringTokenizer(uri, "/");
if (t.countTokens() != 2) {
throw new WorkflowException("Workflow Definition Image servlet does not contain workflow definition id : " + uri);
}
// skip servlet name
t.nextToken();
String workflowDefinitionId = t.nextToken();
// retrieve workflow definition image
WebApplicationContext wc = WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext());
WorkflowService workflowService = (WorkflowService) wc.getBean(ServiceRegistry.WORKFLOW_SERVICE.getLocalName());
byte[] definitionImage = workflowService.getDefinitionImage(workflowDefinitionId);
// stream out through response
OutputStream out = response.getOutputStream();
out.write(definitionImage);
out.flush();
}
use of org.alfresco.service.cmr.workflow.WorkflowService 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;
}
Aggregations