Search in sources :

Example 6 with ProcessDefinitionEntity

use of org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity in project camunda-bpm-platform by camunda.

the class ModificationBatchJobHandler method postProcessJob.

@Override
protected void postProcessJob(ModificationBatchConfiguration configuration, JobEntity job) {
    CommandContext commandContext = Context.getCommandContext();
    ProcessDefinitionEntity processDefinitionEntity = commandContext.getProcessEngineConfiguration().getDeploymentCache().findDeployedProcessDefinitionById(configuration.getProcessDefinitionId());
    job.setDeploymentId(processDefinitionEntity.getDeploymentId());
}
Also used : CommandContext(org.camunda.bpm.engine.impl.interceptor.CommandContext) ProcessDefinitionEntity(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)

Example 7 with ProcessDefinitionEntity

use of org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity in project camunda-bpm-platform by camunda.

the class RestartProcessInstancesBatchCmd method execute.

@Override
public Batch execute(CommandContext commandContext) {
    List<AbstractProcessInstanceModificationCommand> instructions = builder.getInstructions();
    Collection<String> processInstanceIds = collectProcessInstanceIds();
    ensureNotEmpty(BadUserRequestException.class, "Restart instructions cannot be empty", "instructions", instructions);
    ensureNotEmpty(BadUserRequestException.class, "Process instance ids cannot be empty", "processInstanceIds", processInstanceIds);
    ensureNotContainsNull(BadUserRequestException.class, "Process instance ids cannot be null", "processInstanceIds", processInstanceIds);
    commandContext.getAuthorizationManager().checkAuthorization(Permissions.CREATE, Resources.BATCH);
    ProcessDefinitionEntity processDefinition = getProcessDefinition(commandContext, builder.getProcessDefinitionId());
    ;
    ensureNotNull(BadUserRequestException.class, "Process definition cannot be null", processDefinition);
    ensureTenantAuthorized(commandContext, processDefinition);
    writeUserOperationLog(commandContext, processDefinition, processInstanceIds.size(), true);
    ArrayList<String> ids = new ArrayList<String>();
    ids.addAll(processInstanceIds);
    BatchEntity batch = createBatch(commandContext, instructions, ids, processDefinition);
    batch.createSeedJobDefinition();
    batch.createMonitorJobDefinition();
    batch.createBatchJobDefinition();
    batch.fireHistoricStartEvent();
    batch.createSeedJob();
    return batch;
}
Also used : AbstractProcessInstanceModificationCommand(org.camunda.bpm.engine.impl.cmd.AbstractProcessInstanceModificationCommand) ArrayList(java.util.ArrayList) ProcessDefinitionEntity(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)

Example 8 with ProcessDefinitionEntity

use of org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity in project camunda-bpm-platform by camunda.

the class RestartProcessInstancesJobHandler method postProcessJob.

@Override
protected void postProcessJob(RestartProcessInstancesBatchConfiguration configuration, JobEntity job) {
    CommandContext commandContext = Context.getCommandContext();
    ProcessDefinitionEntity processDefinitionEntity = commandContext.getProcessEngineConfiguration().getDeploymentCache().findDeployedProcessDefinitionById(configuration.getProcessDefinitionId());
    job.setDeploymentId(processDefinitionEntity.getDeploymentId());
}
Also used : CommandContext(org.camunda.bpm.engine.impl.interceptor.CommandContext) ProcessDefinitionEntity(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)

Example 9 with ProcessDefinitionEntity

use of org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity in project camunda-bpm-platform by camunda.

the class AbstractCorrelateMessageCmd method instantiateProcess.

protected ProcessInstance instantiateProcess(CommandContext commandContext, CorrelationHandlerResult correlationResult) {
    ProcessDefinitionEntity processDefinitionEntity = correlationResult.getProcessDefinitionEntity();
    ActivityImpl messageStartEvent = processDefinitionEntity.findActivity(correlationResult.getStartEventActivityId());
    ExecutionEntity processInstance = processDefinitionEntity.createProcessInstance(builder.getBusinessKey(), messageStartEvent);
    processInstance.start(builder.getPayloadProcessInstanceVariables());
    return processInstance;
}
Also used : ActivityImpl(org.camunda.bpm.engine.impl.pvm.process.ActivityImpl) ExecutionEntity(org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity) ProcessDefinitionEntity(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)

Example 10 with ProcessDefinitionEntity

use of org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity in project camunda-bpm-platform by camunda.

the class UpdateProcessDefinitionHistoryTimeToLiveCmd method execute.

public Void execute(CommandContext commandContext) {
    checkAuthorization(commandContext);
    ensureNotNull(BadUserRequestException.class, "processDefinitionId", processDefinitionId);
    if (historyTimeToLive != null) {
        ensureGreaterThanOrEqual(BadUserRequestException.class, "", "historyTimeToLive", historyTimeToLive, 0);
    }
    ProcessDefinitionEntity processDefinitionEntity = commandContext.getProcessDefinitionManager().findLatestProcessDefinitionById(processDefinitionId);
    logUserOperation(commandContext, processDefinitionEntity);
    processDefinitionEntity.setHistoryTimeToLive(historyTimeToLive);
    return null;
}
Also used : ProcessDefinitionEntity(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)

Aggregations

ProcessDefinitionEntity (org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)75 DeploymentCache (org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache)15 CommandChecker (org.camunda.bpm.engine.impl.cfg.CommandChecker)14 ExecutionEntity (org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity)13 CommandContext (org.camunda.bpm.engine.impl.interceptor.CommandContext)10 ActivityImpl (org.camunda.bpm.engine.impl.pvm.process.ActivityImpl)10 ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)8 ArrayList (java.util.ArrayList)6 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)5 EventSubscriptionEntity (org.camunda.bpm.engine.impl.persistence.entity.EventSubscriptionEntity)4 Deployment (org.camunda.bpm.engine.test.Deployment)4 InputStream (java.io.InputStream)3 ProcessInstanceModificationBuilderImpl (org.camunda.bpm.engine.impl.ProcessInstanceModificationBuilderImpl)3 CaseExecutionEntity (org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity)3 CommandExecutor (org.camunda.bpm.engine.impl.interceptor.CommandExecutor)3 IncidentEntity (org.camunda.bpm.engine.impl.persistence.entity.IncidentEntity)3 ProcessInstanceWithVariablesImpl (org.camunda.bpm.engine.impl.persistence.entity.ProcessInstanceWithVariablesImpl)3 Element (org.camunda.bpm.engine.impl.util.xml.Element)3 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)3 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2