001 /*
002 * Copyright 2009 The Kuali Foundation Licensed under the Educational Community
003 * License, Version 1.0 (the "License"); you may not use this file except in
004 * compliance with the License. You may obtain a copy of the License at
005 * http://www.opensource.org/licenses/ecl1.php Unless required by applicable law
006 * or agreed to in writing, software distributed under the License is
007 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
008 * KIND, either express or implied. See the License for the specific language
009 * governing permissions and limitations under the License.
010 */
011 package org.kuali.student.r2.lum.course.dto;
012
013 import java.io.Serializable;
014 import java.util.ArrayList;
015 import java.util.List;
016
017 import javax.xml.bind.annotation.XmlAccessType;
018 import javax.xml.bind.annotation.XmlAccessorType;
019 import javax.xml.bind.annotation.XmlElement;
020 import javax.xml.bind.annotation.XmlType;
021
022 import org.kuali.student.r2.common.dto.IdNamelessEntityInfo;
023 import org.kuali.student.r2.common.dto.TimeAmountInfo;
024 import org.kuali.student.r2.lum.course.infc.Activity;
025 import org.kuali.student.r2.lum.course.infc.Format;
026
027 @XmlType(name = "FormatInfo", propOrder = {"id", "typeKey", "stateKey", "activities", "termsOffered", "duration", "meta", "attributes" , "_futureElements" })
028 @XmlAccessorType(XmlAccessType.FIELD)
029 public class FormatInfo extends IdNamelessEntityInfo implements Format, Serializable {
030
031 private static final long serialVersionUID = 1L;
032
033 @XmlElement
034 private List<ActivityInfo> activities;
035
036 @XmlElement
037 private List<String> termsOffered;
038
039 @XmlElement
040 private TimeAmountInfo duration;
041
042 @XmlElement
043 private List<Object>_futureElements;
044
045 public FormatInfo() {
046
047 }
048
049 public FormatInfo(Format format) {
050 super(format);
051 if (format != null) {
052 List<ActivityInfo> activities = new ArrayList<ActivityInfo>();
053 for (Activity activity : format.getActivities()) {
054 activities.add(new ActivityInfo(activity));
055 }
056
057 this.activities = activities;
058
059 this.termsOffered = new ArrayList<String>(format.getTermsOffered());
060
061 this.duration = new TimeAmountInfo(format.getDuration());
062 }
063 }
064
065 @Override
066 public List<ActivityInfo> getActivities() {
067 if (activities == null) {
068 activities = new ArrayList<ActivityInfo>(0);
069 }
070 return activities;
071 }
072
073 public void setActivities(List<ActivityInfo> activities) {
074 this.activities = activities;
075 }
076
077 @Override
078 public List<String> getTermsOffered() {
079 return termsOffered;
080 }
081
082 public void setTermsOffered(List<String> termsOffered) {
083 this.termsOffered = termsOffered;
084 }
085
086 @Override
087 public TimeAmountInfo getDuration() {
088 return duration;
089 }
090
091 public void setDuration(TimeAmountInfo duration) {
092 this.duration = duration;
093 }
094
095 }