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.Company;
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="CompanyModelImpl.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>Company</code> table
046: * in the database.
047: * </p>
048: *
049: * @author Brian Wing Shun Chan
050: *
051: * @see com.liferay.portal.service.model.Company
052: * @see com.liferay.portal.service.model.CompanyModel
053: * @see com.liferay.portal.service.model.impl.CompanyImpl
054: *
055: */
056: public class CompanyModelImpl extends BaseModelImpl {
057: public static final String TABLE_NAME = "Company";
058: public static final Object[][] TABLE_COLUMNS = {
059: { "companyId", new Integer(Types.BIGINT) },
060:
061: { "accountId", new Integer(Types.BIGINT) },
062:
063: { "webId", new Integer(Types.VARCHAR) },
064:
065: { "key_", new Integer(Types.CLOB) },
066:
067: { "virtualHost", new Integer(Types.VARCHAR) },
068:
069: { "mx", new Integer(Types.VARCHAR) },
070:
071: { "logoId", new Integer(Types.BIGINT) } };
072: public static final String TABLE_SQL_CREATE = "create table Company (companyId LONG not null primary key,accountId LONG,webId VARCHAR(75) null,key_ TEXT null,virtualHost VARCHAR(75) null,mx VARCHAR(75) null,logoId LONG)";
073: public static final String TABLE_SQL_DROP = "drop table Company";
074: public static final boolean CACHE_ENABLED = GetterUtil
075: .getBoolean(
076: PropsUtil
077: .get("value.object.finder.cache.enabled.com.liferay.portal.model.Company"),
078: true);
079: public static final long LOCK_EXPIRATION_TIME = GetterUtil
080: .getLong(PropsUtil
081: .get("lock.expiration.time.com.liferay.portal.model.Company"));
082:
083: public CompanyModelImpl() {
084: }
085:
086: public long getPrimaryKey() {
087: return _companyId;
088: }
089:
090: public void setPrimaryKey(long pk) {
091: setCompanyId(pk);
092: }
093:
094: public Serializable getPrimaryKeyObj() {
095: return new Long(_companyId);
096: }
097:
098: public long getCompanyId() {
099: return _companyId;
100: }
101:
102: public void setCompanyId(long companyId) {
103: if (companyId != _companyId) {
104: _companyId = companyId;
105: }
106: }
107:
108: public long getAccountId() {
109: return _accountId;
110: }
111:
112: public void setAccountId(long accountId) {
113: if (accountId != _accountId) {
114: _accountId = accountId;
115: }
116: }
117:
118: public String getWebId() {
119: return GetterUtil.getString(_webId);
120: }
121:
122: public void setWebId(String webId) {
123: if (((webId == null) && (_webId != null))
124: || ((webId != null) && (_webId == null))
125: || ((webId != null) && (_webId != null) && !webId
126: .equals(_webId))) {
127: _webId = webId;
128: }
129: }
130:
131: public String getKey() {
132: return GetterUtil.getString(_key);
133: }
134:
135: public void setKey(String key) {
136: if (((key == null) && (_key != null))
137: || ((key != null) && (_key == null))
138: || ((key != null) && (_key != null) && !key
139: .equals(_key))) {
140: _key = key;
141: }
142: }
143:
144: public String getVirtualHost() {
145: return GetterUtil.getString(_virtualHost);
146: }
147:
148: public void setVirtualHost(String virtualHost) {
149: if (((virtualHost == null) && (_virtualHost != null))
150: || ((virtualHost != null) && (_virtualHost == null))
151: || ((virtualHost != null) && (_virtualHost != null) && !virtualHost
152: .equals(_virtualHost))) {
153: _virtualHost = virtualHost;
154: }
155: }
156:
157: public String getMx() {
158: return GetterUtil.getString(_mx);
159: }
160:
161: public void setMx(String mx) {
162: if (((mx == null) && (_mx != null))
163: || ((mx != null) && (_mx == null))
164: || ((mx != null) && (_mx != null) && !mx.equals(_mx))) {
165: _mx = mx;
166: }
167: }
168:
169: public long getLogoId() {
170: return _logoId;
171: }
172:
173: public void setLogoId(long logoId) {
174: if (logoId != _logoId) {
175: _logoId = logoId;
176: }
177: }
178:
179: public Company toEscapedModel() {
180: if (isEscapedModel()) {
181: return (Company) this ;
182: } else {
183: Company model = new CompanyImpl();
184:
185: model.setEscapedModel(true);
186:
187: model.setCompanyId(getCompanyId());
188: model.setAccountId(getAccountId());
189: model.setWebId(Html.escape(getWebId()));
190: model.setKey(Html.escape(getKey()));
191: model.setVirtualHost(Html.escape(getVirtualHost()));
192: model.setMx(Html.escape(getMx()));
193: model.setLogoId(getLogoId());
194:
195: model = (Company) Proxy.newProxyInstance(Company.class
196: .getClassLoader(), new Class[] { Company.class },
197: new ReadOnlyBeanHandler(model));
198:
199: return model;
200: }
201: }
202:
203: public Object clone() {
204: CompanyImpl clone = new CompanyImpl();
205:
206: clone.setCompanyId(getCompanyId());
207: clone.setAccountId(getAccountId());
208: clone.setWebId(getWebId());
209: clone.setKey(getKey());
210: clone.setVirtualHost(getVirtualHost());
211: clone.setMx(getMx());
212: clone.setLogoId(getLogoId());
213:
214: return clone;
215: }
216:
217: public int compareTo(Object obj) {
218: if (obj == null) {
219: return -1;
220: }
221:
222: CompanyImpl company = (CompanyImpl) obj;
223:
224: long pk = company.getPrimaryKey();
225:
226: if (getPrimaryKey() < pk) {
227: return -1;
228: } else if (getPrimaryKey() > pk) {
229: return 1;
230: } else {
231: return 0;
232: }
233: }
234:
235: public boolean equals(Object obj) {
236: if (obj == null) {
237: return false;
238: }
239:
240: CompanyImpl company = null;
241:
242: try {
243: company = (CompanyImpl) obj;
244: } catch (ClassCastException cce) {
245: return false;
246: }
247:
248: long pk = company.getPrimaryKey();
249:
250: if (getPrimaryKey() == pk) {
251: return true;
252: } else {
253: return false;
254: }
255: }
256:
257: public int hashCode() {
258: return (int) getPrimaryKey();
259: }
260:
261: private long _companyId;
262: private long _accountId;
263: private String _webId;
264: private String _key;
265: private String _virtualHost;
266: private String _mx;
267: private long _logoId;
268: }
|