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 public class CollectionDefinitionConstraintProvider extends BaseConstraintProvider<CollectionDefinition> {
35
36 @Override
37 public void init() {
38 resolverMap = new HashMap<String, ConstraintResolver<CollectionDefinition>>();
39 resolverMap.put(ExistenceConstraint.class.getName(), new DefinitionConstraintResolver<CollectionDefinition>());
40 resolverMap.put(CollectionSizeConstraint.class.getName(), new DefinitionConstraintResolver<CollectionDefinition>());
41 }
42
43
44
45
46 @Override
47 public boolean isSupported(Constrainable definition) {
48
49 if (definition instanceof CollectionDefinition)
50 return true;
51
52 return false;
53 }
54
55 }