Clover Coverage Report - KS Contract Documentation Generator 0.0.1-SNAPSHOT
Coverage timestamp: Wed Dec 31 1969 19:00:00 EST
../../../../../../img/srcFileCovDistChart0.png 0% of files have more coverage
14   65   6   3.5
4   38   0.43   4
4     1.5  
1    
 
  OrchestrationModelValidator       Line # 30 14 0% 6 22 0% 0.0
 
No Tests
 
1    /*
2    * Copyright 2009 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.osedu.org/licenses/ECL-2.0
9    *
10    * Unless required by applicable law or agreed to in writing, software
11    * distributed under the License is distributed on an "AS IS" BASIS,
12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13    * See the License for the specific language governing permissions and
14    * limitations under the License.
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    * Validates the entire spreadsheet model
28    * @author nwright
29    */
 
30    public class OrchestrationModelValidator implements ModelValidator {
31   
32    private DictionaryModel model;
33    private ModelFinder finder;
34   
 
35  0 toggle public OrchestrationModelValidator(DictionaryModel model) {
36  0 this.model = model;
37  0 this.finder = new ModelFinder(model);
38    }
39    List<String> errors;
40   
 
41  0 toggle @Override
42    public Collection<String> validate() {
43  0 errors = new ArrayList();
44  0 validateOrchObjs();
45  0 errors.addAll(new DictionaryModelValidator(model).validate());
46  0 return errors;
47    }
48   
 
49  0 toggle private void validateOrchObjs() {
50  0 if (model.getOrchObjs().size() == 0) {
51  0 addError("No orchestration objects found");
52    }
53  0 for (OrchObj orch : model.getOrchObjs()) {
54  0 OrchObjValidator cv = new OrchObjValidator(orch);
55  0 errors.addAll(cv.validate());
56    }
57    }
58   
 
59  0 toggle private void addError(String msg) {
60  0 String error = "Error in orchestration dictionary spreadsheet: " + msg;
61  0 if (!errors.contains(error)) {
62  0 errors.add(error);
63    }
64    }
65    }