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 ) ) ; } } }
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 .