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.util; 017 018import org.apache.commons.lang.StringUtils; 019 020/** 021 * KRA Audit Error class. 022 * 023 * @author Kuali Rice Team (rice.collab@kuali.org) 024 */ 025public class AuditError { 026 027 private String errorKey; 028 private String validationKey; 029 private String messageKey; 030 private String link; 031 private String[] params; 032 033 public AuditError(String errorKey, String messageKey, String link) { 034 this.setErrorKey(errorKey); 035 this.setMessageKey(messageKey); 036 this.setLink(link); 037 this.params = new String[5]; // bean:message takes up to 5 tokenized parameters 038 } 039 040 public AuditError(String errorKey, String messageKey, String link, String[] params) { 041 this(errorKey, messageKey, link); 042 this.setParams(params); 043 } 044 045 /** 046 * Gets the errorKey attribute. 047 * 048 * @return Returns the errorKey. 049 */ 050 public String getErrorKey() { 051 return errorKey; 052 } 053 054 /** 055 * Sets the errorKey attribute value. 056 * 057 * @param errorKey The errorKey to set. 058 */ 059 public void setErrorKey(String errorKey) { 060 this.errorKey = errorKey; 061 } 062 063 /** 064 * The key used to match in the ValidationMessages component, should either be id, property path, 065 * or a key to match for that component; if NOT set, this will return errorKey. 066 * 067 * @return the validation key used by ValidationMessages 068 */ 069 public String getValidationKey() { 070 if (StringUtils.isBlank(validationKey)) { 071 return errorKey; 072 } 073 return validationKey; 074 } 075 076 /** 077 * @see #getValidationKey() 078 */ 079 public void setValidationKey(String validationKey) { 080 this.validationKey = validationKey; 081 } 082 083 /** 084 * Gets the link attribute. 085 * 086 * @return Returns the link. 087 */ 088 public String getLink() { 089 return link; 090 } 091 092 /** 093 * Sets the link attribute value. 094 * 095 * @param link The link to set. 096 */ 097 public void setLink(String link) { 098 this.link = link; 099 } 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}