Search in sources :

Example 66 with ProcessDefinitionEntity

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

the class GetDeploymentProcessDiagramLayoutCmd method execute.

public DiagramLayout execute(final CommandContext commandContext) {
    ProcessDefinitionEntity processDefinition = Context.getProcessEngineConfiguration().getDeploymentCache().findDeployedProcessDefinitionById(processDefinitionId);
    for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
        checker.checkReadProcessDefinition(processDefinition);
    }
    InputStream processModelStream = commandContext.runWithoutAuthorization(new Callable<InputStream>() {

        public InputStream call() throws Exception {
            return new GetDeploymentProcessModelCmd(processDefinitionId).execute(commandContext);
        }
    });
    InputStream processDiagramStream = commandContext.runWithoutAuthorization(new Callable<InputStream>() {

        public InputStream call() throws Exception {
            return new GetDeploymentProcessDiagramCmd(processDefinitionId).execute(commandContext);
        }
    });
    return new ProcessDiagramLayoutFactory().getProcessDiagramLayout(processModelStream, processDiagramStream);
}
Also used : InputStream(java.io.InputStream) ProcessDefinitionEntity(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity) ProcessDiagramLayoutFactory(org.camunda.bpm.engine.impl.bpmn.diagram.ProcessDiagramLayoutFactory) CommandChecker(org.camunda.bpm.engine.impl.cfg.CommandChecker) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException)

Example 67 with ProcessDefinitionEntity

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

the class DefaultJobRetryCmd method getCurrentActivity.

protected ActivityImpl getCurrentActivity(CommandContext commandContext, JobEntity job) {
    String type = job.getJobHandlerType();
    ActivityImpl activity = null;
    if (SUPPORTED_TYPES.contains(type)) {
        DeploymentCache deploymentCache = Context.getProcessEngineConfiguration().getDeploymentCache();
        ProcessDefinitionEntity processDefinitionEntity = deploymentCache.findDeployedProcessDefinitionById(job.getProcessDefinitionId());
        activity = processDefinitionEntity.findActivity(job.getActivityId());
    } else {
    // noop, because activity type is not supported
    }
    return activity;
}
Also used : ActivityImpl(org.camunda.bpm.engine.impl.pvm.process.ActivityImpl) DeploymentCache(org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache) ProcessDefinitionEntity(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)

Example 68 with ProcessDefinitionEntity

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

the class SignalEventHandler method handleStartEvent.

protected void handleStartEvent(EventSubscriptionEntity eventSubscription, Map<String, Object> payload, String businessKey, CommandContext commandContext) {
    String processDefinitionId = eventSubscription.getConfiguration();
    ensureNotNull("Configuration of signal start event subscription '" + eventSubscription.getId() + "' contains no process definition id.", processDefinitionId);
    DeploymentCache deploymentCache = Context.getProcessEngineConfiguration().getDeploymentCache();
    ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);
    if (processDefinition == null || processDefinition.isSuspended()) {
        // ignore event subscription
        LOG.debugIgnoringEventSubscription(eventSubscription, processDefinitionId);
    } else {
        ActivityImpl signalStartEvent = processDefinition.findActivity(eventSubscription.getActivityId());
        PvmProcessInstance processInstance = processDefinition.createProcessInstance(businessKey, signalStartEvent);
        processInstance.start(payload);
    }
}
Also used : PvmProcessInstance(org.camunda.bpm.engine.impl.pvm.PvmProcessInstance) ActivityImpl(org.camunda.bpm.engine.impl.pvm.process.ActivityImpl) DeploymentCache(org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache) ProcessDefinitionEntity(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)

Example 69 with ProcessDefinitionEntity

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

the class FoxFailedJobParseListenerTest method findActivity.

protected ActivityImpl findActivity(ProcessInstance pi, String activityId) {
    ProcessInstanceWithVariablesImpl entity = (ProcessInstanceWithVariablesImpl) pi;
    ProcessDefinitionEntity processDefEntity = entity.getExecutionEntity().getProcessDefinition();
    assertNotNull(processDefEntity);
    ActivityImpl activity = processDefEntity.findActivity(activityId);
    assertNotNull(activity);
    return activity;
}
Also used : ProcessInstanceWithVariablesImpl(org.camunda.bpm.engine.impl.persistence.entity.ProcessInstanceWithVariablesImpl) ActivityImpl(org.camunda.bpm.engine.impl.pvm.process.ActivityImpl) ProcessDefinitionEntity(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)

Example 70 with ProcessDefinitionEntity

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

the class AbstractMigrationCmd method resolveSourceProcessDefinition.

protected ProcessDefinitionEntity resolveSourceProcessDefinition(CommandContext commandContext) {
    String sourceProcessDefinitionId = executionBuilder.getMigrationPlan().getSourceProcessDefinitionId();
    ProcessDefinitionEntity sourceProcessDefinition = getProcessDefinition(commandContext, sourceProcessDefinitionId);
    EnsureUtil.ensureNotNull("sourceProcessDefinition", sourceProcessDefinition);
    return sourceProcessDefinition;
}
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