1 /*
2 * Copyright (c) 2002-2014, Mairie de Paris
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright notice
10 * and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright notice
13 * and the following disclaimer in the documentation and/or other materials
14 * provided with the distribution.
15 *
16 * 3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 *
32 * License 1.0
33 */
34 package fr.paris.lutece.portal.business.regularexpression;
35
36
37 /**
38 *
39 * RegularExpression
40 *
41 */
42 public class RegularExpression
43 {
44 private int _nIdExpression;
45 private String _strTitle;
46 private String _strValue;
47 private String _strInformationMessage;
48 private String _strErrorMessage;
49 private String _strValidExemple;
50
51 /**
52 *return the id of the regular expression
53 * @return the id of the regular expression
54 */
55 public int getIdExpression( )
56 {
57 return _nIdExpression;
58 }
59
60 /**
61 * set the id of the regular expression
62 * @param idExpression the id of the regular expression
63 */
64 public void setIdExpression( int idExpression )
65 {
66 _nIdExpression = idExpression;
67 }
68
69 /**
70 * return the error message
71 * @return the error message
72 */
73 public String getErrorMessage( )
74 {
75 return _strErrorMessage;
76 }
77
78 /**
79 * set the error message
80 * @param errorMessage the error message
81 */
82 public void setErrorMessage( String errorMessage )
83 {
84 _strErrorMessage = errorMessage;
85 }
86
87 /**
88 *
89 * return a valid exemple which is validate by the regular expression
90 * @return a valid exemple
91 */
92 public String getValidExemple( )
93 {
94 return _strValidExemple;
95 }
96
97 /**
98 * set a valid exemple which is validate by the regular expression
99 * @param exempleValide a valid exemple
100 */
101 public void setValidExemple( String exempleValide )
102 {
103 _strValidExemple = exempleValide;
104 }
105
106 /**
107 *return the information message
108 * @return the information message
109 */
110 public String getInformationMessage( )
111 {
112 return _strInformationMessage;
113 }
114
115 /**
116 * set the information message
117 * @param informationMessage the information message
118 */
119 public void setInformationMessage( String informationMessage )
120 {
121 _strInformationMessage = informationMessage;
122 }
123
124 /**
125 * return the title of the regular expression
126 * @return the title of the regular expression
127 */
128 public String getTitle( )
129 {
130 return _strTitle;
131 }
132
133 /**
134 * set the title of the regular expression
135 * @param title the title of the regular expression
136 */
137 public void setTitle( String title )
138 {
139 _strTitle = title;
140 }
141
142 /**
143 * return the value of the regular expression
144 * @return the value of the regular expression
145 */
146 public String getValue( )
147 {
148 return _strValue;
149 }
150
151 /**
152 * set the value of the regular expression
153 * @param value the value of the regular expression
154 */
155 public void setValue( String value )
156 {
157 _strValue = value;
158 }
159
160 /**
161 * @param obj the object to compare
162 * @return true if the regularExpression in parameter is the same regularExpression
163 */
164 public boolean equals( Object obj )
165 {
166 if ( obj instanceof RegularExpression && ( ( (RegularExpression) obj ).getIdExpression( ) == _nIdExpression ) )
167 {
168 return true;
169 }
170
171 return false;
172 }
173
174 /**
175 * @return the id of the expression
176 */
177 public int hashCode( )
178 {
179 return _nIdExpression;
180 }
181 }