Coverage Report - org.kuali.student.contract.model.validation.OrchObjValidator
 
Classes in this File Line Coverage Branch Coverage Complexity
OrchObjValidator
0%
0/14
0%
0/6
2
 
 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.OrchObj;
 19  
 
 20  
 import java.util.ArrayList;
 21  
 import java.util.Collection;
 22  
 import java.util.List;
 23  
 
 24  
 /**
 25  
  * This validates a constraint.
 26  
  * @author nwright
 27  
  */
 28  
 public class OrchObjValidator implements ModelValidator
 29  
 {
 30  
 
 31  
  private OrchObj orch;
 32  
 
 33  
  public OrchObjValidator (OrchObj orch)
 34  0
  {
 35  0
   this.orch = orch;
 36  0
  }
 37  
 
 38  
  private Collection errors;
 39  
 
 40  
  @Override
 41  
  public Collection<String> validate ()
 42  
  {
 43  0
   this.errors = new ArrayList ();
 44  0
   if (orch.getXmlType ().equals (""))
 45  
   {
 46  0
     this.addError ("XML Type is required");
 47  
   }
 48  
   // TODO: more validation
 49  0
   return this.errors;
 50  
  }
 51  
 
 52  
   private void addError (String msg)
 53  
  {
 54  0
   String key = orch.getId ();
 55  0
   if (key.equals (""))
 56  
   {
 57  0
    key = "";
 58  
   }
 59  0
   String error = "Error in: " + key + ": " + msg;
 60  0
   if ( ! errors.contains (error))
 61  
   {
 62  0
    errors.add (error);
 63  
   }
 64  0
  }
 65  
 
 66  
 }