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); } });
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)
theLockedBy = this.getLockedBy(); strategy.appendField(locator, this, "lockedBy", buffer, theLockedBy);
lhsLockedBy = this.getLockedBy(); String rhsLockedBy; rhsLockedBy = that.getLockedBy(); if (!strategy.equals(LocatorUtils.property(thisLocator, "lockedBy", lhsLockedBy), LocatorUtils.property(thatLocator, "lockedBy", rhsLockedBy), lhsLockedBy, rhsLockedBy)) { return false;
theLockedBy = this.getLockedBy(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "lockedBy", theLockedBy), currentHashCode, theLockedBy);