use of org.camunda.bpm.engine.ManagementService in project camunda-bpm-platform by camunda.
the class JobDefinitionResourceImpl method getJobDefinition.
public JobDefinitionDto getJobDefinition() {
ManagementService managementService = engine.getManagementService();
JobDefinition jobDefinition = managementService.createJobDefinitionQuery().jobDefinitionId(jobDefinitionId).singleResult();
if (jobDefinition == null) {
throw new InvalidRequestException(Status.NOT_FOUND, "Job Definition with id " + jobDefinitionId + " does not exist");
}
return JobDefinitionDto.fromJobDefinition(jobDefinition);
}
use of org.camunda.bpm.engine.ManagementService in project camunda-bpm-platform by camunda.
the class ProcessDefinitionResourceImpl method getActivityStatistics.
@Override
public List<StatisticsResultDto> getActivityStatistics(Boolean includeFailedJobs, Boolean includeIncidents, String includeIncidentsForType) {
if (includeIncidents != null && includeIncidentsForType != null) {
throw new InvalidRequestException(Status.BAD_REQUEST, "Only one of the query parameter includeIncidents or includeIncidentsForType can be set.");
}
ManagementService mgmtService = engine.getManagementService();
ActivityStatisticsQuery query = mgmtService.createActivityStatisticsQuery(processDefinitionId);
if (includeFailedJobs != null && includeFailedJobs) {
query.includeFailedJobs();
}
if (includeIncidents != null && includeIncidents) {
query.includeIncidents();
} else if (includeIncidentsForType != null) {
query.includeIncidentsForType(includeIncidentsForType);
}
List<ActivityStatistics> queryResults = query.list();
List<StatisticsResultDto> results = new ArrayList<StatisticsResultDto>();
for (ActivityStatistics queryResult : queryResults) {
StatisticsResultDto dto = ActivityStatisticsResultDto.fromActivityStatistics(queryResult);
results.add(dto);
}
return results;
}
use of org.camunda.bpm.engine.ManagementService in project camunda-bpm-platform by camunda.
the class JobResourceImpl method executeJob.
@Override
public void executeJob() {
try {
ManagementService managementService = engine.getManagementService();
managementService.executeJob(this.jobId);
} catch (AuthorizationException e) {
throw e;
} catch (ProcessEngineException e) {
throw new InvalidRequestException(Status.NOT_FOUND, e.getMessage());
} catch (RuntimeException r) {
throw new RestException(Status.INTERNAL_SERVER_ERROR, r.getMessage());
}
}
use of org.camunda.bpm.engine.ManagementService in project camunda-bpm-platform by camunda.
the class JobResourceImpl method getStacktrace.
@Override
public String getStacktrace() {
try {
ManagementService managementService = engine.getManagementService();
String stacktrace = managementService.getJobExceptionStacktrace(jobId);
return stacktrace;
} catch (AuthorizationException e) {
throw e;
} catch (ProcessEngineException e) {
throw new InvalidRequestException(Status.NOT_FOUND, e.getMessage());
}
}
use of org.camunda.bpm.engine.ManagementService in project camunda-bpm-platform by camunda.
the class JobResourceImpl method setJobRetries.
@Override
public void setJobRetries(RetriesDto dto) {
try {
ManagementService managementService = engine.getManagementService();
managementService.setJobRetries(jobId, dto.getRetries());
} catch (AuthorizationException e) {
throw e;
} catch (ProcessEngineException e) {
throw new InvalidRequestException(Status.INTERNAL_SERVER_ERROR, e.getMessage());
}
}
Aggregations