View Javadoc

1   /*
2    * Copyright 2010 The Kuali Foundation 
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the
5    * "License"); you may not use this file except in compliance with the
6    * License. You may obtain a copy of the License at
7    *
8    * http://www.osedu.org/licenses/ECL-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13   * implied. See the License for the specific language governing
14   * permissions and limitations under the License.
15   */
16  
17  package org.kuali.student.r2.common.dto;
18  
19  import java.io.Serializable;
20  import java.util.Date;
21  import java.util.List;
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.XmlElement;
27  import javax.xml.bind.annotation.XmlType;
28  
29  import org.kuali.student.r2.common.infc.DateRange;
30  //import org.w3c.dom.Element;
31  
32  /**
33   * A DTO for a date range.
34   *
35   * @author tom
36   */
37  
38  @XmlAccessorType(XmlAccessType.FIELD)
39  @XmlType(name = "DateRangeInfo", propOrder = {
40                  "startDate", "endDate" })//, "_futureElements" }) TODO KSCM-372: Non-GWT translatable code})
41  
42  public class DateRangeInfo 
43      implements DateRange, Serializable {
44  	
45      private static final long serialVersionUID = 1L;
46  
47      @XmlElement
48      private Date startDate;
49      
50      @XmlElement
51      private Date endDate;
52      
53  //    TODO KSCM-372: Non-GWT translatable code
54  //    @XmlAnyElement
55  //    private List<Element> _futureElements;    
56      
57  
58      /**
59       *  Constructs a new DateRangeInfo.
60       */
61      public DateRangeInfo() {
62      }
63  	
64      /**
65       * Constructs a new DateRangeInfo from another DateRange.
66       *
67       * @param dateRange the DateRange to copy
68       */
69      public DateRangeInfo(DateRange dateRange) {
70          if (dateRange != null) {
71              if (dateRange.getStartDate() != null) {
72                  this.startDate = new Date(dateRange.getStartDate().getTime());
73              }
74  
75              if (dateRange.getEndDate() != null) {
76                  this.endDate = new Date(dateRange.getEndDate().getTime());
77              }
78  	}
79      }
80  
81      @Override
82      public Date getStartDate() {
83          return startDate;
84      }
85  
86      public void setStartDate(Date startDate) {
87          this.startDate = startDate;
88      }
89  
90      @Override
91      public Date getEndDate() {
92          return endDate;
93      }
94  
95      public void setEndDate(Date endDate) {
96          this.endDate = endDate;
97      }
98  }