KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > engines > validation > ValidationError


1 /*
2  * ____.
3  * __/\ ______| |__/\. _______
4  * __ .____| | \ | +----+ \
5  * _______| /--| | | - \ _ | : - \_________
6  * \\______: :---| : : | : | \________>
7  * |__\---\_____________:______: :____|____:_____\
8  * /_____|
9  *
10  * . . . i n j a h i a w e t r u s t . . .
11  *
12  *
13  *
14  * ----- BEGIN LICENSE BLOCK -----
15  * Version: JCSL 1.0
16  *
17  * The contents of this file are subject to the Jahia Community Source License
18  * 1.0 or later (the "License"); you may not use this file except in
19  * compliance with the License. You may obtain a copy of the License at
20  * http://www.jahia.org/license
21  *
22  * Software distributed under the License is distributed on an "AS IS" basis,
23  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
24  * for the rights, obligations and limitations governing use of the contents
25  * of the file. The Original and Upgraded Code is the Jahia CMS and Portal
26  * Server. The developer of the Original and Upgraded Code is JAHIA Ltd. JAHIA
27  * Ltd. owns the copyrights in the portions it created. All Rights Reserved.
28  *
29  * The Shared Modifications are Jahia View Helper.
30  *
31  * The Developer of the Shared Modifications is Jahia Solution S�rl.
32  * Portions created by the Initial Developer are Copyright (C) 2002 by the
33  * Initial Developer. All Rights Reserved.
34  *
35  * Contributor(s):
36  * 28-Feb-2005, Commaro, Benjamin Papez
37  *
38  * ----- END LICENSE BLOCK -----
39  */

40
41 package org.jahia.engines.validation;
42
43
44 /**
45  *
46  * <p>Title: ValidationError</p>
47  * <p>Description: The object of this class holds a validation error for a Jahia field.</p>
48  * <p>Copyright: Copyright (c) 2004</p>
49  * <p>Company: Jahia Ltd</p>
50  * @author not attributable
51  * @version 1.0
52  */

53 public class ValidationError {
54     
55     private final Object JavaDoc source;
56     private final String JavaDoc msgError;
57     // Used to link a ValidationError to a RessourceBundle message, so we can
58
// easily use it in an EngineMessage.
59
private final String JavaDoc ressourceBundleProp;
60     private final String JavaDoc[] values;
61     
62     // Disable default constructor
63
private ValidationError() {
64         this.source = null;
65         this.msgError = null;
66         this.ressourceBundleProp = null;
67         this.values = null;
68     }
69     
70     public ValidationError(Object JavaDoc newSource, String JavaDoc newMsgError) {
71         this.source = newSource;
72         this.msgError = newMsgError;
73         this.ressourceBundleProp = null;
74         this.values = null;
75     }
76     
77     public ValidationError(Object JavaDoc newSource, String JavaDoc newMsgError,
78             String JavaDoc ressourceBundleProp, String JavaDoc[] values) {
79         this.source = newSource;
80         this.msgError = newMsgError;
81         this.ressourceBundleProp = ressourceBundleProp;
82         this.values = values;
83     }
84     
85     public Object JavaDoc getSource() {
86         return this.source;
87     }
88     
89     public String JavaDoc getMsgError() {
90         return this.msgError;
91     }
92     
93     public String JavaDoc getRessourceBundleProp() {
94         return ressourceBundleProp;
95     }
96     
97     public String JavaDoc[] getValues() {
98         return values;
99     }
100     
101     public String JavaDoc toString() {
102         final StringBuffer JavaDoc buff = new StringBuffer JavaDoc();
103         buff.append(ValidationError.class.getName()).
104                 append(": Source: " + source).
105                 append(", Message: " + msgError).
106                 append(", RessourceBundleProp: " + ressourceBundleProp);
107         return buff.toString();
108     }
109 }
110
Popular Tags