001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.model.impl;
016    
017    import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.kernel.util.GetterUtil;
020    import com.liferay.portal.kernel.util.StringBundler;
021    import com.liferay.portal.kernel.util.StringPool;
022    import com.liferay.portal.model.Subscription;
023    import com.liferay.portal.model.SubscriptionModel;
024    import com.liferay.portal.service.ServiceContext;
025    import com.liferay.portal.util.PortalUtil;
026    
027    import com.liferay.portlet.expando.model.ExpandoBridge;
028    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
029    
030    import java.io.Serializable;
031    
032    import java.lang.reflect.Proxy;
033    
034    import java.sql.Types;
035    
036    import java.util.Date;
037    
038    /**
039     * <p>
040     * This interface is a model that represents the Subscription table in the
041     * database.
042     * </p>
043     *
044     * @author    Brian Wing Shun Chan
045     * @see       SubscriptionImpl
046     * @see       com.liferay.portal.model.Subscription
047     * @see       com.liferay.portal.model.SubscriptionModel
048     * @generated
049     */
050    public class SubscriptionModelImpl extends BaseModelImpl<Subscription>
051            implements SubscriptionModel {
052            public static final String TABLE_NAME = "Subscription";
053            public static final Object[][] TABLE_COLUMNS = {
054                            { "subscriptionId", new Integer(Types.BIGINT) },
055                            { "companyId", new Integer(Types.BIGINT) },
056                            { "userId", new Integer(Types.BIGINT) },
057                            { "userName", new Integer(Types.VARCHAR) },
058                            { "createDate", new Integer(Types.TIMESTAMP) },
059                            { "modifiedDate", new Integer(Types.TIMESTAMP) },
060                            { "classNameId", new Integer(Types.BIGINT) },
061                            { "classPK", new Integer(Types.BIGINT) },
062                            { "frequency", new Integer(Types.VARCHAR) }
063                    };
064            public static final String TABLE_SQL_CREATE = "create table Subscription (subscriptionId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,classNameId LONG,classPK LONG,frequency VARCHAR(75) null)";
065            public static final String TABLE_SQL_DROP = "drop table Subscription";
066            public static final String DATA_SOURCE = "liferayDataSource";
067            public static final String SESSION_FACTORY = "liferaySessionFactory";
068            public static final String TX_MANAGER = "liferayTransactionManager";
069            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
070                                    "value.object.entity.cache.enabled.com.liferay.portal.model.Subscription"),
071                            true);
072            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
073                                    "value.object.finder.cache.enabled.com.liferay.portal.model.Subscription"),
074                            true);
075            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
076                                    "lock.expiration.time.com.liferay.portal.model.Subscription"));
077    
078            public SubscriptionModelImpl() {
079            }
080    
081            public long getPrimaryKey() {
082                    return _subscriptionId;
083            }
084    
085            public void setPrimaryKey(long pk) {
086                    setSubscriptionId(pk);
087            }
088    
089            public Serializable getPrimaryKeyObj() {
090                    return new Long(_subscriptionId);
091            }
092    
093            public long getSubscriptionId() {
094                    return _subscriptionId;
095            }
096    
097            public void setSubscriptionId(long subscriptionId) {
098                    _subscriptionId = subscriptionId;
099            }
100    
101            public long getCompanyId() {
102                    return _companyId;
103            }
104    
105            public void setCompanyId(long companyId) {
106                    _companyId = companyId;
107    
108                    if (!_setOriginalCompanyId) {
109                            _setOriginalCompanyId = true;
110    
111                            _originalCompanyId = companyId;
112                    }
113            }
114    
115            public long getOriginalCompanyId() {
116                    return _originalCompanyId;
117            }
118    
119            public long getUserId() {
120                    return _userId;
121            }
122    
123            public void setUserId(long userId) {
124                    _userId = userId;
125    
126                    if (!_setOriginalUserId) {
127                            _setOriginalUserId = true;
128    
129                            _originalUserId = userId;
130                    }
131            }
132    
133            public String getUserUuid() throws SystemException {
134                    return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
135            }
136    
137            public void setUserUuid(String userUuid) {
138                    _userUuid = userUuid;
139            }
140    
141            public long getOriginalUserId() {
142                    return _originalUserId;
143            }
144    
145            public String getUserName() {
146                    if (_userName == null) {
147                            return StringPool.BLANK;
148                    }
149                    else {
150                            return _userName;
151                    }
152            }
153    
154            public void setUserName(String userName) {
155                    _userName = userName;
156            }
157    
158            public Date getCreateDate() {
159                    return _createDate;
160            }
161    
162            public void setCreateDate(Date createDate) {
163                    _createDate = createDate;
164            }
165    
166            public Date getModifiedDate() {
167                    return _modifiedDate;
168            }
169    
170            public void setModifiedDate(Date modifiedDate) {
171                    _modifiedDate = modifiedDate;
172            }
173    
174            public String getClassName() {
175                    if (getClassNameId() <= 0) {
176                            return StringPool.BLANK;
177                    }
178    
179                    return PortalUtil.getClassName(getClassNameId());
180            }
181    
182            public long getClassNameId() {
183                    return _classNameId;
184            }
185    
186            public void setClassNameId(long classNameId) {
187                    _classNameId = classNameId;
188    
189                    if (!_setOriginalClassNameId) {
190                            _setOriginalClassNameId = true;
191    
192                            _originalClassNameId = classNameId;
193                    }
194            }
195    
196            public long getOriginalClassNameId() {
197                    return _originalClassNameId;
198            }
199    
200            public long getClassPK() {
201                    return _classPK;
202            }
203    
204            public void setClassPK(long classPK) {
205                    _classPK = classPK;
206    
207                    if (!_setOriginalClassPK) {
208                            _setOriginalClassPK = true;
209    
210                            _originalClassPK = classPK;
211                    }
212            }
213    
214            public long getOriginalClassPK() {
215                    return _originalClassPK;
216            }
217    
218            public String getFrequency() {
219                    if (_frequency == null) {
220                            return StringPool.BLANK;
221                    }
222                    else {
223                            return _frequency;
224                    }
225            }
226    
227            public void setFrequency(String frequency) {
228                    _frequency = frequency;
229            }
230    
231            public Subscription toEscapedModel() {
232                    if (isEscapedModel()) {
233                            return (Subscription)this;
234                    }
235                    else {
236                            return (Subscription)Proxy.newProxyInstance(Subscription.class.getClassLoader(),
237                                    new Class[] { Subscription.class },
238                                    new AutoEscapeBeanHandler(this));
239                    }
240            }
241    
242            public ExpandoBridge getExpandoBridge() {
243                    if (_expandoBridge == null) {
244                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
245                                            Subscription.class.getName(), getPrimaryKey());
246                    }
247    
248                    return _expandoBridge;
249            }
250    
251            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
252                    getExpandoBridge().setAttributes(serviceContext);
253            }
254    
255            public Object clone() {
256                    SubscriptionImpl clone = new SubscriptionImpl();
257    
258                    clone.setSubscriptionId(getSubscriptionId());
259                    clone.setCompanyId(getCompanyId());
260                    clone.setUserId(getUserId());
261                    clone.setUserName(getUserName());
262                    clone.setCreateDate(getCreateDate());
263                    clone.setModifiedDate(getModifiedDate());
264                    clone.setClassNameId(getClassNameId());
265                    clone.setClassPK(getClassPK());
266                    clone.setFrequency(getFrequency());
267    
268                    return clone;
269            }
270    
271            public int compareTo(Subscription subscription) {
272                    long pk = subscription.getPrimaryKey();
273    
274                    if (getPrimaryKey() < pk) {
275                            return -1;
276                    }
277                    else if (getPrimaryKey() > pk) {
278                            return 1;
279                    }
280                    else {
281                            return 0;
282                    }
283            }
284    
285            public boolean equals(Object obj) {
286                    if (obj == null) {
287                            return false;
288                    }
289    
290                    Subscription subscription = null;
291    
292                    try {
293                            subscription = (Subscription)obj;
294                    }
295                    catch (ClassCastException cce) {
296                            return false;
297                    }
298    
299                    long pk = subscription.getPrimaryKey();
300    
301                    if (getPrimaryKey() == pk) {
302                            return true;
303                    }
304                    else {
305                            return false;
306                    }
307            }
308    
309            public int hashCode() {
310                    return (int)getPrimaryKey();
311            }
312    
313            public String toString() {
314                    StringBundler sb = new StringBundler(19);
315    
316                    sb.append("{subscriptionId=");
317                    sb.append(getSubscriptionId());
318                    sb.append(", companyId=");
319                    sb.append(getCompanyId());
320                    sb.append(", userId=");
321                    sb.append(getUserId());
322                    sb.append(", userName=");
323                    sb.append(getUserName());
324                    sb.append(", createDate=");
325                    sb.append(getCreateDate());
326                    sb.append(", modifiedDate=");
327                    sb.append(getModifiedDate());
328                    sb.append(", classNameId=");
329                    sb.append(getClassNameId());
330                    sb.append(", classPK=");
331                    sb.append(getClassPK());
332                    sb.append(", frequency=");
333                    sb.append(getFrequency());
334                    sb.append("}");
335    
336                    return sb.toString();
337            }
338    
339            public String toXmlString() {
340                    StringBundler sb = new StringBundler(31);
341    
342                    sb.append("<model><model-name>");
343                    sb.append("com.liferay.portal.model.Subscription");
344                    sb.append("</model-name>");
345    
346                    sb.append(
347                            "<column><column-name>subscriptionId</column-name><column-value><![CDATA[");
348                    sb.append(getSubscriptionId());
349                    sb.append("]]></column-value></column>");
350                    sb.append(
351                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
352                    sb.append(getCompanyId());
353                    sb.append("]]></column-value></column>");
354                    sb.append(
355                            "<column><column-name>userId</column-name><column-value><![CDATA[");
356                    sb.append(getUserId());
357                    sb.append("]]></column-value></column>");
358                    sb.append(
359                            "<column><column-name>userName</column-name><column-value><![CDATA[");
360                    sb.append(getUserName());
361                    sb.append("]]></column-value></column>");
362                    sb.append(
363                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
364                    sb.append(getCreateDate());
365                    sb.append("]]></column-value></column>");
366                    sb.append(
367                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
368                    sb.append(getModifiedDate());
369                    sb.append("]]></column-value></column>");
370                    sb.append(
371                            "<column><column-name>classNameId</column-name><column-value><![CDATA[");
372                    sb.append(getClassNameId());
373                    sb.append("]]></column-value></column>");
374                    sb.append(
375                            "<column><column-name>classPK</column-name><column-value><![CDATA[");
376                    sb.append(getClassPK());
377                    sb.append("]]></column-value></column>");
378                    sb.append(
379                            "<column><column-name>frequency</column-name><column-value><![CDATA[");
380                    sb.append(getFrequency());
381                    sb.append("]]></column-value></column>");
382    
383                    sb.append("</model>");
384    
385                    return sb.toString();
386            }
387    
388            private long _subscriptionId;
389            private long _companyId;
390            private long _originalCompanyId;
391            private boolean _setOriginalCompanyId;
392            private long _userId;
393            private String _userUuid;
394            private long _originalUserId;
395            private boolean _setOriginalUserId;
396            private String _userName;
397            private Date _createDate;
398            private Date _modifiedDate;
399            private long _classNameId;
400            private long _originalClassNameId;
401            private boolean _setOriginalClassNameId;
402            private long _classPK;
403            private long _originalClassPK;
404            private boolean _setOriginalClassPK;
405            private String _frequency;
406            private transient ExpandoBridge _expandoBridge;
407    }