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  package org.kuali.student.enrollment.batchjobresults.dto;
17  
18  import java.util.List;
19  
20  import javax.xml.bind.annotation.XmlAccessType;
21  import javax.xml.bind.annotation.XmlAccessorType;
22  import javax.xml.bind.annotation.XmlAnyElement;
23  import javax.xml.bind.annotation.XmlElement;
24  import javax.xml.bind.annotation.XmlType;
25  
26  import org.kuali.student.enrollment.batchjobresults.infc.BatchJobResult;
27  import org.kuali.student.r2.common.dto.AttributeInfo;
28  import org.kuali.student.r2.common.dto.ContextInfo;
29  import org.kuali.student.r2.common.dto.IdEntityInfo;
30  import org.kuali.student.r2.common.dto.RichTextInfo;
31  import org.kuali.student.r2.common.infc.Attribute;
32  import org.w3c.dom.Element;
33  
34  @XmlAccessorType(XmlAccessType.FIELD)
35  @XmlType(name = "SocInfo", propOrder = {"id",
36      "typeKey",
37      "stateKey",
38      "name",
39      "descr",
40      "parameters",
41      "context",
42      "globalResults",
43      "itemsProcessed",
44      "itemsExpected",
45      "message",
46      "meta",
47      "attributes",
48      "_futureElements"})
49  public class BatchJobResultInfo
50          extends IdEntityInfo
51          implements BatchJobResult {
52  
53      private static final long serialVersionUID = 1L;
54      @XmlElement
55      private List<AttributeInfo> parameters;
56      @XmlElement
57      private ContextInfo context;
58      @XmlElement
59      private List<AttributeInfo> globalResults;
60      @XmlElement
61      private Integer itemsProcessed;
62      @XmlElement
63      private Integer itemsExpected;
64      @XmlElement
65      private RichTextInfo message;
66      @XmlAnyElement
67      private List<Element> _futureElements;
68  
69      public BatchJobResultInfo() {
70      }
71  
72      /**
73       * Copies batch job result
74       */
75      public BatchJobResultInfo(BatchJobResult orig) {
76  
77          super(orig);
78  
79          if (orig == null) {
80              return;
81          }
82  
83          if (orig.getParameters() != null) {
84              for (Attribute attr : orig.getParameters()) {
85                  this.getParameters().add(new AttributeInfo(attr));
86              }
87          }
88          if (orig.getGlobalResults() != null) {
89              for (Attribute attr : orig.getGlobalResults()) {
90                  this.getGlobalResults().add(new AttributeInfo(attr));
91              }
92          }
93          this.context = new ContextInfo(orig.getContext());
94          this.itemsProcessed = orig.getItemsProcessed();
95          this.itemsExpected = orig.getItemsExpected();
96          if (orig.getMessage() != null) {
97              this.message = new RichTextInfo (orig.getMessage());
98          }
99      }
100 
101     @Override
102     public ContextInfo getContext() {
103         return context;
104     }
105 
106     public void setContext(ContextInfo context) {
107         this.context = context;
108     }
109 
110     @Override
111     public List<AttributeInfo> getGlobalResults() {
112         return globalResults;
113     }
114 
115     public void setGlobalResults(List<AttributeInfo> globalResults) {
116         this.globalResults = globalResults;
117     }
118 
119     @Override
120     public List<AttributeInfo> getParameters() {
121         return parameters;
122     }
123 
124     public void setParameters(List<AttributeInfo> parameters) {
125         this.parameters = parameters;
126     }
127 
128     @Override
129     public Integer getItemsProcessed() {
130         return itemsProcessed;
131     }
132 
133     public void setItemsProcessed(Integer itemsProcessed) {
134         this.itemsProcessed = itemsProcessed;
135     }
136 
137     @Override
138     public Integer getItemsExpected() {
139         return itemsExpected;
140     }
141 
142     public void setItemsExpected(Integer itemsExpected) {
143         this.itemsExpected = itemsExpected;
144     }
145 
146     @Override
147     public RichTextInfo getMessage() {
148         return message;
149     }
150 
151     public void setMessage(RichTextInfo message) {
152         this.message = message;
153     }
154 
155    
156 }