Search in sources :

Example 1 with BatchDto

use of org.camunda.bpm.engine.rest.dto.batch.BatchDto in project camunda-bpm-platform by camunda.

the class BatchRestServiceImpl method getBatches.

public List<BatchDto> getBatches(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
    BatchQueryDto queryDto = new BatchQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
    BatchQuery query = queryDto.toQuery(getProcessEngine());
    List<Batch> matchingBatches;
    if (firstResult != null || maxResults != null) {
        matchingBatches = executePaginatedQuery(query, firstResult, maxResults);
    } else {
        matchingBatches = query.list();
    }
    List<BatchDto> batchResults = new ArrayList<BatchDto>();
    for (Batch matchingBatch : matchingBatches) {
        batchResults.add(BatchDto.fromBatch(matchingBatch));
    }
    return batchResults;
}
Also used : Batch(org.camunda.bpm.engine.batch.Batch) ArrayList(java.util.ArrayList) BatchDto(org.camunda.bpm.engine.rest.dto.batch.BatchDto) BatchQuery(org.camunda.bpm.engine.batch.BatchQuery) BatchQueryDto(org.camunda.bpm.engine.rest.dto.batch.BatchQueryDto)

Example 2 with BatchDto

use of org.camunda.bpm.engine.rest.dto.batch.BatchDto in project camunda-bpm-platform by camunda.

the class BatchRestServiceQueryTest method verifyBatchListJson.

protected void verifyBatchListJson(String batchListJson) {
    List<Object> batches = from(batchListJson).get();
    assertEquals("There should be one batch returned.", 1, batches.size());
    BatchDto batch = from(batchListJson).getObject("[0]", BatchDto.class);
    assertNotNull("The returned batch should not be null.", batch);
    assertEquals(MockProvider.EXAMPLE_BATCH_ID, batch.getId());
    assertEquals(MockProvider.EXAMPLE_BATCH_TYPE, batch.getType());
    assertEquals(MockProvider.EXAMPLE_BATCH_TOTAL_JOBS, batch.getTotalJobs());
    assertEquals(MockProvider.EXAMPLE_BATCH_JOBS_CREATED, batch.getJobsCreated());
    assertEquals(MockProvider.EXAMPLE_BATCH_JOBS_PER_SEED, batch.getBatchJobsPerSeed());
    assertEquals(MockProvider.EXAMPLE_INVOCATIONS_PER_BATCH_JOB, batch.getInvocationsPerBatchJob());
    assertEquals(MockProvider.EXAMPLE_SEED_JOB_DEFINITION_ID, batch.getSeedJobDefinitionId());
    assertEquals(MockProvider.EXAMPLE_MONITOR_JOB_DEFINITION_ID, batch.getMonitorJobDefinitionId());
    assertEquals(MockProvider.EXAMPLE_BATCH_JOB_DEFINITION_ID, batch.getBatchJobDefinitionId());
    assertEquals(MockProvider.EXAMPLE_TENANT_ID, batch.getTenantId());
    assertTrue(batch.isSuspended());
}
Also used : BatchDto(org.camunda.bpm.engine.rest.dto.batch.BatchDto)

Example 3 with BatchDto

use of org.camunda.bpm.engine.rest.dto.batch.BatchDto in project camunda-bpm-platform by camunda.

the class JobRestServiceInteractionTest method verifyBatchJson.

protected void verifyBatchJson(String batchJson) {
    BatchDto batch = JsonPathUtil.from(batchJson).getObject("", BatchDto.class);
    assertNotNull("The returned batch should not be null.", batch);
    assertEquals(MockProvider.EXAMPLE_BATCH_ID, batch.getId());
    assertEquals(MockProvider.EXAMPLE_BATCH_TYPE, batch.getType());
    assertEquals(MockProvider.EXAMPLE_BATCH_TOTAL_JOBS, batch.getTotalJobs());
    assertEquals(MockProvider.EXAMPLE_BATCH_JOBS_PER_SEED, batch.getBatchJobsPerSeed());
    assertEquals(MockProvider.EXAMPLE_INVOCATIONS_PER_BATCH_JOB, batch.getInvocationsPerBatchJob());
    assertEquals(MockProvider.EXAMPLE_SEED_JOB_DEFINITION_ID, batch.getSeedJobDefinitionId());
    assertEquals(MockProvider.EXAMPLE_MONITOR_JOB_DEFINITION_ID, batch.getMonitorJobDefinitionId());
    assertEquals(MockProvider.EXAMPLE_BATCH_JOB_DEFINITION_ID, batch.getBatchJobDefinitionId());
    assertEquals(MockProvider.EXAMPLE_TENANT_ID, batch.getTenantId());
}
Also used : BatchDto(org.camunda.bpm.engine.rest.dto.batch.BatchDto)

