View Javadoc

1   /**
2    * Copyright 2010 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10   * software distributed under the License is distributed on an "AS IS"
11   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing
13   * permissions and limitations under the License.
14   */
15  
16  package org.kuali.student.r2.common.messages.dto;
17  
18  import java.io.Serializable;
19  import java.util.List;
20  
21  import javax.xml.bind.annotation.XmlAccessType;
22  import javax.xml.bind.annotation.XmlAccessorType;
23  import javax.xml.bind.annotation.XmlAnyElement;
24  import javax.xml.bind.annotation.XmlElement;
25  import javax.xml.bind.annotation.XmlType;
26  
27  import org.kuali.student.r2.common.dto.LocaleInfo;
28  import org.kuali.student.r2.common.messages.infc.Message;
29  //import org.w3c.dom.Element;
30  
31  /**
32   *
33   * Refer to interface javadoc
34   *
35   * @Version 2.0
36   * @Author Sri komandur@uw.edu
37   *
38   */
39  
40  @XmlAccessorType(XmlAccessType.FIELD)
41  @XmlType(name = "MessageInfo", propOrder = { 
42                  "messageKey", "locale", "groupName", "value", "_futureElements" })
43  
44  public class MessageInfo 
45      implements Message, Serializable {
46  
47      private static final long serialVersionUID = 1L;
48  
49      @XmlElement
50      private String messageKey;
51  
52      @XmlElement
53      private LocaleInfo locale;
54  
55      @XmlElement
56      private String groupName;
57  
58      @XmlElement
59      private String value;
60  
61      @XmlAnyElement
62      private List<Object> _futureElements;  
63  
64  
65      /**
66       * Constructs a new MessageInfo.
67       */
68      public MessageInfo() {
69      }
70  
71      /**
72       * Constructs a new MessageInfo from a Message.
73       *
74       * @param message the Message to copy
75       */
76      public MessageInfo(Message message) {
77          if(message != null) {
78              if (message.getLocale() != null) {
79                  this.locale = new LocaleInfo(message.getLocale());
80              }
81              this.messageKey = message.getMessageKey();
82              this.groupName = message.getGroupName();
83              this.value = message.getValue();
84          }
85      }
86  
87      @Override
88      public String getMessageKey() {
89          return this.messageKey;
90      }
91  
92      public void setMessageKey(String messageKey) {
93          this.messageKey = messageKey;
94      }
95  
96      @Override
97      public LocaleInfo getLocale() {
98          return this.locale;
99      }
100 
101     public void setLocale(LocaleInfo locale) {
102         this.locale = locale;
103     }
104 
105     @Override
106     public String getGroupName() {
107         return this.groupName;
108     }
109 
110     public void setGroupName(String groupName) {
111         this.groupName = groupName;
112     }
113 
114     @Override
115     public String getValue() {
116         return this.value;
117     }
118 
119     public void setValue(String value) {
120         this.value = value;
121     }
122 }