1   /**
2    * Copyright (c) 2000-2007 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.model.impl;
24  
25  import com.liferay.portal.kernel.util.GetterUtil;
26  import com.liferay.portal.model.impl.BaseModelImpl;
27  import com.liferay.portal.util.PropsUtil;
28  
29  import com.liferay.util.XSSUtil;
30  
31  import java.io.Serializable;
32  
33  import java.sql.Types;
34  
35  /**
36   * <a href="CountryModelImpl.java.html"><b><i>View Source</i></b></a>
37   *
38   * <p>
39   * ServiceBuilder generated this class. Modifications in this class will be overwritten
40   * the next time is generated.
41   * </p>
42   *
43   * <p>
44   * This class is a model that represents the <code>Country</code> table in the database.
45   * </p>
46   *
47   * @author Brian Wing Shun Chan
48   *
49   * @see com.liferay.portal.service.model.Country
50   * @see com.liferay.portal.service.model.CountryModel
51   * @see com.liferay.portal.service.model.impl.CountryImpl
52   *
53   */
54  public class CountryModelImpl extends BaseModelImpl {
55      public static String TABLE_NAME = "Country";
56      public static Object[][] TABLE_COLUMNS = {
57              { "countryId", new Integer(Types.BIGINT) },
58              { "name", new Integer(Types.VARCHAR) },
59              { "a2", new Integer(Types.VARCHAR) },
60              { "a3", new Integer(Types.VARCHAR) },
61              { "number_", new Integer(Types.VARCHAR) },
62              { "idd_", new Integer(Types.VARCHAR) },
63              { "active_", new Integer(Types.BOOLEAN) }
64          };
65      public static String TABLE_SQL_CREATE = "create table Country (countryId LONG not null primary key,name VARCHAR(75) null,a2 VARCHAR(75) null,a3 VARCHAR(75) null,number_ VARCHAR(75) null,idd_ VARCHAR(75) null,active_ BOOLEAN)";
66      public static String TABLE_SQL_DROP = "drop table Country";
67      public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
68                  "xss.allow.com.liferay.portal.model.Country"), XSS_ALLOW);
69      public static boolean XSS_ALLOW_NAME = GetterUtil.getBoolean(PropsUtil.get(
70                  "xss.allow.com.liferay.portal.model.Country.name"),
71              XSS_ALLOW_BY_MODEL);
72      public static boolean XSS_ALLOW_A2 = GetterUtil.getBoolean(PropsUtil.get(
73                  "xss.allow.com.liferay.portal.model.Country.a2"),
74              XSS_ALLOW_BY_MODEL);
75      public static boolean XSS_ALLOW_A3 = GetterUtil.getBoolean(PropsUtil.get(
76                  "xss.allow.com.liferay.portal.model.Country.a3"),
77              XSS_ALLOW_BY_MODEL);
78      public static boolean XSS_ALLOW_NUMBER = GetterUtil.getBoolean(PropsUtil.get(
79                  "xss.allow.com.liferay.portal.model.Country.number"),
80              XSS_ALLOW_BY_MODEL);
81      public static boolean XSS_ALLOW_IDD = GetterUtil.getBoolean(PropsUtil.get(
82                  "xss.allow.com.liferay.portal.model.Country.idd"),
83              XSS_ALLOW_BY_MODEL);
84      public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
85                  "lock.expiration.time.com.liferay.portal.model.CountryModel"));
86  
87      public CountryModelImpl() {
88      }
89  
90      public long getPrimaryKey() {
91          return _countryId;
92      }
93  
94      public void setPrimaryKey(long pk) {
95          setCountryId(pk);
96      }
97  
98      public Serializable getPrimaryKeyObj() {
99          return new Long(_countryId);
100     }
101 
102     public long getCountryId() {
103         return _countryId;
104     }
105 
106     public void setCountryId(long countryId) {
107         if (countryId != _countryId) {
108             _countryId = countryId;
109         }
110     }
111 
112     public String getName() {
113         return GetterUtil.getString(_name);
114     }
115 
116     public void setName(String name) {
117         if (((name == null) && (_name != null)) ||
118                 ((name != null) && (_name == null)) ||
119                 ((name != null) && (_name != null) && !name.equals(_name))) {
120             if (!XSS_ALLOW_NAME) {
121                 name = XSSUtil.strip(name);
122             }
123 
124             _name = name;
125         }
126     }
127 
128     public String getA2() {
129         return GetterUtil.getString(_a2);
130     }
131 
132     public void setA2(String a2) {
133         if (((a2 == null) && (_a2 != null)) || ((a2 != null) && (_a2 == null)) ||
134                 ((a2 != null) && (_a2 != null) && !a2.equals(_a2))) {
135             if (!XSS_ALLOW_A2) {
136                 a2 = XSSUtil.strip(a2);
137             }
138 
139             _a2 = a2;
140         }
141     }
142 
143     public String getA3() {
144         return GetterUtil.getString(_a3);
145     }
146 
147     public void setA3(String a3) {
148         if (((a3 == null) && (_a3 != null)) || ((a3 != null) && (_a3 == null)) ||
149                 ((a3 != null) && (_a3 != null) && !a3.equals(_a3))) {
150             if (!XSS_ALLOW_A3) {
151                 a3 = XSSUtil.strip(a3);
152             }
153 
154             _a3 = a3;
155         }
156     }
157 
158     public String getNumber() {
159         return GetterUtil.getString(_number);
160     }
161 
162     public void setNumber(String number) {
163         if (((number == null) && (_number != null)) ||
164                 ((number != null) && (_number == null)) ||
165                 ((number != null) && (_number != null) &&
166                 !number.equals(_number))) {
167             if (!XSS_ALLOW_NUMBER) {
168                 number = XSSUtil.strip(number);
169             }
170 
171             _number = number;
172         }
173     }
174 
175     public String getIdd() {
176         return GetterUtil.getString(_idd);
177     }
178 
179     public void setIdd(String idd) {
180         if (((idd == null) && (_idd != null)) ||
181                 ((idd != null) && (_idd == null)) ||
182                 ((idd != null) && (_idd != null) && !idd.equals(_idd))) {
183             if (!XSS_ALLOW_IDD) {
184                 idd = XSSUtil.strip(idd);
185             }
186 
187             _idd = idd;
188         }
189     }
190 
191     public boolean getActive() {
192         return _active;
193     }
194 
195     public boolean isActive() {
196         return _active;
197     }
198 
199     public void setActive(boolean active) {
200         if (active != _active) {
201             _active = active;
202         }
203     }
204 
205     public Object clone() {
206         CountryImpl clone = new CountryImpl();
207         clone.setCountryId(getCountryId());
208         clone.setName(getName());
209         clone.setA2(getA2());
210         clone.setA3(getA3());
211         clone.setNumber(getNumber());
212         clone.setIdd(getIdd());
213         clone.setActive(getActive());
214 
215         return clone;
216     }
217 
218     public int compareTo(Object obj) {
219         if (obj == null) {
220             return -1;
221         }
222 
223         CountryImpl country = (CountryImpl)obj;
224         int value = 0;
225         value = getName().compareTo(country.getName());
226 
227         if (value != 0) {
228             return value;
229         }
230 
231         return 0;
232     }
233 
234     public boolean equals(Object obj) {
235         if (obj == null) {
236             return false;
237         }
238 
239         CountryImpl country = null;
240 
241         try {
242             country = (CountryImpl)obj;
243         }
244         catch (ClassCastException cce) {
245             return false;
246         }
247 
248         long pk = country.getPrimaryKey();
249 
250         if (getPrimaryKey() == pk) {
251             return true;
252         }
253         else {
254             return false;
255         }
256     }
257 
258     public int hashCode() {
259         return (int)getPrimaryKey();
260     }
261 
262     private long _countryId;
263     private String _name;
264     private String _a2;
265     private String _a3;
266     private String _number;
267     private String _idd;
268     private boolean _active;
269 }