use of org.kuali.kfs.kew.exception.WorkflowServiceError in project cu-kfs by CU-CommunityApps.
the class PreferencesServiceImpl method validate.
private void validate(Preferences preferences) {
LOG.debug("validating preferences");
List<WorkflowServiceError> errors = new ArrayList<>();
try {
Integer.valueOf(preferences.getRefreshRate().trim());
} catch (NumberFormatException | NullPointerException e) {
errors.add(new WorkflowServiceErrorImpl("ActionList Refresh Rate must be in whole " + "minutes", Preferences.KEYS.ERR_KEY_REFRESH_RATE_WHOLE_NUM));
}
try {
if (Integer.parseInt(preferences.getPageSize().trim()) == 0) {
errors.add(new WorkflowServiceErrorImpl("ActionList Page Size must be non-zero ", Preferences.KEYS.ERR_KEY_ACTION_LIST_PAGE_SIZE_WHOLE_NUM));
}
} catch (NumberFormatException | NullPointerException e) {
errors.add(new WorkflowServiceErrorImpl("ActionList Page Size must be in whole " + "minutes", Preferences.KEYS.ERR_KEY_ACTION_LIST_PAGE_SIZE_WHOLE_NUM));
}
LOG.debug("end validating preferences");
if (!errors.isEmpty()) {
throw new WorkflowServiceErrorException("Preference Validation Error", errors);
}
}
use of org.kuali.kfs.kew.exception.WorkflowServiceError in project cu-kfs by CU-CommunityApps.
the class RuleAttributeServiceImpl method validate.
private void validate(RuleAttribute ruleAttribute) {
LOG.debug("validating ruleAttribute");
List<WorkflowServiceError> errors = new ArrayList<>();
if (ruleAttribute.getName() == null || ruleAttribute.getName().trim().equals("")) {
errors.add(new WorkflowServiceErrorImpl("Please enter a rule attribute name.", RULE_ATTRIBUTE_NAME_REQUIRED));
LOG.error("Rule attribute name is missing");
} else {
ruleAttribute.setName(ruleAttribute.getName().trim());
if (ruleAttribute.getId() == null) {
RuleAttribute nameInUse = findByName(ruleAttribute.getName());
if (nameInUse != null) {
errors.add(new WorkflowServiceErrorImpl("Rule attribute name already in use", "routetemplate.ruleattribute.name.duplicate"));
LOG.error("Rule attribute name already in use");
}
}
}
if (ruleAttribute.getResourceDescriptor() == null || ruleAttribute.getResourceDescriptor().trim().equals("")) {
errors.add(new WorkflowServiceErrorImpl("Please enter a rule attribute class name.", RULE_ATTRIBUTE_CLASS_REQUIRED));
LOG.error("Rule attribute class name is missing");
} else {
ruleAttribute.setResourceDescriptor(ruleAttribute.getResourceDescriptor().trim());
}
LOG.debug("end validating ruleAttribute");
if (!errors.isEmpty()) {
throw new WorkflowServiceErrorException("RuleAttribute Validation Error", errors);
}
}
Aggregations