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.model.impl.BaseModelImpl;
22  import com.liferay.portal.service.ServiceContext;
23  import com.liferay.portal.util.PortalUtil;
24  
25  import com.liferay.portlet.expando.model.ExpandoBridge;
26  import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
27  import com.liferay.portlet.social.model.SocialEquityHistory;
28  import com.liferay.portlet.social.model.SocialEquityHistorySoap;
29  
30  import java.io.Serializable;
31  
32  import java.lang.reflect.Proxy;
33  
34  import java.sql.Types;
35  
36  import java.util.ArrayList;
37  import java.util.Date;
38  import java.util.List;
39  
40  /**
41   * <a href="SocialEquityHistoryModelImpl.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 SocialEquityHistory table in the
50   * database.
51   * </p>
52   *
53   * @author    Brian Wing Shun Chan
54   * @see       SocialEquityHistoryImpl
55   * @see       com.liferay.portlet.social.model.SocialEquityHistory
56   * @see       com.liferay.portlet.social.model.SocialEquityHistoryModel
57   * @generated
58   */
59  public class SocialEquityHistoryModelImpl extends BaseModelImpl<SocialEquityHistory> {
60      public static final String TABLE_NAME = "SocialEquityHistory";
61      public static final Object[][] TABLE_COLUMNS = {
62              { "equityHistoryId", new Integer(Types.BIGINT) },
63              { "groupId", new Integer(Types.BIGINT) },
64              { "companyId", new Integer(Types.BIGINT) },
65              { "userId", new Integer(Types.BIGINT) },
66              { "createDate", new Integer(Types.TIMESTAMP) },
67              { "personalEquity", new Integer(Types.INTEGER) }
68          };
69      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)";
70      public static final String TABLE_SQL_DROP = "drop table SocialEquityHistory";
71      public static final String DATA_SOURCE = "liferayDataSource";
72      public static final String SESSION_FACTORY = "liferaySessionFactory";
73      public static final String TX_MANAGER = "liferayTransactionManager";
74      public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
75                  "value.object.entity.cache.enabled.com.liferay.portlet.social.model.SocialEquityHistory"),
76              true);
77      public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
78                  "value.object.finder.cache.enabled.com.liferay.portlet.social.model.SocialEquityHistory"),
79              true);
80  
81      public static SocialEquityHistory toModel(SocialEquityHistorySoap soapModel) {
82          SocialEquityHistory model = new SocialEquityHistoryImpl();
83  
84          model.setEquityHistoryId(soapModel.getEquityHistoryId());
85          model.setGroupId(soapModel.getGroupId());
86          model.setCompanyId(soapModel.getCompanyId());
87          model.setUserId(soapModel.getUserId());
88          model.setCreateDate(soapModel.getCreateDate());
89          model.setPersonalEquity(soapModel.getPersonalEquity());
90  
91          return model;
92      }
93  
94      public static List<SocialEquityHistory> toModels(
95          SocialEquityHistorySoap[] soapModels) {
96          List<SocialEquityHistory> models = new ArrayList<SocialEquityHistory>(soapModels.length);
97  
98          for (SocialEquityHistorySoap soapModel : soapModels) {
99              models.add(toModel(soapModel));
100         }
101 
102         return models;
103     }
104 
105     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
106                 "lock.expiration.time.com.liferay.portlet.social.model.SocialEquityHistory"));
107 
108     public SocialEquityHistoryModelImpl() {
109     }
110 
111     public long getPrimaryKey() {
112         return _equityHistoryId;
113     }
114 
115     public void setPrimaryKey(long pk) {
116         setEquityHistoryId(pk);
117     }
118 
119     public Serializable getPrimaryKeyObj() {
120         return new Long(_equityHistoryId);
121     }
122 
123     public long getEquityHistoryId() {
124         return _equityHistoryId;
125     }
126 
127     public void setEquityHistoryId(long equityHistoryId) {
128         _equityHistoryId = equityHistoryId;
129     }
130 
131     public long getGroupId() {
132         return _groupId;
133     }
134 
135     public void setGroupId(long groupId) {
136         _groupId = groupId;
137     }
138 
139     public long getCompanyId() {
140         return _companyId;
141     }
142 
143     public void setCompanyId(long companyId) {
144         _companyId = companyId;
145     }
146 
147     public long getUserId() {
148         return _userId;
149     }
150 
151     public void setUserId(long userId) {
152         _userId = userId;
153     }
154 
155     public String getUserUuid() throws SystemException {
156         return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
157     }
158 
159     public void setUserUuid(String userUuid) {
160         _userUuid = userUuid;
161     }
162 
163     public Date getCreateDate() {
164         return _createDate;
165     }
166 
167     public void setCreateDate(Date createDate) {
168         _createDate = createDate;
169     }
170 
171     public int getPersonalEquity() {
172         return _personalEquity;
173     }
174 
175     public void setPersonalEquity(int personalEquity) {
176         _personalEquity = personalEquity;
177     }
178 
179     public SocialEquityHistory toEscapedModel() {
180         if (isEscapedModel()) {
181             return (SocialEquityHistory)this;
182         }
183         else {
184             return (SocialEquityHistory)Proxy.newProxyInstance(SocialEquityHistory.class.getClassLoader(),
185                 new Class[] { SocialEquityHistory.class },
186                 new AutoEscapeBeanHandler(this));
187         }
188     }
189 
190     public ExpandoBridge getExpandoBridge() {
191         if (_expandoBridge == null) {
192             _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
193                     SocialEquityHistory.class.getName(), getPrimaryKey());
194         }
195 
196         return _expandoBridge;
197     }
198 
199     public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
200         getExpandoBridge().setAttributes(serviceContext);
201     }
202 
203     public Object clone() {
204         SocialEquityHistoryImpl clone = new SocialEquityHistoryImpl();
205 
206         clone.setEquityHistoryId(getEquityHistoryId());
207         clone.setGroupId(getGroupId());
208         clone.setCompanyId(getCompanyId());
209         clone.setUserId(getUserId());
210         clone.setCreateDate(getCreateDate());
211         clone.setPersonalEquity(getPersonalEquity());
212 
213         return clone;
214     }
215 
216     public int compareTo(SocialEquityHistory socialEquityHistory) {
217         long pk = socialEquityHistory.getPrimaryKey();
218 
219         if (getPrimaryKey() < pk) {
220             return -1;
221         }
222         else if (getPrimaryKey() > pk) {
223             return 1;
224         }
225         else {
226             return 0;
227         }
228     }
229 
230     public boolean equals(Object obj) {
231         if (obj == null) {
232             return false;
233         }
234 
235         SocialEquityHistory socialEquityHistory = null;
236 
237         try {
238             socialEquityHistory = (SocialEquityHistory)obj;
239         }
240         catch (ClassCastException cce) {
241             return false;
242         }
243 
244         long pk = socialEquityHistory.getPrimaryKey();
245 
246         if (getPrimaryKey() == pk) {
247             return true;
248         }
249         else {
250             return false;
251         }
252     }
253 
254     public int hashCode() {
255         return (int)getPrimaryKey();
256     }
257 
258     public String toString() {
259         StringBundler sb = new StringBundler(13);
260 
261         sb.append("{equityHistoryId=");
262         sb.append(getEquityHistoryId());
263         sb.append(", groupId=");
264         sb.append(getGroupId());
265         sb.append(", companyId=");
266         sb.append(getCompanyId());
267         sb.append(", userId=");
268         sb.append(getUserId());
269         sb.append(", createDate=");
270         sb.append(getCreateDate());
271         sb.append(", personalEquity=");
272         sb.append(getPersonalEquity());
273         sb.append("}");
274 
275         return sb.toString();
276     }
277 
278     public String toXmlString() {
279         StringBundler sb = new StringBundler(22);
280 
281         sb.append("<model><model-name>");
282         sb.append("com.liferay.portlet.social.model.SocialEquityHistory");
283         sb.append("</model-name>");
284 
285         sb.append(
286             "<column><column-name>equityHistoryId</column-name><column-value><![CDATA[");
287         sb.append(getEquityHistoryId());
288         sb.append("]]></column-value></column>");
289         sb.append(
290             "<column><column-name>groupId</column-name><column-value><![CDATA[");
291         sb.append(getGroupId());
292         sb.append("]]></column-value></column>");
293         sb.append(
294             "<column><column-name>companyId</column-name><column-value><![CDATA[");
295         sb.append(getCompanyId());
296         sb.append("]]></column-value></column>");
297         sb.append(
298             "<column><column-name>userId</column-name><column-value><![CDATA[");
299         sb.append(getUserId());
300         sb.append("]]></column-value></column>");
301         sb.append(
302             "<column><column-name>createDate</column-name><column-value><![CDATA[");
303         sb.append(getCreateDate());
304         sb.append("]]></column-value></column>");
305         sb.append(
306             "<column><column-name>personalEquity</column-name><column-value><![CDATA[");
307         sb.append(getPersonalEquity());
308         sb.append("]]></column-value></column>");
309 
310         sb.append("</model>");
311 
312         return sb.toString();
313     }
314 
315     private long _equityHistoryId;
316     private long _groupId;
317     private long _companyId;
318     private long _userId;
319     private String _userUuid;
320     private Date _createDate;
321     private int _personalEquity;
322     private transient ExpandoBridge _expandoBridge;
323 }