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.SocialEquityAssetEntry;
28  import com.liferay.portlet.social.model.SocialEquityAssetEntrySoap;
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.List;
38  
39  /**
40   * <a href="SocialEquityAssetEntryModelImpl.java.html"><b><i>View Source</i></b></a>
41   *
42   * <p>
43   * ServiceBuilder generated this class. Modifications in this class will be
44   * overwritten the next time is generated.
45   * </p>
46   *
47   * <p>
48   * This interface is a model that represents the SocialEquityAssetEntry table in the
49   * database.
50   * </p>
51   *
52   * @author    Brian Wing Shun Chan
53   * @see       SocialEquityAssetEntryImpl
54   * @see       com.liferay.portlet.social.model.SocialEquityAssetEntry
55   * @see       com.liferay.portlet.social.model.SocialEquityAssetEntryModel
56   * @generated
57   */
58  public class SocialEquityAssetEntryModelImpl extends BaseModelImpl<SocialEquityAssetEntry> {
59      public static final String TABLE_NAME = "SocialEquityAssetEntry";
60      public static final Object[][] TABLE_COLUMNS = {
61              { "equityAssetEntryId", new Integer(Types.BIGINT) },
62              { "groupId", new Integer(Types.BIGINT) },
63              { "companyId", new Integer(Types.BIGINT) },
64              { "userId", new Integer(Types.BIGINT) },
65              { "assetEntryId", new Integer(Types.BIGINT) },
66              { "informationK", new Integer(Types.DOUBLE) },
67              { "informationB", new Integer(Types.DOUBLE) },
68              { "informationEquity", new Integer(Types.DOUBLE) }
69          };
70      public static final String TABLE_SQL_CREATE = "create table SocialEquityAssetEntry (equityAssetEntryId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,assetEntryId LONG,informationK DOUBLE,informationB DOUBLE,informationEquity DOUBLE)";
71      public static final String TABLE_SQL_DROP = "drop table SocialEquityAssetEntry";
72      public static final String DATA_SOURCE = "liferayDataSource";
73      public static final String SESSION_FACTORY = "liferaySessionFactory";
74      public static final String TX_MANAGER = "liferayTransactionManager";
75      public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
76                  "value.object.entity.cache.enabled.com.liferay.portlet.social.model.SocialEquityAssetEntry"),
77              true);
78      public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
79                  "value.object.finder.cache.enabled.com.liferay.portlet.social.model.SocialEquityAssetEntry"),
80              true);
81  
82      public static SocialEquityAssetEntry toModel(
83          SocialEquityAssetEntrySoap soapModel) {
84          SocialEquityAssetEntry model = new SocialEquityAssetEntryImpl();
85  
86          model.setEquityAssetEntryId(soapModel.getEquityAssetEntryId());
87          model.setGroupId(soapModel.getGroupId());
88          model.setCompanyId(soapModel.getCompanyId());
89          model.setUserId(soapModel.getUserId());
90          model.setAssetEntryId(soapModel.getAssetEntryId());
91          model.setInformationK(soapModel.getInformationK());
92          model.setInformationB(soapModel.getInformationB());
93          model.setInformationEquity(soapModel.getInformationEquity());
94  
95          return model;
96      }
97  
98      public static List<SocialEquityAssetEntry> toModels(
99          SocialEquityAssetEntrySoap[] soapModels) {
100         List<SocialEquityAssetEntry> models = new ArrayList<SocialEquityAssetEntry>(soapModels.length);
101 
102         for (SocialEquityAssetEntrySoap soapModel : soapModels) {
103             models.add(toModel(soapModel));
104         }
105 
106         return models;
107     }
108 
109     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
110                 "lock.expiration.time.com.liferay.portlet.social.model.SocialEquityAssetEntry"));
111 
112     public SocialEquityAssetEntryModelImpl() {
113     }
114 
115     public long getPrimaryKey() {
116         return _equityAssetEntryId;
117     }
118 
119     public void setPrimaryKey(long pk) {
120         setEquityAssetEntryId(pk);
121     }
122 
123     public Serializable getPrimaryKeyObj() {
124         return new Long(_equityAssetEntryId);
125     }
126 
127     public long getEquityAssetEntryId() {
128         return _equityAssetEntryId;
129     }
130 
131     public void setEquityAssetEntryId(long equityAssetEntryId) {
132         _equityAssetEntryId = equityAssetEntryId;
133     }
134 
135     public long getGroupId() {
136         return _groupId;
137     }
138 
139     public void setGroupId(long groupId) {
140         _groupId = groupId;
141     }
142 
143     public long getCompanyId() {
144         return _companyId;
145     }
146 
147     public void setCompanyId(long companyId) {
148         _companyId = companyId;
149     }
150 
151     public long getUserId() {
152         return _userId;
153     }
154 
155     public void setUserId(long userId) {
156         _userId = userId;
157     }
158 
159     public String getUserUuid() throws SystemException {
160         return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
161     }
162 
163     public void setUserUuid(String userUuid) {
164         _userUuid = userUuid;
165     }
166 
167     public long getAssetEntryId() {
168         return _assetEntryId;
169     }
170 
171     public void setAssetEntryId(long assetEntryId) {
172         _assetEntryId = assetEntryId;
173 
174         if (!_setOriginalAssetEntryId) {
175             _setOriginalAssetEntryId = true;
176 
177             _originalAssetEntryId = assetEntryId;
178         }
179     }
180 
181     public long getOriginalAssetEntryId() {
182         return _originalAssetEntryId;
183     }
184 
185     public double getInformationK() {
186         return _informationK;
187     }
188 
189     public void setInformationK(double informationK) {
190         _informationK = informationK;
191     }
192 
193     public double getInformationB() {
194         return _informationB;
195     }
196 
197     public void setInformationB(double informationB) {
198         _informationB = informationB;
199     }
200 
201     public double getInformationEquity() {
202         return _informationEquity;
203     }
204 
205     public void setInformationEquity(double informationEquity) {
206         _informationEquity = informationEquity;
207     }
208 
209     public SocialEquityAssetEntry toEscapedModel() {
210         if (isEscapedModel()) {
211             return (SocialEquityAssetEntry)this;
212         }
213         else {
214             return (SocialEquityAssetEntry)Proxy.newProxyInstance(SocialEquityAssetEntry.class.getClassLoader(),
215                 new Class[] { SocialEquityAssetEntry.class },
216                 new AutoEscapeBeanHandler(this));
217         }
218     }
219 
220     public ExpandoBridge getExpandoBridge() {
221         if (_expandoBridge == null) {
222             _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
223                     SocialEquityAssetEntry.class.getName(), getPrimaryKey());
224         }
225 
226         return _expandoBridge;
227     }
228 
229     public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
230         getExpandoBridge().setAttributes(serviceContext);
231     }
232 
233     public Object clone() {
234         SocialEquityAssetEntryImpl clone = new SocialEquityAssetEntryImpl();
235 
236         clone.setEquityAssetEntryId(getEquityAssetEntryId());
237         clone.setGroupId(getGroupId());
238         clone.setCompanyId(getCompanyId());
239         clone.setUserId(getUserId());
240         clone.setAssetEntryId(getAssetEntryId());
241         clone.setInformationK(getInformationK());
242         clone.setInformationB(getInformationB());
243         clone.setInformationEquity(getInformationEquity());
244 
245         return clone;
246     }
247 
248     public int compareTo(SocialEquityAssetEntry socialEquityAssetEntry) {
249         long pk = socialEquityAssetEntry.getPrimaryKey();
250 
251         if (getPrimaryKey() < pk) {
252             return -1;
253         }
254         else if (getPrimaryKey() > pk) {
255             return 1;
256         }
257         else {
258             return 0;
259         }
260     }
261 
262     public boolean equals(Object obj) {
263         if (obj == null) {
264             return false;
265         }
266 
267         SocialEquityAssetEntry socialEquityAssetEntry = null;
268 
269         try {
270             socialEquityAssetEntry = (SocialEquityAssetEntry)obj;
271         }
272         catch (ClassCastException cce) {
273             return false;
274         }
275 
276         long pk = socialEquityAssetEntry.getPrimaryKey();
277 
278         if (getPrimaryKey() == pk) {
279             return true;
280         }
281         else {
282             return false;
283         }
284     }
285 
286     public int hashCode() {
287         return (int)getPrimaryKey();
288     }
289 
290     public String toString() {
291         StringBundler sb = new StringBundler(17);
292 
293         sb.append("{equityAssetEntryId=");
294         sb.append(getEquityAssetEntryId());
295         sb.append(", groupId=");
296         sb.append(getGroupId());
297         sb.append(", companyId=");
298         sb.append(getCompanyId());
299         sb.append(", userId=");
300         sb.append(getUserId());
301         sb.append(", assetEntryId=");
302         sb.append(getAssetEntryId());
303         sb.append(", informationK=");
304         sb.append(getInformationK());
305         sb.append(", informationB=");
306         sb.append(getInformationB());
307         sb.append(", informationEquity=");
308         sb.append(getInformationEquity());
309         sb.append("}");
310 
311         return sb.toString();
312     }
313 
314     public String toXmlString() {
315         StringBundler sb = new StringBundler(28);
316 
317         sb.append("<model><model-name>");
318         sb.append("com.liferay.portlet.social.model.SocialEquityAssetEntry");
319         sb.append("</model-name>");
320 
321         sb.append(
322             "<column><column-name>equityAssetEntryId</column-name><column-value><![CDATA[");
323         sb.append(getEquityAssetEntryId());
324         sb.append("]]></column-value></column>");
325         sb.append(
326             "<column><column-name>groupId</column-name><column-value><![CDATA[");
327         sb.append(getGroupId());
328         sb.append("]]></column-value></column>");
329         sb.append(
330             "<column><column-name>companyId</column-name><column-value><![CDATA[");
331         sb.append(getCompanyId());
332         sb.append("]]></column-value></column>");
333         sb.append(
334             "<column><column-name>userId</column-name><column-value><![CDATA[");
335         sb.append(getUserId());
336         sb.append("]]></column-value></column>");
337         sb.append(
338             "<column><column-name>assetEntryId</column-name><column-value><![CDATA[");
339         sb.append(getAssetEntryId());
340         sb.append("]]></column-value></column>");
341         sb.append(
342             "<column><column-name>informationK</column-name><column-value><![CDATA[");
343         sb.append(getInformationK());
344         sb.append("]]></column-value></column>");
345         sb.append(
346             "<column><column-name>informationB</column-name><column-value><![CDATA[");
347         sb.append(getInformationB());
348         sb.append("]]></column-value></column>");
349         sb.append(
350             "<column><column-name>informationEquity</column-name><column-value><![CDATA[");
351         sb.append(getInformationEquity());
352         sb.append("]]></column-value></column>");
353 
354         sb.append("</model>");
355 
356         return sb.toString();
357     }
358 
359     private long _equityAssetEntryId;
360     private long _groupId;
361     private long _companyId;
362     private long _userId;
363     private String _userUuid;
364     private long _assetEntryId;
365     private long _originalAssetEntryId;
366     private boolean _setOriginalAssetEntryId;
367     private double _informationK;
368     private double _informationB;
369     private double _informationEquity;
370     private transient ExpandoBridge _expandoBridge;
371 }