Coverage Report - org.kuali.student.core.academiccalendar.dto.HolidayInfo
 
Classes in this File Line Coverage Branch Coverage Complexity
HolidayInfo
0%
0/21
0%
0/4
1.2
HolidayInfo$Builder
0%
0/26
0%
0/4
1.2
 
 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.common.dto.KeyEntityInfo;
 33  
 import org.kuali.student.core.academiccalendar.infc.HolidayInfc;
 34  
 
 35  
 import org.kuali.student.core.ws.binding.JaxbAttributeMapListAdapter;
 36  
 
 37  
 
 38  
 /**
 39  
  * Information about a holiday.
 40  
  *
 41  
  * @Author tom
 42  
  * @Since Tue Apr 05 14:22:34 EDT 2011
 43  
  */ 
 44  
 
 45  
 @XmlAccessorType(XmlAccessType.FIELD)
 46  
 @XmlType(name = "HolidayInfo", propOrder = {"key", "typeKey", "stateKey", "name", "descr", "isDateRange", "startDate", "endDate", "isInstructionalDay", "isExamDay", "metaInfo", "attributes", "_futureElements"})
 47  
 
 48  
 public class HolidayInfo extends KeyEntityInfo implements HolidayInfc, Serializable {
 49  
 
 50  
     private static final long serialVersionUID = 1L;
 51  
 
 52  
     @XmlElement
 53  
     private final Boolean isDateRange;
 54  
 
 55  
     @XmlElement
 56  
     private final Date startDate;
 57  
 
 58  
     @XmlElement
 59  
     private final Date endDate;
 60  
 
 61  
     @XmlElement
 62  
     private final Boolean isInstructionalDay;
 63  
 
 64  
     @XmlElement
 65  
     private final Boolean isExamDay;
 66  
 
 67  
     @XmlAnyElement
 68  
     private final List<Element> _futureElements;  
 69  
 
 70  0
     private HolidayInfo() {
 71  0
         isDateRange = false;
 72  0
         startDate = null;
 73  0
         endDate = null;
 74  0
         isInstructionalDay = false;
 75  0
         isExamDay = false;
 76  0
         _futureElements = null;
 77  0
     }
 78  
 
 79  
     /**
 80  
      * Constructs a new HolidayInfo from another Holiday.
 81  
      *
 82  
      * @param holiday the Holiday to copy
 83  
      */
 84  
     public HolidayInfo(HolidayInfc holiday) {
 85  0
         super(holiday);
 86  0
         this.isDateRange = holiday.getIsDateRange();
 87  0
         this.startDate = null != holiday.getStartDate() ? new Date(holiday.getStartDate().getTime()) : null;
 88  0
         this.endDate = null != holiday.getEndDate() ? new Date(holiday.getEndDate().getTime()) : null;
 89  0
         this.isInstructionalDay = holiday.getIsInstructionalDay();
 90  0
         this.isExamDay = holiday.getIsExamDay();
 91  0
         _futureElements = null;
 92  0
     }
 93  
 
 94  
     /**
 95  
      * Name: IsDateRange
 96  
      * Tests if this holiday has a date range. If true, the end date
 97  
      * value follows the start date.
 98  
      *
 99  
      * @return true if this Holiday has different start end end
 100  
      *         dates, false if this Holiday represents a single date
 101  
      */
 102  
     @Override
 103  
     public Boolean getIsDateRange() {
 104  0
         return isDateRange;
 105  
     }
 106  
 
 107  
     /**
 108  
      * Name: StartDate
 109  
      * Gets the start Date and time of the holiday.
 110  
      *
 111  
      * @return the holiday start
 112  
      */
 113  
     @Override
 114  
     public Date getStartDate() {
 115  0
         return startDate;
 116  
     }
 117  
 
 118  
     /**
 119  
      * Name: EndDate
 120  
      * Gets the end Date and time of the holiday.
 121  
      *
 122  
      * @return the holiday end
 123  
      */
 124  
     @Override
 125  
     public Date getEndDate() {
 126  0
         return endDate;
 127  
     }
 128  
 
 129  
     /**
 130  
      * Name: IsInstructionalDay
 131  
      * Tests if this holiday is an instructional day. 
 132  
      *
 133  
      * @return true if this holiday is an instructional day, false if
 134  
      *         it does not count as an instructional day
 135  
      */
 136  
     @Override
 137  
     public Boolean getIsInstructionalDay() {
 138  0
         return isInstructionalDay;
 139  
     }
 140  
 
 141  
     /**
 142  
      * Name: IsExamDay
 143  
      * Tests if exams are permitted on this holiday.
 144  
      *
 145  
      * @return true if this holiday is an exam day, false otherwise
 146  
      */
 147  
     @Override
 148  
     public Boolean getIsExamDay() {
 149  0
         return isExamDay;
 150  
     }
 151  
 
 152  
     /**
 153  
      * The builder class for this HolidayInfo.
 154  
      */
 155  0
     public static class Builder extends KeyEntityInfo.Builder implements ModelBuilder<HolidayInfo>, HolidayInfc {
 156  
 
 157  
         private Boolean isDateRange;
 158  
         private Date startDate;
 159  
         private Date endDate;
 160  
         private Boolean isInstructionalDay;
 161  
         private Boolean isExamDay;
 162  
 
 163  
         /**
 164  
          * Constructs a new builder.
 165  
          */
 166  0
         public Builder() {
 167  0
         }
 168  
 
 169  
         /**
 170  
          *  Constructs a new builder initialized from another
 171  
          *  Holiday.
 172  
          */
 173  
         public Builder(HolidayInfc holiday) {
 174  0
             super(holiday);
 175  0
             this.isDateRange = holiday.getIsDateRange();
 176  0
             this.startDate = null != holiday.getStartDate() ? new Date(holiday.getStartDate().getTime()) : null;
 177  0
             this.endDate = null != holiday.getEndDate() ? new Date(holiday.getEndDate().getTime()) : null;
 178  0
             this.isInstructionalDay = holiday.getIsInstructionalDay();
 179  0
             this.isExamDay = holiday.getIsExamDay();
 180  0
         }
 181  
 
 182  
         /**
 183  
          * Builds the Holiday.
 184  
          *
 185  
          * @return a new Holiday
 186  
          */
 187  
         public HolidayInfo build() {
 188  0
             return new HolidayInfo(this);
 189  
         }
 190  
 
 191  
         /**
 192  
          * Tests if this holiday has a date range. If true, the end date
 193  
          * value follows the start date.
 194  
          *
 195  
          * @return true if this Holiday has different start end end
 196  
          *         dates, false if this Holiday represents a single date
 197  
          */
 198  
         @Override
 199  
         public Boolean getIsDateRange() {
 200  0
             return isDateRange;
 201  
         }
 202  
 
 203  
         /**
 204  
          * Sets the date range flag (should this flag be inferred from
 205  
          * the dates?)
 206  
          *
 207  
          * @param isDateRange true if this Holiday has different
 208  
          *         start end end dates, false if this Holiday
 209  
          *         represents a single date
 210  
          */
 211  
         public void dateRange(Boolean isDateRange) {
 212  0
             this.isDateRange = isDateRange;
 213  0
         }
 214  
 
 215  
         /**
 216  
          * Gets the start date.
 217  
          *
 218  
          * @return the Holiday start date
 219  
          */
 220  
         @Override
 221  
         public Date getStartDate() {
 222  0
             return startDate;
 223  
         }
 224  
 
 225  
         /**
 226  
          * Sets the Holiday start date.
 227  
          *
 228  
          * @param endDate the start date
 229  
          */
 230  
         public void setStartDate(Date startDate) {
 231  0
             this.startDate = new Date(startDate.getTime());
 232  0
         }
 233  
 
 234  
         /**
 235  
          * Gets the start date.
 236  
          *
 237  
          * @return the Holiday end date
 238  
          */
 239  
         @Override
 240  
         public Date getEndDate() {
 241  0
             return endDate;
 242  
         }
 243  
 
 244  
         /**
 245  
          * Sets the Holiday end date.
 246  
          *
 247  
          * @param endDate the end date
 248  
          */
 249  
         public void setEndDate(Date endDate) {
 250  0
             this.endDate = new Date(endDate.getTime());
 251  0
         }
 252  
 
 253  
         /**
 254  
          * Tests if this holiday is an instructional day. 
 255  
          *
 256  
          * @return true if this holiday is an instructional day, false if
 257  
          *         it does not count as an instructional day
 258  
          */
 259  
         public Boolean getIsInstructionalDay() {
 260  0
             return isInstructionalDay;
 261  
         }
 262  
 
 263  
         public void setIsInstructionalDay(Boolean isInstructionalDay) {
 264  0
             this.isInstructionalDay = isInstructionalDay;
 265  0
         }
 266  
 
 267  
         /**
 268  
          * Tests if this holiday is an exam day. 
 269  
          *
 270  
          * @return true if this holiday is an exam day, false if
 271  
          *         it does not count as an exam day
 272  
          */
 273  
         public Boolean getIsExamDay() {
 274  0
             return isExamDay;
 275  
         }
 276  
 
 277  
         public void setIsExamDay(Boolean isExamDay) {
 278  0
             this.isExamDay = isExamDay;
 279  0
         }
 280  
     }
 281  
 }