use of org.camunda.bpm.engine.exception.NotFoundException in project camunda-bpm-platform by camunda.
the class CaseInstanceResourceImpl method terminate.
public void terminate(CaseExecutionTriggerDto triggerDto) {
try {
CaseService caseService = engine.getCaseService();
CaseExecutionCommandBuilder commandBuilder = caseService.withCaseExecution(caseInstanceId);
initializeCommand(commandBuilder, triggerDto, "terminate");
commandBuilder.terminate();
} catch (NotFoundException e) {
throw createInvalidRequestException("terminate", Status.NOT_FOUND, e);
} catch (NotValidException e) {
throw createInvalidRequestException("terminate", Status.BAD_REQUEST, e);
} catch (NotAllowedException e) {
throw createInvalidRequestException("terminate", Status.FORBIDDEN, e);
} catch (ProcessEngineException e) {
throw createRestException("terminate", Status.INTERNAL_SERVER_ERROR, e);
}
}
use of org.camunda.bpm.engine.exception.NotFoundException in project camunda-bpm-platform by camunda.
the class CaseInstanceResourceImpl method complete.
public void complete(CaseExecutionTriggerDto triggerDto) {
try {
CaseService caseService = engine.getCaseService();
CaseExecutionCommandBuilder commandBuilder = caseService.withCaseExecution(caseInstanceId);
initializeCommand(commandBuilder, triggerDto, "complete");
commandBuilder.complete();
} catch (NotFoundException e) {
throw createInvalidRequestException("complete", Status.NOT_FOUND, e);
} catch (NotValidException e) {
throw createInvalidRequestException("complete", Status.BAD_REQUEST, e);
} catch (NotAllowedException e) {
throw createInvalidRequestException("complete", Status.FORBIDDEN, e);
} catch (ProcessEngineException e) {
throw createRestException("complete", Status.INTERNAL_SERVER_ERROR, e);
}
}
use of org.camunda.bpm.engine.exception.NotFoundException in project camunda-bpm-platform by camunda.
the class AbstractGetDeployedFormCmd method execute.
public InputStream execute(final CommandContext commandContext) {
checkAuthorization(commandContext);
final FormData formData = getFormData(commandContext);
String formKey = formData.getFormKey();
if (formKey == null) {
throw new BadUserRequestException("The form key is not set.");
}
final String resourceName = getResourceName(formKey);
try {
return commandContext.runWithoutAuthorization(new Callable<InputStream>() {
@Override
public InputStream call() throws Exception {
return new GetDeploymentResourceCmd(formData.getDeploymentId(), resourceName).execute(commandContext);
}
});
} catch (DeploymentResourceNotFoundException e) {
throw new NotFoundException("The form with the resource name '" + resourceName + "' cannot be found in deployment.", e);
}
}
use of org.camunda.bpm.engine.exception.NotFoundException in project camunda-bpm-platform by camunda.
the class SetExternalTasksRetriesTest method shouldFailForNonExistingExternalTaskIdAsync.
@Test
public void shouldFailForNonExistingExternalTaskIdAsync() {
List<ExternalTask> externalTasks = externalTaskService.createExternalTaskQuery().list();
ArrayList<String> externalTaskIds = new ArrayList<String>();
for (ExternalTask task : externalTasks) {
externalTaskIds.add(task.getId());
}
externalTaskIds.add("nonExistingExternalTaskId");
Batch batch = externalTaskService.setRetriesAsync(externalTaskIds, null, 10);
try {
executeSeedAndBatchJobs(batch);
fail("exception expected");
} catch (NotFoundException e) {
Assert.assertThat(e.getMessage(), containsString("Cannot find external task with id nonExistingExternalTaskId"));
}
}
use of org.camunda.bpm.engine.exception.NotFoundException in project camunda-bpm-platform by camunda.
the class RedeploymentTest method testRedeployUnexistingDeploymentResource.
public void testRedeployUnexistingDeploymentResource() {
// given
BpmnModelInstance model = createProcessWithServiceTask(PROCESS_KEY);
Deployment deployment = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_NAME, model).deploy();
try {
// when
repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResourceByName(deployment.getId(), "not-existing-resource.bpmn").deploy();
fail("It should not be possible to re-deploy a not existing deployment resource");
} catch (NotFoundException e) {
// then
// expected
}
try {
// when
repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResourcesByName(deployment.getId(), Arrays.asList("not-existing-resource.bpmn")).deploy();
fail("It should not be possible to re-deploy a not existing deployment resource");
} catch (NotFoundException e) {
// then
// expected
}
try {
// when
repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResourceById(deployment.getId(), "not-existing-resource-id").deploy();
fail("It should not be possible to re-deploy a not existing deployment resource");
} catch (NotFoundException e) {
// then
// expected
}
try {
// when
repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResourcesById(deployment.getId(), Arrays.asList("not-existing-resource-id")).deploy();
fail("It should not be possible to re-deploy a not existing deployment resource");
} catch (NotFoundException e) {
// then
// expected
}
deleteDeployments(deployment);
}
Aggregations