001    /**
002     * Copyright (c) 2000-2011 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 socialEquityHistoryImpl = new SocialEquityHistoryImpl();
177    
178                    socialEquityHistoryImpl.setEquityHistoryId(getEquityHistoryId());
179    
180                    socialEquityHistoryImpl.setGroupId(getGroupId());
181    
182                    socialEquityHistoryImpl.setCompanyId(getCompanyId());
183    
184                    socialEquityHistoryImpl.setUserId(getUserId());
185    
186                    socialEquityHistoryImpl.setCreateDate(getCreateDate());
187    
188                    socialEquityHistoryImpl.setPersonalEquity(getPersonalEquity());
189    
190                    return socialEquityHistoryImpl;
191            }
192    
193            public int compareTo(SocialEquityHistory socialEquityHistory) {
194                    long pk = socialEquityHistory.getPrimaryKey();
195    
196                    if (getPrimaryKey() < pk) {
197                            return -1;
198                    }
199                    else if (getPrimaryKey() > pk) {
200                            return 1;
201                    }
202                    else {
203                            return 0;
204                    }
205            }
206    
207            public boolean equals(Object obj) {
208                    if (obj == null) {
209                            return false;
210                    }
211    
212                    SocialEquityHistory socialEquityHistory = null;
213    
214                    try {
215                            socialEquityHistory = (SocialEquityHistory)obj;
216                    }
217                    catch (ClassCastException cce) {
218                            return false;
219                    }
220    
221                    long pk = socialEquityHistory.getPrimaryKey();
222    
223                    if (getPrimaryKey() == pk) {
224                            return true;
225                    }
226                    else {
227                            return false;
228                    }
229            }
230    
231            public int hashCode() {
232                    return (int)getPrimaryKey();
233            }
234    
235            public String toString() {
236                    StringBundler sb = new StringBundler(13);
237    
238                    sb.append("{equityHistoryId=");
239                    sb.append(getEquityHistoryId());
240                    sb.append(", groupId=");
241                    sb.append(getGroupId());
242                    sb.append(", companyId=");
243                    sb.append(getCompanyId());
244                    sb.append(", userId=");
245                    sb.append(getUserId());
246                    sb.append(", createDate=");
247                    sb.append(getCreateDate());
248                    sb.append(", personalEquity=");
249                    sb.append(getPersonalEquity());
250                    sb.append("}");
251    
252                    return sb.toString();
253            }
254    
255            public String toXmlString() {
256                    StringBundler sb = new StringBundler(22);
257    
258                    sb.append("<model><model-name>");
259                    sb.append("com.liferay.portlet.social.model.SocialEquityHistory");
260                    sb.append("</model-name>");
261    
262                    sb.append(
263                            "<column><column-name>equityHistoryId</column-name><column-value><![CDATA[");
264                    sb.append(getEquityHistoryId());
265                    sb.append("]]></column-value></column>");
266                    sb.append(
267                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
268                    sb.append(getGroupId());
269                    sb.append("]]></column-value></column>");
270                    sb.append(
271                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
272                    sb.append(getCompanyId());
273                    sb.append("]]></column-value></column>");
274                    sb.append(
275                            "<column><column-name>userId</column-name><column-value><![CDATA[");
276                    sb.append(getUserId());
277                    sb.append("]]></column-value></column>");
278                    sb.append(
279                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
280                    sb.append(getCreateDate());
281                    sb.append("]]></column-value></column>");
282                    sb.append(
283                            "<column><column-name>personalEquity</column-name><column-value><![CDATA[");
284                    sb.append(getPersonalEquity());
285                    sb.append("]]></column-value></column>");
286    
287                    sb.append("</model>");
288    
289                    return sb.toString();
290            }
291    
292            private long _equityHistoryId;
293            private long _groupId;
294            private long _companyId;
295            private long _userId;
296            private String _userUuid;
297            private Date _createDate;
298            private int _personalEquity;
299            private transient ExpandoBridge _expandoBridge;
300    }