private List<ProcessDefinition> executePaginatedQuery(ProcessDefinitionQuery query, Integer firstResult, Integer maxResults) { if (firstResult == null) { firstResult = 0; } if (maxResults == null) { maxResults = Integer.MAX_VALUE; } return query.listPage(firstResult, maxResults); }
private List<ProcessDefinition> executePaginatedQuery(ProcessDefinitionQuery query, Integer firstResult, Integer maxResults) { if (firstResult == null) { firstResult = 0; } if (maxResults == null) { maxResults = Integer.MAX_VALUE; } return query.listPage(firstResult, maxResults); }
protected List<HalResource<?>> resolveNotCachedLinks(String[] linkedIds, ProcessEngine processEngine) { RepositoryService repositoryService = processEngine.getRepositoryService(); List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery() .processDefinitionIdIn(linkedIds) .listPage(0, linkedIds.length); List<HalResource<?>> resolved = new ArrayList<HalResource<?>>(); for (ProcessDefinition procDef : processDefinitions) { resolved.add(HalProcessDefinition.fromProcessDefinition(procDef, processEngine)); } return resolved; }
protected List<HalResource<?>> resolveNotCachedLinks(String[] linkedIds, ProcessEngine processEngine) { RepositoryService repositoryService = processEngine.getRepositoryService(); List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery() .processDefinitionIdIn(linkedIds) .listPage(0, linkedIds.length); List<HalResource<?>> resolved = new ArrayList<HalResource<?>>(); for (ProcessDefinition procDef : processDefinitions) { resolved.add(HalProcessDefinition.fromProcessDefinition(procDef, processEngine)); } return resolved; }
/** * If parameter "maxResults" is missing, we expect Integer.MAX_VALUE as default. */ @Test public void testMissingMaxResultsParameter() { int firstResult = 10; given().queryParam("firstResult", firstResult) .then().expect().statusCode(Status.OK.getStatusCode()) .when().get(PROCESS_DEFINITION_QUERY_URL); verify(mockedQuery).listPage(firstResult, Integer.MAX_VALUE); }
private List<ProcessDefinition> executePaginatedQuery(ProcessDefinitionQuery query, Integer firstResult, Integer maxResults) { if (firstResult == null) { firstResult = 0; } if (maxResults == null) { maxResults = Integer.MAX_VALUE; } return query.listPage(firstResult, maxResults); }
/** * If parameter "firstResult" is missing, we expect 0 as default. */ @Test public void testMissingFirstResultParameter() { int maxResults = 10; given().queryParam("maxResults", maxResults) .then().expect().statusCode(Status.OK.getStatusCode()) .when().get(PROCESS_DEFINITION_QUERY_URL); verify(mockedQuery).listPage(0, maxResults); }
@Test public void testSuccessfulPagination() { int firstResult = 0; int maxResults = 10; given().queryParam("firstResult", firstResult).queryParam("maxResults", maxResults) .then().expect().statusCode(Status.OK.getStatusCode()) .when().get(PROCESS_DEFINITION_QUERY_URL); verify(mockedQuery).listPage(firstResult, maxResults); }
when(sampleProcessDefinitionQuery.listPage(0, 1)).thenReturn(mockDefinitions); when(sampleProcessDefinitionQuery.processDefinitionIdIn(MockProvider.EXAMPLE_PROCESS_DEFINITION_ID)).thenReturn(sampleProcessDefinitionQuery); when(sampleProcessDefinitionQuery.count()).thenReturn(1l);
when(sampleProcessDefinitionQuery.listPage(0, 1)).thenReturn(mockDefinitions); when(sampleProcessDefinitionQuery.processDefinitionIdIn(MockProvider.EXAMPLE_PROCESS_DEFINITION_ID)).thenReturn(sampleProcessDefinitionQuery); when(sampleProcessDefinitionQuery.count()).thenReturn(1l);
protected List<HalResource<?>> resolveNotCachedLinks(String[] linkedIds, ProcessEngine processEngine) { RepositoryService repositoryService = processEngine.getRepositoryService(); List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery() .processDefinitionIdIn(linkedIds) .listPage(0, linkedIds.length); List<HalResource<?>> resolved = new ArrayList<HalResource<?>>(); for (ProcessDefinition procDef : processDefinitions) { resolved.add(HalProcessDefinition.fromProcessDefinition(procDef, processEngine)); } return resolved; }