001/**
002 * Copyright 2005-2014 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.krad.data.bo;
017
018
019import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
020
021/**
022 * Holds the text and metadata for a message that will be given by the system, including validation
023 * messages, UI text (labels, instructions), and other text that has been externalized from the
024 * system
025 *
026 * @author Kuali Rice Team (rice.collab@kuali.org)
027 */
028public class SimpleTestBo extends PersistableBusinessObjectBase {
029
030    private String namespaceCode;
031    private String componentCode;
032    private String key;
033    private String locale;
034    private String description;
035    private String text;
036
037    public SimpleTestBo() {
038        super();
039    }
040
041    /**
042     * Namespace code (often an application or module code) that message is associated with, used for
043     * grouping messages
044     *
045     * @return String namespace code
046     */
047    public String getNamespaceCode() {
048        return namespaceCode;
049    }
050
051    /**
052     * Setter for the namespace code the message should be associated with
053     *
054     * @param namespaceCode
055     */
056    public void setNamespaceCode(String namespaceCode) {
057        this.namespaceCode = namespaceCode;
058    }
059
060    /**
061     * A code within the namespace that identifies a component or group, used for further grouping
062     * of messages within the namespace
063     *
064     * <p>
065     * Examples here could be a bean id, the class name of an object, or any application/module defined code
066     * </p>
067     *
068     * @return String representing a component code
069     */
070    public String getComponentCode() {
071        return componentCode;
072    }
073
074    /**
075     * Setter for the component code the message should be associated with
076     *
077     * @param componentCode
078     */
079    public void setComponentCode(String componentCode) {
080        this.componentCode = componentCode;
081    }
082
083    /**
084     * A key that uniquely identifies the message within the namespace and component
085     *
086     * <p>
087     * Within the UIF, this is generally used to indicate the property path the message is associated with
088     * (for example: "control.label"). For validation messages this is generally a combination that identifies
089     * the type of validation message and the validation performed (for example: "error.account.missing")
090     * </p>
091     *
092     * @return String message key
093     */
094    public String getKey() {
095        return key;
096    }
097
098    /**
099     * 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}