use of org.activiti.engine.impl.persistence.deploy.ProcessDefinitionInfoCacheObject in project Activiti by Activiti.
the class GetProcessDefinitionInfoCmd method execute.
public ObjectNode execute(CommandContext commandContext) {
if (processDefinitionId == null) {
throw new ActivitiIllegalArgumentException("process definition id is null");
}
ObjectNode resultNode = null;
DeploymentManager deploymentManager = commandContext.getProcessEngineConfiguration().getDeploymentManager();
// make sure the process definition is in the cache
deploymentManager.findDeployedProcessDefinitionById(processDefinitionId);
ProcessDefinitionInfoCacheObject definitionInfoCacheObject = deploymentManager.getProcessDefinitionInfoCache().get(processDefinitionId);
if (definitionInfoCacheObject != null) {
resultNode = definitionInfoCacheObject.getInfoNode();
}
return resultNode;
}
use of org.activiti.engine.impl.persistence.deploy.ProcessDefinitionInfoCacheObject in project Activiti by Activiti.
the class Context method getProcessDefinitionInfoNode.
protected static ObjectNode getProcessDefinitionInfoNode(String processDefinitionId) {
Map<String, ObjectNode> bpmnOverrideMap = getBpmnOverrideContext();
if (bpmnOverrideMap.containsKey(processDefinitionId) == false) {
ProcessDefinitionInfoCacheObject cacheObject = getProcessEngineConfiguration().getDeploymentManager().getProcessDefinitionInfoCache().get(processDefinitionId);
addBpmnOverrideElement(processDefinitionId, cacheObject.getInfoNode());
}
return getBpmnOverrideContext().get(processDefinitionId);
}
use of org.activiti.engine.impl.persistence.deploy.ProcessDefinitionInfoCacheObject in project Activiti by Activiti.
the class BpmnDeployer method addDefinitionInfoToCache.
protected void addDefinitionInfoToCache(ProcessDefinitionEntity processDefinition, ProcessEngineConfigurationImpl processEngineConfiguration, CommandContext commandContext) {
if (processEngineConfiguration.isEnableProcessDefinitionInfoCache() == false) {
return;
}
DeploymentManager deploymentManager = processEngineConfiguration.getDeploymentManager();
ProcessDefinitionInfoEntityManager definitionInfoEntityManager = commandContext.getProcessDefinitionInfoEntityManager();
ObjectMapper objectMapper = commandContext.getProcessEngineConfiguration().getObjectMapper();
ProcessDefinitionInfoEntity definitionInfoEntity = definitionInfoEntityManager.findProcessDefinitionInfoByProcessDefinitionId(processDefinition.getId());
ObjectNode infoNode = null;
if (definitionInfoEntity != null && definitionInfoEntity.getInfoJsonId() != null) {
byte[] infoBytes = definitionInfoEntityManager.findInfoJsonById(definitionInfoEntity.getInfoJsonId());
if (infoBytes != null) {
try {
infoNode = (ObjectNode) objectMapper.readTree(infoBytes);
} catch (Exception e) {
throw new ActivitiException("Error deserializing json info for process definition " + processDefinition.getId());
}
}
}
ProcessDefinitionInfoCacheObject definitionCacheObject = new ProcessDefinitionInfoCacheObject();
if (definitionInfoEntity == null) {
definitionCacheObject.setRevision(0);
} else {
definitionCacheObject.setId(definitionInfoEntity.getId());
definitionCacheObject.setRevision(definitionInfoEntity.getRevision());
}
if (infoNode == null) {
infoNode = objectMapper.createObjectNode();
}
definitionCacheObject.setInfoNode(infoNode);
deploymentManager.getProcessDefinitionInfoCache().add(processDefinition.getId(), definitionCacheObject);
}
Aggregations