001 /*
002 * Copyright 2010 The Kuali Foundation Licensed under the
003 * Educational Community License, Version 2.0 (the "License"); you may
004 * not use this file except in compliance with the License. You may
005 * obtain a copy of the License at
006 *
007 * http://www.osedu.org/licenses/ECL-2.0
008 *
009 * Unless required by applicable law or agreed to in writing,
010 * software distributed under the License is distributed on an "AS IS"
011 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
012 * or implied. See the License for the specific language governing
013 * permissions and limitations under the License.
014 */
015 package org.kuali.student.enrollment.acal.dto;
016
017 import java.io.Serializable;
018 import java.util.Date;
019 import java.util.List;
020
021 import javax.xml.bind.annotation.XmlAccessType;
022 import javax.xml.bind.annotation.XmlAccessorType;
023 import javax.xml.bind.annotation.XmlAnyElement;
024 import javax.xml.bind.annotation.XmlElement;
025 import javax.xml.bind.annotation.XmlType;
026
027 import org.kuali.student.enrollment.acal.infc.KeyDate;
028 import org.kuali.student.r2.common.dto.IdEntityInfo;
029
030 import org.w3c.dom.Element;
031
032 @XmlAccessorType(XmlAccessType.FIELD)
033 @XmlType(name = "KeyDateInfo", propOrder = {
034 "id", "typeKey", "stateKey", "name", "descr",
035 "isAllDay", "isRelativeToKeyDate", "relativeAnchorKeyDateId",
036 "isDateRange", "startDate", "endDate",
037 "meta", "attributes", "_futureElements" })
038
039 public class KeyDateInfo
040 extends IdEntityInfo
041 implements KeyDate, Serializable {
042
043 private static final long serialVersionUID = 1L;
044
045 @XmlElement
046 private Boolean isAllDay;
047
048 @XmlElement
049 private Boolean isRelativeToKeyDate;
050
051 @XmlElement
052 private String relativeAnchorKeyDateId;
053
054 @XmlElement
055 private Boolean isDateRange;
056
057 @XmlElement
058 private Date startDate;
059
060 @XmlElement
061 private Date endDate;
062
063 @XmlAnyElement
064 private List<Element> _futureElements;
065
066 /**
067 * Constructs a new KeyDateInfo.
068 */
069 public KeyDateInfo() {
070 }
071
072 /**
073 * Constructs a new KeyDateInfo from another KeyDate.
074 *
075 * @param keyDate the KeyDate to copy
076 */
077 public KeyDateInfo(KeyDate keyDate) {
078 super(keyDate);
079 if (keyDate != null) {
080 this.isAllDay = keyDate.getIsAllDay();
081 this.isRelativeToKeyDate = keyDate.getIsRelativeToKeyDate();
082 this.relativeAnchorKeyDateId = keyDate.getRelativeAnchorKeyDateId();
083
084 this.isDateRange = keyDate.getIsDateRange();
085
086 if (keyDate.getStartDate() != null) {
087 this.startDate = new Date(keyDate.getStartDate().getTime());
088 }
089
090 if (keyDate.getEndDate() != null) {
091 this.endDate = new Date(keyDate.getEndDate().getTime());
092 }
093 }
094 }
095
096 @Override
097 public Boolean getIsAllDay() {
098 return isAllDay;
099 }
100
101 public void setIsAllDay(Boolean isAllDay) {
102 this.isAllDay = isAllDay;
103 }
104
105 @Override
106 public Boolean getIsRelativeToKeyDate() {
107 return isRelativeToKeyDate;
108 }
109
110 public void setIsRelativeToKeyDate(Boolean isRelativeToKeyDate) {
111 this.isRelativeToKeyDate = isRelativeToKeyDate;
112 }
113
114 @Override
115 public String getRelativeAnchorKeyDateId() {
116 return relativeAnchorKeyDateId;
117 }
118
119 public void setRelativeAnchorKeyDateId(String relativeAnchorKeyDateId) {
120 this.relativeAnchorKeyDateId = relativeAnchorKeyDateId;
121 }
122
123 @Override
124 public Boolean getIsDateRange() {
125 return isDateRange;
126 }
127
128 public void setIsDateRange(Boolean isDateRange) {
129 this.isDateRange = isDateRange;
130 }
131
132 @Override
133 public Date getStartDate() {
134 return startDate;
135 }
136
137 public void setStartDate(Date startDate) {
138 this.startDate = startDate;
139 }
140
141 @Override
142 public Date getEndDate() {
143 return endDate;
144 }
145
146 public void setEndDate(Date endDate) {
147 this.endDate = endDate;
148 }
149 }