Search in sources :

Example 16 with DecisionRequirementsDefinitionQuery

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

the class DecisionRequirementsDefinitionRestServiceQueryTest method createMockQuery.

private DecisionRequirementsDefinitionQuery createMockQuery(List<DecisionRequirementsDefinition> mockedDefinitions) {
    DecisionRequirementsDefinitionQuery query = mock(DecisionRequirementsDefinitionQuery.class);
    when(query.list()).thenReturn(mockedDefinitions);
    when(query.count()).thenReturn((long) mockedDefinitions.size());
    when(processEngine.getRepositoryService().createDecisionRequirementsDefinitionQuery()).thenReturn(query);
    return query;
}
Also used : DecisionRequirementsDefinitionQuery(org.camunda.bpm.engine.repository.DecisionRequirementsDefinitionQuery)

Example 17 with DecisionRequirementsDefinitionQuery

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

the class DecisionRequirementsDefinitionRestServiceImpl method getDecisionRequirementsDefinitionsCount.

@Override
public CountResultDto getDecisionRequirementsDefinitionsCount(UriInfo uriInfo) {
    DecisionRequirementsDefinitionQueryDto queryDto = new DecisionRequirementsDefinitionQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
    ProcessEngine engine = getProcessEngine();
    DecisionRequirementsDefinitionQuery query = queryDto.toQuery(engine);
    long count = query.count();
    CountResultDto result = new CountResultDto();
    result.setCount(count);
    return result;
}
Also used : DecisionRequirementsDefinitionQuery(org.camunda.bpm.engine.repository.DecisionRequirementsDefinitionQuery) CountResultDto(org.camunda.bpm.engine.rest.dto.CountResultDto) DecisionRequirementsDefinitionQueryDto(org.camunda.bpm.engine.rest.dto.repository.DecisionRequirementsDefinitionQueryDto) ProcessEngine(org.camunda.bpm.engine.ProcessEngine)

Example 18 with DecisionRequirementsDefinitionQuery

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

the class DecisionRequirementsDefinitionRestServiceImpl method getDecisionRequirementsDefinitions.

@Override
public List<DecisionRequirementsDefinitionDto> getDecisionRequirementsDefinitions(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
    DecisionRequirementsDefinitionQueryDto queryDto = new DecisionRequirementsDefinitionQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
    List<DecisionRequirementsDefinitionDto> dtos = new ArrayList<DecisionRequirementsDefinitionDto>();
    ProcessEngine engine = getProcessEngine();
    DecisionRequirementsDefinitionQuery query = queryDto.toQuery(engine);
    List<DecisionRequirementsDefinition> matchingDefinitions = null;
    if (firstResult != null || maxResults != null) {
        matchingDefinitions = executePaginatedQuery(query, firstResult, maxResults);
    } else {
        matchingDefinitions = query.list();
    }
    for (DecisionRequirementsDefinition definition : matchingDefinitions) {
        DecisionRequirementsDefinitionDto dto = DecisionRequirementsDefinitionDto.fromDecisionRequirementsDefinition(definition);
        dtos.add(dto);
    }
    return dtos;
}
Also used : DecisionRequirementsDefinitionQuery(org.camunda.bpm.engine.repository.DecisionRequirementsDefinitionQuery) DecisionRequirementsDefinition(org.camunda.bpm.engine.repository.DecisionRequirementsDefinition) DecisionRequirementsDefinitionDto(org.camunda.bpm.engine.rest.dto.repository.DecisionRequirementsDefinitionDto) ArrayList(java.util.ArrayList) DecisionRequirementsDefinitionQueryDto(org.camunda.bpm.engine.rest.dto.repository.DecisionRequirementsDefinitionQueryDto) ProcessEngine(org.camunda.bpm.engine.ProcessEngine)

Example 19 with DecisionRequirementsDefinitionQuery

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

the class DecisionRequirementsDefinitionQueryTest method queryByDecisionRequirementsDefinitionName.

@Test
public void queryByDecisionRequirementsDefinitionName() {
    DecisionRequirementsDefinitionQuery query = repositoryService.createDecisionRequirementsDefinitionQuery();
    assertThat(query.decisionRequirementsDefinitionName("notExisting").count(), is(0L));
    assertThat(query.decisionRequirementsDefinitionName("Score").count(), is(1L));
    assertThat(query.singleResult().getKey(), is("score"));
}
Also used : DecisionRequirementsDefinitionQuery(org.camunda.bpm.engine.repository.DecisionRequirementsDefinitionQuery) Test(org.junit.Test)

Example 20 with DecisionRequirementsDefinitionQuery

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

the class DecisionRequirementsDefinitionQueryTest method queryByVersion.

@Test
public void queryByVersion() {
    DecisionRequirementsDefinitionQuery query = repositoryService.createDecisionRequirementsDefinitionQuery();
    assertThat(query.decisionRequirementsDefinitionVersion(1).count(), is(3L));
    assertThat(query.decisionRequirementsDefinitionVersion(2).count(), is(1L));
    assertThat(query.decisionRequirementsDefinitionVersion(3).count(), is(0L));
}
Also used : DecisionRequirementsDefinitionQuery(org.camunda.bpm.engine.repository.DecisionRequirementsDefinitionQuery) Test(org.junit.Test)

Aggregations

DecisionRequirementsDefinitionQuery (org.camunda.bpm.engine.repository.DecisionRequirementsDefinitionQuery)37 Test (org.junit.Test)31 DecisionRequirementsDefinition (org.camunda.bpm.engine.repository.DecisionRequirementsDefinition)9 Deployment (org.camunda.bpm.engine.test.Deployment)4 InputStream (java.io.InputStream)2 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)2 DecisionRequirementsDefinitionQueryDto (org.camunda.bpm.engine.rest.dto.repository.DecisionRequirementsDefinitionQueryDto)2 ArrayList (java.util.ArrayList)1 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)1 DecisionRequirementsDefinitionDto (org.camunda.bpm.engine.rest.dto.repository.DecisionRequirementsDefinitionDto)1