001    /*
002     * Copyright 2011 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 1.0 (the
005     * "License"); you may not use this file except in compliance with the
006     * License.  You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl1.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
013     * implied.  See the License for the specific language governing
014     * permissions and limitations under the License.
015     */
016    
017    package org.kuali.student.enrollment.courseoffering.dto;
018    
019    import java.util.ArrayList;
020    import java.util.List;
021    
022    import javax.xml.bind.annotation.XmlAccessType;
023    import javax.xml.bind.annotation.XmlAccessorType;
024    import javax.xml.bind.annotation.XmlAnyElement;
025    import javax.xml.bind.annotation.XmlElement;
026    import javax.xml.bind.annotation.XmlType;
027    
028    import org.kuali.student.enrollment.courseoffering.infc.ActivityOfferingCluster;
029    import org.kuali.student.enrollment.courseoffering.infc.ActivityOfferingSet;
030    import org.kuali.student.r2.common.dto.IdEntityInfo;
031    
032    import org.w3c.dom.Element;
033    
034    /**
035     * @author Kuali Student Team (Kamal)
036     */
037    @XmlAccessorType(XmlAccessType.FIELD)
038    @XmlType(name = "ActivityOfferingClusterInfo", propOrder = {
039                    "id", "typeKey", "stateKey", "name", "descr",
040                    "privateName", "formatOfferingId", "activityOfferingSets",
041                    "meta", "attributes", "_futureElements"})
042    
043    public class ActivityOfferingClusterInfo
044        extends IdEntityInfo 
045        implements ActivityOfferingCluster {
046    
047        private static final long serialVersionUID = 1L;
048    
049        @XmlElement
050        private String privateName;
051    
052        @XmlElement
053        private String formatOfferingId;
054    
055        @XmlElement
056        private List<ActivityOfferingSetInfo> activityOfferingSets;
057    
058        @XmlAnyElement
059        private List<Element> _futureElements;
060    
061        
062        /**
063         * Constructs a new ActivityOfferingClusterInfo.
064         */
065        public ActivityOfferingClusterInfo() {
066        }
067    
068        /**
069         * Constructs a new ActivityOfferingClusterInfo from another
070         * ActivityOfferingCluster.
071         *
072         * @param template the registration group template to copy
073         */
074        public ActivityOfferingClusterInfo(ActivityOfferingCluster template) {
075            super(template); 
076            
077            if (template == null) {
078                return;      
079            }
080    
081            this.formatOfferingId = template.getFormatOfferingId();
082            if (template.getActivityOfferingSets() != null) {
083                this.activityOfferingSets = new ArrayList<ActivityOfferingSetInfo>(template.getActivityOfferingSets().size());
084                for (ActivityOfferingSet aotemplate : template.getActivityOfferingSets()) {
085                    this.activityOfferingSets.add(new ActivityOfferingSetInfo(aotemplate));
086                }
087            }
088        }
089    
090        @Override
091        public String getPrivateName() {
092            return this.privateName;
093        }
094    
095        public void setPrivateName(String privateName) {
096            this.privateName = privateName;
097        }
098    
099        @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    }