Search in sources :

Example 6 with DecisionDefinitionEntity

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

the class MultiTenancyRepositoryServiceTest method getPreviousDecisionDefinitionWithTenantId.

@Test
public void getPreviousDecisionDefinitionWithTenantId() {
    testRule.deployForTenant(TENANT_ONE, DMN);
    testRule.deployForTenant(TENANT_ONE, DMN);
    testRule.deployForTenant(TENANT_ONE, DMN);
    testRule.deployForTenant(TENANT_TWO, DMN);
    testRule.deployForTenant(TENANT_TWO, DMN);
    List<DecisionDefinition> latestDefinitions = repositoryService.createDecisionDefinitionQuery().latestVersion().orderByTenantId().asc().list();
    DecisionDefinitionEntity previousDefinitionTenantOne = getPreviousDefinition((DecisionDefinitionEntity) latestDefinitions.get(0));
    DecisionDefinitionEntity previousDefinitionTenantTwo = getPreviousDefinition((DecisionDefinitionEntity) latestDefinitions.get(1));
    assertThat(previousDefinitionTenantOne.getVersion(), is(2));
    assertThat(previousDefinitionTenantOne.getTenantId(), is(TENANT_ONE));
    assertThat(previousDefinitionTenantTwo.getVersion(), is(1));
    assertThat(previousDefinitionTenantTwo.getTenantId(), is(TENANT_TWO));
}
Also used : DecisionDefinition(org.camunda.bpm.engine.repository.DecisionDefinition) DecisionDefinitionEntity(org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionDefinitionEntity) Test(org.junit.Test)

Example 7 with DecisionDefinitionEntity

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

the class DeleteHistoricDecisionInstanceByDefinitionIdCmd method execute.

@Override
public Object execute(CommandContext commandContext) {
    ensureNotNull("decisionDefinitionId", decisionDefinitionId);
    DecisionDefinitionEntity decisionDefinition = commandContext.getDecisionDefinitionManager().findDecisionDefinitionById(decisionDefinitionId);
    ensureNotNull("No decision definition found with id: " + decisionDefinitionId, "decisionDefinition", decisionDefinition);
    for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
        checker.checkDeleteHistoricDecisionInstance(decisionDefinition.getKey());
    }
    commandContext.getHistoricDecisionInstanceManager().deleteHistoricDecisionInstancesByDecisionDefinitionId(decisionDefinitionId);
    return null;
}
Also used : CommandChecker(org.camunda.bpm.engine.impl.cfg.CommandChecker) DecisionDefinitionEntity(org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionDefinitionEntity)

Example 8 with DecisionDefinitionEntity

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

the class GetDeploymentDecisionDefinitionCmd method execute.

public DecisionDefinition 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);
    }
    return decisionDefinition;
}
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)

Example 9 with DecisionDefinitionEntity

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

the class RedeploymentRegistrationTest method decisionDefinitionTestProvider.

protected static TestProvider decisionDefinitionTestProvider() {
    return new TestProvider() {

        @Override
        public Command<ProcessApplicationReference> createGetProcessApplicationCommand(final String definitionId) {
            return new Command<ProcessApplicationReference>() {

                public ProcessApplicationReference execute(CommandContext commandContext) {
                    ProcessEngineConfigurationImpl configuration = commandContext.getProcessEngineConfiguration();
                    DeploymentCache deploymentCache = configuration.getDeploymentCache();
                    DecisionDefinitionEntity definition = deploymentCache.findDeployedDecisionDefinitionById(definitionId);
                    return ProcessApplicationContextUtil.getTargetProcessApplication(definition);
                }
            };
        }

        @Override
        public String getLatestDefinitionIdByKey(RepositoryService repositoryService, String key) {
            return repositoryService.createDecisionDefinitionQuery().decisionDefinitionKey(key).latestVersion().singleResult().getId();
        }
    };
}
Also used : ProcessApplicationReference(org.camunda.bpm.application.ProcessApplicationReference) CommandContext(org.camunda.bpm.engine.impl.interceptor.CommandContext) Command(org.camunda.bpm.engine.impl.interceptor.Command) DeploymentCache(org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) DecisionDefinitionEntity(org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionDefinitionEntity) RepositoryService(org.camunda.bpm.engine.RepositoryService)

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