@Transactional public ProcessInstance mergeProcessInstance(ProcessInstance processInstance) { log.debug("mergeProcessInstance"); ProcessInstance ret = m_entityManager.merge(processInstance); m_entityManager.flush(); if (log.isDebugEnabled()) { log.debug("updating processInstance {} to {}",processInstance.getId(),processInstance.getStatus()); } return ret; }
@Transactional public List<ProcessInstance> getAllProcesses() { log.debug("getAllProcesses"); Query query = m_entityManager.createQuery("SELECT c FROM nz.co.senanque.workflow.instances.ProcessInstance c"); @SuppressWarnings("unchecked") List<ProcessInstance> result = query.getResultList(); if (log.isDebugEnabled()) { log.debug("----------all processInstances ---------------"); for (ProcessInstance processInstance:result) { log.debug("processInstanceId={} processName={} taskId={} status={}",processInstance.getId(),processInstance.getProcessDefinitionName(),processInstance.getTaskId(), processInstance.getStatus()); } log.debug("found {} processes",result.size()); log.debug("----------------------------------------------"); } return result; }
@Transactional public List<ProcessInstance> getActiveProcesses() { if (log.isDebugEnabled()) { getAllProcesses(); } Query query = m_entityManager.createNamedQuery("ActiveProcesses"); @SuppressWarnings("unchecked") List<ProcessInstance> result = query.getResultList(); if (log.isDebugEnabled()) { for (ProcessInstance processInstance:result) { log.debug("processInstanceId={} processName={} taskId={} status={}",processInstance.getId(),processInstance.getProcessDefinitionName(),processInstance.getTaskId(), processInstance.getStatus()); } log.debug("found {} active processes",result.size()); } return result; }
public void doAction() { if (processInstance.getStatus() != TaskStatus.WAIT) { throw new WorkflowException("Process is not in a wait state"); } getWorkflowManager().processMessage(processInstance, message, getMessageMapper()); log.debug("completed lock message processing"); }}); if (!lockTemplate.doAction()) {
public void doAction() { if (processInstance.getStatus() != TaskStatus.WAIT) { throw new WorkflowException("Process is not in a wait state"); } getWorkflowManager().processMessage(processInstance, message, getMessageMapper()); }
ret.append(processInstance.getProcessDefinitionName()); ret.append(" status: "); ret.append(processInstance.getStatus()); ret.append(" waitCount: "); ret.append(processInstance.getWaitCount());
public void doAction() { String taskId = ProcessInstanceUtils.getTaskId(processInstance); ProcessInstance pi = getWorkflowDAO().refreshProcessInstance(processInstance); // if (log.isDebugEnabled()) { // log.debug("taskId {} ProcessInstanceUtils.getTaskId(pi) {} {}",taskId,ProcessInstanceUtils.getTaskId(pi),(!taskId.equals(ProcessInstanceUtils.getTaskId(pi)))); // log.debug("pi.getStatus() {} techSupport {} {}",pi.getStatus(),techSupport,((pi.getStatus() != TaskStatus.WAIT) && !techSupport)); // log.debug("pi.getStatus() {} userName {} pi.getLockedBy() {} {}",pi.getStatus(),userName,pi.getLockedBy(),(pi.getStatus() == TaskStatus.BUSY) && !userName.equals(pi.getLockedBy()) && !techSupport); // } if (!techSupport) { if (!(taskId.equals(ProcessInstanceUtils.getTaskId(pi)) && ((pi.getStatus() == TaskStatus.WAIT) || ((pi.getStatus() == TaskStatus.BUSY) && userName.equals(pi.getLockedBy()))))) { // // In this case we did not actually fail to get the lock but // // the process is not in the state // // it was in when we saw it in the table because another // // user (probably) has updated it. // // Therefore it is dangerous to proceed (unless we are tech support) throw new RuntimeException("ProcessInstance is already busy"); } } pi.setStatus(TaskStatus.BUSY); pi.setLockedBy(userName); TaskBase task = getCurrentTask(pi); Audit audit = createAudit(pi, task); getWorkflowDAO().mergeProcessInstance(pi); } });
@Transactional public void processMessage(ProcessInstance processInstance, Message<?> message, MessageMapper messageMapper) { Object context = getContextDAO().getContext(processInstance.getObjectInstance()); processInstance.setStatus(TaskStatus.GO); try { messageMapper.unpackMessage(message, context); } catch (Exception e) { processInstance.setStatus(TaskStatus.ABORTING); processInstance.setComment(e.getMessage()); } log.debug("set status to processInstance {} to {} {}",processInstance.getId(),processInstance.getStatus(),context); getContextDAO().mergeContext(context); getWorkflowDAO().mergeProcessInstance(processInstance); getWorkflowDAO().flush(); if (log.isDebugEnabled()) { getWorkflowDAO().getActiveProcesses(); } }
protected Audit createAudit(ProcessInstance processInstance, TaskBase task) { Audit audit = new Audit(); audit.setCreated(new Timestamp(System.currentTimeMillis())); audit.setTaskId(task.getTaskId()); audit.setProcessDefinitionName(task.getOwnerProcess().getName()); audit.setComment(trimComment(task.toString())); audit.setHandler(task.getHandler()); audit.setInterrupted(false); audit.setLockedBy(processInstance.getLockedBy()); audit.setStatus(processInstance.getStatus()); audit.setParentId(processInstance.getId()); processInstance.getAudits().add(audit); return audit; } /* (non-Javadoc)
HashIdLogger.log(this,"execute"); TaskBase task = getCurrentTask(processInstance); if (processInstance.getStatus() == TaskStatus.DONE) { return; log.debug("processInstanceId={} processName={} taskId={} status={}",processInstance.getId(),task.getOwnerProcess().getName(),task.getTaskId(), processInstance.getStatus()); boolean b = true; Audit audit = createAudit(processInstance, task); try { if (processInstance.getStatus()==TaskStatus.ABORTING) if (processInstance.getStatus()==TaskStatus.TIMEOUT) if (processInstance.getStatus()==TaskStatus.GO) tickleParentProcess(processInstance,processInstance.getStatus()); break; } else {
processInstance.setStatus(TaskStatus.GO); for (ProcessInstance sibling: processInstance.getChildProcesses()) { if (sibling.getStatus() == TaskStatus.ABORTED) { processInstance.setStatus(TaskStatus.ABORTING); processInstance.setComment("Child aborted");
theStatus = this.getStatus(); strategy.appendField(locator, this, "status", buffer, theStatus);
theStatus = this.getStatus(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "status", theStatus), currentHashCode, theStatus);