Search in sources :

Example 6 with DecisionDefinition

use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.

the class DefaultDmnHistoryEventProducer method createDecisionEvaluatedEvt.

protected HistoricDecisionInstanceEntity createDecisionEvaluatedEvt(DmnDecisionLogicEvaluationEvent evaluationEvent, CaseExecutionEntity execution) {
    // create event instance
    HistoricDecisionInstanceEntity event = newDecisionInstanceEventEntity(execution, evaluationEvent);
    // initialize event
    initDecisionInstanceEvent(event, evaluationEvent, HistoryEventTypes.DMN_DECISION_EVALUATE);
    setReferenceToCaseInstance(event, execution);
    // set current time as evaluation time
    event.setEvaluationTime(ClockUtil.getCurrentTime());
    DecisionDefinition decisionDefinition = (DecisionDefinition) evaluationEvent.getDecision();
    String tenantId = execution.getTenantId();
    if (tenantId == null) {
        tenantId = provideTenantId(decisionDefinition, event);
    }
    event.setTenantId(tenantId);
    return event;
}
Also used : HistoricDecisionInstanceEntity(org.camunda.bpm.engine.impl.history.event.HistoricDecisionInstanceEntity) DecisionDefinition(org.camunda.bpm.engine.repository.DecisionDefinition)

Example 7 with DecisionDefinition

use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.

the class DefaultDmnHistoryEventProducer method createDecisionEvaluatedEvt.

protected HistoricDecisionInstanceEntity createDecisionEvaluatedEvt(DmnDecisionLogicEvaluationEvent evaluationEvent, ExecutionEntity execution) {
    // create event instance
    HistoricDecisionInstanceEntity event = newDecisionInstanceEventEntity(execution, evaluationEvent);
    // initialize event
    initDecisionInstanceEvent(event, evaluationEvent, HistoryEventTypes.DMN_DECISION_EVALUATE);
    setReferenceToProcessInstance(event, execution);
    // set current time as evaluation time
    event.setEvaluationTime(ClockUtil.getCurrentTime());
    DecisionDefinition decisionDefinition = (DecisionDefinition) evaluationEvent.getDecision();
    String tenantId = execution.getTenantId();
    if (tenantId == null) {
        tenantId = provideTenantId(decisionDefinition, event);
    }
    event.setTenantId(tenantId);
    return event;
}
Also used : HistoricDecisionInstanceEntity(org.camunda.bpm.engine.impl.history.event.HistoricDecisionInstanceEntity) DecisionDefinition(org.camunda.bpm.engine.repository.DecisionDefinition)

Example 8 with DecisionDefinition

use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.

the class DefaultDmnHistoryEventProducer method createDecisionEvaluatedEvt.

protected HistoricDecisionInstanceEntity createDecisionEvaluatedEvt(DmnDecisionLogicEvaluationEvent evaluationEvent) {
    // create event instance
    HistoricDecisionInstanceEntity event = newDecisionInstanceEventEntity(evaluationEvent);
    // initialize event
    initDecisionInstanceEvent(event, evaluationEvent, HistoryEventTypes.DMN_DECISION_EVALUATE);
    // set current time as evaluation time
    event.setEvaluationTime(ClockUtil.getCurrentTime());
    // set the user id if there is an authenticated user and no process instance
    setUserId(event);
    DecisionDefinition decisionDefinition = (DecisionDefinition) evaluationEvent.getDecision();
    String tenantId = decisionDefinition.getTenantId();
    if (tenantId == null) {
        tenantId = provideTenantId(decisionDefinition, event);
    }
    event.setTenantId(tenantId);
    return event;
}
Also used : HistoricDecisionInstanceEntity(org.camunda.bpm.engine.impl.history.event.HistoricDecisionInstanceEntity) DecisionDefinition(org.camunda.bpm.engine.repository.DecisionDefinition)

Example 9 with DecisionDefinition

use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.

the class DeploymentManager method deleteDecisionDeployment.

protected void deleteDecisionDeployment(String deploymentId, boolean cascade) {
    ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
    if (processEngineConfiguration.isDmnEnabled()) {
        DecisionDefinitionManager decisionDefinitionManager = getDecisionDefinitionManager();
        List<DecisionDefinition> decisionDefinitions = decisionDefinitionManager.findDecisionDefinitionByDeploymentId(deploymentId);
        if (cascade) {
            // delete historic decision instances
            for (DecisionDefinition decisionDefinition : decisionDefinitions) {
                getHistoricDecisionInstanceManager().deleteHistoricDecisionInstancesByDecisionDefinitionId(decisionDefinition.getId());
            }
        }
        // delete decision definitions from db
        decisionDefinitionManager.deleteDecisionDefinitionsByDeploymentId(deploymentId);
        DeploymentCache deploymentCache = processEngineConfiguration.getDeploymentCache();
        for (DecisionDefinition decisionDefinition : decisionDefinitions) {
            String decisionDefinitionId = decisionDefinition.getId();
            // remove decision definitions from cache:
            deploymentCache.removeDecisionDefinition(decisionDefinitionId);
        }
    }
}
Also used : DecisionDefinitionManager(org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionDefinitionManager) DeploymentCache(org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) DecisionDefinition(org.camunda.bpm.engine.repository.DecisionDefinition)

Example 10 with DecisionDefinition

use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.

the class DecisionServiceTest method evaluateDecisionTableByKeyWithNonExistingVersion.

@Deployment(resources = DMN_DECISION_TABLE)
@Test
public void evaluateDecisionTableByKeyWithNonExistingVersion() {
    DecisionDefinition decisionDefinition = repositoryService.createDecisionDefinitionQuery().singleResult();
    thrown.expect(NotFoundException.class);
    thrown.expectMessage("no decision definition deployed with key = 'decision' and version = '42'");
    decisionService.evaluateDecisionTableByKeyAndVersion(decisionDefinition.getKey(), 42, null);
}
Also used : DecisionDefinition(org.camunda.bpm.engine.repository.DecisionDefinition) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

DecisionDefinition (org.camunda.bpm.engine.repository.DecisionDefinition)68 Test (org.junit.Test)21 Deployment (org.camunda.bpm.engine.test.Deployment)18 DecisionDefinitionQuery (org.camunda.bpm.engine.repository.DecisionDefinitionQuery)10 Date (java.util.Date)6 DmnDecisionTableResult (org.camunda.bpm.dmn.engine.DmnDecisionTableResult)5 BadUserRequestException (org.camunda.bpm.engine.BadUserRequestException)5 InputStream (java.io.InputStream)4 ArrayList (java.util.ArrayList)4 DmnDecisionResult (org.camunda.bpm.dmn.engine.DmnDecisionResult)4 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)3 HistoricDecisionInstanceEntity (org.camunda.bpm.engine.impl.history.event.HistoricDecisionInstanceEntity)3 Response (com.jayway.restassured.response.Response)2 HistoricCaseInstance (org.camunda.bpm.engine.history.HistoricCaseInstance)2 HistoricDecisionInstanceQuery (org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery)2 HistoricDecisionOutputInstance (org.camunda.bpm.engine.history.HistoricDecisionOutputInstance)2 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)2 CommandChecker (org.camunda.bpm.engine.impl.cfg.CommandChecker)2 GetDeploymentResourceCmd (org.camunda.bpm.engine.impl.cmd.GetDeploymentResourceCmd)2 DeploymentCache (org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache)2