Search in sources :

Example 6 with CaseDefinitionEntity

use of org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity in project camunda-bpm-platform by camunda.

the class GetDeploymentCaseDiagramCmd method execute.

@Override
public InputStream execute(final CommandContext commandContext) {
    CaseDefinitionEntity caseDefinition = Context.getProcessEngineConfiguration().getDeploymentCache().findDeployedCaseDefinitionById(caseDefinitionId);
    for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
        checker.checkReadCaseDefinition(caseDefinition);
    }
    final String deploymentId = caseDefinition.getDeploymentId();
    final String resourceName = caseDefinition.getDiagramResourceName();
    InputStream caseDiagramStream = null;
    if (resourceName != null) {
        caseDiagramStream = commandContext.runWithoutAuthorization(new Callable<InputStream>() {

            public InputStream call() throws Exception {
                return new GetDeploymentResourceCmd(deploymentId, resourceName).execute(commandContext);
            }
        });
    }
    return caseDiagramStream;
}
Also used : InputStream(java.io.InputStream) CaseDefinitionEntity(org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity) GetDeploymentResourceCmd(org.camunda.bpm.engine.impl.cmd.GetDeploymentResourceCmd) CommandChecker(org.camunda.bpm.engine.impl.cfg.CommandChecker) Callable(java.util.concurrent.Callable)

Example 7 with CaseDefinitionEntity

use of org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity in project camunda-bpm-platform by camunda.

the class CaseExecutionEntity method ensureCaseDefinitionInitialized.

protected void ensureCaseDefinitionInitialized() {
    if ((caseDefinition == null) && (caseDefinitionId != null)) {
        CaseDefinitionEntity deployedCaseDefinition = Context.getProcessEngineConfiguration().getDeploymentCache().getCaseDefinitionById(caseDefinitionId);
        setCaseDefinition(deployedCaseDefinition);
    }
}
Also used : CaseDefinitionEntity(org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity)

Example 8 with CaseDefinitionEntity

use of org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity in project camunda-bpm-platform by camunda.

the class CaseHandler method initializeActivity.

protected void initializeActivity(Case element, CmmnActivity activity, CmmnHandlerContext context) {
    CaseDefinitionEntity definition = (CaseDefinitionEntity) activity;
    Deployment deployment = context.getDeployment();
    definition.setKey(element.getId());
    definition.setName(element.getName());
    definition.setDeploymentId(deployment.getId());
    definition.setTaskDefinitions(new HashMap<String, TaskDefinition>());
    definition.setHistoryTimeToLive(ParseUtil.parseHistoryTimeToLive(element.getCamundaHistoryTimeToLiveString()));
    CmmnModelInstance model = context.getModel();
    Definitions definitions = model.getDefinitions();
    String category = definitions.getTargetNamespace();
    definition.setCategory(category);
}
Also used : TaskDefinition(org.camunda.bpm.engine.impl.task.TaskDefinition) CaseDefinitionEntity(org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity) Definitions(org.camunda.bpm.model.cmmn.instance.Definitions) Deployment(org.camunda.bpm.engine.repository.Deployment) CmmnModelInstance(org.camunda.bpm.model.cmmn.CmmnModelInstance)

Example 9 with CaseDefinitionEntity

use of org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity in project camunda-bpm-platform by camunda.

the class CaseHandler method createActivity.

protected CaseDefinitionEntity createActivity(CmmnElement element, CmmnHandlerContext context) {
    CaseDefinitionEntity definition = new CaseDefinitionEntity();
    definition.setCmmnElement(element);
    return definition;
}
Also used : CaseDefinitionEntity(org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity)

Example 10 with CaseDefinitionEntity

use of org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity in project camunda-bpm-platform by camunda.

the class UpdateCaseDefinitionHistoryTimeToLiveCmd method execute.

@Override
public Void execute(CommandContext commandContext) {
    ensureNotNull(BadUserRequestException.class, "caseDefinitionId", caseDefinitionId);
    if (historyTimeToLive != null) {
        ensureGreaterThanOrEqual(BadUserRequestException.class, "", "historyTimeToLive", historyTimeToLive, 0);
    }
    CaseDefinitionEntity caseDefinitionEntity = commandContext.getCaseDefinitionManager().findLatestDefinitionById(caseDefinitionId);
    for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
        checker.checkUpdateCaseDefinition(caseDefinitionEntity);
    }
    caseDefinitionEntity.setHistoryTimeToLive(historyTimeToLive);
    return null;
}
Also used : CaseDefinitionEntity(org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity) CommandChecker(org.camunda.bpm.engine.impl.cfg.CommandChecker)

Aggregations

CaseDefinitionEntity (org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity)31 Test (org.junit.Test)9 CommandChecker (org.camunda.bpm.engine.impl.cfg.CommandChecker)6 CmmnActivity (org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity)5 CaseExecutionEntity (org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity)4 TaskDefinition (org.camunda.bpm.engine.impl.task.TaskDefinition)4 InputStream (java.io.InputStream)3 DeploymentCache (org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache)3 HumanTask (org.camunda.bpm.model.cmmn.instance.HumanTask)3 PlanItem (org.camunda.bpm.model.cmmn.instance.PlanItem)3 ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)2 GetDeploymentResourceCmd (org.camunda.bpm.engine.impl.cmd.GetDeploymentResourceCmd)2 CmmnCaseDefinition (org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition)2 ExpressionManager (org.camunda.bpm.engine.impl.el.ExpressionManager)2 ExecutionEntity (org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity)2 ProcessDefinitionEntity (org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)2 CmmnModelInstance (org.camunda.bpm.model.cmmn.CmmnModelInstance)2 Case (org.camunda.bpm.model.cmmn.instance.Case)2 CasePlanModel (org.camunda.bpm.model.cmmn.instance.CasePlanModel)2 Definitions (org.camunda.bpm.model.cmmn.instance.Definitions)2