View Javadoc

1   /**
2    * Copyright 2005-2011 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.kew.rule;
17  
18  import java.io.Serializable;
19  
20  import org.kuali.rice.krad.util.MessageMap;
21  
22  
23  /**
24   * An error returned from the validation of a {@link WorkflowRuleAttribute}.
25   * Returned by a call to {@link WorkflowAttributeXmlValidator#validateClientRoutingData()}
26   * and {@link org.kuali.rice.kew.framework.document.attribute.SearchableAttribute#validateSearchFieldParameters(org.kuali.rice.kew.api.extension.ExtensionDefinition, java.util.Map, String)}
27   *
28   * @author Kuali Rice Team (rice.collab@kuali.org)
29   */
30  public class WorkflowAttributeValidationError implements Serializable {
31  
32  	private static final long serialVersionUID = 6785629049454272657L;
33  
34  	private MessageMap messageMap;
35  
36  	private String key;
37  	private String message;
38  
39  	public WorkflowAttributeValidationError(String key, String message) {
40  		this.key = key;
41  		this.message = message;
42  	}
43  
44  	public WorkflowAttributeValidationError(String key, String message, MessageMap messageMap) {
45  		this.key = key;
46  		this.message = message;
47  		this.messageMap = messageMap;
48  	}
49  
50  	/**
51  	 * @param key The key to set.
52  	 */
53  	public void setKey(String key) {
54  		this.key = key;
55  	}
56  
57  	/**
58  	 * @return Returns the key.
59  	 */
60  	public String getKey() {
61  		return key;
62  	}
63  
64  	/**
65  	 * @param message The message to set.
66  	 */
67  	public void setMessage(String message) {
68  		this.message = message;
69  	}
70  
71  	/**
72  	 * @return Returns the message.
73  	 */
74  	public String getMessage() {
75  		return message;
76  	}
77  
78  	/**
79  	 * @return the messageMap
80  	 */
81  	public MessageMap getMessageMap() {
82  		return this.messageMap;
83  	}
84  
85  	/**
86  	 * @param messageMap the messageMap to set
87  	 */
88  	public void setMessageMap(MessageMap messageMap) {
89  		this.messageMap = messageMap;
90  	}
91  
92  	public static org.kuali.rice.kew.api.document.attribute.WorkflowAttributeValidationError to(WorkflowAttributeValidationError validationError) {
93  	    if (validationError == null) {
94  	        return null;
95  	    }
96  	    return org.kuali.rice.kew.api.document.attribute.WorkflowAttributeValidationError
97                  .create(validationError.getKey(), validationError.getMessage());
98  	}
99  
100 }