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