use of org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionManager in project camunda-bpm-platform by camunda.
the class DeployCmd method findDeploymentIdsForProcessDefinitions.
protected Set<String> findDeploymentIdsForProcessDefinitions(CommandContext commandContext, Set<String> processDefinitionKeys) {
Set<String> deploymentsToRegister = new HashSet<String>();
if (!processDefinitionKeys.isEmpty()) {
String[] keys = processDefinitionKeys.toArray(new String[processDefinitionKeys.size()]);
ProcessDefinitionManager processDefinitionManager = commandContext.getProcessDefinitionManager();
List<ProcessDefinition> previousDefinitions = processDefinitionManager.findProcessDefinitionsByKeyIn(keys);
for (ProcessDefinition definition : previousDefinitions) {
deploymentsToRegister.add(definition.getDeploymentId());
}
}
return deploymentsToRegister;
}
use of org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionManager in project camunda-bpm-platform by camunda.
the class ProcessApplicationManager method getDeployedProcessDefinitionArtifacts.
protected List<ProcessDefinition> getDeployedProcessDefinitionArtifacts(DeploymentEntity deployment) {
CommandContext commandContext = Context.getCommandContext();
// in case deployment was created by this command
List<ProcessDefinition> entities = deployment.getDeployedProcessDefinitions();
if (entities == null) {
String deploymentId = deployment.getId();
ProcessDefinitionManager manager = commandContext.getProcessDefinitionManager();
return manager.findProcessDefinitionsByDeploymentId(deploymentId);
}
return entities;
}
use of org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionManager in project camunda-bpm-platform by camunda.
the class DeployCmd method getDeployedProcesses.
protected List<? extends ProcessDefinition> getDeployedProcesses(DeploymentEntity deployment) {
List<? extends ProcessDefinition> deployedProcessDefinitions = deployment.getDeployedProcessDefinitions();
if (deployedProcessDefinitions == null) {
// existing deployment
CommandContext commandContext = Context.getCommandContext();
ProcessDefinitionManager manager = commandContext.getProcessDefinitionManager();
deployedProcessDefinitions = manager.findProcessDefinitionsByDeploymentId(deployment.getId());
}
return deployedProcessDefinitions;
}
use of org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionManager in project camunda-bpm-platform by camunda.
the class AbstractSetProcessDefinitionStateCmd method updateSuspensionState.
@Override
protected void updateSuspensionState(final CommandContext commandContext, SuspensionState suspensionState) {
ProcessDefinitionManager processDefinitionManager = commandContext.getProcessDefinitionManager();
if (processDefinitionId != null) {
processDefinitionManager.updateProcessDefinitionSuspensionStateById(processDefinitionId, suspensionState);
} else if (isTenantIdSet) {
processDefinitionManager.updateProcessDefinitionSuspensionStateByKeyAndTenantId(processDefinitionKey, tenantId, suspensionState);
} else {
processDefinitionManager.updateProcessDefinitionSuspensionStateByKey(processDefinitionKey, suspensionState);
}
commandContext.runWithoutAuthorization(new Callable<Void>() {
public Void call() throws Exception {
UpdateJobDefinitionSuspensionStateBuilderImpl jobDefinitionSuspensionStateBuilder = createJobDefinitionCommandBuilder();
AbstractSetJobDefinitionStateCmd jobDefinitionCmd = getSetJobDefinitionStateCmd(jobDefinitionSuspensionStateBuilder);
jobDefinitionCmd.disableLogUserOperation();
jobDefinitionCmd.execute(commandContext);
return null;
}
});
}
use of org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionManager in project camunda-bpm-platform by camunda.
the class AbstractDeleteProcessDefinitionCmd method deleteProcessDefinitionCmd.
protected void deleteProcessDefinitionCmd(CommandContext commandContext, String processDefinitionId, boolean cascade, boolean skipCustomListeners) {
ensureNotNull("processDefinitionId", processDefinitionId);
ProcessDefinition processDefinition = commandContext.getProcessDefinitionManager().findLatestProcessDefinitionById(processDefinitionId);
ensureNotNull(NotFoundException.class, "No process definition found with id '" + processDefinitionId + "'", "processDefinition", processDefinition);
List<CommandChecker> commandCheckers = commandContext.getProcessEngineConfiguration().getCommandCheckers();
for (CommandChecker checker : commandCheckers) {
checker.checkDeleteProcessDefinitionById(processDefinitionId);
}
UserOperationLogManager userOperationLogManager = commandContext.getOperationLogManager();
userOperationLogManager.logProcessDefinitionOperation(UserOperationLogEntry.OPERATION_TYPE_DELETE, processDefinitionId, processDefinition.getKey(), new PropertyChange("cascade", false, cascade));
ProcessDefinitionManager definitionManager = commandContext.getProcessDefinitionManager();
definitionManager.deleteProcessDefinition(processDefinition, processDefinitionId, cascade, cascade, skipCustomListeners);
}
Aggregations