View Javadoc

1   /*
2    * Copyright 2009 The Kuali Foundation Licensed under the Educational Community
3    * License, Version 1.0 (the "License"); you may not use this file except in
4    * compliance with the License. You may obtain a copy of the License at
5    * http://www.opensource.org/licenses/ecl1.php Unless required by applicable law
6    * or agreed to in writing, software distributed under the License is
7    * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8    * KIND, either express or implied. See the License for the specific language
9    * governing permissions and limitations under the License.
10   */
11  package org.kuali.student.r2.lum.course.dto;
12  
13  import java.io.Serializable;
14  import java.util.ArrayList;
15  import java.util.List;
16  
17  import javax.xml.bind.annotation.XmlAccessType;
18  import javax.xml.bind.annotation.XmlAccessorType;
19  import javax.xml.bind.annotation.XmlElement;
20  import javax.xml.bind.annotation.XmlType;
21  
22  import org.kuali.student.r2.common.dto.IdNamelessEntityInfo;
23  import org.kuali.student.r2.common.dto.TimeAmountInfo;
24  import org.kuali.student.r2.lum.course.infc.Activity;
25  import org.kuali.student.r2.lum.course.infc.Format;
26  
27  @XmlType(name = "FormatInfo", propOrder = {"id", "typeKey", "stateKey", "activities", "termsOffered", "duration", "meta", "attributes" , "_futureElements" }) 
28  @XmlAccessorType(XmlAccessType.FIELD)
29  public class FormatInfo extends IdNamelessEntityInfo implements Format, Serializable {
30  
31      private static final long serialVersionUID = 1L;
32  
33      @XmlElement
34      private List<ActivityInfo> activities;
35  
36      @XmlElement
37      private List<String> termsOffered;
38  
39      @XmlElement
40      private TimeAmountInfo duration;
41  
42      @XmlElement
43      private List<Object>_futureElements;
44      
45      public FormatInfo() {
46  
47      }
48  
49      public FormatInfo(Format format) {
50          super(format);
51          if (format != null) {
52              List<ActivityInfo> activities = new ArrayList<ActivityInfo>();
53              for (Activity activity : format.getActivities()) {
54                  activities.add(new ActivityInfo(activity));
55              }
56  
57              this.activities = activities;
58  
59              this.termsOffered = new ArrayList<String>(format.getTermsOffered());
60  
61              this.duration = new TimeAmountInfo(format.getDuration());
62          }
63      }
64  
65      @Override
66      public List<ActivityInfo> getActivities() {
67          if (activities == null) {
68              activities = new ArrayList<ActivityInfo>(0);
69          }
70          return activities;
71      }
72  
73      public void setActivities(List<ActivityInfo> activities) {
74          this.activities = activities;
75      }
76  
77      @Override
78      public List<String> getTermsOffered() {
79          return termsOffered;
80      }
81  
82      public void setTermsOffered(List<String> termsOffered) {
83          this.termsOffered = termsOffered;
84      }
85  
86      @Override
87      public TimeAmountInfo getDuration() {
88          return duration;
89      }
90  
91      public void setDuration(TimeAmountInfo duration) {
92          this.duration = duration;
93      }
94  
95  }