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.portlet.social.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.model.impl.BaseModelImpl;
022    import com.liferay.portal.service.ServiceContext;
023    import com.liferay.portal.util.PortalUtil;
024    
025    import com.liferay.portlet.expando.model.ExpandoBridge;
026    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
027    import com.liferay.portlet.social.model.SocialEquityHistory;
028    import com.liferay.portlet.social.model.SocialEquityHistoryModel;
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 SocialEquityHistory service. Represents a row in the "SocialEquityHistory" 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.portlet.social.model.SocialEquityHistoryModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link SocialEquityHistoryImpl}.
043     * </p>
044     *
045     * <p>
046     * Never modify or reference this class directly. All methods that expect a social equity history model instance should use the {@link com.liferay.portlet.social.model.SocialEquityHistory} interface instead.
047     * </p>
048     *
049     * @author Brian Wing Shun Chan
050     * @see SocialEquityHistoryImpl
051     * @see com.liferay.portlet.social.model.SocialEquityHistory
052     * @see com.liferay.portlet.social.model.SocialEquityHistoryModel
053     * @generated
054     */
055    public class SocialEquityHistoryModelImpl extends BaseModelImpl<SocialEquityHistory>
056            implements SocialEquityHistoryModel {
057            public static final String TABLE_NAME = "SocialEquityHistory";
058            public static final Object[][] TABLE_COLUMNS = {
059                            { "equityHistoryId", new Integer(Types.BIGINT) },
060                            { "groupId", new Integer(Types.BIGINT) },
061                            { "companyId", new Integer(Types.BIGINT) },
062                            { "userId", new Integer(Types.BIGINT) },
063                            { "createDate", new Integer(Types.TIMESTAMP) },
064                            { "personalEquity", new Integer(Types.INTEGER) }
065                    };
066            public static final String TABLE_SQL_CREATE = "create table SocialEquityHistory (equityHistoryId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,createDate DATE null,personalEquity INTEGER)";
067            public static final String TABLE_SQL_DROP = "drop table SocialEquityHistory";
068            public static final String DATA_SOURCE = "liferayDataSource";
069            public static final String SESSION_FACTORY = "liferaySessionFactory";
070            public static final String TX_MANAGER = "liferayTransactionManager";
071            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
072                                    "value.object.entity.cache.enabled.com.liferay.portlet.social.model.SocialEquityHistory"),
073                            true);
074            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
075                                    "value.object.finder.cache.enabled.com.liferay.portlet.social.model.SocialEquityHistory"),
076                            true);
077            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
078                                    "lock.expiration.time.com.liferay.portlet.social.model.SocialEquityHistory"));
079    
080            public SocialEquityHistoryModelImpl() {
081            }
082    
083            public long getPrimaryKey() {
084                    return _equityHistoryId;
085            }
086    
087            public void setPrimaryKey(long pk) {
088                    setEquityHistoryId(pk);
089            }
090    
091            public Serializable getPrimaryKeyObj() {
092                    return new Long(_equityHistoryId);
093            }
094    
095            public long getEquityHistoryId() {
096                    return _equityHistoryId;
097            }
098    
099            public void setEquityHistoryId(long equityHistoryId) {
100                    _equityHistoryId = equityHistoryId;
101            }
102    
103            public long getGroupId() {
104                    return _groupId;
105            }
106    
107            public void setGroupId(long groupId) {
108                    _groupId = groupId;
109            }
110    
111            public long getCompanyId() {
112                    return _companyId;
113            }
114    
115            public void setCompanyId(long companyId) {
116                    _companyId = companyId;
117            }
118    
119            public long getUserId() {
120                    return _userId;
121            }
122    
123            public void setUserId(long userId) {
124                    _userId = userId;
125            }
126    
127            public String getUserUuid() throws SystemException {
128                    return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
129            }
130    
131            public void setUserUuid(String userUuid) {
132                    _userUuid = userUuid;
133            }
134    
135            public Date getCreateDate() {
136                    return _createDate;
137            }
138    
139            public void setCreateDate(Date createDate) {
140                    _createDate = createDate;
141            }
142    
143            public int getPersonalEquity() {
144                    return _personalEquity;
145            }
146    
147            public void setPersonalEquity(int personalEquity) {
148                    _personalEquity = personalEquity;
149            }
150    
151            public SocialEquityHistory toEscapedModel() {
152                    if (isEscapedModel()) {
153                            return (SocialEquityHistory)this;
154                    }
155                    else {
156                            return (SocialEquityHistory)Proxy.newProxyInstance(SocialEquityHistory.class.getClassLoader(),
157                                    new Class[] { SocialEquityHistory.class },
158                                    new AutoEscapeBeanHandler(this));
159                    }
160            }
161    
162            public ExpandoBridge getExpandoBridge() {
163                    if (_expandoBridge == null) {
164                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
165                                            SocialEquityHistory.class.getName(), getPrimaryKey());
166                    }
167    
168                    return _expandoBridge;
169            }
170    
171            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
172                    getExpandoBridge().setAttributes(serviceContext);
173            }
174    
175            public Object clone() {
176                    SocialEquityHistoryImpl clone = new SocialEquityHistoryImpl();
177    
178                    clone.setEquityHistoryId(getEquityHistoryId());
179                    clone.setGroupId(getGroupId());
180                    clone.setCompanyId(getCompanyId());
181                    clone.setUserId(getUserId());
182                    clone.setCreateDate(getCreateDate());
183                    clone.setPersonalEquity(getPersonalEquity());
184    
185                    return clone;
186            }
187    
188            public int compareTo(SocialEquityHistory socialEquityHistory) {
189                    long pk = socialEquityHistory.getPrimaryKey();
190    
191                    if (getPrimaryKey() < pk) {
192                            return -1;
193                    }
194                    else if (getPrimaryKey() > pk) {
195                            return 1;
196                    }
197                    else {
198                            return 0;
199                    }
200            }
201    
202            public boolean equals(Object obj) {
203                    if (obj == null) {
204                            return false;
205                    }
206    
207                    SocialEquityHistory socialEquityHistory = null;
208    
209                    try {
210                            socialEquityHistory = (SocialEquityHistory)obj;
211                    }
212                    catch (ClassCastException cce) {
213                            return false;
214                    }
215    
216                    long pk = socialEquityHistory.getPrimaryKey();
217    
218                    if (getPrimaryKey() == pk) {
219                            return true;
220                    }
221                    else {
222                            return false;
223                    }
224            }
225    
226            public int hashCode() {
227                    return (int)getPrimaryKey();
228            }
229    
230            public String toString() {
231                    StringBundler sb = new StringBundler(13);
232    
233                    sb.append("{equityHistoryId=");
234                    sb.append(getEquityHistoryId());
235                    sb.append(", groupId=");
236                    sb.append(getGroupId());
237                    sb.append(", companyId=");
238                    sb.append(getCompanyId());
239                    sb.append(", userId=");
240                    sb.append(getUserId());
241                    sb.append(", createDate=");
242                    sb.append(getCreateDate());
243                    sb.append(", personalEquity=");
244                    sb.append(getPersonalEquity());
245                    sb.append("}");
246    
247                    return sb.toString();
248            }
249    
250            public String toXmlString() {
251                    StringBundler sb = new StringBundler(22);
252    
253                    sb.append("<model><model-name>");
254                    sb.append("com.liferay.portlet.social.model.SocialEquityHistory");
255                    sb.append("</model-name>");
256    
257                    sb.append(
258                            "<column><column-name>equityHistoryId</column-name><column-value><![CDATA[");
259                    sb.append(getEquityHistoryId());
260                    sb.append("]]></column-value></column>");
261                    sb.append(
262                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
263                    sb.append(getGroupId());
264                    sb.append("]]></column-value></column>");
265                    sb.append(
266                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
267                    sb.append(getCompanyId());
268                    sb.append("]]></column-value></column>");
269                    sb.append(
270                            "<column><column-name>userId</column-name><column-value><![CDATA[");
271                    sb.append(getUserId());
272                    sb.append("]]></column-value></column>");
273                    sb.append(
274                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
275                    sb.append(getCreateDate());
276                    sb.append("]]></column-value></column>");
277                    sb.append(
278                            "<column><column-name>personalEquity</column-name><column-value><![CDATA[");
279                    sb.append(getPersonalEquity());
280                    sb.append("]]></column-value></column>");
281    
282                    sb.append("</model>");
283    
284                    return sb.toString();
285            }
286    
287            private long _equityHistoryId;
288            private long _groupId;
289            private long _companyId;
290            private long _userId;
291            private String _userUuid;
292            private Date _createDate;
293            private int _personalEquity;
294            private transient ExpandoBridge _expandoBridge;
295    }