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.OrchObj;
19
20 import java.util.ArrayList;
21 import java.util.Collection;
22 import java.util.List;
23
24
25
26
27
28 public class OrchObjValidator implements ModelValidator {
29
30 private OrchObj orch;
31
32 public OrchObjValidator(OrchObj orch) {
33 this.orch = orch;
34 }
35 private Collection errors;
36
37 @Override
38 public Collection<String> validate() {
39 this.errors = new ArrayList();
40 if (orch.getXmlType().equals("")) {
41 this.addError("XML Type is required");
42 }
43
44 return this.errors;
45 }
46
47 private void addError(String msg) {
48 String key = orch.getId();
49 if (key.equals("")) {
50 key = "";
51 }
52 String error = "Error in: " + key + ": " + msg;
53 if (!errors.contains(error)) {
54 errors.add(error);
55 }
56 }
57 }