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 */
016package org.kuali.student.enrollment.courseofferingset.dto;
017
018import java.util.ArrayList;
019import java.util.Date;
020import java.util.List;
021
022import javax.xml.bind.annotation.XmlAccessType;
023import javax.xml.bind.annotation.XmlAccessorType;
024import javax.xml.bind.annotation.XmlAnyElement;
025import javax.xml.bind.annotation.XmlElement;
026import javax.xml.bind.annotation.XmlType;
027
028import org.kuali.student.enrollment.courseofferingset.infc.SocRolloverResult;
029import org.kuali.student.r2.common.dto.IdNamelessEntityInfo;
030import org.kuali.student.r2.common.dto.RichTextInfo;
031import org.w3c.dom.Element;
032
033@XmlAccessorType(XmlAccessType.FIELD)
034@XmlType(name = "SocRolloverResultInfo", propOrder = {"id",
035    "typeKey",
036    "stateKey",
037    "sourceSocId",
038    "targetSocId",
039    "targetTermId",
040    "optionKeys",
041    "itemsProcessed",
042    "itemsExpected",
043    "courseOfferingsCreated",
044    "courseOfferingsSkipped",
045    "activityOfferingsCreated",
046    "activityOfferingsSkipped",
047    "sourceTermId",
048    "message",
049    "dateInitiated",
050    "dateCompleted",
051    "meta",
052    "attributes",
053    "_futureElements"})
054public class SocRolloverResultInfo
055        extends IdNamelessEntityInfo
056        implements SocRolloverResult {
057
058    private static final long serialVersionUID = 1L;
059    @XmlElement
060    private String sourceSocId;
061    @XmlElement
062    private String targetSocId;
063    @XmlElement
064    private String targetTermId;
065    @XmlElement
066    private List<String> optionKeys;
067    @XmlElement
068    private Integer itemsProcessed;
069    @XmlElement
070    private Integer itemsExpected;
071    @XmlElement
072    private Integer courseOfferingsCreated;
073    @XmlElement
074    private Integer courseOfferingsSkipped;
075    @XmlElement
076    private Integer activityOfferingsCreated;
077    @XmlElement
078    private Integer activityOfferingsSkipped;
079    @XmlElement
080    private String sourceTermId;
081    @XmlElement
082    private RichTextInfo message;
083    @XmlElement
084    private Date dateInitiated;
085    @XmlElement
086    private Date dateCompleted;
087    @XmlAnyElement
088    private List<Element> _futureElements;
089
090    public SocRolloverResultInfo() {
091        // Might as well initialize this to something sensible
092        courseOfferingsCreated = 0;
093        courseOfferingsSkipped = 0;
094        activityOfferingsCreated = 0;
095        activityOfferingsSkipped = 0;
096    }
097
098    /**
099     * Copies Soc rollover results
100     *
101     * @param
102     */
103    public SocRolloverResultInfo(SocRolloverResult orig) {
104
105        super(orig);
106
107        if (orig == null) {
108            return;
109        }
110
111        this.sourceSocId = orig.getSourceSocId();
112        this.targetSocId = orig.getTargetSocId();
113        this.targetTermId = orig.getTargetTermId();
114        this.optionKeys = new ArrayList<String>(orig.getOptionKeys());
115        this.itemsProcessed = orig.getItemsProcessed();
116        this.itemsExpected = orig.getItemsExpected();
117        this.courseOfferingsCreated = orig.getCourseOfferingsCreated();
118        this.courseOfferingsSkipped = orig.getCourseOfferingsSkipped();
119        this.activityOfferingsCreated = orig.getActivityOfferingsCreated();
120        this.activityOfferingsSkipped = orig.getActivityOfferingsSkipped();
121        this.sourceTermId = orig.getSourceTermId();
122        if (orig.getMessage() != null) {
123            this.message = new RichTextInfo (orig.getMessage());
124        }
125        this.dateInitiated = orig.getDateInitiated();
126        this.dateCompleted = orig.getDateCompleted();
127    }
128
129    @Override
130    public List<String> getOptionKeys() {
131        if (this.optionKeys == null) {
132            this.optionKeys = new ArrayList<String>();
133        }
134        return optionKeys;
135    }
136
137    public void setOptionKeys(List<String> optionKeys) {
138        this.optionKeys = optionKeys;
139    }
140
141    @Override
142    public String getSourceSocId() {
143        return sourceSocId;
144    }
145
146    public void setSourceSocId(String sourceSocId) {
147        this.sourceSocId = sourceSocId;
148    }
149
150    @Override
151    public String getTargetSocId() {
152        return targetSocId;
153    }
154
155    public void setTargetSocId(String targetSocId) {
156        this.targetSocId = targetSocId;
157    }
158
159    @Override
160    public String getTargetTermId() {
161        return targetTermId;
162    }
163
164    public void setTargetTermId(String targetTermId) {
165        this.targetTermId = targetTermId;
166    }
167
168    @Override
169    public Integer getItemsProcessed() {
170        return itemsProcessed;
171    }
172
173    public void setItemsProcessed(Integer itemsProcessed) {
174        this.itemsProcessed = itemsProcessed;
175    }
176
177    @Override
178    public Integer getItemsExpected() {
179        return itemsExpected;
180    }
181
182    public void setItemsExpected(Integer itemsExpected) {
183        this.itemsExpected = itemsExpected;
184    }
185
186    @Override
187    public RichTextInfo getMessage() {
188        return message;
189    }
190
191    public void setMessage(RichTextInfo message) {
192        this.message = message;
193    }
194
195    @Override
196    public Integer getActivityOfferingsCreated() {
197        return activityOfferingsCreated;
198    }
199
200    public void setActivityOfferingsCreated(Integer activityOfferingsCreated) {
201        this.activityOfferingsCreated = activityOfferingsCreated;
202    }
203
204    @Override
205    public Integer getActivityOfferingsSkipped() {
206        return activityOfferingsSkipped;
207    }
208
209    public void setActivityOfferingsSkipped(Integer activityOfferingsSkipped) {
210        this.activityOfferingsSkipped = activityOfferingsSkipped;
211    }
212
213    @Override
214    public Integer getCourseOfferingsCreated() {
215        return courseOfferingsCreated;
216    }
217
218    public void setCourseOfferingsCreated(Integer courseOfferingsCreated) {
219        this.courseOfferingsCreated = courseOfferingsCreated;
220    }
221
222    @Override
223    public Integer getCourseOfferingsSkipped() {
224        return courseOfferingsSkipped;
225    }
226
227    public void setCourseOfferingsSkipped(Integer courseOfferingsSkipped) {
228        this.courseOfferingsSkipped = courseOfferingsSkipped;
229    }
230
231    @Override
232    public String getSourceTermId() {
233        return sourceTermId;
234    }
235
236    public void setSourceTermId(String sourceTermId) {
237        this.sourceTermId = sourceTermId;
238    }
239
240    @Override
241    public Date getDateInitiated() {
242        return dateInitiated;
243    }
244
245    public void setDateInitiated(Date dateInitiated) {
246        this.dateInitiated = dateInitiated;
247    }
248
249    @Override
250    public Date getDateCompleted() {
251        return dateCompleted;
252    }
253
254    public void setDateCompleted(Date dateCompleted) {
255        this.dateCompleted = dateCompleted;
256    }
257}