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