View Javadoc

1   /*
2    * Copyright 2010 The Kuali Foundation 
3    *
4    * Licensed under the Educational Community License, Version 2.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.osedu.org/licenses/ECL-2.0
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  
17  package org.kuali.student.r2.common.dto;
18  
19  import java.io.Serializable;
20  import java.util.ArrayList;
21  import java.util.List;
22  
23  import javax.xml.bind.annotation.XmlAccessType;
24  import javax.xml.bind.annotation.XmlAccessorType;
25  import javax.xml.bind.annotation.XmlAnyElement;
26  import javax.xml.bind.annotation.XmlElement;
27  import javax.xml.bind.annotation.XmlType;
28  
29  import org.kuali.student.r2.common.infc.OperationStatus;
30  //import org.w3c.dom.Element;
31  
32  @XmlAccessorType(XmlAccessType.FIELD)
33  @XmlType(name = "OperationStatusInfo", propOrder = {
34                  "status", "messages", "warnings", "errors" })//, "_futureElements" }) TODO KSCM-372: Non-GWT translatable code
35  
36  public class OperationStatusInfo 
37      implements OperationStatus, Serializable {
38  
39      private static final long serialVersionUID = 1L;
40  
41      @XmlElement
42      private String status;
43  
44      @XmlElement
45      private List<String> messages;
46  
47      @XmlElement
48      private List<String> warnings;
49  
50      @XmlElement
51      private List<String> errors;
52  
53  //    TODO KSCM-372: Non-GWT translatable code
54  //    @XmlAnyElement
55  //    private List<Element> _futureElements;
56  
57  
58      /**
59       * Constructs a new OperationStatusInfo.
60       */
61      public OperationStatusInfo() {
62      }
63      
64      /**
65       * Constructs a new OperationStatusInfo from another
66       * OperationStatus.
67       *
68       * @param status the OperationStatus to copy
69       */
70      public OperationStatusInfo (OperationStatus status) {
71          if (status != null) {
72              this.status = status.getStatus();
73              if (status.getMessages() != null) {
74                  this.messages = new ArrayList(status.getMessages());
75              }
76  
77              if (status.getWarnings() != null) {
78                  this.warnings = new ArrayList(status.getWarnings());
79              }
80  
81              if (status.getErrors() != null) {
82                  this.errors = new ArrayList(status.getErrors());
83              }
84          }
85      }
86  
87      @Override
88      public String getStatus() {
89          return status;
90      }
91  
92      public void setStatus(String status) {
93          this.status = status;
94      }
95  
96      @Override
97      public List<String> getMessages() {
98          if (messages == null) {
99              messages = new ArrayList<String>(0);
100         }
101 
102         return messages;
103     }
104 
105     public void setMessages(List<String> messages) {
106         this.messages = messages;
107     }
108     
109     @Override
110     public List<String> getWarnings() {
111         if (warnings == null) {
112             warnings = new ArrayList<String>(0);
113         }
114 
115         return warnings;
116     }
117 
118     public void setWarnings(List<String> warnings) {
119         this.warnings = warnings;
120     }
121 
122     @Override
123     public List<String> getErrors() {
124         if (errors == null) {
125             errors = new ArrayList<String>(0);
126         }
127 
128         return errors;
129     }
130 
131     public void setErrors(List<String> errors) {
132         this.errors = errors;
133     }
134 }