@Override public Object getAdapter(DocumentModel doc, Class<?> itf) { if (doc.hasFacet(TaskConstants.TASK_FACET_NAME)) { return new TaskImpl(doc); } else { return null; } }
private Task getCurrentTask(String wfName, CoreSession session, DocumentModel document) { Task currentTask = null; if (ToutaticeGlobalConst.CST_WORKFLOW_PROCESS_ONLINE.equals(wfName)) { Task task = ToutaticeWorkflowHelper.getTaskByName(ToutaticeGlobalConst.CST_WORKFLOW_TASK_ONLINE_VALIDATE, session, document); currentTask = new TaskImpl(task.getDocument()); } return currentTask; }
for (DocumentModel doc : docs) { if (doc.hasFacet(DocumentRoutingConstants.ROUTING_TASK_FACET_NAME)) { Task task = new TaskImpl(doc); String taskType = task.getType(); Map<String, Action> taskActions = Collections.emptyMap();
@OperationMethod() public DocumentModel run(DocumentModel document) throws Exception { Task task = ToutaticeWorkflowHelper.getTaskByName(taskName, coreSession, document); Task taskForNotif = new TaskImpl(task.getDocument()); String initiator = ToutaticeWorkflowHelper.getOnLineWorkflowInitiator(document); if(StringUtils.isNotBlank(comment)){ Principal principal = coreSession.getPrincipal(); task.addComment(principal.getName(), comment); } //FIXME: no matter if formVariable = new HashMap<String, Object>(0)? routingService.endTask(coreSession, task, new HashMap<String, Object>(0), transition); ToutaticeWorkflowHelper.notifyRecipients(coreSession, taskForNotif, document, initiator, getEvent(transition)); return document; }
routing.endTask(documentManager, new TaskImpl(doc), data, buttonId); } catch (DocumentRouteException e) {
@Override public String endTask(Task task) throws NuxeoException { String view = MainTabsActions.DEFAULT_VIEW; if (TOUTATICE_WF_ONLINE_ACTIONS.contains(getClickedButton())) { DocumentModel currentDoc = navigationContext.getCurrentDocument(); Task taskForNotif = new TaskImpl(task.getDocument()); String wfInitiator = getWorkFlowInitiator(); String eventName; if(ToutaticeGlobalConst.CST_WORKFLOW_BUTTON_ONLINE_ACCEPT.equalsIgnoreCase(getClickedButton())){ eventName = ToutaticeGlobalConst.CST_EVENT_ONLINE_TASK_APPROVED; } else { eventName = ToutaticeGlobalConst.CST_EVENT_ONLINE_TASK_REJECTED; } super.endTask(task); ToutaticeWorkflowHelper.notifyRecipients(documentManager, taskForNotif, currentDoc, wfInitiator, eventName); } else { //no-op. only forward processing to mother class view = super.endTask(task); } return view; }