Search in sources :

Example 1 with DecisionRequirementsDefinitionEntity

use of org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionRequirementsDefinitionEntity 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 2 with DecisionRequirementsDefinitionEntity

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

the class DecisionRequirementsDefinitionTransformHandler method createFromDefinitions.

@Override
protected DmnDecisionRequirementsGraphImpl createFromDefinitions(DmnElementTransformContext context, Definitions definitions) {
    DecisionRequirementsDefinitionEntity entity = (DecisionRequirementsDefinitionEntity) super.createFromDefinitions(context, definitions);
    entity.setCategory(definitions.getNamespace());
    return entity;
}
Also used : DecisionRequirementsDefinitionEntity(org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionRequirementsDefinitionEntity)

Example 3 with DecisionRequirementsDefinitionEntity

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

the class GetDeploymentDecisionRequirementsDefinitionCmd method execute.

public DecisionRequirementsDefinition execute(CommandContext commandContext) {
    ensureNotNull("decisionRequirementsDefinitionId", decisionRequirementsDefinitionId);
    DeploymentCache deploymentCache = Context.getProcessEngineConfiguration().getDeploymentCache();
    DecisionRequirementsDefinitionEntity decisionRequirementsDefinition = deploymentCache.findDeployedDecisionRequirementsDefinitionById(decisionRequirementsDefinitionId);
    for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
        checker.checkReadDecisionRequirementsDefinition(decisionRequirementsDefinition);
    }
    return decisionRequirementsDefinition;
}
Also used : DeploymentCache(org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache) CommandChecker(org.camunda.bpm.engine.impl.cfg.CommandChecker) DecisionRequirementsDefinitionEntity(org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionRequirementsDefinitionEntity)

Example 4 with DecisionRequirementsDefinitionEntity

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

the class DecisionRequirementsDefinitionDeployer method ensureNoDuplicateDefinitionKeys.

@Override
protected void ensureNoDuplicateDefinitionKeys(List<DecisionRequirementsDefinitionEntity> definitions) {
    // ignore decision requirements definitions which will not be persistent
    ArrayList<DecisionRequirementsDefinitionEntity> persistableDefinitions = new ArrayList<DecisionRequirementsDefinitionEntity>();
    for (DecisionRequirementsDefinitionEntity definition : definitions) {
        if (isDecisionRequirementsDefinitionPersistable(definition)) {
            persistableDefinitions.add(definition);
        }
    }
    super.ensureNoDuplicateDefinitionKeys(persistableDefinitions);
}
Also used : ArrayList(java.util.ArrayList) DecisionRequirementsDefinitionEntity(org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionRequirementsDefinitionEntity)

Example 5 with DecisionRequirementsDefinitionEntity

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

the class DecisionRequirementsDefinitionDeployer method transformDefinitions.

@Override
protected List<DecisionRequirementsDefinitionEntity> transformDefinitions(DeploymentEntity deployment, ResourceEntity resource, Properties properties) {
    byte[] bytes = resource.getBytes();
    ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);
    try {
        DecisionRequirementsDefinitionEntity drd = transformer.createTransform().modelInstance(inputStream).transformDecisionRequirementsGraph();
        return Collections.singletonList(drd);
    } catch (Exception e) {
        throw LOG.exceptionParseDmnResource(resource.getName(), e);
    }
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) DecisionRequirementsDefinitionEntity(org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionRequirementsDefinitionEntity)

Aggregations

DecisionRequirementsDefinitionEntity (org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionRequirementsDefinitionEntity)6 ArrayList (java.util.ArrayList)2 DeploymentCache (org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ProcessApplicationReference (org.camunda.bpm.application.ProcessApplicationReference)1 DmnDecision (org.camunda.bpm.dmn.engine.DmnDecision)1 RepositoryService (org.camunda.bpm.engine.RepositoryService)1 CommandChecker (org.camunda.bpm.engine.impl.cfg.CommandChecker)1 ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)1 DecisionDefinitionEntity (org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionDefinitionEntity)1 Command (org.camunda.bpm.engine.impl.interceptor.Command)1 CommandContext (org.camunda.bpm.engine.impl.interceptor.CommandContext)1