1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.datadictionary.validation.constraint.provider;
17
18 import org.kuali.rice.krad.datadictionary.CollectionDefinition;
19 import org.kuali.rice.krad.datadictionary.validation.capability.Constrainable;
20 import org.kuali.rice.krad.datadictionary.validation.constraint.CollectionSizeConstraint;
21 import org.kuali.rice.krad.datadictionary.validation.constraint.ExistenceConstraint;
22 import org.kuali.rice.krad.datadictionary.validation.constraint.resolver.ConstraintResolver;
23 import org.kuali.rice.krad.datadictionary.validation.constraint.resolver.DefinitionConstraintResolver;
24
25 import java.util.HashMap;
26
27
28
29
30
31
32
33
34
35
36 public class CollectionDefinitionConstraintProvider extends BaseConstraintProvider<CollectionDefinition> {
37
38 @Override
39 public void init() {
40 resolverMap = new HashMap<String, ConstraintResolver<CollectionDefinition>>();
41 resolverMap.put(ExistenceConstraint.class.getName(), new DefinitionConstraintResolver<CollectionDefinition>());
42 resolverMap.put(CollectionSizeConstraint.class.getName(),
43 new DefinitionConstraintResolver<CollectionDefinition>());
44 }
45
46
47
48
49 @Override
50 public boolean isSupported(Constrainable definition) {
51
52 if (definition instanceof CollectionDefinition) {
53 return true;
54 }
55
56 return false;
57 }
58
59 }