Search in sources :

Example 6 with GetDeploymentResourceCmd

use of org.camunda.bpm.engine.impl.cmd.GetDeploymentResourceCmd in project camunda-bpm-platform by camunda.

the class GetDeploymentDecisionRequirementsDiagramCmd method execute.

public InputStream execute(final CommandContext commandContext) {
    DecisionRequirementsDefinition decisionRequirementsDefinition = new GetDeploymentDecisionRequirementsDefinitionCmd(decisionRequirementsDefinitionId).execute(commandContext);
    final String deploymentId = decisionRequirementsDefinition.getDeploymentId();
    final String resourceName = decisionRequirementsDefinition.getDiagramResourceName();
    if (resourceName != null) {
        return commandContext.runWithoutAuthorization(new Callable<InputStream>() {

            public InputStream call() throws Exception {
                return new GetDeploymentResourceCmd(deploymentId, resourceName).execute(commandContext);
            }
        });
    } else {
        return null;
    }
}
Also used : DecisionRequirementsDefinition(org.camunda.bpm.engine.repository.DecisionRequirementsDefinition) InputStream(java.io.InputStream) GetDeploymentResourceCmd(org.camunda.bpm.engine.impl.cmd.GetDeploymentResourceCmd)

Example 7 with GetDeploymentResourceCmd

use of org.camunda.bpm.engine.impl.cmd.GetDeploymentResourceCmd in project camunda-bpm-platform by camunda.

the class ModelInstanceCache method loadAndCacheBpmnModelInstance.

protected InstanceType loadAndCacheBpmnModelInstance(final DefinitionType definitionEntity) {
    final CommandContext commandContext = Context.getCommandContext();
    InputStream bpmnResourceInputStream = commandContext.runWithoutAuthorization(new Callable<InputStream>() {

        public InputStream call() throws Exception {
            return new GetDeploymentResourceCmd(definitionEntity.getDeploymentId(), definitionEntity.getResourceName()).execute(commandContext);
        }
    });
    try {
        InstanceType bpmnModelInstance = readModelFromStream(bpmnResourceInputStream);
        instanceCache.put(definitionEntity.getId(), bpmnModelInstance);
        return bpmnModelInstance;
    } catch (Exception e) {
        throwLoadModelException(definitionEntity.getId(), e);
    }
    return null;
}
Also used : CommandContext(org.camunda.bpm.engine.impl.interceptor.CommandContext) InputStream(java.io.InputStream) GetDeploymentResourceCmd(org.camunda.bpm.engine.impl.cmd.GetDeploymentResourceCmd)

Aggregations

InputStream (java.io.InputStream)7 GetDeploymentResourceCmd (org.camunda.bpm.engine.impl.cmd.GetDeploymentResourceCmd)7 CommandChecker (org.camunda.bpm.engine.impl.cfg.CommandChecker)2 CaseDefinitionEntity (org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity)2 DecisionDefinition (org.camunda.bpm.engine.repository.DecisionDefinition)2 DecisionRequirementsDefinition (org.camunda.bpm.engine.repository.DecisionRequirementsDefinition)2 Callable (java.util.concurrent.Callable)1 CommandContext (org.camunda.bpm.engine.impl.interceptor.CommandContext)1