Example 4 with BatchDto

use of org.camunda.bpm.engine.rest.dto.batch.BatchDto in project camunda-bpm-platform by camunda.

the class ProcessInstanceRestServiceInteractionTest method verifyBatchJson.

protected void verifyBatchJson(String batchJson) {
    BatchDto batch = JsonPathUtil.from(batchJson).getObject("", BatchDto.class);
    assertNotNull("The returned batch should not be null.", batch);
    assertEquals(MockProvider.EXAMPLE_BATCH_ID, batch.getId());
    assertEquals(MockProvider.EXAMPLE_BATCH_TYPE, batch.getType());
    assertEquals(MockProvider.EXAMPLE_BATCH_TOTAL_JOBS, batch.getTotalJobs());
    assertEquals(MockProvider.EXAMPLE_BATCH_JOBS_PER_SEED, batch.getBatchJobsPerSeed());
    assertEquals(MockProvider.EXAMPLE_INVOCATIONS_PER_BATCH_JOB, batch.getInvocationsPerBatchJob());
    assertEquals(MockProvider.EXAMPLE_SEED_JOB_DEFINITION_ID, batch.getSeedJobDefinitionId());
    assertEquals(MockProvider.EXAMPLE_MONITOR_JOB_DEFINITION_ID, batch.getMonitorJobDefinitionId());
    assertEquals(MockProvider.EXAMPLE_BATCH_JOB_DEFINITION_ID, batch.getBatchJobDefinitionId());
    assertEquals(MockProvider.EXAMPLE_TENANT_ID, batch.getTenantId());
}
Also used : BatchDto(org.camunda.bpm.engine.rest.dto.batch.BatchDto)

Example 5 with BatchDto

use of org.camunda.bpm.engine.rest.dto.batch.BatchDto in project camunda-bpm-platform by camunda.

the class HistoricProcessInstanceRestServiceInteractionTest method verifyBatchJson.

protected void verifyBatchJson(String batchJson) {
    BatchDto batch = JsonPathUtil.from(batchJson).getObject("", BatchDto.class);
    assertNotNull("The returned batch should not be null.", batch);
    assertEquals(MockProvider.EXAMPLE_BATCH_ID, batch.getId());
    assertEquals(MockProvider.EXAMPLE_BATCH_TYPE, batch.getType());
    assertEquals(MockProvider.EXAMPLE_BATCH_TOTAL_JOBS, batch.getTotalJobs());
    assertEquals(MockProvider.EXAMPLE_BATCH_JOBS_PER_SEED, batch.getBatchJobsPerSeed());
    assertEquals(MockProvider.EXAMPLE_INVOCATIONS_PER_BATCH_JOB, batch.getInvocationsPerBatchJob());
    assertEquals(MockProvider.EXAMPLE_SEED_JOB_DEFINITION_ID, batch.getSeedJobDefinitionId());
    assertEquals(MockProvider.EXAMPLE_MONITOR_JOB_DEFINITION_ID, batch.getMonitorJobDefinitionId());
    assertEquals(MockProvider.EXAMPLE_BATCH_JOB_DEFINITION_ID, batch.getBatchJobDefinitionId());
    assertEquals(MockProvider.EXAMPLE_TENANT_ID, batch.getTenantId());
}
Also used : BatchDto(org.camunda.bpm.engine.rest.dto.batch.BatchDto)

Aggregations

BatchDto (org.camunda.bpm.engine.rest.dto.batch.BatchDto)7 ArrayList (java.util.ArrayList)1 Batch (org.camunda.bpm.engine.batch.Batch)1 BatchQuery (org.camunda.bpm.engine.batch.BatchQuery)1 BatchQueryDto (org.camunda.bpm.engine.rest.dto.batch.BatchQueryDto)1