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));
}
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;
}
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;
}
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();
}
};
}
Aggregations