Package org.joget.workflow.model

Examples of org.joget.workflow.model.WorkflowAssignment


    }

    @RequestMapping(value = "/json/workflow/assignment/complete/(*:activityId)", method = RequestMethod.POST)
    public void assignmentComplete(Writer writer, @RequestParam(value = "callback", required = false) String callback, @RequestParam("activityId") String activityId) throws JSONException, IOException {
        appService.getAppDefinitionForWorkflowActivity(activityId);
        WorkflowAssignment assignment = workflowManager.getAssignment(activityId);

        String processId = (assignment != null) ? assignment.getProcessId() : "";

        if (assignment != null && !assignment.isAccepted()) {
            workflowManager.assignmentAccept(activityId);
        }

        workflowManager.assignmentComplete(activityId);
        LogUtil.info(getClass().getName(), "Assignment " + activityId + " completed");
        JSONObject jsonObject = new JSONObject();
        jsonObject.accumulate("status", "completed");
        jsonObject.accumulate("processId", processId);
        jsonObject.accumulate("activityId", activityId);

        // check for auto continuation
        String processDefId = assignment.getProcessDefId();
        String activityDefId = assignment.getActivityDefId();
        String packageId = WorkflowUtil.getProcessDefPackageId(processDefId);
        String packageVersion = WorkflowUtil.getProcessDefVersion(processDefId);
        boolean continueNextAssignment = appService.isActivityAutoContinue(packageId, packageVersion, processDefId, activityDefId);
        if (continueNextAssignment) {
            WorkflowAssignment nextAssignment = workflowManager.getAssignmentByProcess(processId);
            if (nextAssignment != null) {
                jsonObject.accumulate("nextActivityId", nextAssignment.getActivityId());
            }
        }

        writeJson(writer, jsonObject, callback);
    }
View Full Code Here


public class WorkflowDODSPersistentManager extends DODSPersistentManager {

    @Override
    public void persist(WMSessionHandle shandle, ActivityPersistenceObject act, boolean isInitialPersistence) throws PersistenceException {
        if (isInitialPersistence) {
            WorkflowAssignment mockAss = new WorkflowAssignment();
            mockAss.setActivityId(act.getId());
            mockAss.setActivityDefId(act.getActivityDefinitionId());
            mockAss.setProcessId(act.getProcessId());
            mockAss.setProcessDefId(act.getProcessMgrName());
           
            act.setName(WorkflowUtil.processVariable(act.getName(), null, mockAss));
        }
        super.persist(shandle, act, isInitialPersistence);
    }
View Full Code Here

            String processId = act.container(shandle).manager(shandle).name(shandle);
            String activityId = act.activity_definition_id(shandle);
            String version = act.container(shandle).manager(shandle).version(shandle);

            // retrieve assignment
            WorkflowAssignment workflowAssignment = new WorkflowAssignment();
            workflowAssignment.setProcessId(act.process_id(shandle));
            workflowAssignment.setProcessDefId(processId);
            workflowAssignment.setProcessName(act.container(shandle).name(shandle));
            workflowAssignment.setProcessVersion(version);
            workflowAssignment.setProcessRequesterId((String) shandle.getVendorData());
            workflowAssignment.setDescription(act.description(shandle));
            workflowAssignment.setActivityDefId(activityId);
            workflowAssignment.setActivityId(act.key(shandle));
            workflowAssignment.setActivityName(act.name(shandle));
            workflowAssignment.setAssigneeId(act.getPerformerId(shandle));

            // retrieve workflow variables
            List<WorkflowVariable> processVariableList = new ArrayList();
            Map variableMap = act.process_context(shandle);
            Iterator it = variableMap.entrySet().iterator();
            while (it.hasNext()) {
                Map.Entry<String, String> pairs = (Map.Entry) it.next();
                WorkflowVariable var = new WorkflowVariable();
                var.setId(pairs.getKey());
                var.setVal(pairs.getValue());
                processVariableList.add(var);
            }
            workflowAssignment.setProcessVariableList(processVariableList);

            // execute tool
            WorkflowUtil.addAuditTrail(this.getClass().getName(), "executeTool", workflowAssignment.getActivityId());
            if(!workflowMapper.executeTool(workflowAssignment)){
                WorkflowUtil.addAuditTrail(this.getClass().getName(), "executeActivity", "Could not execute tool [processId=" + act.container(shandle).manager(shandle).name(shandle) + ", version=" + act.container(shandle).manager(shandle).version(shandle) + ", activityId=" + act.activity_definition_id(shandle) + "]");
            }else{
                WorkflowUtil.addAuditTrail(this.getClass().getName(), "executeToolCompleted", workflowAssignment.getActivityId());
            }

        } catch (Throwable ex) {
            workflowMapper.addAuditTrail(this.getClass().getName(), "executeActivity", "Could not execute tool [processId=" + act.container(shandle).manager(shandle).name(shandle) + ", version=" + act.container(shandle).manager(shandle).version(shandle) + ", activityId=" + act.activity_definition_id(shandle) + "]");
            LogUtil.error(getClass().getName(), ex, "Could not execute tool [processId=" + act.container(shandle).manager(shandle).name(shandle) + ", version=" + act.container(shandle).manager(shandle).version(shandle) + ", activityId=" + act.activity_definition_id(shandle) + "]");
View Full Code Here

        Collection<WorkflowAssignment> ass = new ArrayList<WorkflowAssignment>();
       
        //transform to WorkflowAssignment
        if (shAss != null && !shAss.isEmpty()) {
            for (SharkAssignment s : shAss) {
                WorkflowAssignment a = new WorkflowAssignment();
                a.setActivityId(s.getActivity().getActivityId());
                a.setActivityDefId(s.getActivity().getActivityDefId());
                a.setActivityName(s.getActivity().getActivityName());
                a.setProcessDefId(s.getProcess().getProcessDefId());
                a.setProcessId(s.getProcess().getProcessId());
                a.setProcessName(s.getProcess().getProcessName());
                a.setProcessRequesterId(s.getProcess().getProcessRequesterId());
                a.setProcessVersion(s.getProcess().getProcessVersion());
                a.setAssigneeName(s.getAssigneeName());
                ass.add(a);
            }
        }
       
        return ass;
View Full Code Here

TOP

Related Classes of org.joget.workflow.model.WorkflowAssignment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.