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