001
014
015 package com.liferay.portal.model.impl;
016
017 import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018 import com.liferay.portal.kernel.util.GetterUtil;
019 import com.liferay.portal.kernel.util.StringBundler;
020 import com.liferay.portal.kernel.util.StringPool;
021 import com.liferay.portal.model.Country;
022 import com.liferay.portal.model.CountryModel;
023 import com.liferay.portal.model.CountrySoap;
024 import com.liferay.portal.service.ServiceContext;
025
026 import com.liferay.portlet.expando.model.ExpandoBridge;
027 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
028
029 import java.io.Serializable;
030
031 import java.lang.reflect.Proxy;
032
033 import java.sql.Types;
034
035 import java.util.ArrayList;
036 import java.util.List;
037
038
055 public class CountryModelImpl extends BaseModelImpl<Country>
056 implements CountryModel {
057 public static final String TABLE_NAME = "Country";
058 public static final Object[][] TABLE_COLUMNS = {
059 { "countryId", new Integer(Types.BIGINT) },
060 { "name", new Integer(Types.VARCHAR) },
061 { "a2", new Integer(Types.VARCHAR) },
062 { "a3", new Integer(Types.VARCHAR) },
063 { "number_", new Integer(Types.VARCHAR) },
064 { "idd_", new Integer(Types.VARCHAR) },
065 { "active_", new Integer(Types.BOOLEAN) }
066 };
067 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)";
068 public static final String TABLE_SQL_DROP = "drop table Country";
069 public static final String ORDER_BY_JPQL = " ORDER BY country.name ASC";
070 public static final String ORDER_BY_SQL = " ORDER BY Country.name ASC";
071 public static final String DATA_SOURCE = "liferayDataSource";
072 public static final String SESSION_FACTORY = "liferaySessionFactory";
073 public static final String TX_MANAGER = "liferayTransactionManager";
074 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
075 "value.object.entity.cache.enabled.com.liferay.portal.model.Country"),
076 true);
077 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
078 "value.object.finder.cache.enabled.com.liferay.portal.model.Country"),
079 true);
080
081
087 public static Country toModel(CountrySoap soapModel) {
088 Country model = new CountryImpl();
089
090 model.setCountryId(soapModel.getCountryId());
091 model.setName(soapModel.getName());
092 model.setA2(soapModel.getA2());
093 model.setA3(soapModel.getA3());
094 model.setNumber(soapModel.getNumber());
095 model.setIdd(soapModel.getIdd());
096 model.setActive(soapModel.getActive());
097
098 return model;
099 }
100
101
107 public static List<Country> toModels(CountrySoap[] soapModels) {
108 List<Country> models = new ArrayList<Country>(soapModels.length);
109
110 for (CountrySoap soapModel : soapModels) {
111 models.add(toModel(soapModel));
112 }
113
114 return models;
115 }
116
117 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
118 "lock.expiration.time.com.liferay.portal.model.Country"));
119
120 public CountryModelImpl() {
121 }
122
123 public long getPrimaryKey() {
124 return _countryId;
125 }
126
127 public void setPrimaryKey(long pk) {
128 setCountryId(pk);
129 }
130
131 public Serializable getPrimaryKeyObj() {
132 return new Long(_countryId);
133 }
134
135 public long getCountryId() {
136 return _countryId;
137 }
138
139 public void setCountryId(long countryId) {
140 _countryId = countryId;
141 }
142
143 public String getName() {
144 if (_name == null) {
145 return StringPool.BLANK;
146 }
147 else {
148 return _name;
149 }
150 }
151
152 public void setName(String name) {
153 _name = name;
154
155 if (_originalName == null) {
156 _originalName = name;
157 }
158 }
159
160 public String getOriginalName() {
161 return GetterUtil.getString(_originalName);
162 }
163
164 public String getA2() {
165 if (_a2 == null) {
166 return StringPool.BLANK;
167 }
168 else {
169 return _a2;
170 }
171 }
172
173 public void setA2(String a2) {
174 _a2 = a2;
175
176 if (_originalA2 == null) {
177 _originalA2 = a2;
178 }
179 }
180
181 public String getOriginalA2() {
182 return GetterUtil.getString(_originalA2);
183 }
184
185 public String getA3() {
186 if (_a3 == null) {
187 return StringPool.BLANK;
188 }
189 else {
190 return _a3;
191 }
192 }
193
194 public void setA3(String a3) {
195 _a3 = a3;
196
197 if (_originalA3 == null) {
198 _originalA3 = a3;
199 }
200 }
201
202 public String getOriginalA3() {
203 return GetterUtil.getString(_originalA3);
204 }
205
206 public String getNumber() {
207 if (_number == null) {
208 return StringPool.BLANK;
209 }
210 else {
211 return _number;
212 }
213 }
214
215 public void setNumber(String number) {
216 _number = number;
217 }
218
219 public String getIdd() {
220 if (_idd == null) {
221 return StringPool.BLANK;
222 }
223 else {
224 return _idd;
225 }
226 }
227
228 public void setIdd(String idd) {
229 _idd = idd;
230 }
231
232 public boolean getActive() {
233 return _active;
234 }
235
236 public boolean isActive() {
237 return _active;
238 }
239
240 public void setActive(boolean active) {
241 _active = active;
242 }
243
244 public Country toEscapedModel() {
245 if (isEscapedModel()) {
246 return (Country)this;
247 }
248 else {
249 return (Country)Proxy.newProxyInstance(Country.class.getClassLoader(),
250 new Class[] { Country.class }, new AutoEscapeBeanHandler(this));
251 }
252 }
253
254 public ExpandoBridge getExpandoBridge() {
255 if (_expandoBridge == null) {
256 _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(0,
257 Country.class.getName(), getPrimaryKey());
258 }
259
260 return _expandoBridge;
261 }
262
263 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
264 getExpandoBridge().setAttributes(serviceContext);
265 }
266
267 public Object clone() {
268 CountryImpl clone = new CountryImpl();
269
270 clone.setCountryId(getCountryId());
271 clone.setName(getName());
272 clone.setA2(getA2());
273 clone.setA3(getA3());
274 clone.setNumber(getNumber());
275 clone.setIdd(getIdd());
276 clone.setActive(getActive());
277
278 return clone;
279 }
280
281 public int compareTo(Country country) {
282 int value = 0;
283
284 value = getName().compareTo(country.getName());
285
286 if (value != 0) {
287 return value;
288 }
289
290 return 0;
291 }
292
293 public boolean equals(Object obj) {
294 if (obj == null) {
295 return false;
296 }
297
298 Country country = null;
299
300 try {
301 country = (Country)obj;
302 }
303 catch (ClassCastException cce) {
304 return false;
305 }
306
307 long pk = country.getPrimaryKey();
308
309 if (getPrimaryKey() == pk) {
310 return true;
311 }
312 else {
313 return false;
314 }
315 }
316
317 public int hashCode() {
318 return (int)getPrimaryKey();
319 }
320
321 public String toString() {
322 StringBundler sb = new StringBundler(15);
323
324 sb.append("{countryId=");
325 sb.append(getCountryId());
326 sb.append(", name=");
327 sb.append(getName());
328 sb.append(", a2=");
329 sb.append(getA2());
330 sb.append(", a3=");
331 sb.append(getA3());
332 sb.append(", number=");
333 sb.append(getNumber());
334 sb.append(", idd=");
335 sb.append(getIdd());
336 sb.append(", active=");
337 sb.append(getActive());
338 sb.append("}");
339
340 return sb.toString();
341 }
342
343 public String toXmlString() {
344 StringBundler sb = new StringBundler(25);
345
346 sb.append("<model><model-name>");
347 sb.append("com.liferay.portal.model.Country");
348 sb.append("</model-name>");
349
350 sb.append(
351 "<column><column-name>countryId</column-name><column-value><![CDATA[");
352 sb.append(getCountryId());
353 sb.append("]]></column-value></column>");
354 sb.append(
355 "<column><column-name>name</column-name><column-value><![CDATA[");
356 sb.append(getName());
357 sb.append("]]></column-value></column>");
358 sb.append(
359 "<column><column-name>a2</column-name><column-value><![CDATA[");
360 sb.append(getA2());
361 sb.append("]]></column-value></column>");
362 sb.append(
363 "<column><column-name>a3</column-name><column-value><![CDATA[");
364 sb.append(getA3());
365 sb.append("]]></column-value></column>");
366 sb.append(
367 "<column><column-name>number</column-name><column-value><![CDATA[");
368 sb.append(getNumber());
369 sb.append("]]></column-value></column>");
370 sb.append(
371 "<column><column-name>idd</column-name><column-value><![CDATA[");
372 sb.append(getIdd());
373 sb.append("]]></column-value></column>");
374 sb.append(
375 "<column><column-name>active</column-name><column-value><![CDATA[");
376 sb.append(getActive());
377 sb.append("]]></column-value></column>");
378
379 sb.append("</model>");
380
381 return sb.toString();
382 }
383
384 private long _countryId;
385 private String _name;
386 private String _originalName;
387 private String _a2;
388 private String _originalA2;
389 private String _a3;
390 private String _originalA3;
391 private String _number;
392 private String _idd;
393 private boolean _active;
394 private transient ExpandoBridge _expandoBridge;
395 }