Coverage Report - org.kuali.student.core.academiccalendar.dto.KeyDateInfo
 
Classes in this File Line Coverage Branch Coverage Complexity
KeyDateInfo
0%
0/15
0%
0/4
1.286
KeyDateInfo$Builder
0%
0/18
0%
0/4
1.286
 
 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.KeyDateInfc;
 34  
 
 35  
 import org.kuali.student.core.ws.binding.JaxbAttributeMapListAdapter;
 36  
 
 37  
 
 38  
 /**
 39  
  * Information about a key date.
 40  
  *
 41  
  * @Author tom
 42  
  * @Since Tue Apr 05 14:22:34 EDT 2011
 43  
  */ 
 44  
 
 45  
 @XmlAccessorType(XmlAccessType.FIELD)
 46  
 @XmlType(name = "KeyDateInfo", propOrder = {"key", "typeKey", "stateKey", "name", "descr", "isDateRange", "startDate", "endDate", "metaInfo", "attributes", "_futureElements"})
 47  
 
 48  
 public class KeyDateInfo extends KeyEntityInfo implements KeyDateInfc, 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  
     @XmlAnyElement
 62  
     private final List<Element> _futureElements;  
 63  
 
 64  0
     private KeyDateInfo() {
 65  0
         isDateRange = false;
 66  0
         startDate = null;
 67  0
         endDate = null;
 68  0
         _futureElements = null;
 69  0
     }
 70  
 
 71  
     /**
 72  
      * Constructs a new KeyDateInfo from another KeyDate.
 73  
      *
 74  
      * @param keyDate the KeyDate to copy
 75  
      */
 76  
     public KeyDateInfo(KeyDateInfc keyDate) {
 77  0
         super(keyDate);
 78  0
         this.isDateRange = keyDate.getIsDateRange();
 79  0
         this.startDate = null != keyDate.getStartDate() ? new Date(keyDate.getStartDate().getTime()) : null;
 80  0
         this.endDate = null != keyDate.getEndDate() ? new Date(keyDate.getEndDate().getTime()) : null;
 81  0
         _futureElements = null;
 82  0
     }
 83  
 
 84  
     /**
 85  
      * Name: IsDateRange
 86  
      * Tests if this keyDate has a date range. If true, the end date
 87  
      * value follows the start date.
 88  
      *
 89  
      * @return true if this KeyDate has different start end end
 90  
      *         dates, false if this KeyDate represents a single date
 91  
      */
 92  
     @Override
 93  
     public Boolean getIsDateRange() {
 94  0
         return isDateRange;
 95  
     }
 96  
 
 97  
     /**
 98  
      * Name: StartDate
 99  
      * Gets the start Date and time of the keyDate.
 100  
      *
 101  
      * @return the keyDate start
 102  
      */
 103  
     @Override
 104  
     public Date getStartDate() {
 105  0
         return startDate;
 106  
     }
 107  
 
 108  
     /**
 109  
      * Name: EndDate
 110  
      * Gets the end Date and time of the keyDate.
 111  
      *
 112  
      * @return the keyDate end
 113  
      */
 114  
     @Override
 115  
     public Date getEndDate() {
 116  0
         return endDate;
 117  
     }
 118  
 
 119  
     /**
 120  
      * The builder class for this KeyDateInfo.
 121  
      */
 122  0
     public static class Builder extends KeyEntityInfo.Builder implements ModelBuilder<KeyDateInfo>, KeyDateInfc {
 123  
 
 124  
         private Boolean isDateRange;
 125  
         private Date startDate;
 126  
         private Date endDate;
 127  
 
 128  
         /**
 129  
          * Constructs a new builder.
 130  
          */
 131  0
         public Builder() {
 132  0
         }
 133  
 
 134  
         /**
 135  
          *  Constructs a new builder initialized from another
 136  
          *  KeyDate.
 137  
          */
 138  
         public Builder(KeyDateInfc keyDate) {
 139  0
             super(keyDate);
 140  0
             this.isDateRange = keyDate.getIsDateRange();
 141  0
             this.startDate = null != keyDate.getStartDate() ? new Date(keyDate.getStartDate().getTime()) : null;
 142  0
             this.endDate = null != keyDate.getEndDate() ? new Date(keyDate.getEndDate().getTime()) : null;
 143  0
         }
 144  
 
 145  
         /**
 146  
          * Builds the KeyDate.
 147  
          *
 148  
          * @return a new KeyDate
 149  
          */
 150  
         public KeyDateInfo build() {
 151  0
             return new KeyDateInfo(this);
 152  
         }
 153  
 
 154  
         /**
 155  
          * Tests if this keyDate has a date range. If true, the end date
 156  
          * value follows the start date.
 157  
          *
 158  
          * @return true if this KeyDate has different start end end
 159  
          *         dates, false if this KeyDate represents a single date
 160  
          */
 161  
         @Override
 162  
         public Boolean getIsDateRange() {
 163  0
             return isDateRange;
 164  
         }
 165  
 
 166  
         /**
 167  
          * Sets the date range flag (should this flag be inferred from
 168  
          * the dates?)
 169  
          *
 170  
          * @param isDateRange true if this KeyDate has different
 171  
          *         start end end dates, false if this KeyDate
 172  
          *         represents a single date
 173  
          */
 174  
         public void dateRange(Boolean isDateRange) {
 175  0
             this.isDateRange = isDateRange;
 176  0
         }
 177  
 
 178  
         /**
 179  
          * Gets the start date.
 180  
          *
 181  
          * @return the KeyDate start date
 182  
          */
 183  
         @Override
 184  
         public Date getStartDate() {
 185  0
             return startDate;
 186  
         }
 187  
 
 188  
         /**
 189  
          * Sets the KeyDate start date.
 190  
          *
 191  
          * @param endDate the start date
 192  
          */
 193  
         public void setStartDate(Date startDate) {
 194  0
             this.startDate = new Date(startDate.getTime());
 195  0
         }
 196  
 
 197  
         /**
 198  
          * Gets the start date.
 199  
          *
 200  
          * @return the KeyDate end date
 201  
          */
 202  
         @Override
 203  
         public Date getEndDate() {
 204  0
             return endDate;
 205  
         }
 206  
 
 207  
         /**
 208  
          * Sets the KeyDate end date.
 209  
          *
 210  
          * @param endDate the end date
 211  
          */
 212  
         public void setEndDate(Date endDate) {
 213  0
             this.endDate = new Date(endDate.getTime());
 214  0
         }
 215  
     }
 216  
 }