001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portal.model.impl;
022:
023: import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
024: import com.liferay.portal.kernel.util.GetterUtil;
025: import com.liferay.portal.model.Country;
026: import com.liferay.portal.util.PropsUtil;
027:
028: import com.liferay.util.Html;
029:
030: import java.io.Serializable;
031:
032: import java.lang.reflect.Proxy;
033:
034: import java.sql.Types;
035:
036: /**
037: * <a href="CountryModelImpl.java.html"><b><i>View Source</i></b></a>
038: *
039: * <p>
040: * ServiceBuilder generated this class. Modifications in this class will be
041: * overwritten the next time is generated.
042: * </p>
043: *
044: * <p>
045: * This class is a model that represents the <code>Country</code> table
046: * in the database.
047: * </p>
048: *
049: * @author Brian Wing Shun Chan
050: *
051: * @see com.liferay.portal.service.model.Country
052: * @see com.liferay.portal.service.model.CountryModel
053: * @see com.liferay.portal.service.model.impl.CountryImpl
054: *
055: */
056: public class CountryModelImpl extends BaseModelImpl {
057: public static final String TABLE_NAME = "Country";
058: public static final Object[][] TABLE_COLUMNS = {
059: { "countryId", new Integer(Types.BIGINT) },
060:
061: { "name", new Integer(Types.VARCHAR) },
062:
063: { "a2", new Integer(Types.VARCHAR) },
064:
065: { "a3", new Integer(Types.VARCHAR) },
066:
067: { "number_", new Integer(Types.VARCHAR) },
068:
069: { "idd_", new Integer(Types.VARCHAR) },
070:
071: { "active_", new Integer(Types.BOOLEAN) } };
072: 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)";
073: public static final String TABLE_SQL_DROP = "drop table Country";
074: public static final boolean CACHE_ENABLED = GetterUtil
075: .getBoolean(
076: PropsUtil
077: .get("value.object.finder.cache.enabled.com.liferay.portal.model.Country"),
078: true);
079: public static final long LOCK_EXPIRATION_TIME = GetterUtil
080: .getLong(PropsUtil
081: .get("lock.expiration.time.com.liferay.portal.model.Country"));
082:
083: public CountryModelImpl() {
084: }
085:
086: public long getPrimaryKey() {
087: return _countryId;
088: }
089:
090: public void setPrimaryKey(long pk) {
091: setCountryId(pk);
092: }
093:
094: public Serializable getPrimaryKeyObj() {
095: return new Long(_countryId);
096: }
097:
098: public long getCountryId() {
099: return _countryId;
100: }
101:
102: public void setCountryId(long countryId) {
103: if (countryId != _countryId) {
104: _countryId = countryId;
105: }
106: }
107:
108: public String getName() {
109: return GetterUtil.getString(_name);
110: }
111:
112: public void setName(String name) {
113: if (((name == null) && (_name != null))
114: || ((name != null) && (_name == null))
115: || ((name != null) && (_name != null) && !name
116: .equals(_name))) {
117: _name = name;
118: }
119: }
120:
121: public String getA2() {
122: return GetterUtil.getString(_a2);
123: }
124:
125: public void setA2(String a2) {
126: if (((a2 == null) && (_a2 != null))
127: || ((a2 != null) && (_a2 == null))
128: || ((a2 != null) && (_a2 != null) && !a2.equals(_a2))) {
129: _a2 = a2;
130: }
131: }
132:
133: public String getA3() {
134: return GetterUtil.getString(_a3);
135: }
136:
137: public void setA3(String a3) {
138: if (((a3 == null) && (_a3 != null))
139: || ((a3 != null) && (_a3 == null))
140: || ((a3 != null) && (_a3 != null) && !a3.equals(_a3))) {
141: _a3 = a3;
142: }
143: }
144:
145: public String getNumber() {
146: return GetterUtil.getString(_number);
147: }
148:
149: public void setNumber(String number) {
150: if (((number == null) && (_number != null))
151: || ((number != null) && (_number == null))
152: || ((number != null) && (_number != null) && !number
153: .equals(_number))) {
154: _number = number;
155: }
156: }
157:
158: public String getIdd() {
159: return GetterUtil.getString(_idd);
160: }
161:
162: public void setIdd(String idd) {
163: if (((idd == null) && (_idd != null))
164: || ((idd != null) && (_idd == null))
165: || ((idd != null) && (_idd != null) && !idd
166: .equals(_idd))) {
167: _idd = idd;
168: }
169: }
170:
171: public boolean getActive() {
172: return _active;
173: }
174:
175: public boolean isActive() {
176: return _active;
177: }
178:
179: public void setActive(boolean active) {
180: if (active != _active) {
181: _active = active;
182: }
183: }
184:
185: public Country toEscapedModel() {
186: if (isEscapedModel()) {
187: return (Country) this ;
188: } else {
189: Country model = new CountryImpl();
190:
191: model.setEscapedModel(true);
192:
193: model.setCountryId(getCountryId());
194: model.setName(Html.escape(getName()));
195: model.setA2(Html.escape(getA2()));
196: model.setA3(Html.escape(getA3()));
197: model.setNumber(Html.escape(getNumber()));
198: model.setIdd(Html.escape(getIdd()));
199: model.setActive(getActive());
200:
201: model = (Country) Proxy.newProxyInstance(Country.class
202: .getClassLoader(), new Class[] { Country.class },
203: new ReadOnlyBeanHandler(model));
204:
205: return model;
206: }
207: }
208:
209: public Object clone() {
210: CountryImpl clone = new CountryImpl();
211:
212: clone.setCountryId(getCountryId());
213: clone.setName(getName());
214: clone.setA2(getA2());
215: clone.setA3(getA3());
216: clone.setNumber(getNumber());
217: clone.setIdd(getIdd());
218: clone.setActive(getActive());
219:
220: return clone;
221: }
222:
223: public int compareTo(Object obj) {
224: if (obj == null) {
225: return -1;
226: }
227:
228: CountryImpl country = (CountryImpl) obj;
229:
230: int value = 0;
231:
232: value = getName().compareTo(country.getName());
233:
234: if (value != 0) {
235: return value;
236: }
237:
238: return 0;
239: }
240:
241: public boolean equals(Object obj) {
242: if (obj == null) {
243: return false;
244: }
245:
246: CountryImpl country = null;
247:
248: try {
249: country = (CountryImpl) obj;
250: } catch (ClassCastException cce) {
251: return false;
252: }
253:
254: long pk = country.getPrimaryKey();
255:
256: if (getPrimaryKey() == pk) {
257: return true;
258: } else {
259: return false;
260: }
261: }
262:
263: public int hashCode() {
264: return (int) getPrimaryKey();
265: }
266:
267: private long _countryId;
268: private String _name;
269: private String _a2;
270: private String _a3;
271: private String _number;
272: private String _idd;
273: private boolean _active;
274: }
|