Java Code Examples for org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity#getVersion()
The following examples show how to use
org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity#getVersion() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BpmnDeployer.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
/** * Sets the version on each process definition entity, and the identifier. If the map contains * an older version for a process definition, then the version is set to that older entity's * version plus one; otherwise it is set to 1. Also dispatches an ENTITY_CREATED event. */ protected void setProcessDefinitionVersionsAndIds(ParsedDeployment parsedDeployment, Map<ProcessDefinitionEntity, ProcessDefinitionEntity> mapNewToOldProcessDefinitions) { CommandContext commandContext = Context.getCommandContext(); for (ProcessDefinitionEntity processDefinition : parsedDeployment.getAllProcessDefinitions()) { int version = 1; ProcessDefinitionEntity latest = mapNewToOldProcessDefinitions.get(processDefinition); if (latest != null) { version = latest.getVersion() + 1; } processDefinition.setVersion(version); processDefinition.setId(getIdForNewProcessDefinition(processDefinition)); if (commandContext.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) { commandContext.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(ActivitiEventBuilder.createEntityEvent(ActivitiEventType.ENTITY_CREATED, processDefinition)); } } }
Example 2
Source File: BpmnDeployer.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
/** * Returns the ID to use for a new process definition; subclasses may override this to provide * their own identification scheme. * * Process definition ids NEED to be unique accross the whole engine! */ protected String getIdForNewProcessDefinition(ProcessDefinitionEntity processDefinition) { String nextId = idGenerator.getNextId(); String result = processDefinition.getKey() + ":" + processDefinition.getVersion() + ":" + nextId; // ACT-505 // ACT-115: maximum id length is 64 characters if (result.length() > 64) { result = nextId; } return result; }
Example 3
Source File: SyncProcessCmd.java From lemon with Apache License 2.0 | 4 votes |
public Void execute(CommandContext commandContext) { ProcessDefinitionEntity processDefinitionEntity = new GetDeploymentProcessDefinitionCmd( processDefinitionId).execute(commandContext); String processDefinitionKey = processDefinitionEntity.getKey(); int processDefinitionVersion = processDefinitionEntity.getVersion(); BpmConfBaseManager bpmConfBaseManager = getBpmConfBaseManager(); BpmConfBase bpmConfBase = bpmConfBaseManager .findUnique( "from BpmConfBase where processDefinitionKey=? and processDefinitionVersion=?", processDefinitionKey, processDefinitionVersion); if (bpmConfBase == null) { bpmConfBase = new BpmConfBase(); bpmConfBase.setProcessDefinitionId(processDefinitionId); bpmConfBase.setProcessDefinitionKey(processDefinitionKey); bpmConfBase.setProcessDefinitionVersion(processDefinitionVersion); bpmConfBaseManager.save(bpmConfBase); } else if (bpmConfBase.getProcessDefinitionId() == null) { bpmConfBase.setProcessDefinitionId(processDefinitionId); bpmConfBaseManager.save(bpmConfBase); } BpmnModel bpmnModel = new GetBpmnModelCmd(processDefinitionId) .execute(commandContext); Graph graph = new FindGraphCmd(processDefinitionId) .execute(commandContext); this.processGlobal(bpmnModel, 1, bpmConfBase); int priority = 2; for (Node node : graph.getNodes()) { if ("exclusiveGateway".equals(node.getType())) { continue; } else if ("userTask".equals(node.getType())) { this.processUserTask(node, bpmnModel, priority++, bpmConfBase); } else if ("startEvent".equals(node.getType())) { this.processStartEvent(node, bpmnModel, priority++, bpmConfBase); } else if ("endEvent".equals(node.getType())) { this.processEndEvent(node, bpmnModel, priority++, bpmConfBase); } } return null; }