1   /**
2    * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
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.model.Company;
28  import com.liferay.portal.util.PropsUtil;
29  
30  import com.liferay.util.Html;
31  
32  import java.io.Serializable;
33  
34  import java.lang.reflect.Proxy;
35  
36  import java.sql.Types;
37  
38  /**
39   * <a href="CompanyModelImpl.java.html"><b><i>View Source</i></b></a>
40   *
41   * <p>
42   * ServiceBuilder generated this class. Modifications in this class will be
43   * overwritten the next time is generated.
44   * </p>
45   *
46   * <p>
47   * This class is a model that represents the <code>Company</code> table
48   * in the database.
49   * </p>
50   *
51   * @author Brian Wing Shun Chan
52   *
53   * @see com.liferay.portal.service.model.Company
54   * @see com.liferay.portal.service.model.CompanyModel
55   * @see com.liferay.portal.service.model.impl.CompanyImpl
56   *
57   */
58  public class CompanyModelImpl extends BaseModelImpl {
59      public static final String TABLE_NAME = "Company";
60      public static final Object[][] TABLE_COLUMNS = {
61              { "companyId", new Integer(Types.BIGINT) },
62              
63  
64              { "accountId", new Integer(Types.BIGINT) },
65              
66  
67              { "webId", new Integer(Types.VARCHAR) },
68              
69  
70              { "key_", new Integer(Types.CLOB) },
71              
72  
73              { "virtualHost", new Integer(Types.VARCHAR) },
74              
75  
76              { "mx", new Integer(Types.VARCHAR) },
77              
78  
79              { "logoId", new Integer(Types.BIGINT) }
80          };
81      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)";
82      public static final String TABLE_SQL_DROP = "drop table Company";
83      public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
84                  "value.object.finder.cache.enabled.com.liferay.portal.model.Company"),
85              true);
86      public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
87                  "lock.expiration.time.com.liferay.portal.model.Company"));
88  
89      public CompanyModelImpl() {
90      }
91  
92      public long getPrimaryKey() {
93          return _companyId;
94      }
95  
96      public void setPrimaryKey(long pk) {
97          setCompanyId(pk);
98      }
99  
100     public Serializable getPrimaryKeyObj() {
101         return new Long(_companyId);
102     }
103 
104     public long getCompanyId() {
105         return _companyId;
106     }
107 
108     public void setCompanyId(long companyId) {
109         if (companyId != _companyId) {
110             _companyId = companyId;
111         }
112     }
113 
114     public long getAccountId() {
115         return _accountId;
116     }
117 
118     public void setAccountId(long accountId) {
119         if (accountId != _accountId) {
120             _accountId = accountId;
121         }
122     }
123 
124     public String getWebId() {
125         return GetterUtil.getString(_webId);
126     }
127 
128     public void setWebId(String webId) {
129         if (((webId == null) && (_webId != null)) ||
130                 ((webId != null) && (_webId == null)) ||
131                 ((webId != null) && (_webId != null) && !webId.equals(_webId))) {
132             _webId = webId;
133         }
134     }
135 
136     public String getKey() {
137         return GetterUtil.getString(_key);
138     }
139 
140     public void setKey(String key) {
141         if (((key == null) && (_key != null)) ||
142                 ((key != null) && (_key == null)) ||
143                 ((key != null) && (_key != null) && !key.equals(_key))) {
144             _key = key;
145         }
146     }
147 
148     public String getVirtualHost() {
149         return GetterUtil.getString(_virtualHost);
150     }
151 
152     public void setVirtualHost(String virtualHost) {
153         if (((virtualHost == null) && (_virtualHost != null)) ||
154                 ((virtualHost != null) && (_virtualHost == null)) ||
155                 ((virtualHost != null) && (_virtualHost != null) &&
156                 !virtualHost.equals(_virtualHost))) {
157             _virtualHost = virtualHost;
158         }
159     }
160 
161     public String getMx() {
162         return GetterUtil.getString(_mx);
163     }
164 
165     public void setMx(String mx) {
166         if (((mx == null) && (_mx != null)) || ((mx != null) && (_mx == null)) ||
167                 ((mx != null) && (_mx != null) && !mx.equals(_mx))) {
168             _mx = mx;
169         }
170     }
171 
172     public long getLogoId() {
173         return _logoId;
174     }
175 
176     public void setLogoId(long logoId) {
177         if (logoId != _logoId) {
178             _logoId = logoId;
179         }
180     }
181 
182     public Company toEscapedModel() {
183         if (isEscapedModel()) {
184             return (Company)this;
185         }
186         else {
187             Company model = new CompanyImpl();
188 
189             model.setEscapedModel(true);
190 
191             model.setCompanyId(getCompanyId());
192             model.setAccountId(getAccountId());
193             model.setWebId(Html.escape(getWebId()));
194             model.setKey(Html.escape(getKey()));
195             model.setVirtualHost(Html.escape(getVirtualHost()));
196             model.setMx(Html.escape(getMx()));
197             model.setLogoId(getLogoId());
198 
199             model = (Company)Proxy.newProxyInstance(Company.class.getClassLoader(),
200                     new Class[] { Company.class },
201                     new ReadOnlyBeanHandler(model));
202 
203             return model;
204         }
205     }
206 
207     public Object clone() {
208         CompanyImpl clone = new CompanyImpl();
209 
210         clone.setCompanyId(getCompanyId());
211         clone.setAccountId(getAccountId());
212         clone.setWebId(getWebId());
213         clone.setKey(getKey());
214         clone.setVirtualHost(getVirtualHost());
215         clone.setMx(getMx());
216         clone.setLogoId(getLogoId());
217 
218         return clone;
219     }
220 
221     public int compareTo(Object obj) {
222         if (obj == null) {
223             return -1;
224         }
225 
226         CompanyImpl company = (CompanyImpl)obj;
227 
228         long pk = company.getPrimaryKey();
229 
230         if (getPrimaryKey() < pk) {
231             return -1;
232         }
233         else if (getPrimaryKey() > pk) {
234             return 1;
235         }
236         else {
237             return 0;
238         }
239     }
240 
241     public boolean equals(Object obj) {
242         if (obj == null) {
243             return false;
244         }
245 
246         CompanyImpl company = null;
247 
248         try {
249             company = (CompanyImpl)obj;
250         }
251         catch (ClassCastException cce) {
252             return false;
253         }
254 
255         long pk = company.getPrimaryKey();
256 
257         if (getPrimaryKey() == pk) {
258             return true;
259         }
260         else {
261             return false;
262         }
263     }
264 
265     public int hashCode() {
266         return (int)getPrimaryKey();
267     }
268 
269     private long _companyId;
270     private long _accountId;
271     private String _webId;
272     private String _key;
273     private String _virtualHost;
274     private String _mx;
275     private long _logoId;
276 }