Search in sources :

Example 1 with ProcessDefinitionManager

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;
}
Also used : ProcessDefinitionManager(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionManager) HashSet(java.util.HashSet)

Example 2 with ProcessDefinitionManager

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;
}
Also used : ProcessDefinitionManager(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionManager) CommandContext(org.camunda.bpm.engine.impl.interceptor.CommandContext) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition)

Example 3 with ProcessDefinitionManager

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;
}
Also used : ProcessDefinitionManager(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionManager) CommandContext(org.camunda.bpm.engine.impl.interceptor.CommandContext)

Example 4 with ProcessDefinitionManager

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;
        }
    });
}
Also used : ProcessDefinitionManager(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionManager) UpdateJobDefinitionSuspensionStateBuilderImpl(org.camunda.bpm.engine.impl.management.UpdateJobDefinitionSuspensionStateBuilderImpl) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException)

Example 5 with ProcessDefinitionManager

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);
}
Also used : UserOperationLogManager(org.camunda.bpm.engine.impl.persistence.entity.UserOperationLogManager) ProcessDefinitionManager(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionManager) PropertyChange(org.camunda.bpm.engine.impl.persistence.entity.PropertyChange) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) CommandChecker(org.camunda.bpm.engine.impl.cfg.CommandChecker)

Aggregations

ProcessDefinitionManager (org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionManager)5 CommandContext (org.camunda.bpm.engine.impl.interceptor.CommandContext)2 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)2 HashSet (java.util.HashSet)1 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)1 CommandChecker (org.camunda.bpm.engine.impl.cfg.CommandChecker)1 UpdateJobDefinitionSuspensionStateBuilderImpl (org.camunda.bpm.engine.impl.management.UpdateJobDefinitionSuspensionStateBuilderImpl)1 PropertyChange (org.camunda.bpm.engine.impl.persistence.entity.PropertyChange)1 UserOperationLogManager (org.camunda.bpm.engine.impl.persistence.entity.UserOperationLogManager)1