View Javadoc

1   /**
2    * Copyright 2013 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.enrollment.coursewaitlist.dto;
18  
19  
20  import org.kuali.student.enrollment.coursewaitlist.infc.CourseWaitList;
21  import org.kuali.student.r2.common.dto.IdNamelessEntityInfo;
22  import org.kuali.student.r2.common.dto.TimeAmountInfo;
23  import org.kuali.student.r2.common.util.constants.CourseWaitListServiceConstants;
24  
25  import javax.xml.bind.annotation.XmlAccessType;
26  import javax.xml.bind.annotation.XmlAccessorType;
27  import javax.xml.bind.annotation.XmlAnyElement;
28  import javax.xml.bind.annotation.XmlElement;
29  import javax.xml.bind.annotation.XmlType;
30  import java.io.Serializable;
31  import java.util.ArrayList;
32  import java.util.Date;
33  import java.util.List;
34  
35  @XmlAccessorType(XmlAccessType.FIELD)
36  @XmlType(name = "CourseWaitListInfo", propOrder = {
37          "id", "typeKey", "stateKey","activityOfferingIds",
38          "formatOfferingIds", "registerInFirstAvailableActivityOffering",
39          "automaticallyProcessed", "confirmationRequired", "maxSize",
40          "checkInRequired", "checkInFrequency", "allowHoldUntilEntries", "effectiveDate", "expirationDate",
41          "meta", "attributes", "_futureElements"})
42  public class CourseWaitListInfo extends IdNamelessEntityInfo implements CourseWaitList, Serializable {
43  
44      private static final long serialVersionUID = 1L;
45  
46      @XmlElement
47      private List<String> activityOfferingIds;
48      @XmlElement
49      private List<String> formatOfferingIds;
50      @XmlElement
51      private Boolean registerInFirstAvailableActivityOffering;
52      @XmlElement
53      private Boolean automaticallyProcessed;
54      @XmlElement
55      private Boolean confirmationRequired;
56      @XmlElement
57      private Integer maxSize;
58      @XmlElement
59      private Boolean checkInRequired;
60      @XmlElement
61      private TimeAmountInfo checkInFrequency;
62      @XmlElement
63      private Boolean allowHoldUntilEntries;
64      @XmlElement
65      private Date effectiveDate;
66      @XmlElement
67      private Date expirationDate;
68      @XmlAnyElement
69      private List<Object> _futureElements;
70  
71      public CourseWaitListInfo() {
72          activityOfferingIds = new ArrayList<String>();
73          formatOfferingIds = new ArrayList<String>();
74      }
75  
76      public CourseWaitListInfo(CourseWaitList waitList) {
77          super(waitList);
78  
79          if (waitList != null) {
80              if (waitList.getActivityOfferingIds() != null) {
81                  setActivityOfferingIds(new ArrayList<String>(waitList.getActivityOfferingIds()));
82              } else {
83                  setActivityOfferingIds(new ArrayList<String>());
84              }
85  
86              if (waitList.getFormatOfferingIds() != null) {
87                  setFormatOfferingIds(new ArrayList<String>(waitList.getFormatOfferingIds()));
88              } else {
89                  setFormatOfferingIds(new ArrayList<String>());
90              }
91  
92              setRegisterInFirstAvailableActivityOffering(waitList.getRegisterInFirstAvailableActivityOffering());
93              setAutomaticallyProcessed(waitList.getAutomaticallyProcessed());
94              setConfirmationRequired(waitList.getConfirmationRequired());
95              setMaxSize(waitList.getMaxSize());
96              setCheckInRequired(waitList.getCheckInRequired());
97              if(waitList.getCheckInFrequency() != null) {
98                  setCheckInFrequency(new TimeAmountInfo(waitList.getCheckInFrequency()));
99              }
100             setAllowHoldUntilEntries(waitList.getAllowHoldUntilEntries());
101             if(waitList.getEffectiveDate() != null) {
102                 setEffectiveDate(new Date(waitList.getEffectiveDate().getTime()));
103             }
104             if(waitList.getExpirationDate() != null) {
105                 setExpirationDate(new Date(waitList.getExpirationDate().getTime()));
106             }
107         }
108     }
109 
110     @Override
111     public List<String> getFormatOfferingIds() {
112         return formatOfferingIds;
113     }
114 
115     public void setFormatOfferingIds(List<String> formatOfferingIds) {
116         this.formatOfferingIds = formatOfferingIds;
117     }
118 
119     @Override
120     public List<String> getActivityOfferingIds() {
121         return activityOfferingIds;
122     }
123 
124     public void setActivityOfferingIds(List<String> activityOfferingIds) {
125         this.activityOfferingIds = activityOfferingIds;
126     }
127 
128     @Override
129     public Boolean getRegisterInFirstAvailableActivityOffering() {
130         return registerInFirstAvailableActivityOffering;
131     }
132 
133     public void setRegisterInFirstAvailableActivityOffering(Boolean registerInFirstAvailableActivityOffering) {
134         this.registerInFirstAvailableActivityOffering = registerInFirstAvailableActivityOffering;
135     }
136 
137     @Override
138     public Boolean getAutomaticallyProcessed() {
139         return automaticallyProcessed;
140     }
141 
142     public void setAutomaticallyProcessed(Boolean automaticallyProcessed) {
143         this.automaticallyProcessed = automaticallyProcessed;
144     }
145 
146     @Override
147     public Boolean getConfirmationRequired() {
148         return confirmationRequired;
149     }
150 
151     public void setConfirmationRequired(Boolean confirmationRequired) {
152         this.confirmationRequired = confirmationRequired;
153     }
154 
155     @Override
156     public Integer getMaxSize() {
157         return maxSize;
158     }
159 
160     public void setMaxSize(Integer maxSize) {
161         this.maxSize = maxSize;
162     }
163 
164     @Override
165     public Boolean getCheckInRequired() {
166         return checkInRequired;
167     }
168 
169     public void setCheckInRequired(Boolean checkInRequired) {
170         this.checkInRequired = checkInRequired;
171     }
172 
173     @Override
174     public TimeAmountInfo getCheckInFrequency() {
175         return checkInFrequency;
176     }
177 
178     public void setCheckInFrequency(TimeAmountInfo checkInFrequency) {
179         this.checkInFrequency = checkInFrequency;
180     }
181 
182     @Override
183     public Boolean getAllowHoldUntilEntries() {
184         return allowHoldUntilEntries;
185     }
186 
187     public void setAllowHoldUntilEntries(Boolean allowHoldUntilEntries) {
188         this.allowHoldUntilEntries = allowHoldUntilEntries;
189     }
190 
191     @Override
192     public Date getEffectiveDate() {
193         return effectiveDate;
194     }
195 
196     public void setEffectiveDate(Date effectiveDate) {
197         this.effectiveDate = effectiveDate;
198     }
199 
200 
201     @Override
202     public Date getExpirationDate() {
203         return expirationDate;
204     }
205 
206     public void setExpirationDate(Date expirationDate) {
207         this.expirationDate = expirationDate;
208     }
209 }