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