1 /**
2 * Copyright 2005-2016 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.util;
17
18 import org.apache.commons.lang.StringUtils;
19
20 /**
21 * KRA Audit Error class.
22 *
23 * @author Kuali Rice Team (rice.collab@kuali.org)
24 */
25 public class AuditError {
26
27 private String errorKey;
28 private String validationKey;
29 private String messageKey;
30 private String link;
31 private String[] params;
32
33 public AuditError(String errorKey, String messageKey, String link) {
34 this.setErrorKey(errorKey);
35 this.setMessageKey(messageKey);
36 this.setLink(link);
37 this.params = new String[5]; // bean:message takes up to 5 tokenized parameters
38 }
39
40 public AuditError(String errorKey, String messageKey, String link, String[] params) {
41 this(errorKey, messageKey, link);
42 this.setParams(params);
43 }
44
45 /**
46 * Gets the errorKey attribute.
47 *
48 * @return Returns the errorKey.
49 */
50 public String getErrorKey() {
51 return errorKey;
52 }
53
54 /**
55 * Sets the errorKey attribute value.
56 *
57 * @param errorKey The errorKey to set.
58 */
59 public void setErrorKey(String errorKey) {
60 this.errorKey = errorKey;
61 }
62
63 /**
64 * The key used to match in the ValidationMessages component, should either be id, property path,
65 * or a key to match for that component; if NOT set, this will return errorKey.
66 *
67 * @return the validation key used by ValidationMessages
68 */
69 public String getValidationKey() {
70 if (StringUtils.isBlank(validationKey)) {
71 return errorKey;
72 }
73 return validationKey;
74 }
75
76 /**
77 * @see #getValidationKey()
78 */
79 public void setValidationKey(String validationKey) {
80 this.validationKey = validationKey;
81 }
82
83 /**
84 * Gets the link attribute.
85 *
86 * @return Returns the link.
87 */
88 public String getLink() {
89 return link;
90 }
91
92 /**
93 * Sets the link attribute value.
94 *
95 * @param link The link to set.
96 */
97 public void setLink(String link) {
98 this.link = link;
99 }
100
101 /**
102 * Gets the key attribute.
103 *
104 * @return Returns the key.
105 */
106 public String getMessageKey() {
107 return messageKey;
108 }
109
110 /**
111 * Sets the key attribute value.
112 *
113 * @param key The key to set.
114 */
115 public void setMessageKey(String messageKey) {
116 this.messageKey = messageKey;
117 }
118
119 /**
120 * Gets the params attribute.
121 *
122 * @return Returns the params.
123 */
124 public String[] getParams() {
125 return params;
126 }
127
128 /**
129 * Sets the params attribute value.
130 *
131 * @param params The params to set.
132 */
133 public void setParams(String[] params) {
134 this.params = params;
135 }
136 }