use of org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity in project Activiti by Activiti.
the class BpmnDeployer method persistProcessDefinitionsAndAuthorizations.
/**
* Saves each process definition. It is assumed that the deployment is new, the definitions
* have never been saved before, and that they have all their values properly set up.
*/
protected void persistProcessDefinitionsAndAuthorizations(ParsedDeployment parsedDeployment) {
CommandContext commandContext = Context.getCommandContext();
ProcessDefinitionEntityManager processDefinitionManager = commandContext.getProcessDefinitionEntityManager();
for (ProcessDefinitionEntity processDefinition : parsedDeployment.getAllProcessDefinitions()) {
processDefinitionManager.insert(processDefinition, false);
bpmnDeploymentHelper.addAuthorizationsForNewProcessDefinition(parsedDeployment.getProcessModelForProcessDefinition(processDefinition), processDefinition);
}
}
use of org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity in project Activiti by Activiti.
the class BpmnDeployer method setProcessDefinitionDiagramNames.
//
// /**
// * Creates new diagrams for process definitions if the deployment is new, the process definition in
// * question supports it, and the engine is configured to make new diagrams.
// *
// * When this method creates a new diagram, it also persists it via the ResourceEntityManager
// * and adds it to the resources of the deployment.
// */
// protected void createAndPersistNewDiagramsIfNeeded(ParsedDeployment parsedDeployment) {
//
// final ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
// final DeploymentEntity deploymentEntity = parsedDeployment.getDeployment();
//
// final ResourceEntityManager resourceEntityManager = processEngineConfiguration.getResourceEntityManager();
//
// for (ProcessDefinitionEntity processDefinition : parsedDeployment.getAllProcessDefinitions()) {
// if (processDefinitionDiagramHelper.shouldCreateDiagram(processDefinition, deploymentEntity)) {
// ResourceEntity resource = processDefinitionDiagramHelper.createDiagramForProcessDefinition(
// processDefinition, parsedDeployment.getBpmnParseForProcessDefinition(processDefinition));
// if (resource != null) {
// resourceEntityManager.insert(resource, false);
// deploymentEntity.addResource(resource); // now we'll find it if we look for the diagram name later.
// }
// }
// }
// }
/**
* Updates all the process definition entities to have the correct diagram resource name. Must
* be called after createAndPersistNewDiagramsAsNeeded to ensure that any newly-created diagrams
* already have their resources attached to the deployment.
*/
protected void setProcessDefinitionDiagramNames(ParsedDeployment parsedDeployment) {
Map<String, ResourceEntity> resources = parsedDeployment.getDeployment().getResources();
for (ProcessDefinitionEntity processDefinition : parsedDeployment.getAllProcessDefinitions()) {
String diagramResourceName = ResourceNameUtil.getProcessDiagramResourceNameFromDeployment(processDefinition, resources);
processDefinition.setDiagramResourceName(diagramResourceName);
}
}
use of org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity in project Activiti by Activiti.
the class BpmnDeployer method makeProcessDefinitionsConsistentWithPersistedVersions.
/**
* Loads the persisted version of each process definition and set values on the in-memory
* version to be consistent.
*/
protected void makeProcessDefinitionsConsistentWithPersistedVersions(ParsedDeployment parsedDeployment) {
for (ProcessDefinitionEntity processDefinition : parsedDeployment.getAllProcessDefinitions()) {
ProcessDefinitionEntity persistedProcessDefinition = bpmnDeploymentHelper.getPersistedInstanceOfProcessDefinition(processDefinition);
if (persistedProcessDefinition != null) {
processDefinition.setId(persistedProcessDefinition.getId());
processDefinition.setVersion(persistedProcessDefinition.getVersion());
processDefinition.setAppVersion(persistedProcessDefinition.getAppVersion());
processDefinition.setSuspensionState(persistedProcessDefinition.getSuspensionState());
}
}
}
use of org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity in project Activiti by Activiti.
the class MybatisProcessDefinitionDataManager method findProcessDefinitionByKeyAndVersionAndTenantId.
@Override
@SuppressWarnings("unchecked")
public ProcessDefinitionEntity findProcessDefinitionByKeyAndVersionAndTenantId(String processDefinitionKey, Integer processDefinitionVersion, String tenantId) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("processDefinitionKey", processDefinitionKey);
params.put("processDefinitionVersion", processDefinitionVersion);
params.put("tenantId", tenantId);
List<ProcessDefinitionEntity> results = getDbSqlSession().selectList("selectProcessDefinitionsByKeyAndVersionAndTenantId", params);
if (results.size() == 1) {
return results.get(0);
} else if (results.size() > 1) {
throw new ActivitiException("There are " + results.size() + " process definitions with key = '" + processDefinitionKey + "' and version = '" + processDefinitionVersion + "'.");
}
return null;
}
use of org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity in project Activiti by Activiti.
the class MybatisProcessDefinitionDataManager method findProcessDefinitionByKeyAndVersion.
@Override
public ProcessDefinitionEntity findProcessDefinitionByKeyAndVersion(String processDefinitionKey, Integer processDefinitionVersion) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("processDefinitionKey", processDefinitionKey);
params.put("processDefinitionVersion", processDefinitionVersion);
List<ProcessDefinitionEntity> results = getDbSqlSession().selectList("selectProcessDefinitionsByKeyAndVersion", params);
if (results.size() == 1) {
return results.get(0);
} else if (results.size() > 1) {
throw new ActivitiException("There are " + results.size() + " process definitions with key = '" + processDefinitionKey + "' and version = '" + processDefinitionVersion + "'.");
}
return null;
}
Aggregations