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.SocialEquityUser;
028    import com.liferay.portlet.social.model.SocialEquityUserModel;
029    
030    import java.io.Serializable;
031    
032    import java.lang.reflect.Proxy;
033    
034    import java.sql.Types;
035    
036    /**
037     * The base model implementation for the SocialEquityUser service. Represents a row in the "SocialEquityUser" database table, with each column mapped to a property of this class.
038     *
039     * <p>
040     * This implementation and its corresponding interface {@link com.liferay.portlet.social.model.SocialEquityUserModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link SocialEquityUserImpl}.
041     * </p>
042     *
043     * <p>
044     * Never modify or reference this class directly. All methods that expect a social equity user model instance should use the {@link com.liferay.portlet.social.model.SocialEquityUser} interface instead.
045     * </p>
046     *
047     * @author Brian Wing Shun Chan
048     * @see SocialEquityUserImpl
049     * @see com.liferay.portlet.social.model.SocialEquityUser
050     * @see com.liferay.portlet.social.model.SocialEquityUserModel
051     * @generated
052     */
053    public class SocialEquityUserModelImpl extends BaseModelImpl<SocialEquityUser>
054            implements SocialEquityUserModel {
055            public static final String TABLE_NAME = "SocialEquityUser";
056            public static final Object[][] TABLE_COLUMNS = {
057                            { "equityUserId", new Integer(Types.BIGINT) },
058                            { "groupId", new Integer(Types.BIGINT) },
059                            { "companyId", new Integer(Types.BIGINT) },
060                            { "userId", new Integer(Types.BIGINT) },
061                            { "contributionK", new Integer(Types.DOUBLE) },
062                            { "contributionB", new Integer(Types.DOUBLE) },
063                            { "participationK", new Integer(Types.DOUBLE) },
064                            { "participationB", new Integer(Types.DOUBLE) },
065                            { "rank", new Integer(Types.INTEGER) }
066                    };
067            public static final String TABLE_SQL_CREATE = "create table SocialEquityUser (equityUserId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,contributionK DOUBLE,contributionB DOUBLE,participationK DOUBLE,participationB DOUBLE,rank INTEGER)";
068            public static final String TABLE_SQL_DROP = "drop table SocialEquityUser";
069            public static final String DATA_SOURCE = "liferayDataSource";
070            public static final String SESSION_FACTORY = "liferaySessionFactory";
071            public static final String TX_MANAGER = "liferayTransactionManager";
072            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
073                                    "value.object.entity.cache.enabled.com.liferay.portlet.social.model.SocialEquityUser"),
074                            true);
075            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
076                                    "value.object.finder.cache.enabled.com.liferay.portlet.social.model.SocialEquityUser"),
077                            true);
078            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
079                                    "lock.expiration.time.com.liferay.portlet.social.model.SocialEquityUser"));
080    
081            public SocialEquityUserModelImpl() {
082            }
083    
084            public long getPrimaryKey() {
085                    return _equityUserId;
086            }
087    
088            public void setPrimaryKey(long pk) {
089                    setEquityUserId(pk);
090            }
091    
092            public Serializable getPrimaryKeyObj() {
093                    return new Long(_equityUserId);
094            }
095    
096            public long getEquityUserId() {
097                    return _equityUserId;
098            }
099    
100            public void setEquityUserId(long equityUserId) {
101                    _equityUserId = equityUserId;
102            }
103    
104            public String getEquityUserUuid() throws SystemException {
105                    return PortalUtil.getUserValue(getEquityUserId(), "uuid",
106                            _equityUserUuid);
107            }
108    
109            public void setEquityUserUuid(String equityUserUuid) {
110                    _equityUserUuid = equityUserUuid;
111            }
112    
113            public long getGroupId() {
114                    return _groupId;
115            }
116    
117            public void setGroupId(long groupId) {
118                    _groupId = groupId;
119    
120                    if (!_setOriginalGroupId) {
121                            _setOriginalGroupId = true;
122    
123                            _originalGroupId = groupId;
124                    }
125            }
126    
127            public long getOriginalGroupId() {
128                    return _originalGroupId;
129            }
130    
131            public long getCompanyId() {
132                    return _companyId;
133            }
134    
135            public void setCompanyId(long companyId) {
136                    _companyId = companyId;
137            }
138    
139            public long getUserId() {
140                    return _userId;
141            }
142    
143            public void setUserId(long userId) {
144                    _userId = userId;
145    
146                    if (!_setOriginalUserId) {
147                            _setOriginalUserId = true;
148    
149                            _originalUserId = userId;
150                    }
151            }
152    
153            public String getUserUuid() throws SystemException {
154                    return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
155            }
156    
157            public void setUserUuid(String userUuid) {
158                    _userUuid = userUuid;
159            }
160    
161            public long getOriginalUserId() {
162                    return _originalUserId;
163            }
164    
165            public double getContributionK() {
166                    return _contributionK;
167            }
168    
169            public void setContributionK(double contributionK) {
170                    _contributionK = contributionK;
171            }
172    
173            public double getContributionB() {
174                    return _contributionB;
175            }
176    
177            public void setContributionB(double contributionB) {
178                    _contributionB = contributionB;
179            }
180    
181            public double getParticipationK() {
182                    return _participationK;
183            }
184    
185            public void setParticipationK(double participationK) {
186                    _participationK = participationK;
187            }
188    
189            public double getParticipationB() {
190                    return _participationB;
191            }
192    
193            public void setParticipationB(double participationB) {
194                    _participationB = participationB;
195            }
196    
197            public int getRank() {
198                    return _rank;
199            }
200    
201            public void setRank(int rank) {
202                    _rank = rank;
203            }
204    
205            public SocialEquityUser toEscapedModel() {
206                    if (isEscapedModel()) {
207                            return (SocialEquityUser)this;
208                    }
209                    else {
210                            return (SocialEquityUser)Proxy.newProxyInstance(SocialEquityUser.class.getClassLoader(),
211                                    new Class[] { SocialEquityUser.class },
212                                    new AutoEscapeBeanHandler(this));
213                    }
214            }
215    
216            public ExpandoBridge getExpandoBridge() {
217                    if (_expandoBridge == null) {
218                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
219                                            SocialEquityUser.class.getName(), getPrimaryKey());
220                    }
221    
222                    return _expandoBridge;
223            }
224    
225            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
226                    getExpandoBridge().setAttributes(serviceContext);
227            }
228    
229            public Object clone() {
230                    SocialEquityUserImpl clone = new SocialEquityUserImpl();
231    
232                    clone.setEquityUserId(getEquityUserId());
233                    clone.setGroupId(getGroupId());
234                    clone.setCompanyId(getCompanyId());
235                    clone.setUserId(getUserId());
236                    clone.setContributionK(getContributionK());
237                    clone.setContributionB(getContributionB());
238                    clone.setParticipationK(getParticipationK());
239                    clone.setParticipationB(getParticipationB());
240                    clone.setRank(getRank());
241    
242                    return clone;
243            }
244    
245            public int compareTo(SocialEquityUser socialEquityUser) {
246                    long pk = socialEquityUser.getPrimaryKey();
247    
248                    if (getPrimaryKey() < pk) {
249                            return -1;
250                    }
251                    else if (getPrimaryKey() > pk) {
252                            return 1;
253                    }
254                    else {
255                            return 0;
256                    }
257            }
258    
259            public boolean equals(Object obj) {
260                    if (obj == null) {
261                            return false;
262                    }
263    
264                    SocialEquityUser socialEquityUser = null;
265    
266                    try {
267                            socialEquityUser = (SocialEquityUser)obj;
268                    }
269                    catch (ClassCastException cce) {
270                            return false;
271                    }
272    
273                    long pk = socialEquityUser.getPrimaryKey();
274    
275                    if (getPrimaryKey() == pk) {
276                            return true;
277                    }
278                    else {
279                            return false;
280                    }
281            }
282    
283            public int hashCode() {
284                    return (int)getPrimaryKey();
285            }
286    
287            public String toString() {
288                    StringBundler sb = new StringBundler(19);
289    
290                    sb.append("{equityUserId=");
291                    sb.append(getEquityUserId());
292                    sb.append(", groupId=");
293                    sb.append(getGroupId());
294                    sb.append(", companyId=");
295                    sb.append(getCompanyId());
296                    sb.append(", userId=");
297                    sb.append(getUserId());
298                    sb.append(", contributionK=");
299                    sb.append(getContributionK());
300                    sb.append(", contributionB=");
301                    sb.append(getContributionB());
302                    sb.append(", participationK=");
303                    sb.append(getParticipationK());
304                    sb.append(", participationB=");
305                    sb.append(getParticipationB());
306                    sb.append(", rank=");
307                    sb.append(getRank());
308                    sb.append("}");
309    
310                    return sb.toString();
311            }
312    
313            public String toXmlString() {
314                    StringBundler sb = new StringBundler(31);
315    
316                    sb.append("<model><model-name>");
317                    sb.append("com.liferay.portlet.social.model.SocialEquityUser");
318                    sb.append("</model-name>");
319    
320                    sb.append(
321                            "<column><column-name>equityUserId</column-name><column-value><![CDATA[");
322                    sb.append(getEquityUserId());
323                    sb.append("]]></column-value></column>");
324                    sb.append(
325                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
326                    sb.append(getGroupId());
327                    sb.append("]]></column-value></column>");
328                    sb.append(
329                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
330                    sb.append(getCompanyId());
331                    sb.append("]]></column-value></column>");
332                    sb.append(
333                            "<column><column-name>userId</column-name><column-value><![CDATA[");
334                    sb.append(getUserId());
335                    sb.append("]]></column-value></column>");
336                    sb.append(
337                            "<column><column-name>contributionK</column-name><column-value><![CDATA[");
338                    sb.append(getContributionK());
339                    sb.append("]]></column-value></column>");
340                    sb.append(
341                            "<column><column-name>contributionB</column-name><column-value><![CDATA[");
342                    sb.append(getContributionB());
343                    sb.append("]]></column-value></column>");
344                    sb.append(
345                            "<column><column-name>participationK</column-name><column-value><![CDATA[");
346                    sb.append(getParticipationK());
347                    sb.append("]]></column-value></column>");
348                    sb.append(
349                            "<column><column-name>participationB</column-name><column-value><![CDATA[");
350                    sb.append(getParticipationB());
351                    sb.append("]]></column-value></column>");
352                    sb.append(
353                            "<column><column-name>rank</column-name><column-value><![CDATA[");
354                    sb.append(getRank());
355                    sb.append("]]></column-value></column>");
356    
357                    sb.append("</model>");
358    
359                    return sb.toString();
360            }
361    
362            private long _equityUserId;
363            private String _equityUserUuid;
364            private long _groupId;
365            private long _originalGroupId;
366            private boolean _setOriginalGroupId;
367            private long _companyId;
368            private long _userId;
369            private String _userUuid;
370            private long _originalUserId;
371            private boolean _setOriginalUserId;
372            private double _contributionK;
373            private double _contributionB;
374            private double _participationK;
375            private double _participationB;
376            private int _rank;
377            private transient ExpandoBridge _expandoBridge;
378    }