Search in sources :

Example 31 with DecisionRequirementsDefinition

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));
}
Also used : DecisionRequirementsDefinitionQuery(org.camunda.bpm.engine.repository.DecisionRequirementsDefinitionQuery) DecisionRequirementsDefinition(org.camunda.bpm.engine.repository.DecisionRequirementsDefinition) Test(org.junit.Test)

Example 32 with DecisionRequirementsDefinition

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));
}
Also used : DecisionRequirementsDefinitionQuery(org.camunda.bpm.engine.repository.DecisionRequirementsDefinitionQuery) DecisionRequirementsDefinition(org.camunda.bpm.engine.repository.DecisionRequirementsDefinition) Test(org.junit.Test)

Example 33 with DecisionRequirementsDefinition

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));
}
Also used : DecisionRequirementsDefinition(org.camunda.bpm.engine.repository.DecisionRequirementsDefinition) Test(org.junit.Test)

Example 34 with DecisionRequirementsDefinition

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);
        }
    });
}
Also used : DecisionRequirementsDefinition(org.camunda.bpm.engine.repository.DecisionRequirementsDefinition) InputStream(java.io.InputStream) GetDeploymentResourceCmd(org.camunda.bpm.engine.impl.cmd.GetDeploymentResourceCmd)

Example 35 with DecisionRequirementsDefinition

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;
    }
}
Also used : DecisionRequirementsDefinition(org.camunda.bpm.engine.repository.DecisionRequirementsDefinition) InputStream(java.io.InputStream) GetDeploymentResourceCmd(org.camunda.bpm.engine.impl.cmd.GetDeploymentResourceCmd)

Aggregations

DecisionRequirementsDefinition (org.camunda.bpm.engine.repository.DecisionRequirementsDefinition)40 Test (org.junit.Test)25 HistoricDecisionInstanceStatisticsQuery (org.camunda.bpm.engine.history.HistoricDecisionInstanceStatisticsQuery)13 DecisionRequirementsDefinitionQuery (org.camunda.bpm.engine.repository.DecisionRequirementsDefinitionQuery)9 Deployment (org.camunda.bpm.engine.test.Deployment)6 InputStream (java.io.InputStream)5 Response (com.jayway.restassured.response.Response)2 HistoricDecisionInstanceQuery (org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery)2 GetDeploymentResourceCmd (org.camunda.bpm.engine.impl.cmd.GetDeploymentResourceCmd)2 Before (org.junit.Before)2 ArrayList (java.util.ArrayList)1 DecisionService (org.camunda.bpm.engine.DecisionService)1 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)1 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)1 RepositoryService (org.camunda.bpm.engine.RepositoryService)1 NotFoundException (org.camunda.bpm.engine.exception.NotFoundException)1 NotValidException (org.camunda.bpm.engine.exception.NotValidException)1 NullValueException (org.camunda.bpm.engine.exception.NullValueException)1 HistoricDecisionInstance (org.camunda.bpm.engine.history.HistoricDecisionInstance)1 NativeHistoricDecisionInstanceQuery (org.camunda.bpm.engine.history.NativeHistoricDecisionInstanceQuery)1