1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.social.model.impl;
16  
17  import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
18  import com.liferay.portal.kernel.exception.SystemException;
19  import com.liferay.portal.kernel.util.GetterUtil;
20  import com.liferay.portal.kernel.util.StringBundler;
21  import com.liferay.portal.kernel.util.StringPool;
22  import com.liferay.portal.model.impl.BaseModelImpl;
23  import com.liferay.portal.service.ServiceContext;
24  import com.liferay.portal.util.PortalUtil;
25  
26  import com.liferay.portlet.expando.model.ExpandoBridge;
27  import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
28  import com.liferay.portlet.social.model.SocialEquityLog;
29  import com.liferay.portlet.social.model.SocialEquityLogSoap;
30  
31  import java.io.Serializable;
32  
33  import java.lang.reflect.Proxy;
34  
35  import java.sql.Types;
36  
37  import java.util.ArrayList;
38  import java.util.List;
39  
40  /**
41   * <a href="SocialEquityLogModelImpl.java.html"><b><i>View Source</i></b></a>
42   *
43   * <p>
44   * ServiceBuilder generated this class. Modifications in this class will be
45   * overwritten the next time is generated.
46   * </p>
47   *
48   * <p>
49   * This interface is a model that represents the SocialEquityLog table in the
50   * database.
51   * </p>
52   *
53   * @author    Brian Wing Shun Chan
54   * @see       SocialEquityLogImpl
55   * @see       com.liferay.portlet.social.model.SocialEquityLog
56   * @see       com.liferay.portlet.social.model.SocialEquityLogModel
57   * @generated
58   */
59  public class SocialEquityLogModelImpl extends BaseModelImpl<SocialEquityLog> {
60      public static final String TABLE_NAME = "SocialEquityLog";
61      public static final Object[][] TABLE_COLUMNS = {
62              { "equityLogId", new Integer(Types.BIGINT) },
63              { "groupId", new Integer(Types.BIGINT) },
64              { "companyId", new Integer(Types.BIGINT) },
65              { "userId", new Integer(Types.BIGINT) },
66              { "assetEntryId", new Integer(Types.BIGINT) },
67              { "actionId", new Integer(Types.VARCHAR) },
68              { "actionDate", new Integer(Types.INTEGER) },
69              { "type_", new Integer(Types.INTEGER) },
70              { "value", new Integer(Types.INTEGER) },
71              { "validity", new Integer(Types.INTEGER) },
72              { "active_", new Integer(Types.BOOLEAN) }
73          };
74      public static final String TABLE_SQL_CREATE = "create table SocialEquityLog (equityLogId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,assetEntryId LONG,actionId VARCHAR(75) null,actionDate INTEGER,type_ INTEGER,value INTEGER,validity INTEGER,active_ BOOLEAN)";
75      public static final String TABLE_SQL_DROP = "drop table SocialEquityLog";
76      public static final String DATA_SOURCE = "liferayDataSource";
77      public static final String SESSION_FACTORY = "liferaySessionFactory";
78      public static final String TX_MANAGER = "liferayTransactionManager";
79      public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
80                  "value.object.entity.cache.enabled.com.liferay.portlet.social.model.SocialEquityLog"),
81              true);
82      public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
83                  "value.object.finder.cache.enabled.com.liferay.portlet.social.model.SocialEquityLog"),
84              true);
85  
86      public static SocialEquityLog toModel(SocialEquityLogSoap soapModel) {
87          SocialEquityLog model = new SocialEquityLogImpl();
88  
89          model.setEquityLogId(soapModel.getEquityLogId());
90          model.setGroupId(soapModel.getGroupId());
91          model.setCompanyId(soapModel.getCompanyId());
92          model.setUserId(soapModel.getUserId());
93          model.setAssetEntryId(soapModel.getAssetEntryId());
94          model.setActionId(soapModel.getActionId());
95          model.setActionDate(soapModel.getActionDate());
96          model.setType(soapModel.getType());
97          model.setValue(soapModel.getValue());
98          model.setValidity(soapModel.getValidity());
99          model.setActive(soapModel.getActive());
100 
101         return model;
102     }
103 
104     public static List<SocialEquityLog> toModels(
105         SocialEquityLogSoap[] soapModels) {
106         List<SocialEquityLog> models = new ArrayList<SocialEquityLog>(soapModels.length);
107 
108         for (SocialEquityLogSoap soapModel : soapModels) {
109             models.add(toModel(soapModel));
110         }
111 
112         return models;
113     }
114 
115     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
116                 "lock.expiration.time.com.liferay.portlet.social.model.SocialEquityLog"));
117 
118     public SocialEquityLogModelImpl() {
119     }
120 
121     public long getPrimaryKey() {
122         return _equityLogId;
123     }
124 
125     public void setPrimaryKey(long pk) {
126         setEquityLogId(pk);
127     }
128 
129     public Serializable getPrimaryKeyObj() {
130         return new Long(_equityLogId);
131     }
132 
133     public long getEquityLogId() {
134         return _equityLogId;
135     }
136 
137     public void setEquityLogId(long equityLogId) {
138         _equityLogId = equityLogId;
139     }
140 
141     public long getGroupId() {
142         return _groupId;
143     }
144 
145     public void setGroupId(long groupId) {
146         _groupId = groupId;
147     }
148 
149     public long getCompanyId() {
150         return _companyId;
151     }
152 
153     public void setCompanyId(long companyId) {
154         _companyId = companyId;
155     }
156 
157     public long getUserId() {
158         return _userId;
159     }
160 
161     public void setUserId(long userId) {
162         _userId = userId;
163     }
164 
165     public String getUserUuid() throws SystemException {
166         return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
167     }
168 
169     public void setUserUuid(String userUuid) {
170         _userUuid = userUuid;
171     }
172 
173     public long getAssetEntryId() {
174         return _assetEntryId;
175     }
176 
177     public void setAssetEntryId(long assetEntryId) {
178         _assetEntryId = assetEntryId;
179     }
180 
181     public String getActionId() {
182         if (_actionId == null) {
183             return StringPool.BLANK;
184         }
185         else {
186             return _actionId;
187         }
188     }
189 
190     public void setActionId(String actionId) {
191         _actionId = actionId;
192     }
193 
194     public int getActionDate() {
195         return _actionDate;
196     }
197 
198     public void setActionDate(int actionDate) {
199         _actionDate = actionDate;
200     }
201 
202     public int getType() {
203         return _type;
204     }
205 
206     public void setType(int type) {
207         _type = type;
208     }
209 
210     public int getValue() {
211         return _value;
212     }
213 
214     public void setValue(int value) {
215         _value = value;
216     }
217 
218     public int getValidity() {
219         return _validity;
220     }
221 
222     public void setValidity(int validity) {
223         _validity = validity;
224     }
225 
226     public boolean getActive() {
227         return _active;
228     }
229 
230     public boolean isActive() {
231         return _active;
232     }
233 
234     public void setActive(boolean active) {
235         _active = active;
236     }
237 
238     public SocialEquityLog toEscapedModel() {
239         if (isEscapedModel()) {
240             return (SocialEquityLog)this;
241         }
242         else {
243             return (SocialEquityLog)Proxy.newProxyInstance(SocialEquityLog.class.getClassLoader(),
244                 new Class[] { SocialEquityLog.class },
245                 new AutoEscapeBeanHandler(this));
246         }
247     }
248 
249     public ExpandoBridge getExpandoBridge() {
250         if (_expandoBridge == null) {
251             _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
252                     SocialEquityLog.class.getName(), getPrimaryKey());
253         }
254 
255         return _expandoBridge;
256     }
257 
258     public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
259         getExpandoBridge().setAttributes(serviceContext);
260     }
261 
262     public Object clone() {
263         SocialEquityLogImpl clone = new SocialEquityLogImpl();
264 
265         clone.setEquityLogId(getEquityLogId());
266         clone.setGroupId(getGroupId());
267         clone.setCompanyId(getCompanyId());
268         clone.setUserId(getUserId());
269         clone.setAssetEntryId(getAssetEntryId());
270         clone.setActionId(getActionId());
271         clone.setActionDate(getActionDate());
272         clone.setType(getType());
273         clone.setValue(getValue());
274         clone.setValidity(getValidity());
275         clone.setActive(getActive());
276 
277         return clone;
278     }
279 
280     public int compareTo(SocialEquityLog socialEquityLog) {
281         long pk = socialEquityLog.getPrimaryKey();
282 
283         if (getPrimaryKey() < pk) {
284             return -1;
285         }
286         else if (getPrimaryKey() > pk) {
287             return 1;
288         }
289         else {
290             return 0;
291         }
292     }
293 
294     public boolean equals(Object obj) {
295         if (obj == null) {
296             return false;
297         }
298 
299         SocialEquityLog socialEquityLog = null;
300 
301         try {
302             socialEquityLog = (SocialEquityLog)obj;
303         }
304         catch (ClassCastException cce) {
305             return false;
306         }
307 
308         long pk = socialEquityLog.getPrimaryKey();
309 
310         if (getPrimaryKey() == pk) {
311             return true;
312         }
313         else {
314             return false;
315         }
316     }
317 
318     public int hashCode() {
319         return (int)getPrimaryKey();
320     }
321 
322     public String toString() {
323         StringBundler sb = new StringBundler(23);
324 
325         sb.append("{equityLogId=");
326         sb.append(getEquityLogId());
327         sb.append(", groupId=");
328         sb.append(getGroupId());
329         sb.append(", companyId=");
330         sb.append(getCompanyId());
331         sb.append(", userId=");
332         sb.append(getUserId());
333         sb.append(", assetEntryId=");
334         sb.append(getAssetEntryId());
335         sb.append(", actionId=");
336         sb.append(getActionId());
337         sb.append(", actionDate=");
338         sb.append(getActionDate());
339         sb.append(", type=");
340         sb.append(getType());
341         sb.append(", value=");
342         sb.append(getValue());
343         sb.append(", validity=");
344         sb.append(getValidity());
345         sb.append(", active=");
346         sb.append(getActive());
347         sb.append("}");
348 
349         return sb.toString();
350     }
351 
352     public String toXmlString() {
353         StringBundler sb = new StringBundler(37);
354 
355         sb.append("<model><model-name>");
356         sb.append("com.liferay.portlet.social.model.SocialEquityLog");
357         sb.append("</model-name>");
358 
359         sb.append(
360             "<column><column-name>equityLogId</column-name><column-value><![CDATA[");
361         sb.append(getEquityLogId());
362         sb.append("]]></column-value></column>");
363         sb.append(
364             "<column><column-name>groupId</column-name><column-value><![CDATA[");
365         sb.append(getGroupId());
366         sb.append("]]></column-value></column>");
367         sb.append(
368             "<column><column-name>companyId</column-name><column-value><![CDATA[");
369         sb.append(getCompanyId());
370         sb.append("]]></column-value></column>");
371         sb.append(
372             "<column><column-name>userId</column-name><column-value><![CDATA[");
373         sb.append(getUserId());
374         sb.append("]]></column-value></column>");
375         sb.append(
376             "<column><column-name>assetEntryId</column-name><column-value><![CDATA[");
377         sb.append(getAssetEntryId());
378         sb.append("]]></column-value></column>");
379         sb.append(
380             "<column><column-name>actionId</column-name><column-value><![CDATA[");
381         sb.append(getActionId());
382         sb.append("]]></column-value></column>");
383         sb.append(
384             "<column><column-name>actionDate</column-name><column-value><![CDATA[");
385         sb.append(getActionDate());
386         sb.append("]]></column-value></column>");
387         sb.append(
388             "<column><column-name>type</column-name><column-value><![CDATA[");
389         sb.append(getType());
390         sb.append("]]></column-value></column>");
391         sb.append(
392             "<column><column-name>value</column-name><column-value><![CDATA[");
393         sb.append(getValue());
394         sb.append("]]></column-value></column>");
395         sb.append(
396             "<column><column-name>validity</column-name><column-value><![CDATA[");
397         sb.append(getValidity());
398         sb.append("]]></column-value></column>");
399         sb.append(
400             "<column><column-name>active</column-name><column-value><![CDATA[");
401         sb.append(getActive());
402         sb.append("]]></column-value></column>");
403 
404         sb.append("</model>");
405 
406         return sb.toString();
407     }
408 
409     private long _equityLogId;
410     private long _groupId;
411     private long _companyId;
412     private long _userId;
413     private String _userUuid;
414     private long _assetEntryId;
415     private String _actionId;
416     private int _actionDate;
417     private int _type;
418     private int _value;
419     private int _validity;
420     private boolean _active;
421     private transient ExpandoBridge _expandoBridge;
422 }