1
22
23 package com.liferay.portal.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.GetterUtil;
27 import com.liferay.portal.kernel.util.HtmlUtil;
28 import com.liferay.portal.model.Country;
29 import com.liferay.portal.model.CountrySoap;
30 import com.liferay.portal.util.PropsUtil;
31
32 import java.io.Serializable;
33
34 import java.lang.reflect.Proxy;
35
36 import java.sql.Types;
37
38 import java.util.ArrayList;
39 import java.util.List;
40
41
61 public class CountryModelImpl extends BaseModelImpl {
62 public static final String TABLE_NAME = "Country";
63 public static final Object[][] TABLE_COLUMNS = {
64 { "countryId", new Integer(Types.BIGINT) },
65
66
67 { "name", new Integer(Types.VARCHAR) },
68
69
70 { "a2", new Integer(Types.VARCHAR) },
71
72
73 { "a3", new Integer(Types.VARCHAR) },
74
75
76 { "number_", new Integer(Types.VARCHAR) },
77
78
79 { "idd_", new Integer(Types.VARCHAR) },
80
81
82 { "active_", new Integer(Types.BOOLEAN) }
83 };
84 public static final 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)";
85 public static final String TABLE_SQL_DROP = "drop table Country";
86 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
87 "value.object.finder.cache.enabled.com.liferay.portal.model.Country"),
88 true);
89
90 public static Country toModel(CountrySoap soapModel) {
91 Country model = new CountryImpl();
92
93 model.setCountryId(soapModel.getCountryId());
94 model.setName(soapModel.getName());
95 model.setA2(soapModel.getA2());
96 model.setA3(soapModel.getA3());
97 model.setNumber(soapModel.getNumber());
98 model.setIdd(soapModel.getIdd());
99 model.setActive(soapModel.getActive());
100
101 return model;
102 }
103
104 public static List<Country> toModels(CountrySoap[] soapModels) {
105 List<Country> models = new ArrayList<Country>(soapModels.length);
106
107 for (CountrySoap soapModel : soapModels) {
108 models.add(toModel(soapModel));
109 }
110
111 return models;
112 }
113
114 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
115 "lock.expiration.time.com.liferay.portal.model.Country"));
116
117 public CountryModelImpl() {
118 }
119
120 public long getPrimaryKey() {
121 return _countryId;
122 }
123
124 public void setPrimaryKey(long pk) {
125 setCountryId(pk);
126 }
127
128 public Serializable getPrimaryKeyObj() {
129 return new Long(_countryId);
130 }
131
132 public long getCountryId() {
133 return _countryId;
134 }
135
136 public void setCountryId(long countryId) {
137 if (countryId != _countryId) {
138 _countryId = countryId;
139 }
140 }
141
142 public String getName() {
143 return GetterUtil.getString(_name);
144 }
145
146 public void setName(String name) {
147 if (((name == null) && (_name != null)) ||
148 ((name != null) && (_name == null)) ||
149 ((name != null) && (_name != null) && !name.equals(_name))) {
150 _name = name;
151 }
152 }
153
154 public String getA2() {
155 return GetterUtil.getString(_a2);
156 }
157
158 public void setA2(String a2) {
159 if (((a2 == null) && (_a2 != null)) || ((a2 != null) && (_a2 == null)) ||
160 ((a2 != null) && (_a2 != null) && !a2.equals(_a2))) {
161 _a2 = a2;
162 }
163 }
164
165 public String getA3() {
166 return GetterUtil.getString(_a3);
167 }
168
169 public void setA3(String a3) {
170 if (((a3 == null) && (_a3 != null)) || ((a3 != null) && (_a3 == null)) ||
171 ((a3 != null) && (_a3 != null) && !a3.equals(_a3))) {
172 _a3 = a3;
173 }
174 }
175
176 public String getNumber() {
177 return GetterUtil.getString(_number);
178 }
179
180 public void setNumber(String number) {
181 if (((number == null) && (_number != null)) ||
182 ((number != null) && (_number == null)) ||
183 ((number != null) && (_number != null) &&
184 !number.equals(_number))) {
185 _number = number;
186 }
187 }
188
189 public String getIdd() {
190 return GetterUtil.getString(_idd);
191 }
192
193 public void setIdd(String idd) {
194 if (((idd == null) && (_idd != null)) ||
195 ((idd != null) && (_idd == null)) ||
196 ((idd != null) && (_idd != null) && !idd.equals(_idd))) {
197 _idd = idd;
198 }
199 }
200
201 public boolean getActive() {
202 return _active;
203 }
204
205 public boolean isActive() {
206 return _active;
207 }
208
209 public void setActive(boolean active) {
210 if (active != _active) {
211 _active = active;
212 }
213 }
214
215 public Country toEscapedModel() {
216 if (isEscapedModel()) {
217 return (Country)this;
218 }
219 else {
220 Country model = new CountryImpl();
221
222 model.setEscapedModel(true);
223
224 model.setCountryId(getCountryId());
225 model.setName(HtmlUtil.escape(getName()));
226 model.setA2(HtmlUtil.escape(getA2()));
227 model.setA3(HtmlUtil.escape(getA3()));
228 model.setNumber(HtmlUtil.escape(getNumber()));
229 model.setIdd(HtmlUtil.escape(getIdd()));
230 model.setActive(getActive());
231
232 model = (Country)Proxy.newProxyInstance(Country.class.getClassLoader(),
233 new Class[] { Country.class },
234 new ReadOnlyBeanHandler(model));
235
236 return model;
237 }
238 }
239
240 public Object clone() {
241 CountryImpl clone = new CountryImpl();
242
243 clone.setCountryId(getCountryId());
244 clone.setName(getName());
245 clone.setA2(getA2());
246 clone.setA3(getA3());
247 clone.setNumber(getNumber());
248 clone.setIdd(getIdd());
249 clone.setActive(getActive());
250
251 return clone;
252 }
253
254 public int compareTo(Object obj) {
255 if (obj == null) {
256 return -1;
257 }
258
259 CountryImpl country = (CountryImpl)obj;
260
261 int value = 0;
262
263 value = getName().compareTo(country.getName());
264
265 if (value != 0) {
266 return value;
267 }
268
269 return 0;
270 }
271
272 public boolean equals(Object obj) {
273 if (obj == null) {
274 return false;
275 }
276
277 CountryImpl country = null;
278
279 try {
280 country = (CountryImpl)obj;
281 }
282 catch (ClassCastException cce) {
283 return false;
284 }
285
286 long pk = country.getPrimaryKey();
287
288 if (getPrimaryKey() == pk) {
289 return true;
290 }
291 else {
292 return false;
293 }
294 }
295
296 public int hashCode() {
297 return (int)getPrimaryKey();
298 }
299
300 private long _countryId;
301 private String _name;
302 private String _a2;
303 private String _a3;
304 private String _number;
305 private String _idd;
306 private boolean _active;
307 }