use of org.kuali.kfs.kew.rule.bo.RuleAttribute 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