1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.krad.datadictionary.validation.processor; |
17 | |
|
18 | |
import org.kuali.rice.krad.datadictionary.exception.AttributeValidationException; |
19 | |
import org.kuali.rice.krad.datadictionary.validation.AttributeValueReader; |
20 | |
import org.kuali.rice.krad.datadictionary.validation.ValidationUtils; |
21 | |
import org.kuali.rice.krad.datadictionary.validation.constraint.Constraint; |
22 | |
import org.kuali.rice.krad.datadictionary.validation.constraint.PrerequisiteConstraint; |
23 | |
import org.kuali.rice.krad.datadictionary.validation.result.ConstraintValidationResult; |
24 | |
import org.kuali.rice.krad.datadictionary.validation.result.DictionaryValidationResult; |
25 | |
import org.kuali.rice.krad.datadictionary.validation.result.ProcessorResult; |
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | 10 | public class PrerequisiteConstraintProcessor extends BasePrerequisiteConstraintProcessor<PrerequisiteConstraint> { |
32 | |
|
33 | |
private static final String CONSTRAINT_NAME = "prerequisite constraint"; |
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
@Override |
40 | |
public ProcessorResult process(DictionaryValidationResult result, Object value, PrerequisiteConstraint constraint, AttributeValueReader attributeValueReader) throws AttributeValidationException { |
41 | |
|
42 | 7 | if (ValidationUtils.isNullOrEmpty(value)) |
43 | 1 | return new ProcessorResult(result.addSkipped(attributeValueReader, CONSTRAINT_NAME)); |
44 | |
|
45 | |
|
46 | 6 | ConstraintValidationResult constraintValidationResult = processPrerequisiteConstraint(constraint, attributeValueReader); |
47 | 6 | result.addConstraintValidationResult(attributeValueReader, constraintValidationResult); |
48 | |
|
49 | |
|
50 | 6 | return new ProcessorResult(constraintValidationResult); |
51 | |
} |
52 | |
|
53 | |
@Override |
54 | |
public String getName() { |
55 | 11 | return CONSTRAINT_NAME; |
56 | |
} |
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | |
@Override |
62 | |
public Class<? extends Constraint> getConstraintType() { |
63 | 0 | return PrerequisiteConstraint.class; |
64 | |
} |
65 | |
|
66 | |
} |