use of org.camunda.bpm.engine.exception.NotValidException in project camunda-bpm-platform by camunda.
the class CaseExecutionResourceImpl method terminate.
public void terminate(CaseExecutionTriggerDto triggerDto) {
try {
CaseService caseService = engine.getCaseService();
CaseExecutionCommandBuilder commandBuilder = caseService.withCaseExecution(caseExecutionId);
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.NotValidException 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.NotValidException 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.NotValidException in project camunda-bpm-platform by camunda.
the class ParseUtil method parseHistoryTimeToLive.
/**
* Parse History Time To Live in ISO-8601 format to integer and set into the given entity
* @param historyTimeToLive
*/
public static Integer parseHistoryTimeToLive(String historyTimeToLive) {
Integer timeToLive = null;
if (historyTimeToLive != null && !historyTimeToLive.isEmpty()) {
Matcher matISO = REGEX_TTL_ISO.matcher(historyTimeToLive);
if (matISO.find()) {
historyTimeToLive = matISO.group(1);
}
timeToLive = parseIntegerAttribute("historyTimeToLive", historyTimeToLive);
}
if (timeToLive != null && timeToLive < 0) {
throw new NotValidException("Cannot parse historyTimeToLive: negative value is not allowed");
}
return timeToLive;
}
use of org.camunda.bpm.engine.exception.NotValidException in project camunda-bpm-platform by camunda.
the class ProcessInstanceModificationTest method testStartBeforeNonExistingActivity.
@Deployment(resources = EXCLUSIVE_GATEWAY_PROCESS)
public void testStartBeforeNonExistingActivity() {
// given
ProcessInstance instance = runtimeService.startProcessInstanceByKey("exclusiveGateway");
try {
// when
runtimeService.createProcessInstanceModification(instance.getId()).startBeforeActivity("someNonExistingActivity").execute();
fail("should not succeed");
} catch (NotValidException e) {
// then
assertTextPresentIgnoreCase("element 'someNonExistingActivity' does not exist in process ", e.getMessage());
}
}
Aggregations