Coverage Report - org.kuali.student.core.academiccalendar.dto.AcademicCalendarInfo
 
Classes in this File Line Coverage Branch Coverage Complexity
AcademicCalendarInfo
0%
0/26
0%
0/10
1.35
AcademicCalendarInfo$Builder
0%
0/27
0%
0/4
1.35
 
 1  
 /**
 2  
  * Copyright 2010 The Kuali Foundation Licensed under the
 3  
  * Educational Community License, Version 2.0 (the "License"); you may
 4  
  * not use this file except in compliance with the License. You may
 5  
  * obtain a copy of the License at
 6  
  *
 7  
  * http://www.osedu.org/licenses/ECL-2.0
 8  
  *
 9  
  * Unless required by applicable law or agreed to in writing,
 10  
  * software distributed under the License is distributed on an "AS IS"
 11  
  * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 12  
  * or implied. See the License for the specific language governing
 13  
  * permissions and limitations under the License.
 14  
  */
 15  
 
 16  
 package org.kuali.student.core.academiccalendar.dto;
 17  
 
 18  
 import java.io.Serializable;
 19  
 import java.util.Date;
 20  
 import java.util.List;
 21  
 import java.util.ArrayList;
 22  
 import org.w3c.dom.Element;
 23  
 
 24  
 import javax.xml.bind.annotation.XmlAccessType;
 25  
 import javax.xml.bind.annotation.XmlAccessorType;
 26  
 import javax.xml.bind.annotation.XmlAnyElement;
 27  
 import javax.xml.bind.annotation.XmlAttribute;
 28  
 import javax.xml.bind.annotation.XmlElement;
 29  
 import javax.xml.bind.annotation.XmlType;
 30  
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 31  
 
 32  
 import org.kuali.student.common.infc.ModelBuilder;
 33  
 import org.kuali.student.common.dto.KeyEntityInfo;
 34  
 import org.kuali.student.common.dto.TypeInfo;
 35  
 import org.kuali.student.core.academiccalendar.infc.AcademicCalendarInfc;
 36  
 import org.kuali.student.core.academiccalendar.infc.TermInfc;
 37  
 
 38  
 
 39  
 /**
 40  
  * Information about an academic calendar.
 41  
  *
 42  
  * @Author tom
 43  
  * @Since Tue Apr 05 14:22:34 EDT 2011
 44  
  */ 
 45  
 
 46  0
 @XmlAccessorType(XmlAccessType.FIELD)
 47  
 @XmlType(name = "AcademicCalendarInfo", propOrder = {"key", "typeKey", "stateKey", "name", "descr", "campusCalendar", "startDate", "endDate", "terms", "credentialProgramType", "metaInfo", "attributes", "_futureElements"})
 48  
 
 49  
 public class AcademicCalendarInfo extends KeyEntityInfo implements AcademicCalendarInfc, Serializable {
 50  
 
 51  
     private static final long serialVersionUID = 1L;
 52  
 
 53  
     @XmlElement
 54  
     private final CampusCalendarInfo campusCalendar;
 55  
 
 56  
     @XmlElement
 57  
     private final Date startDate;
 58  
 
 59  
     @XmlElement
 60  
     private final Date endDate;
 61  
 
 62  
     @XmlElement
 63  
     private final List<TermInfo> terms;
 64  
 
 65  
     @XmlElement 
 66  
     private final TypeInfo credentialProgramType;
 67  
 
 68  
     @XmlAnyElement
 69  
     private final List<Element> _futureElements;  
 70  
 
 71  0
     private AcademicCalendarInfo() {
 72  0
         campusCalendar = null;
 73  0
             startDate = null;
 74  0
         endDate = null;
 75  0
         terms = null;
 76  0
         credentialProgramType = null;
 77  0
         _futureElements = null;
 78  0
     }
 79  
 
 80  
     /**
 81  
      * Constructs a new AcademicCalendarInfo from another
 82  
      * AcademicCalendar.
 83  
      *
 84  
      * @param academicCalendar the Academic Calendar to copy
 85  
      */
 86  
     public AcademicCalendarInfo(AcademicCalendarInfc academicCalendar) {
 87  0
         super(academicCalendar);
 88  0
         this.campusCalendar = null !=academicCalendar.getCampusCalendar() ? new CampusCalendarInfo(academicCalendar.getCampusCalendar()) : null;
 89  0
         this.startDate = null != academicCalendar.getStartDate() ? new Date(academicCalendar.getStartDate().getTime()) : null;
 90  0
         this.endDate = null != academicCalendar.getEndDate() ? new Date(academicCalendar.getEndDate().getTime()) : null;
 91  0
         if (academicCalendar.getTerms() != null) {
 92  0
             this.terms = new ArrayList<TermInfo>(academicCalendar.getTerms().size());
 93  0
             for (TermInfc t : academicCalendar.getTerms()) {
 94  0
                 this.terms.add(new TermInfo(t));
 95  
             }
 96  
         } else {
 97  0
             this.terms = new ArrayList<TermInfo>();
 98  
         }
 99  
 
 100  0
         this.credentialProgramType = new TypeInfo(academicCalendar.getCredentialProgramType());
 101  0
         _futureElements = null;
 102  0
     }
 103  
 
 104  
     /**
 105  
      * Name: CampusCalendar 
 106  
      * Gets the campus calendar corresponding to this academic
 107  
      * calendar.
 108  
      */
 109  
     @Override
 110  
     public CampusCalendarInfo getCampusCalendar() {
 111  0
         return campusCalendar;
 112  
     }
 113  
 
 114  
     /**
 115  
      * Name: StartDate
 116  
      * Date and time the academic calendar becomes effective. This
 117  
      * does not provide a bound on date ranges or milestones
 118  
      * associated with this time calendar, but instead indicates the
 119  
      * calendar proper. This is a similar concept to the effective
 120  
      * date on enumerated values. When an end date has been specified,
 121  
      * this field must be less than or equal to the end date.
 122  
      *
 123  
      * @return the Academic Calendar start date
 124  
      */
 125  
     @Override
 126  
     public Date getStartDate() {
 127  0
         return startDate;
 128  
     }
 129  
 
 130  
     /**
 131  
      * Name: EndDate
 132  
      * Date and time the academic calendar becomes
 133  
      * ineffective. This does not provide a bound on date ranges or
 134  
      * milestones associated with this calendar, but instead
 135  
      * indicates the calendar proper. If specified, this must be
 136  
      * greater than or equal to the start date. If this field is not
 137  
      * specified, then no end date has been currently defined
 138  
      * and should automatically be considered greater than the
 139  
      * effective date.
 140  
      *
 141  
      * @return the Academic Calendar end date
 142  
      */
 143  
     @Override
 144  
     public Date getEndDate() {
 145  0
         return endDate;
 146  
     }
 147  
 
 148  
     /**
 149  
      * Name: Terms
 150  
      * Gets the terms corresponding to this academic
 151  
      * calendar.
 152  
      */
 153  
     public List<TermInfo> getTerms() {
 154  0
         return terms;
 155  
     }
 156  
 
 157  
     /**
 158  
      * Name: CredentialProgramType
 159  
      * Gets the credential program type to which this calendar
 160  
      * relates.
 161  
      */
 162  
     public TypeInfo getCredentialProgramType() {
 163  0
         return credentialProgramType;
 164  
     }
 165  
 
 166  
     /**
 167  
      * The builder class for this AcademicCalendarInfo.
 168  
      */
 169  0
     public static class Builder extends KeyEntityInfo.Builder implements ModelBuilder<AcademicCalendarInfo>, AcademicCalendarInfc {
 170  
             
 171  
         private CampusCalendarInfo campusCalendar;
 172  
             private Date startDate;
 173  
         private Date endDate;
 174  
         private List<TermInfo> terms;
 175  
         private TypeInfo credentialProgramType;
 176  
 
 177  
 
 178  
         /**
 179  
          * Constructs a new builder.
 180  
          */
 181  0
         public Builder() {}
 182  
 
 183  
         /**
 184  
          * Constructs a new builder initialized from another AcademicCalendar
 185  
          */
 186  
             public Builder(AcademicCalendarInfc academicCalendar) {
 187  0
             super(academicCalendar);
 188  0
             this.startDate = academicCalendar.getStartDate();
 189  0
             this.endDate = academicCalendar.getEndDate();
 190  0
             if (academicCalendar.getTerms() != null) {
 191  0
                 this.terms = new ArrayList(academicCalendar.getTerms().size());
 192  0
                 for (TermInfc t : academicCalendar.getTerms()) {
 193  0
                     this.terms.add(new TermInfo(t));
 194  
                 }
 195  
             }
 196  0
             this.credentialProgramType = new TypeInfo(academicCalendar.getCredentialProgramType());
 197  0
             }
 198  
                 
 199  
         /**
 200  
          * Builds the AcademicCalendar.
 201  
          *
 202  
          * @return a new AcademicCalendar
 203  
          */
 204  
         public AcademicCalendarInfo build() {
 205  0
             return new AcademicCalendarInfo(this);
 206  
         }
 207  
 
 208  
         /**
 209  
          * Name: CampusCalendar 
 210  
          * Gets the campus calendar correspondingto this academic
 211  
          * calendar.
 212  
          */
 213  
         public CampusCalendarInfo getCampusCalendar() {
 214  0
             return campusCalendar;
 215  
         }
 216  
 
 217  
         public void setCampusCalendar(CampusCalendarInfo campusCalendar) {
 218  0
             this.campusCalendar = campusCalendar;
 219  0
         }
 220  
 
 221  
         /**
 222  
          * Gets the start date.
 223  
          *
 224  
          * @return the Academic Calendar start date
 225  
          */
 226  
         @Override
 227  
         public Date getStartDate() {
 228  0
             return startDate;
 229  
         }
 230  
 
 231  
         /**
 232  
          * Sets the Academic Calendar start date.
 233  
          *
 234  
          * @param startDate the start date for the Academic Calendar
 235  
          */
 236  
         public void setStartDate(Date startDate) {
 237  0
             this.startDate = startDate;
 238  0
         }
 239  
 
 240  
         /**
 241  
          * Gets the start date.
 242  
          *
 243  
          * @return the Academic Calendar end date
 244  
          */
 245  
         @Override
 246  
         public Date getEndDate() {
 247  0
             return endDate;
 248  
         }
 249  
             
 250  
         /**
 251  
          * Sets the Academic Calendar end date.
 252  
          *
 253  
          * @param endDate the end date for the Academic Calendar
 254  
          */
 255  
 
 256  
         public void setEndDate(Date endDate) {
 257  0
             this.endDate = endDate;
 258  0
         }
 259  
 
 260  
         /**
 261  
          * Gets the terms corresponding to this academic
 262  
          * calendar.
 263  
          */
 264  
         public List<TermInfo> getTerms() {
 265  0
             return terms;
 266  
         }
 267  
 
 268  
         public void setTerms(List<TermInfo> terms) {
 269  0
             this.terms = terms;
 270  0
         }
 271  
 
 272  
         /**
 273  
          * Gets the credential program type to which this calendar
 274  
          * relates.
 275  
          */
 276  
         public TypeInfo getCredentialProgramType() {
 277  0
             return credentialProgramType;
 278  
         }
 279  
 
 280  
         public void setCredentialProgramType(TypeInfo credentialProgramType) {
 281  0
             this.credentialProgramType = credentialProgramType;
 282  0
         }
 283  
     }
 284  
 }