public static String findLatestProcessByName(Collection<Process> processes, final String processName, Comparator<Process> comparator) { if (processes == null || processName == null) { return null; } Process highestVersionProcess = Collections.max(processes, comparator); if (highestVersionProcess != null && processName.equals(highestVersionProcess.getName())) { return highestVersionProcess.getId(); } return null; }
return new ProcessDesc(process.getId(), process.getName(), process.getVersion() , process.getPackageName(), process.getType(), process.getKnowledgeType().name(), process.getNamespace(), "");
public String getProcessName() { return getProcess().getName(); }
public Process getProcess(Collection<Process> processes, String name) { for ( Process process : processes ) { if ( process.getName().equals( name ) ) { return process; } } return null; }
public String toString() { return "Process '" + process.getName() + "' [" + process.getId() + "]: " + getMessage(); }
public String getDescription() { if (description == null) { description = process.getName(); if (process != null) { Object metaData = process.getMetaData().get("customDescription");
public int compare(Process o1, Process o2) { // first match by process name if (o1.getName().equals(processName) && o2.getName().equals(processName)) { // then match on version try { if( o1.getVersion() != null && o2.getVersion() != null ) { if ((Double.valueOf(o1.getVersion()) > Double.valueOf(o2.getVersion()))) { return 1; } else { return -1; } } else if( o1.getVersion() != null ) { return 1; } else { return o1.getId().compareTo(o2.getId()); } } catch (NumberFormatException e) { throw new IllegalArgumentException("Could not parse version: " + o1.getVersion() + " " + o2.getVersion(), e); } } else if (o1.getName().equals(processName)) { return 1; } return -1; } }
for ( Map.Entry<String, Object> entry : parameters.entrySet() ) { variableScope.validateVariable(process.getName(), entry.getKey(), entry.getValue()); variableScopeInstance.setVariable( entry.getKey(), entry.getValue() );
.setParameter("depId", migrationSpec.getToDeploymentId()) .setParameter("procId", migrationSpec.getToProcessId()) .setParameter("procName", toBeProcess.getName()) .setParameter("procVersion", toBeProcess.getVersion()) .setParameter("procInstanceId", migrationSpec.getProcessInstanceId());
if (validator == null) { logger.warn("Could not find validator for process {}.", ((Process)process).getType()); logger.warn("Continuing without validation of the process {} [{}]", process.getName(), process.getId()); } else { ProcessValidationError[] errors = validator.validateProcess( (WorkflowProcess) process ); processDescr.setName(process.getPackageName() + "." + process.getName()); processDescr.setResource( resource ); processDescr.setProcessId( process.getId() );
@Override public AuditEvent buildEvent(ProcessStartedEvent pse) { ProcessInstanceImpl pi = (ProcessInstanceImpl) pse.getProcessInstance(); ProcessInstanceLog log = new ProcessInstanceLog(pi.getId(), pi.getProcessId()); log.setExternalId(""+((KieSession) pse.getKieRuntime()).getIdentifier()); log.setProcessName(pi.getProcess().getName()); log.setProcessVersion(pi.getProcess().getVersion()); log.setStatus(ProcessInstance.STATE_ACTIVE); log.setProcessInstanceDescription( pi.getDescription() ); log.setProcessType(((WorkflowProcess)pi.getProcess()).getProcessType()); log.setSlaCompliance(pi.getSlaCompliance()); log.setSlaDueDate(pi.getSlaDueDate()); // store correlation key in its external form CorrelationKey correlationKey = (CorrelationKey) pi.getMetaData().get("CorrelationKey"); if (correlationKey != null) { log.setCorrelationKey(correlationKey.toExternalForm()); } long parentProcessInstanceId = (Long) pi.getMetaData().getOrDefault("ParentProcessInstanceId", -1L); log.setParentProcessInstanceId( parentProcessInstanceId ); return log; }
public String getName() { return delegate.getName(); }
public static String findLatestProcessByName(Collection<Process> processes, final String processName, Comparator<Process> comparator) { if (processes == null || processName == null) { return null; } Process highestVersionProcess = Collections.max(processes, comparator); if (highestVersionProcess != null && processName.equals(highestVersionProcess.getName())) { return highestVersionProcess.getId(); } return null; }
public String getProcessName() { return getProcess().getName(); }
public String toString() { return "Process '" + process.getName() + "' [" + process.getId() + "]: " + getMessage(); }
public String getDescription() { if (description == null) { description = process.getName(); if (process != null) { Object metaData = process.getMetaData().get("customDescription");
public int compare(Process o1, Process o2) { // first match by process name if (o1.getName().equals(processName) && o2.getName().equals(processName)) { // then match on version try { if( o1.getVersion() != null && o2.getVersion() != null ) { if ((Double.valueOf(o1.getVersion()) > Double.valueOf(o2.getVersion()))) { return 1; } else { return -1; } } else if( o1.getVersion() != null ) { return 1; } else { return o1.getId().compareTo(o2.getId()); } } catch (NumberFormatException e) { throw new IllegalArgumentException("Could not parse version: " + o1.getVersion() + " " + o2.getVersion(), e); } } else if (o1.getName().equals(processName)) { return 1; } return -1; } }
@Override public void onProcessAdded(Process process) { logger.debug("Added process with id {} and name {}", process.getId(), process.getName()); this.process = process; resource = addResource(process.getId(), getProcessIdResourceType()); addResource(process.getName(), getProcessNameResourceType()); //add process descriptor as process meta data process.getMetaData().put(getProcessDescriptorName(), this); }
for ( Map.Entry<String, Object> entry : parameters.entrySet() ) { variableScope.validateVariable(process.getName(), entry.getKey(), entry.getValue()); variableScopeInstance.setVariable( entry.getKey(), entry.getValue() );