Coverage Report - org.kuali.student.core.academiccalendar.dto.AcademicCalendarInfo
 
Classes in this File Line Coverage Branch Coverage Complexity
AcademicCalendarInfo
0%
0/18
0%
0/4
1.118
AcademicCalendarInfo$Builder
0%
0/21
N/A
1.118
 
 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 org.w3c.dom.Element;
 22  
 
 23  
 import javax.xml.bind.annotation.XmlAccessType;
 24  
 import javax.xml.bind.annotation.XmlAccessorType;
 25  
 import javax.xml.bind.annotation.XmlAnyElement;
 26  
 import javax.xml.bind.annotation.XmlAttribute;
 27  
 import javax.xml.bind.annotation.XmlElement;
 28  
 import javax.xml.bind.annotation.XmlType;
 29  
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 30  
 
 31  
 import org.kuali.student.common.infc.ModelBuilder;
 32  
 import org.kuali.student.r2.common.dto.KeyEntityInfo;
 33  
 
 34  
 import org.kuali.student.core.academiccalendar.infc.AcademicCalendar;
 35  
 
 36  
 
 37  
 /**
 38  
  * Information about an academic calendar.
 39  
  *
 40  
  * @Author tom
 41  
  * @Since Tue Apr 05 14:22:34 EDT 2011
 42  
  */ 
 43  
 
 44  
 @XmlAccessorType(XmlAccessType.FIELD)
 45  
 @XmlType(name = "AcademicCalendarInfo", propOrder = {"key", "typeKey", "stateKey", "name", "descr", "startDate", "endDate", "campusCalendarKey", "credentialProgramTypeKey", "metaInfo", "attributes", "_futureElements"})
 46  
 
 47  
 public class AcademicCalendarInfo extends KeyEntityInfo implements AcademicCalendar, Serializable {
 48  
 
 49  
     private static final long serialVersionUID = 1L;
 50  
 
 51  
     @XmlElement
 52  
     private final Date startDate;
 53  
 
 54  
     @XmlElement
 55  
     private final Date endDate;
 56  
 
 57  
     @XmlElement
 58  
     private final String campusCalendarKey;
 59  
 
 60  
     @XmlElement 
 61  
     private final String credentialProgramTypeKey;
 62  
 
 63  
     @XmlAnyElement
 64  
     private final List<Element> _futureElements;  
 65  
 
 66  0
     private AcademicCalendarInfo() {
 67  0
         startDate = null;
 68  0
         endDate = null;
 69  0
         campusCalendarKey = null;
 70  0
         credentialProgramTypeKey = null;
 71  0
         _futureElements = null;
 72  0
     }
 73  
 
 74  
     /**
 75  
      * Constructs a new AcademicCalendarInfo from another
 76  
      * AcademicCalendar.
 77  
      *
 78  
      * @param academicCalendar the Academic Calendar to copy
 79  
      */
 80  
     public AcademicCalendarInfo(AcademicCalendar academicCalendar) {
 81  0
         super(academicCalendar);
 82  
 
 83  0
         this.startDate = null != academicCalendar.getStartDate() ? new Date(academicCalendar.getStartDate().getTime()) : null;
 84  0
         this.endDate = null != academicCalendar.getEndDate() ? new Date(academicCalendar.getEndDate().getTime()) : null;
 85  0
         this.campusCalendarKey = academicCalendar.getCampusCalendarKey();
 86  0
         this.credentialProgramTypeKey = academicCalendar.getCredentialProgramTypeKey();
 87  
 
 88  0
         _futureElements = null;
 89  0
     }
 90  
 
 91  
     /**
 92  
      * Date and time the academic calendar becomes effective. This
 93  
      * does not provide a bound on date ranges or milestones
 94  
      * associated with this time calendar, but instead indicates the
 95  
      * calendar proper. This is a similar concept to the effective
 96  
      * date on enumerated values. When an end date has been specified,
 97  
      * this field must be less than or equal to the end date.
 98  
      *
 99  
      * @return the Academic Calendar start date
 100  
      */
 101  
     @Override
 102  
     public Date getStartDate() {
 103  0
         return startDate;
 104  
     }
 105  
 
 106  
     /**
 107  
      * Date and time the academic calendar becomes
 108  
      * ineffective. This does not provide a bound on date ranges or
 109  
      * milestones associated with this calendar, but instead
 110  
      * indicates the calendar proper. If specified, this must be
 111  
      * greater than or equal to the start date. If this field is not
 112  
      * specified, then no end date has been currently defined
 113  
      * and should automatically be considered greater than the
 114  
      * effective date.
 115  
      *
 116  
      * @return the Academic Calendar end date
 117  
      */
 118  
     @Override
 119  
     public Date getEndDate() {
 120  0
         return endDate;
 121  
     }
 122  
 
 123  
     /**
 124  
      * Gets the campus calendar key corresponding to this academic
 125  
      * calendar.
 126  
      */
 127  
     @Override
 128  
     public String getCampusCalendarKey() {
 129  0
         return campusCalendarKey;
 130  
     }
 131  
 
 132  
     /**
 133  
      * Gets the credential program type key to which this calendar
 134  
      * relates.
 135  
      */
 136  
     public String getCredentialProgramTypeKey() {
 137  0
         return credentialProgramTypeKey;
 138  
     }
 139  
 
 140  
     /**
 141  
      * The builder class for this AcademicCalendarInfo.
 142  
      */
 143  0
     public static class Builder extends KeyEntityInfo.Builder implements ModelBuilder<AcademicCalendarInfo>, AcademicCalendar {
 144  
 
 145  
         private Date startDate;
 146  
         private Date endDate;
 147  
         private String campusCalendarKey;
 148  
         private String credentialProgramTypeKey;
 149  
 
 150  
 
 151  
         /**
 152  
          * Constructs a new builder.
 153  
          */
 154  0
         public Builder() {}
 155  
 
 156  
         /**
 157  
          * Constructs a new builder initialized from another AcademicCalendar
 158  
          */
 159  
         public Builder(AcademicCalendar academicCalendar) {
 160  0
             super(academicCalendar);
 161  
 
 162  0
             this.startDate = academicCalendar.getStartDate();
 163  0
             this.endDate = academicCalendar.getEndDate();
 164  0
             this.campusCalendarKey =  academicCalendar.getCampusCalendarKey();
 165  0
             this.credentialProgramTypeKey = academicCalendar.getCredentialProgramTypeKey();
 166  0
         }
 167  
 
 168  
         /**
 169  
          * Builds the AcademicCalendar.
 170  
          *
 171  
          * @return a new AcademicCalendar
 172  
          */
 173  
         public AcademicCalendarInfo build() {
 174  0
             return new AcademicCalendarInfo(this);
 175  
         }
 176  
 
 177  
         /**
 178  
          * Gets the start date.
 179  
          *
 180  
          * @return the Academic Calendar start date
 181  
          */
 182  
         @Override
 183  
         public Date getStartDate() {
 184  0
             return startDate;
 185  
         }
 186  
 
 187  
         /**
 188  
          * Sets the Academic Calendar start date.
 189  
          *
 190  
          * @param startDate the start date for the Academic Calendar
 191  
          */
 192  
         public void setStartDate(Date startDate) {
 193  0
             this.startDate = startDate;
 194  0
         }
 195  
 
 196  
         /**
 197  
          * Gets the start date.
 198  
          *
 199  
          * @return the Academic Calendar end date
 200  
          */
 201  
         @Override
 202  
         public Date getEndDate() {
 203  0
             return endDate;
 204  
         }
 205  
 
 206  
         /**
 207  
          * Sets the Academic Calendar end date.
 208  
          *
 209  
          * @param endDate the end date for the Academic Calendar
 210  
          */
 211  
 
 212  
         public void setEndDate(Date endDate) {
 213  0
             this.endDate = endDate;
 214  0
         }
 215  
 
 216  
         /**
 217  
          * Gets the campus calendar key corresponding to this academic
 218  
          * calendar.
 219  
          */
 220  
         public String getCampusCalendarKey() {
 221  0
             return campusCalendarKey;
 222  
         }
 223  
 
 224  
         public void setCampusCalendarKey(String campusCalendarKey) {
 225  0
             this.campusCalendarKey = campusCalendarKey;
 226  0
         }
 227  
 
 228  
         /**
 229  
          * Gets the credential program type key to which this calendar
 230  
          * relates.
 231  
          */
 232  
         public String getCredentialProgramTypeKey() {
 233  0
             return credentialProgramTypeKey;
 234  
         }
 235  
 
 236  
         public void setCredentialProgramTypeKey(String credentialProgramTypeKey) {
 237  0
             this.credentialProgramTypeKey = credentialProgramTypeKey;
 238  0
         }
 239  
     }
 240  
 }