1   /**
2    * Copyright (c) 2000-2007 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.util.GetterUtil;
26  import com.liferay.portal.model.impl.BaseModelImpl;
27  import com.liferay.portal.util.PropsUtil;
28  
29  import com.liferay.util.XSSUtil;
30  
31  import java.io.Serializable;
32  
33  import java.sql.Types;
34  
35  /**
36   * <a href="CompanyModelImpl.java.html"><b><i>View Source</i></b></a>
37   *
38   * <p>
39   * ServiceBuilder generated this class. Modifications in this class will be overwritten
40   * the next time is generated.
41   * </p>
42   *
43   * <p>
44   * This class is a model that represents the <code>Company</code> table in the database.
45   * </p>
46   *
47   * @author Brian Wing Shun Chan
48   *
49   * @see com.liferay.portal.service.model.Company
50   * @see com.liferay.portal.service.model.CompanyModel
51   * @see com.liferay.portal.service.model.impl.CompanyImpl
52   *
53   */
54  public class CompanyModelImpl extends BaseModelImpl {
55      public static String TABLE_NAME = "Company";
56      public static Object[][] TABLE_COLUMNS = {
57              { "companyId", new Integer(Types.BIGINT) },
58              { "accountId", new Integer(Types.BIGINT) },
59              { "webId", new Integer(Types.VARCHAR) },
60              { "key_", new Integer(Types.CLOB) },
61              { "virtualHost", new Integer(Types.VARCHAR) },
62              { "mx", new Integer(Types.VARCHAR) },
63              { "logoId", new Integer(Types.BIGINT) }
64          };
65      public static 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)";
66      public static String TABLE_SQL_DROP = "drop table Company";
67      public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
68                  "xss.allow.com.liferay.portal.model.Company"), XSS_ALLOW);
69      public static boolean XSS_ALLOW_WEBID = GetterUtil.getBoolean(PropsUtil.get(
70                  "xss.allow.com.liferay.portal.model.Company.webId"),
71              XSS_ALLOW_BY_MODEL);
72      public static boolean XSS_ALLOW_KEY = GetterUtil.getBoolean(PropsUtil.get(
73                  "xss.allow.com.liferay.portal.model.Company.key"),
74              XSS_ALLOW_BY_MODEL);
75      public static boolean XSS_ALLOW_VIRTUALHOST = GetterUtil.getBoolean(PropsUtil.get(
76                  "xss.allow.com.liferay.portal.model.Company.virtualHost"),
77              XSS_ALLOW_BY_MODEL);
78      public static boolean XSS_ALLOW_MX = GetterUtil.getBoolean(PropsUtil.get(
79                  "xss.allow.com.liferay.portal.model.Company.mx"),
80              XSS_ALLOW_BY_MODEL);
81      public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
82                  "lock.expiration.time.com.liferay.portal.model.CompanyModel"));
83  
84      public CompanyModelImpl() {
85      }
86  
87      public long getPrimaryKey() {
88          return _companyId;
89      }
90  
91      public void setPrimaryKey(long pk) {
92          setCompanyId(pk);
93      }
94  
95      public Serializable getPrimaryKeyObj() {
96          return new Long(_companyId);
97      }
98  
99      public long getCompanyId() {
100         return _companyId;
101     }
102 
103     public void setCompanyId(long companyId) {
104         if (companyId != _companyId) {
105             _companyId = companyId;
106         }
107     }
108 
109     public long getAccountId() {
110         return _accountId;
111     }
112 
113     public void setAccountId(long accountId) {
114         if (accountId != _accountId) {
115             _accountId = accountId;
116         }
117     }
118 
119     public String getWebId() {
120         return GetterUtil.getString(_webId);
121     }
122 
123     public void setWebId(String webId) {
124         if (((webId == null) && (_webId != null)) ||
125                 ((webId != null) && (_webId == null)) ||
126                 ((webId != null) && (_webId != null) && !webId.equals(_webId))) {
127             if (!XSS_ALLOW_WEBID) {
128                 webId = XSSUtil.strip(webId);
129             }
130 
131             _webId = webId;
132         }
133     }
134 
135     public String getKey() {
136         return GetterUtil.getString(_key);
137     }
138 
139     public void setKey(String key) {
140         if (((key == null) && (_key != null)) ||
141                 ((key != null) && (_key == null)) ||
142                 ((key != null) && (_key != null) && !key.equals(_key))) {
143             if (!XSS_ALLOW_KEY) {
144                 key = XSSUtil.strip(key);
145             }
146 
147             _key = key;
148         }
149     }
150 
151     public String getVirtualHost() {
152         return GetterUtil.getString(_virtualHost);
153     }
154 
155     public void setVirtualHost(String virtualHost) {
156         if (((virtualHost == null) && (_virtualHost != null)) ||
157                 ((virtualHost != null) && (_virtualHost == null)) ||
158                 ((virtualHost != null) && (_virtualHost != null) &&
159                 !virtualHost.equals(_virtualHost))) {
160             if (!XSS_ALLOW_VIRTUALHOST) {
161                 virtualHost = XSSUtil.strip(virtualHost);
162             }
163 
164             _virtualHost = virtualHost;
165         }
166     }
167 
168     public String getMx() {
169         return GetterUtil.getString(_mx);
170     }
171 
172     public void setMx(String mx) {
173         if (((mx == null) && (_mx != null)) || ((mx != null) && (_mx == null)) ||
174                 ((mx != null) && (_mx != null) && !mx.equals(_mx))) {
175             if (!XSS_ALLOW_MX) {
176                 mx = XSSUtil.strip(mx);
177             }
178 
179             _mx = mx;
180         }
181     }
182 
183     public long getLogoId() {
184         return _logoId;
185     }
186 
187     public void setLogoId(long logoId) {
188         if (logoId != _logoId) {
189             _logoId = logoId;
190         }
191     }
192 
193     public Object clone() {
194         CompanyImpl clone = new CompanyImpl();
195         clone.setCompanyId(getCompanyId());
196         clone.setAccountId(getAccountId());
197         clone.setWebId(getWebId());
198         clone.setKey(getKey());
199         clone.setVirtualHost(getVirtualHost());
200         clone.setMx(getMx());
201         clone.setLogoId(getLogoId());
202 
203         return clone;
204     }
205 
206     public int compareTo(Object obj) {
207         if (obj == null) {
208             return -1;
209         }
210 
211         CompanyImpl company = (CompanyImpl)obj;
212         long pk = company.getPrimaryKey();
213 
214         if (getPrimaryKey() < pk) {
215             return -1;
216         }
217         else if (getPrimaryKey() > pk) {
218             return 1;
219         }
220         else {
221             return 0;
222         }
223     }
224 
225     public boolean equals(Object obj) {
226         if (obj == null) {
227             return false;
228         }
229 
230         CompanyImpl company = null;
231 
232         try {
233             company = (CompanyImpl)obj;
234         }
235         catch (ClassCastException cce) {
236             return false;
237         }
238 
239         long pk = company.getPrimaryKey();
240 
241         if (getPrimaryKey() == pk) {
242             return true;
243         }
244         else {
245             return false;
246         }
247     }
248 
249     public int hashCode() {
250         return (int)getPrimaryKey();
251     }
252 
253     private long _companyId;
254     private long _accountId;
255     private String _webId;
256     private String _key;
257     private String _virtualHost;
258     private String _mx;
259     private long _logoId;
260 }