use of org.camunda.bpm.engine.repository.DecisionRequirementsDefinition in project camunda-bpm-platform by camunda.
the class MultiTenancyDecisionRequirementsDefinitionQueryTest method queryByLatestWithTenantId.
@Test
public void queryByLatestWithTenantId() {
// deploy a second version for tenant one
testRule.deployForTenant(TENANT_ONE, DMN);
DecisionRequirementsDefinitionQuery query = repositoryService.createDecisionRequirementsDefinitionQuery().decisionRequirementsDefinitionKey(DECISION_REQUIREMENTS_DEFINITION_KEY).latestVersion().tenantIdIn(TENANT_ONE);
assertThat(query.count(), is(1L));
DecisionRequirementsDefinition DecisionRequirementsDefinition = query.singleResult();
assertThat(DecisionRequirementsDefinition.getTenantId(), is(TENANT_ONE));
assertThat(DecisionRequirementsDefinition.getVersion(), is(2));
query = repositoryService.createDecisionRequirementsDefinitionQuery().decisionRequirementsDefinitionKey(DECISION_REQUIREMENTS_DEFINITION_KEY).latestVersion().tenantIdIn(TENANT_TWO);
assertThat(query.count(), is(1L));
DecisionRequirementsDefinition = query.singleResult();
assertThat(DecisionRequirementsDefinition.getTenantId(), is(TENANT_TWO));
assertThat(DecisionRequirementsDefinition.getVersion(), is(1));
}
use of org.camunda.bpm.engine.repository.DecisionRequirementsDefinition in project camunda-bpm-platform by camunda.
the class MultiTenancyDecisionRequirementsDefinitionQueryTest method queryByLatestWithTenantIds.
@Test
public void queryByLatestWithTenantIds() {
// deploy a second version for tenant one
testRule.deployForTenant(TENANT_ONE, DMN);
DecisionRequirementsDefinitionQuery query = repositoryService.createDecisionRequirementsDefinitionQuery().decisionRequirementsDefinitionKey(DECISION_REQUIREMENTS_DEFINITION_KEY).latestVersion().tenantIdIn(TENANT_ONE, TENANT_TWO).orderByTenantId().asc();
// one definition for each tenant
assertThat(query.count(), is(2L));
Map<String, DecisionRequirementsDefinition> definitionsForTenant = getDecisionRequirementsDefinitionsForTenant(query.list());
assertThat(definitionsForTenant.get(TENANT_ONE).getVersion(), is(2));
assertThat(definitionsForTenant.get(TENANT_TWO).getVersion(), is(1));
}
use of org.camunda.bpm.engine.repository.DecisionRequirementsDefinition in project camunda-bpm-platform by camunda.
the class MultiTenancyDecisionRequirementsDefinitionCmdsTenantCheckTest method getDecisionRequirementsDefinitionWithAuthenticatedTenant.
@Test
public void getDecisionRequirementsDefinitionWithAuthenticatedTenant() {
identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
DecisionRequirementsDefinition definition = repositoryService.getDecisionRequirementsDefinition(decisionRequirementsDefinitionId);
assertThat(definition.getTenantId(), is(TENANT_ONE));
}
use of org.camunda.bpm.engine.repository.DecisionRequirementsDefinition in project camunda-bpm-platform by camunda.
the class GetDeploymentDecisionRequirementsModelCmd method execute.
public InputStream execute(final CommandContext commandContext) {
DecisionRequirementsDefinition decisionRequirementsDefinition = new GetDeploymentDecisionRequirementsDefinitionCmd(decisionRequirementsDefinitionId).execute(commandContext);
final String deploymentId = decisionRequirementsDefinition.getDeploymentId();
final String resourceName = decisionRequirementsDefinition.getResourceName();
return commandContext.runWithoutAuthorization(new Callable<InputStream>() {
public InputStream call() throws Exception {
return new GetDeploymentResourceCmd(deploymentId, resourceName).execute(commandContext);
}
});
}
use of org.camunda.bpm.engine.repository.DecisionRequirementsDefinition in project camunda-bpm-platform by camunda.
the class GetDeploymentDecisionRequirementsDiagramCmd method execute.
public InputStream execute(final CommandContext commandContext) {
DecisionRequirementsDefinition decisionRequirementsDefinition = new GetDeploymentDecisionRequirementsDefinitionCmd(decisionRequirementsDefinitionId).execute(commandContext);
final String deploymentId = decisionRequirementsDefinition.getDeploymentId();
final String resourceName = decisionRequirementsDefinition.getDiagramResourceName();
if (resourceName != null) {
return commandContext.runWithoutAuthorization(new Callable<InputStream>() {
public InputStream call() throws Exception {
return new GetDeploymentResourceCmd(deploymentId, resourceName).execute(commandContext);
}
});
} else {
return null;
}
}
Aggregations