View Javadoc

1   /*
2    * Copyright 2011 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 1.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.opensource.org/licenses/ecl1.php
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.courseoffering.dto;
18  
19  import java.util.ArrayList;
20  import java.util.List;
21  
22  import javax.xml.bind.annotation.XmlAccessType;
23  import javax.xml.bind.annotation.XmlAccessorType;
24  import javax.xml.bind.annotation.XmlAnyElement;
25  import javax.xml.bind.annotation.XmlElement;
26  import javax.xml.bind.annotation.XmlType;
27  
28  import org.kuali.student.enrollment.courseoffering.infc.ActivityOfferingCluster;
29  import org.kuali.student.enrollment.courseoffering.infc.ActivityOfferingSet;
30  import org.kuali.student.r2.common.dto.IdEntityInfo;
31  
32  import org.w3c.dom.Element;
33  
34  /**
35   * @author Kuali Student Team (Kamal)
36   */
37  @XmlAccessorType(XmlAccessType.FIELD)
38  @XmlType(name = "ActivityOfferingClusterInfo", propOrder = {
39                  "id", "typeKey", "stateKey", "name", "descr",
40                  "privateName", "formatOfferingId", "activityOfferingSets",
41                  "meta", "attributes", "_futureElements"})
42  
43  public class ActivityOfferingClusterInfo
44      extends IdEntityInfo 
45      implements ActivityOfferingCluster {
46  
47      private static final long serialVersionUID = 1L;
48  
49      @XmlElement
50      private String privateName;
51  
52      @XmlElement
53      private String formatOfferingId;
54  
55      @XmlElement
56      private List<ActivityOfferingSetInfo> activityOfferingSets;
57  
58      @XmlAnyElement
59      private List<Element> _futureElements;
60  
61      
62      /**
63       * Constructs a new ActivityOfferingClusterInfo.
64       */
65      public ActivityOfferingClusterInfo() {
66      }
67  
68      /**
69       * Constructs a new ActivityOfferingClusterInfo from another
70       * ActivityOfferingCluster.
71       *
72       * @param template the registration group template to copy
73       */
74      public ActivityOfferingClusterInfo(ActivityOfferingCluster template) {
75          super(template); 
76          
77          if (template == null) {
78              return;      
79          }
80  
81          this.formatOfferingId = template.getFormatOfferingId();
82          if (template.getActivityOfferingSets() != null) {
83              this.activityOfferingSets = new ArrayList<ActivityOfferingSetInfo>(template.getActivityOfferingSets().size());
84              for (ActivityOfferingSet aotemplate : template.getActivityOfferingSets()) {
85                  this.activityOfferingSets.add(new ActivityOfferingSetInfo(aotemplate));
86              }
87          }
88      }
89  
90      @Override
91      public String getPrivateName() {
92          return this.privateName;
93      }
94  
95      public void setPrivateName(String privateName) {
96          this.privateName = privateName;
97      }
98  
99      @Override
100     public String getFormatOfferingId() {
101         return formatOfferingId;
102     }
103 
104     public void setFormatOfferingId(String formatOfferingId) {
105         this.formatOfferingId = formatOfferingId;
106     }
107 
108     @Override
109     public List<ActivityOfferingSetInfo> getActivityOfferingSets() {
110         if (activityOfferingSets == null) {
111             activityOfferingSets = new ArrayList<ActivityOfferingSetInfo>();
112         }
113 
114         return activityOfferingSets;
115     }
116 
117     public void setActivityOfferingSets(List<ActivityOfferingSetInfo> activityOfferingSets) {
118         this.activityOfferingSets = activityOfferingSets;
119     }
120 }