use of org.activiti.engine.ActivitiIllegalArgumentException in project Activiti by Activiti.
the class UserQueryTest method testQueryByInvalidMemberOf.
public void testQueryByInvalidMemberOf() {
UserQuery query = identityService.createUserQuery().memberOfGroup("invalid");
verifyQueryResults(query, 0);
try {
identityService.createUserQuery().memberOfGroup(null).list();
fail();
} catch (ActivitiIllegalArgumentException e) {
}
}
use of org.activiti.engine.ActivitiIllegalArgumentException in project Activiti by Activiti.
the class UserQueryTest method testQueryByInvalidFirstName.
public void testQueryByInvalidFirstName() {
UserQuery query = identityService.createUserQuery().userFirstName("invalid");
verifyQueryResults(query, 0);
try {
identityService.createUserQuery().userFirstName(null).singleResult();
fail();
} catch (ActivitiIllegalArgumentException e) {
}
}
use of org.activiti.engine.ActivitiIllegalArgumentException in project Activiti by Activiti.
the class UserQueryTest method testQueryByInvalidLastName.
public void testQueryByInvalidLastName() {
UserQuery query = identityService.createUserQuery().userLastName("invalid");
verifyQueryResults(query, 0);
try {
identityService.createUserQuery().userLastName(null).singleResult();
fail();
} catch (ActivitiIllegalArgumentException e) {
}
}
use of org.activiti.engine.ActivitiIllegalArgumentException in project Activiti by Activiti.
the class FormDataResource method getFormData.
@RequestMapping(value = "/form/form-data", method = RequestMethod.GET, produces = "application/json")
public FormDataResponse getFormData(@RequestParam(value = "taskId", required = false) String taskId, @RequestParam(value = "processDefinitionId", required = false) String processDefinitionId, HttpServletRequest request) {
if (taskId == null && processDefinitionId == null) {
throw new ActivitiIllegalArgumentException("The taskId or processDefinitionId parameter has to be provided");
}
if (taskId != null && processDefinitionId != null) {
throw new ActivitiIllegalArgumentException("Not both a taskId and a processDefinitionId parameter can be provided");
}
FormData formData = null;
String id = null;
if (taskId != null) {
formData = formService.getTaskFormData(taskId);
id = taskId;
} else {
formData = formService.getStartFormData(processDefinitionId);
id = processDefinitionId;
}
if (formData == null) {
throw new ActivitiObjectNotFoundException("Could not find a form data with id '" + id + "'.", FormData.class);
}
return restResponseFactory.createFormDataResponse(formData);
}
use of org.activiti.engine.ActivitiIllegalArgumentException in project Activiti by Activiti.
the class HistoricProcessInstanceBaseResource method addVariables.
protected void addVariables(HistoricProcessInstanceQuery processInstanceQuery, List<QueryVariable> variables) {
for (QueryVariable variable : variables) {
if (variable.getVariableOperation() == null) {
throw new ActivitiIllegalArgumentException("Variable operation is missing for variable: " + variable.getName());
}
if (variable.getValue() == null) {
throw new ActivitiIllegalArgumentException("Variable value is missing for variable: " + variable.getName());
}
boolean nameLess = variable.getName() == null;
Object actualValue = restResponseFactory.getVariableValue(variable);
// A value-only query is only possible using equals-operator
if (nameLess && variable.getVariableOperation() != QueryVariableOperation.EQUALS) {
throw new ActivitiIllegalArgumentException("Value-only query (without a variable-name) is only supported when using 'equals' operation.");
}
switch(variable.getVariableOperation()) {
case EQUALS:
if (nameLess) {
processInstanceQuery.variableValueEquals(actualValue);
} else {
processInstanceQuery.variableValueEquals(variable.getName(), actualValue);
}
break;
case EQUALS_IGNORE_CASE:
if (actualValue instanceof String) {
processInstanceQuery.variableValueEqualsIgnoreCase(variable.getName(), (String) actualValue);
} else {
throw new ActivitiIllegalArgumentException("Only string variable values are supported when ignoring casing, but was: " + actualValue.getClass().getName());
}
break;
case NOT_EQUALS:
processInstanceQuery.variableValueNotEquals(variable.getName(), actualValue);
break;
case LIKE:
if (actualValue instanceof String) {
processInstanceQuery.variableValueLike(variable.getName(), (String) actualValue);
} else {
throw new ActivitiIllegalArgumentException("Only string variable values are supported for like, but was: " + actualValue.getClass().getName());
}
break;
case LIKE_IGNORE_CASE:
if (actualValue instanceof String) {
processInstanceQuery.variableValueLikeIgnoreCase(variable.getName(), (String) actualValue);
} else {
throw new ActivitiIllegalArgumentException("Only string variable values are supported for like, but was: " + actualValue.getClass().getName());
}
break;
case GREATER_THAN:
processInstanceQuery.variableValueGreaterThan(variable.getName(), actualValue);
break;
case GREATER_THAN_OR_EQUALS:
processInstanceQuery.variableValueGreaterThanOrEqual(variable.getName(), actualValue);
break;
case LESS_THAN:
processInstanceQuery.variableValueLessThan(variable.getName(), actualValue);
break;
case LESS_THAN_OR_EQUALS:
processInstanceQuery.variableValueLessThanOrEqual(variable.getName(), actualValue);
break;
default:
throw new ActivitiIllegalArgumentException("Unsupported variable query operation: " + variable.getVariableOperation());
}
}
}
Aggregations