1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.student.contract.model.validation;
17
18 import org.kuali.student.contract.model.DictionaryModel;
19 import org.kuali.student.contract.model.OrchObj;
20 import org.kuali.student.contract.model.util.ModelFinder;
21
22 import java.util.ArrayList;
23 import java.util.Collection;
24 import java.util.List;
25
26
27
28
29
30 public class OrchestrationModelValidator implements ModelValidator {
31
32 private DictionaryModel model;
33 private ModelFinder finder;
34
35 public OrchestrationModelValidator(DictionaryModel model) {
36 this.model = model;
37 this.finder = new ModelFinder(model);
38 }
39 List<String> errors;
40
41 @Override
42 public Collection<String> validate() {
43 errors = new ArrayList();
44 validateOrchObjs();
45 errors.addAll(new DictionaryModelValidator(model).validate());
46 return errors;
47 }
48
49 private void validateOrchObjs() {
50 if (model.getOrchObjs().size() == 0) {
51 addError("No orchestration objects found");
52 }
53 for (OrchObj orch : model.getOrchObjs()) {
54 OrchObjValidator cv = new OrchObjValidator(orch);
55 errors.addAll(cv.validate());
56 }
57 }
58
59 private void addError(String msg) {
60 String error = "Error in orchestration dictionary spreadsheet: " + msg;
61 if (!errors.contains(error)) {
62 errors.add(error);
63 }
64 }
65 }