View Javadoc

1   /**
2    * Copyright 2012 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   * Created by mahtabme (Mezba Mahtab) on 10/4/12
17   */
18  package org.kuali.student.enrollment.courseoffering.dto;
19  
20  import org.kuali.student.enrollment.courseoffering.infc.ColocatedOfferingSet;
21  import org.kuali.student.r2.common.dto.IdEntityInfo;
22  
23  import org.w3c.dom.Element;
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  
31  import java.util.ArrayList;
32  import java.util.Date;
33  import java.util.List;
34  
35  /**
36   * This class represents a colocated set of activity offerings.
37   *
38   * @author Kuali Student Team
39   */
40  
41  @XmlAccessorType(XmlAccessType.FIELD)
42  @XmlType(name = "ColocatedOfferingSetInfo", propOrder = {
43          "id", "typeKey", "stateKey", "name", "descr",
44          "isMaxEnrollmentShared", "activityOfferingIds", 
45          "effectiveDate", "expirationDate", "maximumEnrollment",
46          "meta", "attributes", "_futureElements"})
47  
48  public class ColocatedOfferingSetInfo 
49      extends IdEntityInfo implements ColocatedOfferingSet {
50  
51      private static final long serialVersionUID = 1L;
52  
53      @XmlElement
54      private Boolean isMaxEnrollmentShared = null;
55  
56      @XmlElement
57      private List<String> activityOfferingIds;
58  
59      @XmlElement
60      private Integer maximumEnrollment;
61  
62      @XmlElement
63      private Date effectiveDate;
64  
65      @XmlElement
66      private Date expirationDate;
67  
68      @XmlAnyElement
69      private List<Element> _futureElements;
70  
71  
72      /**
73       *  Constructs a new CoLocatedOfferingSetInfo.
74       */
75      public ColocatedOfferingSetInfo() {
76      }
77  
78      /**
79       *  Constructs a new CoLocatedOfferingSetInfo from another
80       *  CoLocatedOfferingSet.
81       * 
82       *  @param colocatedOfferingSet the CoLocatedOfferingSet to copy
83       */
84      public ColocatedOfferingSetInfo(ColocatedOfferingSet colocatedOfferingSet) {
85          super(colocatedOfferingSet);
86          if (colocatedOfferingSet!=null) {
87              this.isMaxEnrollmentShared = new Boolean(colocatedOfferingSet.getIsMaxEnrollmentShared());
88              this.activityOfferingIds = new ArrayList<String>(colocatedOfferingSet.getActivityOfferingIds());
89              this.maximumEnrollment = colocatedOfferingSet.getMaximumEnrollment();
90  
91              this.effectiveDate = (null != colocatedOfferingSet.getEffectiveDate()) ? new Date(colocatedOfferingSet.getEffectiveDate().getTime()) : null;
92              this.expirationDate = (null != colocatedOfferingSet.getExpirationDate()) ? new Date(colocatedOfferingSet.getExpirationDate().getTime()) : null;
93          }
94      }
95  
96      @Override
97      public Boolean getIsMaxEnrollmentShared() {
98          return isMaxEnrollmentShared;
99      }
100 
101     public void setIsMaxEnrollmentShared(Boolean maxEnrollmentShared) {
102         isMaxEnrollmentShared = maxEnrollmentShared;
103     }
104 
105     @Override
106     public List<String> getActivityOfferingIds() {
107         return activityOfferingIds;
108     }
109 
110     public void setActivityOfferingIds(List<String> activityOferingIds) {
111         this.activityOfferingIds = activityOfferingIds;
112     }
113 
114     @Deprecated
115     public List<String> getOfferingIds() {
116         return getActivityOfferingIds();
117     }
118 
119     @Deprecated
120     public void setOfferingIds(List<String> activityOferingIds) {
121         setActivityOfferingIds(activityOfferingIds);
122     }
123 
124     @Override
125     public Integer getMaximumEnrollment() {
126         return maximumEnrollment;
127     }
128 
129     public void setMaximumEnrollment(Integer maximumEnrollment) {
130         this.maximumEnrollment = maximumEnrollment;
131     }
132 
133     @Override
134     public Date getEffectiveDate() {
135         return effectiveDate;
136     }
137 
138     public void setEffectiveDate(Date effectiveDate) {
139         this.effectiveDate = effectiveDate;
140     }
141 
142     @Override
143     public Date getExpirationDate() {
144         return expirationDate;
145     }
146 
147     public void setExpirationDate(Date expirationDate) {
148         this.expirationDate = expirationDate;
149     }
150 }