use of org.camunda.bpm.engine.exception.NullValueException in project camunda-bpm-platform by camunda.
the class ProcessInstanceRestServiceImpl method setRetriesByProcess.
@Override
public BatchDto setRetriesByProcess(SetJobRetriesByProcessDto setJobRetriesDto) {
try {
EnsureUtil.ensureNotNull("setJobRetriesDto", setJobRetriesDto);
EnsureUtil.ensureNotNull("retries", setJobRetriesDto.getRetries());
} catch (NullValueException e) {
throw new InvalidRequestException(Status.BAD_REQUEST, e.getMessage());
}
ProcessInstanceQuery processInstanceQuery = null;
if (setJobRetriesDto.getProcessInstanceQuery() != null) {
processInstanceQuery = setJobRetriesDto.getProcessInstanceQuery().toQuery(getProcessEngine());
}
try {
Batch batch = getProcessEngine().getManagementService().setJobRetriesAsync(setJobRetriesDto.getProcessInstances(), processInstanceQuery, setJobRetriesDto.getRetries().intValue());
return BatchDto.fromBatch(batch);
} catch (BadUserRequestException e) {
throw new InvalidRequestException(Status.BAD_REQUEST, e.getMessage());
}
}
use of org.camunda.bpm.engine.exception.NullValueException in project camunda-bpm-platform by camunda.
the class JobRestServiceImpl method setRetries.
@Override
public BatchDto setRetries(SetJobRetriesDto setJobRetriesDto) {
try {
EnsureUtil.ensureNotNull("setJobRetriesDto", setJobRetriesDto);
EnsureUtil.ensureNotNull("retries", setJobRetriesDto.getRetries());
} catch (NullValueException e) {
throw new InvalidRequestException(Status.BAD_REQUEST, e.getMessage());
}
JobQuery jobQuery = null;
if (setJobRetriesDto.getJobQuery() != null) {
jobQuery = setJobRetriesDto.getJobQuery().toQuery(getProcessEngine());
}
try {
Batch batch = getProcessEngine().getManagementService().setJobRetriesAsync(setJobRetriesDto.getJobIds(), jobQuery, setJobRetriesDto.getRetries().intValue());
return BatchDto.fromBatch(batch);
} catch (BadUserRequestException e) {
throw new InvalidRequestException(Status.BAD_REQUEST, e.getMessage());
}
}
use of org.camunda.bpm.engine.exception.NullValueException in project camunda-bpm-platform by camunda.
the class SaveTaskCmd method execute.
public Void execute(CommandContext commandContext) {
ensureNotNull("task", task);
String operation;
if (task.getRevision() == 0) {
try {
checkCreateTask(task, commandContext);
task.insert(null);
commandContext.getHistoricTaskInstanceManager().createHistoricTask(task);
operation = UserOperationLogEntry.OPERATION_TYPE_CREATE;
task.executeMetrics(Metrics.ACTIVTY_INSTANCE_START);
} catch (NullValueException e) {
throw new NotValidException(e.getMessage(), e);
}
} else {
checkTaskAssign(task, commandContext);
task.update();
operation = UserOperationLogEntry.OPERATION_TYPE_UPDATE;
}
task.fireAuthorizationProvider();
task.fireEvents();
task.createHistoricTaskDetails(operation);
return null;
}
use of org.camunda.bpm.engine.exception.NullValueException in project camunda-bpm-platform by camunda.
the class DeploymentQueryTest method testQueryDeploymentAfter.
public void testQueryDeploymentAfter() throws Exception {
Date later = DateTimeUtil.now().plus(10 * 3600).toDate();
Date earlier = DateTimeUtil.now().minus(10 * 3600).toDate();
long count = repositoryService.createDeploymentQuery().deploymentAfter(later).count();
assertEquals(0, count);
count = repositoryService.createDeploymentQuery().deploymentAfter(earlier).count();
assertEquals(2, count);
try {
repositoryService.createDeploymentQuery().deploymentAfter(null);
fail("Exception expected");
} catch (NullValueException e) {
// expected
}
}
use of org.camunda.bpm.engine.exception.NullValueException in project camunda-bpm-platform by camunda.
the class RuntimeServiceTest method testGetInvalidActivityInstancesForActivity.
@Deployment(resources = "org/camunda/bpm/engine/test/api/runtime/RuntimeServiceTest.testGetActivityInstancesForActivity.bpmn20.xml")
@Test
public void testGetInvalidActivityInstancesForActivity() {
ProcessInstance instance = runtimeService.startProcessInstanceByKey("miSubprocess");
ActivityInstance tree = runtimeService.getActivityInstance(instance.getId());
try {
tree.getActivityInstances(null);
fail("exception expected");
} catch (NullValueException e) {
// happy path
}
}
Aggregations