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" }) 
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      @XmlAnyElement
54      private List<Object> _futureElements;  
55  
56  
57      /**
58       * Constructs a new OperationStatusInfo.
59       */
60      public OperationStatusInfo() {
61      }
62      
63      /**
64       * Constructs a new OperationStatusInfo from another
65       * OperationStatus.
66       *
67       * @param status the OperationStatus to copy
68       */
69      public OperationStatusInfo (OperationStatus status) {
70          if (status != null) {
71              this.status = status.getStatus();
72              if (status.getMessages() != null) {
73                  this.messages = new ArrayList(status.getMessages());
74              }
75  
76              if (status.getWarnings() != null) {
77                  this.warnings = new ArrayList(status.getWarnings());
78              }
79  
80              if (status.getErrors() != null) {
81                  this.errors = new ArrayList(status.getErrors());
82              }
83          }
84      }
85  
86      @Override
87      public String getStatus() {
88          return status;
89      }
90  
91      public void setStatus(String status) {
92          this.status = status;
93      }
94  
95      @Override
96      public List<String> getMessages() {
97          if (messages == null) {
98              messages = new ArrayList<String>(0);
99          }
100 
101         return messages;
102     }
103 
104     public void setMessages(List<String> messages) {
105         this.messages = messages;
106     }
107     
108     @Override
109     public List<String> getWarnings() {
110         if (warnings == null) {
111             warnings = new ArrayList<String>(0);
112         }
113 
114         return warnings;
115     }
116 
117     public void setWarnings(List<String> warnings) {
118         this.warnings = warnings;
119     }
120 
121     @Override
122     public List<String> getErrors() {
123         if (errors == null) {
124             errors = new ArrayList<String>(0);
125         }
126 
127         return errors;
128     }
129 
130     public void setErrors(List<String> errors) {
131         this.errors = errors;
132     }
133 }