View Javadoc
1   /**
2    * Copyright 2005-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.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 implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.krad.data.bo;
17  
18  
19  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
20  
21  /**
22   * Holds the text and metadata for a message that will be given by the system, including validation
23   * messages, UI text (labels, instructions), and other text that has been externalized from the
24   * system
25   *
26   * @author Kuali Rice Team (rice.collab@kuali.org)
27   */
28  public class SimpleTestBo extends PersistableBusinessObjectBase {
29  
30      private String namespaceCode;
31      private String componentCode;
32      private String key;
33      private String locale;
34      private String description;
35      private String text;
36  
37      public SimpleTestBo() {
38          super();
39      }
40  
41      /**
42       * Namespace code (often an application or module code) that message is associated with, used for
43       * grouping messages
44       *
45       * @return String namespace code
46       */
47      public String getNamespaceCode() {
48          return namespaceCode;
49      }
50  
51      /**
52       * Setter for the namespace code the message should be associated with
53       *
54       * @param namespaceCode
55       */
56      public void setNamespaceCode(String namespaceCode) {
57          this.namespaceCode = namespaceCode;
58      }
59  
60      /**
61       * A code within the namespace that identifies a component or group, used for further grouping
62       * of messages within the namespace
63       *
64       * <p>
65       * Examples here could be a bean id, the class name of an object, or any application/module defined code
66       * </p>
67       *
68       * @return String representing a component code
69       */
70      public String getComponentCode() {
71          return componentCode;
72      }
73  
74      /**
75       * Setter for the component code the message should be associated with
76       *
77       * @param componentCode
78       */
79      public void setComponentCode(String componentCode) {
80          this.componentCode = componentCode;
81      }
82  
83      /**
84       * A key that uniquely identifies the message within the namespace and component
85       *
86       * <p>
87       * Within the UIF, this is generally used to indicate the property path the message is associated with
88       * (for example: "control.label"). For validation messages this is generally a combination that identifies
89       * the type of validation message and the validation performed (for example: "error.account.missing")
90       * </p>
91       *
92       * @return String message key
93       */
94      public String getKey() {
95          return key;
96      }
97  
98      /**
99       * Setter for the message key
100      *
101      * @param key
102      */
103     public void setKey(String key) {
104         this.key = key;
105     }
106 
107     /**
108      * Locale code the message is represented for, used for supporting messages in different
109      * languages
110      *
111      * @return message locale code
112      */
113     public String getLocale() {
114         return locale;
115     }
116 
117     /**
118      * Setter for the message locale code
119      *
120      * @param locale
121      */
122     public void setLocale(String locale) {
123         this.locale = locale;
124     }
125 
126     /**
127      * A description for the message
128      *
129      * <p>
130      * Not used by the framework, here for purposes of editing of messages and providing a description
131      * of the message to users
132      * </p>
133      *
134      * @return String message description
135      */
136     public String getDescription() {
137         return description;
138     }
139 
140     /**
141      * Setter for the message description
142      *
143      * @param description
144      */
145     public void setDescription(String description) {
146         this.description = description;
147     }
148 
149     /**
150      * Text value for the message
151      *
152      * <p>
153      * This holds the actual text for the message which is what will be displayed. Depending on how
154      * the message is being used it might contain parameters or other special syntax
155      * </p>
156      *
157      * @return String text for the message
158      */
159     public String getText() {
160         return text;
161     }
162 
163     /**
164      * Setter for the message text
165      *
166      * @param text
167      */
168     public void setText(String text) {
169         this.text = text;
170     }
171 
172     /**
173      * Generate toString using message key fields
174      *
175      * @return String representing the message object
176      */
177     @Override
178     public final String toString() {
179         StringBuffer buffer = new StringBuffer();
180 
181         buffer.append("namespaceCode=" + this.namespaceCode);
182         buffer.append(",componentCode=" + this.componentCode);
183         buffer.append(",key=" + this.key);
184         buffer.append(",locale=" + this.locale);
185 
186         return buffer.toString();
187     }
188 }