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