use of org.camunda.bpm.engine.exception.NotFoundException in project camunda-bpm-platform by camunda.
the class CaseInstanceResourceImpl method close.
public void close(CaseExecutionTriggerDto triggerDto) {
try {
CaseService caseService = engine.getCaseService();
CaseExecutionCommandBuilder commandBuilder = caseService.withCaseExecution(caseInstanceId);
initializeCommand(commandBuilder, triggerDto, "close");
commandBuilder.close();
} catch (NotFoundException e) {
throw createInvalidRequestException("close", Status.NOT_FOUND, e);
} catch (NotValidException e) {
throw createInvalidRequestException("close", Status.BAD_REQUEST, e);
} catch (NotAllowedException e) {
throw createInvalidRequestException("close", Status.FORBIDDEN, e);
} catch (ProcessEngineException e) {
throw createRestException("close", Status.INTERNAL_SERVER_ERROR, e);
}
}
use of org.camunda.bpm.engine.exception.NotFoundException in project camunda-bpm-platform by camunda.
the class JobResourceImpl method setJobPriority.
@Override
public void setJobPriority(PriorityDto dto) {
if (dto.getPriority() == null) {
throw new RestException(Status.BAD_REQUEST, "Priority for job '" + jobId + "' cannot be null.");
}
try {
ManagementService managementService = engine.getManagementService();
managementService.setJobPriority(jobId, dto.getPriority());
} catch (AuthorizationException e) {
throw e;
} catch (NotFoundException e) {
throw new InvalidRequestException(Status.NOT_FOUND, e.getMessage());
} catch (ProcessEngineException e) {
throw new RestException(Status.INTERNAL_SERVER_ERROR, e.getMessage());
}
}
use of org.camunda.bpm.engine.exception.NotFoundException in project camunda-bpm-platform by camunda.
the class ExternalTaskRestServiceImpl method setRetriesAsync.
@Override
public BatchDto setRetriesAsync(SetRetriesForExternalTasksDto retriesDto) {
UpdateExternalTaskRetriesBuilder builder = updateRetries(retriesDto);
int retries = retriesDto.getRetries();
try {
Batch batch = builder.setAsync(retries);
return BatchDto.fromBatch(batch);
} catch (NotFoundException e) {
throw new InvalidRequestException(Status.NOT_FOUND, e.getMessage());
} catch (BadUserRequestException e) {
throw new InvalidRequestException(Status.BAD_REQUEST, e.getMessage());
}
}
use of org.camunda.bpm.engine.exception.NotFoundException in project camunda-bpm-platform by camunda.
the class DeployCmd method ensureDeploymentsWithIdsExists.
protected void ensureDeploymentsWithIdsExists(Set<String> expected, List<DeploymentEntity> actual) {
Map<String, DeploymentEntity> deploymentMap = new HashMap<String, DeploymentEntity>();
for (DeploymentEntity deployment : actual) {
deploymentMap.put(deployment.getId(), deployment);
}
List<String> missingDeployments = getMissingElements(expected, deploymentMap);
if (!missingDeployments.isEmpty()) {
StringBuilder builder = new StringBuilder();
builder.append("The following deployments are not found by id: ");
boolean first = true;
for (String missingDeployment : missingDeployments) {
if (!first) {
builder.append(", ");
} else {
first = false;
}
builder.append(missingDeployment);
}
throw new NotFoundException(builder.toString());
}
}
use of org.camunda.bpm.engine.exception.NotFoundException in project camunda-bpm-platform by camunda.
the class SetExternalTasksRetriesTest method shouldFailForNonExistingExternalTaskIdSync.
@Test
public void shouldFailForNonExistingExternalTaskIdSync() {
List<ExternalTask> externalTasks = externalTaskService.createExternalTaskQuery().list();
ArrayList<String> externalTaskIds = new ArrayList<String>();
for (ExternalTask task : externalTasks) {
externalTaskIds.add(task.getId());
}
externalTaskIds.add("nonExistingExternalTaskId");
try {
externalTaskService.setRetries(externalTaskIds, 10);
fail("exception expected");
} catch (NotFoundException e) {
Assert.assertThat(e.getMessage(), containsString("Cannot find external task with id nonExistingExternalTaskId"));
}
}
Aggregations