Search in sources :

Example 1 with DecisionDefinitionEntity

use of org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionDefinitionEntity in project camunda-bpm-platform by camunda.

the class GetDeploymentDmnModelInstanceCmd method execute.

public DmnModelInstance execute(CommandContext commandContext) {
    ensureNotNull("decisionDefinitionId", decisionDefinitionId);
    DeploymentCache deploymentCache = Context.getProcessEngineConfiguration().getDeploymentCache();
    DecisionDefinitionEntity decisionDefinition = deploymentCache.findDeployedDecisionDefinitionById(decisionDefinitionId);
    for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
        checker.checkReadDecisionDefinition(decisionDefinition);
    }
    DmnModelInstance modelInstance = deploymentCache.findDmnModelInstanceForDecisionDefinition(decisionDefinitionId);
    ensureNotNull(DmnModelInstanceNotFoundException.class, "No DMN model instance found for decision definition id " + decisionDefinitionId, "modelInstance", modelInstance);
    return modelInstance;
}
Also used : DeploymentCache(org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache) CommandChecker(org.camunda.bpm.engine.impl.cfg.CommandChecker) DecisionDefinitionEntity(org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionDefinitionEntity) DmnModelInstance(org.camunda.bpm.model.dmn.DmnModelInstance)

Example 2 with DecisionDefinitionEntity

use of org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionDefinitionEntity in project camunda-bpm-platform by camunda.

the class DecisionDefinitionDeployer method transformDefinitions.

@Override
protected List<DecisionDefinitionEntity> transformDefinitions(DeploymentEntity deployment, ResourceEntity resource, Properties properties) {
    List<DecisionDefinitionEntity> decisions = new ArrayList<DecisionDefinitionEntity>();
    // get the decisions from the deployed drd instead of parse the DMN again
    DecisionRequirementsDefinitionEntity deployedDrd = findDeployedDrdForResource(deployment, resource.getName());
    if (deployedDrd == null) {
        throw LOG.exceptionNoDrdForResource(resource.getName());
    }
    Collection<DmnDecision> decisionsOfDrd = deployedDrd.getDecisions();
    for (DmnDecision decisionOfDrd : decisionsOfDrd) {
        DecisionDefinitionEntity decisionEntity = (DecisionDefinitionEntity) decisionOfDrd;
        if (DecisionRequirementsDefinitionDeployer.isDecisionRequirementsDefinitionPersistable(deployedDrd)) {
            decisionEntity.setDecisionRequirementsDefinitionId(deployedDrd.getId());
            decisionEntity.setDecisionRequirementsDefinitionKey(deployedDrd.getKey());
        }
        decisions.add(decisionEntity);
    }
    if (!DecisionRequirementsDefinitionDeployer.isDecisionRequirementsDefinitionPersistable(deployedDrd)) {
        deployment.removeArtifact(deployedDrd);
    }
    return decisions;
}
Also used : ArrayList(java.util.ArrayList) DecisionDefinitionEntity(org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionDefinitionEntity) DecisionRequirementsDefinitionEntity(org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionRequirementsDefinitionEntity) DmnDecision(org.camunda.bpm.dmn.engine.DmnDecision)

Example 3 with DecisionDefinitionEntity

use of org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionDefinitionEntity in project camunda-bpm-platform by camunda.

the class DecisionDefinitionHandler method createFromDecision.

@Override
protected DmnDecisionImpl createFromDecision(DmnElementTransformContext context, Decision decision) {
    DecisionDefinitionEntity decisionDefinition = (DecisionDefinitionEntity) super.createFromDecision(context, decision);
    String category = context.getModelInstance().getDefinitions().getNamespace();
    decisionDefinition.setCategory(category);
    decisionDefinition.setHistoryTimeToLive(ParseUtil.parseHistoryTimeToLive(decision.getCamundaHistoryTimeToLiveString()));
    decisionDefinition.setVersionTag(decision.getVersionTag());
    return decisionDefinition;
}
Also used : DecisionDefinitionEntity(org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionDefinitionEntity)

Example 4 with DecisionDefinitionEntity

use of org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionDefinitionEntity in project camunda-bpm-platform by camunda.

the class DecisionDefinitionCache method findDeployedDefinitionByKeyAndVersion.

public DecisionDefinitionEntity findDeployedDefinitionByKeyAndVersion(String definitionKey, Integer definitionVersion) {
    DecisionDefinitionEntity definition = ((DecisionDefinitionManager) getManager()).findDecisionDefinitionByKeyAndVersion(definitionKey, definitionVersion);
    checkInvalidDefinitionByKeyAndVersion(definitionKey, definitionVersion, definition);
    definition = resolveDefinition(definition);
    return definition;
}
Also used : DecisionDefinitionManager(org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionDefinitionManager) DecisionDefinitionEntity(org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionDefinitionEntity)

Example 5 with DecisionDefinitionEntity

use of org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionDefinitionEntity in project camunda-bpm-platform by camunda.

the class UpdateDecisionDefinitionHistoryTimeToLiveCmd method execute.

public Void execute(CommandContext commandContext) {
    checkAuthorization(commandContext);
    ensureNotNull(BadUserRequestException.class, "decisionDefinitionId", decisionDefinitionId);
    if (historyTimeToLive != null) {
        ensureGreaterThanOrEqual(BadUserRequestException.class, "", "historyTimeToLive", historyTimeToLive, 0);
    }
    DecisionDefinitionEntity decisionDefinitionEntity = commandContext.getDecisionDefinitionManager().findDecisionDefinitionById(decisionDefinitionId);
    decisionDefinitionEntity.setHistoryTimeToLive(historyTimeToLive);
    return null;
}
Also used : DecisionDefinitionEntity(org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionDefinitionEntity)

Aggregations

DecisionDefinitionEntity (org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionDefinitionEntity)9 CommandChecker (org.camunda.bpm.engine.impl.cfg.CommandChecker)3 DeploymentCache (org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache)3 ArrayList (java.util.ArrayList)1 ProcessApplicationReference (org.camunda.bpm.application.ProcessApplicationReference)1 DmnDecision (org.camunda.bpm.dmn.engine.DmnDecision)1 RepositoryService (org.camunda.bpm.engine.RepositoryService)1 ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)1 DecisionDefinitionManager (org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionDefinitionManager)1 DecisionRequirementsDefinitionEntity (org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionRequirementsDefinitionEntity)1 Command (org.camunda.bpm.engine.impl.interceptor.Command)1 CommandContext (org.camunda.bpm.engine.impl.interceptor.CommandContext)1 DecisionDefinition (org.camunda.bpm.engine.repository.DecisionDefinition)1 DmnModelInstance (org.camunda.bpm.model.dmn.DmnModelInstance)1 Test (org.junit.Test)1