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.service.persistence;
16  
17  import com.liferay.portal.NoSuchModelException;
18  import com.liferay.portal.kernel.annotation.BeanReference;
19  import com.liferay.portal.kernel.cache.CacheRegistry;
20  import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
21  import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
22  import com.liferay.portal.kernel.dao.orm.FinderPath;
23  import com.liferay.portal.kernel.dao.orm.Query;
24  import com.liferay.portal.kernel.dao.orm.QueryPos;
25  import com.liferay.portal.kernel.dao.orm.QueryUtil;
26  import com.liferay.portal.kernel.dao.orm.Session;
27  import com.liferay.portal.kernel.exception.SystemException;
28  import com.liferay.portal.kernel.log.Log;
29  import com.liferay.portal.kernel.log.LogFactoryUtil;
30  import com.liferay.portal.kernel.util.GetterUtil;
31  import com.liferay.portal.kernel.util.InstanceFactory;
32  import com.liferay.portal.kernel.util.OrderByComparator;
33  import com.liferay.portal.kernel.util.StringBundler;
34  import com.liferay.portal.kernel.util.StringPool;
35  import com.liferay.portal.kernel.util.StringUtil;
36  import com.liferay.portal.model.ModelListener;
37  import com.liferay.portal.service.persistence.BatchSessionUtil;
38  import com.liferay.portal.service.persistence.ResourcePersistence;
39  import com.liferay.portal.service.persistence.UserPersistence;
40  import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
41  
42  import com.liferay.portlet.social.NoSuchEquityAssetEntryException;
43  import com.liferay.portlet.social.model.SocialEquityAssetEntry;
44  import com.liferay.portlet.social.model.impl.SocialEquityAssetEntryImpl;
45  import com.liferay.portlet.social.model.impl.SocialEquityAssetEntryModelImpl;
46  
47  import java.io.Serializable;
48  
49  import java.util.ArrayList;
50  import java.util.Collections;
51  import java.util.List;
52  
53  /**
54   * <a href="SocialEquityAssetEntryPersistenceImpl.java.html"><b><i>View Source</i></b></a>
55   *
56   * <p>
57   * ServiceBuilder generated this class. Modifications in this class will be
58   * overwritten the next time is generated.
59   * </p>
60   *
61   * @author    Brian Wing Shun Chan
62   * @see       SocialEquityAssetEntryPersistence
63   * @see       SocialEquityAssetEntryUtil
64   * @generated
65   */
66  public class SocialEquityAssetEntryPersistenceImpl extends BasePersistenceImpl<SocialEquityAssetEntry>
67      implements SocialEquityAssetEntryPersistence {
68      public static final String FINDER_CLASS_NAME_ENTITY = SocialEquityAssetEntryImpl.class.getName();
69      public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
70          ".List";
71      public static final FinderPath FINDER_PATH_FETCH_BY_ASSETENTRYID = new FinderPath(SocialEquityAssetEntryModelImpl.ENTITY_CACHE_ENABLED,
72              SocialEquityAssetEntryModelImpl.FINDER_CACHE_ENABLED,
73              FINDER_CLASS_NAME_ENTITY, "fetchByAssetEntryId",
74              new String[] { Long.class.getName() });
75      public static final FinderPath FINDER_PATH_COUNT_BY_ASSETENTRYID = new FinderPath(SocialEquityAssetEntryModelImpl.ENTITY_CACHE_ENABLED,
76              SocialEquityAssetEntryModelImpl.FINDER_CACHE_ENABLED,
77              FINDER_CLASS_NAME_LIST, "countByAssetEntryId",
78              new String[] { Long.class.getName() });
79      public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(SocialEquityAssetEntryModelImpl.ENTITY_CACHE_ENABLED,
80              SocialEquityAssetEntryModelImpl.FINDER_CACHE_ENABLED,
81              FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
82      public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(SocialEquityAssetEntryModelImpl.ENTITY_CACHE_ENABLED,
83              SocialEquityAssetEntryModelImpl.FINDER_CACHE_ENABLED,
84              FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
85  
86      public void cacheResult(SocialEquityAssetEntry socialEquityAssetEntry) {
87          EntityCacheUtil.putResult(SocialEquityAssetEntryModelImpl.ENTITY_CACHE_ENABLED,
88              SocialEquityAssetEntryImpl.class,
89              socialEquityAssetEntry.getPrimaryKey(), socialEquityAssetEntry);
90  
91          FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_ASSETENTRYID,
92              new Object[] { new Long(socialEquityAssetEntry.getAssetEntryId()) },
93              socialEquityAssetEntry);
94      }
95  
96      public void cacheResult(
97          List<SocialEquityAssetEntry> socialEquityAssetEntries) {
98          for (SocialEquityAssetEntry socialEquityAssetEntry : socialEquityAssetEntries) {
99              if (EntityCacheUtil.getResult(
100                         SocialEquityAssetEntryModelImpl.ENTITY_CACHE_ENABLED,
101                         SocialEquityAssetEntryImpl.class,
102                         socialEquityAssetEntry.getPrimaryKey(), this) == null) {
103                 cacheResult(socialEquityAssetEntry);
104             }
105         }
106     }
107 
108     public void clearCache() {
109         CacheRegistry.clear(SocialEquityAssetEntryImpl.class.getName());
110         EntityCacheUtil.clearCache(SocialEquityAssetEntryImpl.class.getName());
111         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
112         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
113     }
114 
115     public void clearCache(SocialEquityAssetEntry socialEquityAssetEntry) {
116         EntityCacheUtil.removeResult(SocialEquityAssetEntryModelImpl.ENTITY_CACHE_ENABLED,
117             SocialEquityAssetEntryImpl.class,
118             socialEquityAssetEntry.getPrimaryKey());
119 
120         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_ASSETENTRYID,
121             new Object[] { new Long(socialEquityAssetEntry.getAssetEntryId()) });
122     }
123 
124     public SocialEquityAssetEntry create(long equityAssetEntryId) {
125         SocialEquityAssetEntry socialEquityAssetEntry = new SocialEquityAssetEntryImpl();
126 
127         socialEquityAssetEntry.setNew(true);
128         socialEquityAssetEntry.setPrimaryKey(equityAssetEntryId);
129 
130         return socialEquityAssetEntry;
131     }
132 
133     public SocialEquityAssetEntry remove(Serializable primaryKey)
134         throws NoSuchModelException, SystemException {
135         return remove(((Long)primaryKey).longValue());
136     }
137 
138     public SocialEquityAssetEntry remove(long equityAssetEntryId)
139         throws NoSuchEquityAssetEntryException, SystemException {
140         Session session = null;
141 
142         try {
143             session = openSession();
144 
145             SocialEquityAssetEntry socialEquityAssetEntry = (SocialEquityAssetEntry)session.get(SocialEquityAssetEntryImpl.class,
146                     new Long(equityAssetEntryId));
147 
148             if (socialEquityAssetEntry == null) {
149                 if (_log.isWarnEnabled()) {
150                     _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
151                         equityAssetEntryId);
152                 }
153 
154                 throw new NoSuchEquityAssetEntryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
155                     equityAssetEntryId);
156             }
157 
158             return remove(socialEquityAssetEntry);
159         }
160         catch (NoSuchEquityAssetEntryException nsee) {
161             throw nsee;
162         }
163         catch (Exception e) {
164             throw processException(e);
165         }
166         finally {
167             closeSession(session);
168         }
169     }
170 
171     public SocialEquityAssetEntry remove(
172         SocialEquityAssetEntry socialEquityAssetEntry)
173         throws SystemException {
174         for (ModelListener<SocialEquityAssetEntry> listener : listeners) {
175             listener.onBeforeRemove(socialEquityAssetEntry);
176         }
177 
178         socialEquityAssetEntry = removeImpl(socialEquityAssetEntry);
179 
180         for (ModelListener<SocialEquityAssetEntry> listener : listeners) {
181             listener.onAfterRemove(socialEquityAssetEntry);
182         }
183 
184         return socialEquityAssetEntry;
185     }
186 
187     protected SocialEquityAssetEntry removeImpl(
188         SocialEquityAssetEntry socialEquityAssetEntry)
189         throws SystemException {
190         socialEquityAssetEntry = toUnwrappedModel(socialEquityAssetEntry);
191 
192         Session session = null;
193 
194         try {
195             session = openSession();
196 
197             if (socialEquityAssetEntry.isCachedModel() ||
198                     BatchSessionUtil.isEnabled()) {
199                 Object staleObject = session.get(SocialEquityAssetEntryImpl.class,
200                         socialEquityAssetEntry.getPrimaryKeyObj());
201 
202                 if (staleObject != null) {
203                     session.evict(staleObject);
204                 }
205             }
206 
207             session.delete(socialEquityAssetEntry);
208 
209             session.flush();
210         }
211         catch (Exception e) {
212             throw processException(e);
213         }
214         finally {
215             closeSession(session);
216         }
217 
218         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
219 
220         SocialEquityAssetEntryModelImpl socialEquityAssetEntryModelImpl = (SocialEquityAssetEntryModelImpl)socialEquityAssetEntry;
221 
222         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_ASSETENTRYID,
223             new Object[] {
224                 new Long(socialEquityAssetEntryModelImpl.getOriginalAssetEntryId())
225             });
226 
227         EntityCacheUtil.removeResult(SocialEquityAssetEntryModelImpl.ENTITY_CACHE_ENABLED,
228             SocialEquityAssetEntryImpl.class,
229             socialEquityAssetEntry.getPrimaryKey());
230 
231         return socialEquityAssetEntry;
232     }
233 
234     public SocialEquityAssetEntry updateImpl(
235         com.liferay.portlet.social.model.SocialEquityAssetEntry socialEquityAssetEntry,
236         boolean merge) throws SystemException {
237         socialEquityAssetEntry = toUnwrappedModel(socialEquityAssetEntry);
238 
239         boolean isNew = socialEquityAssetEntry.isNew();
240 
241         SocialEquityAssetEntryModelImpl socialEquityAssetEntryModelImpl = (SocialEquityAssetEntryModelImpl)socialEquityAssetEntry;
242 
243         Session session = null;
244 
245         try {
246             session = openSession();
247 
248             BatchSessionUtil.update(session, socialEquityAssetEntry, merge);
249 
250             socialEquityAssetEntry.setNew(false);
251         }
252         catch (Exception e) {
253             throw processException(e);
254         }
255         finally {
256             closeSession(session);
257         }
258 
259         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
260 
261         EntityCacheUtil.putResult(SocialEquityAssetEntryModelImpl.ENTITY_CACHE_ENABLED,
262             SocialEquityAssetEntryImpl.class,
263             socialEquityAssetEntry.getPrimaryKey(), socialEquityAssetEntry);
264 
265         if (!isNew &&
266                 (socialEquityAssetEntry.getAssetEntryId() != socialEquityAssetEntryModelImpl.getOriginalAssetEntryId())) {
267             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_ASSETENTRYID,
268                 new Object[] {
269                     new Long(socialEquityAssetEntryModelImpl.getOriginalAssetEntryId())
270                 });
271         }
272 
273         if (isNew ||
274                 (socialEquityAssetEntry.getAssetEntryId() != socialEquityAssetEntryModelImpl.getOriginalAssetEntryId())) {
275             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_ASSETENTRYID,
276                 new Object[] { new Long(socialEquityAssetEntry.getAssetEntryId()) },
277                 socialEquityAssetEntry);
278         }
279 
280         return socialEquityAssetEntry;
281     }
282 
283     protected SocialEquityAssetEntry toUnwrappedModel(
284         SocialEquityAssetEntry socialEquityAssetEntry) {
285         if (socialEquityAssetEntry instanceof SocialEquityAssetEntryImpl) {
286             return socialEquityAssetEntry;
287         }
288 
289         SocialEquityAssetEntryImpl socialEquityAssetEntryImpl = new SocialEquityAssetEntryImpl();
290 
291         socialEquityAssetEntryImpl.setNew(socialEquityAssetEntry.isNew());
292         socialEquityAssetEntryImpl.setPrimaryKey(socialEquityAssetEntry.getPrimaryKey());
293 
294         socialEquityAssetEntryImpl.setEquityAssetEntryId(socialEquityAssetEntry.getEquityAssetEntryId());
295         socialEquityAssetEntryImpl.setGroupId(socialEquityAssetEntry.getGroupId());
296         socialEquityAssetEntryImpl.setCompanyId(socialEquityAssetEntry.getCompanyId());
297         socialEquityAssetEntryImpl.setUserId(socialEquityAssetEntry.getUserId());
298         socialEquityAssetEntryImpl.setAssetEntryId(socialEquityAssetEntry.getAssetEntryId());
299         socialEquityAssetEntryImpl.setInformationK(socialEquityAssetEntry.getInformationK());
300         socialEquityAssetEntryImpl.setInformationB(socialEquityAssetEntry.getInformationB());
301         socialEquityAssetEntryImpl.setInformationEquity(socialEquityAssetEntry.getInformationEquity());
302 
303         return socialEquityAssetEntryImpl;
304     }
305 
306     public SocialEquityAssetEntry findByPrimaryKey(Serializable primaryKey)
307         throws NoSuchModelException, SystemException {
308         return findByPrimaryKey(((Long)primaryKey).longValue());
309     }
310 
311     public SocialEquityAssetEntry findByPrimaryKey(long equityAssetEntryId)
312         throws NoSuchEquityAssetEntryException, SystemException {
313         SocialEquityAssetEntry socialEquityAssetEntry = fetchByPrimaryKey(equityAssetEntryId);
314 
315         if (socialEquityAssetEntry == null) {
316             if (_log.isWarnEnabled()) {
317                 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
318                     equityAssetEntryId);
319             }
320 
321             throw new NoSuchEquityAssetEntryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
322                 equityAssetEntryId);
323         }
324 
325         return socialEquityAssetEntry;
326     }
327 
328     public SocialEquityAssetEntry fetchByPrimaryKey(Serializable primaryKey)
329         throws SystemException {
330         return fetchByPrimaryKey(((Long)primaryKey).longValue());
331     }
332 
333     public SocialEquityAssetEntry fetchByPrimaryKey(long equityAssetEntryId)
334         throws SystemException {
335         SocialEquityAssetEntry socialEquityAssetEntry = (SocialEquityAssetEntry)EntityCacheUtil.getResult(SocialEquityAssetEntryModelImpl.ENTITY_CACHE_ENABLED,
336                 SocialEquityAssetEntryImpl.class, equityAssetEntryId, this);
337 
338         if (socialEquityAssetEntry == null) {
339             Session session = null;
340 
341             try {
342                 session = openSession();
343 
344                 socialEquityAssetEntry = (SocialEquityAssetEntry)session.get(SocialEquityAssetEntryImpl.class,
345                         new Long(equityAssetEntryId));
346             }
347             catch (Exception e) {
348                 throw processException(e);
349             }
350             finally {
351                 if (socialEquityAssetEntry != null) {
352                     cacheResult(socialEquityAssetEntry);
353                 }
354 
355                 closeSession(session);
356             }
357         }
358 
359         return socialEquityAssetEntry;
360     }
361 
362     public SocialEquityAssetEntry findByAssetEntryId(long assetEntryId)
363         throws NoSuchEquityAssetEntryException, SystemException {
364         SocialEquityAssetEntry socialEquityAssetEntry = fetchByAssetEntryId(assetEntryId);
365 
366         if (socialEquityAssetEntry == null) {
367             StringBundler msg = new StringBundler(4);
368 
369             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
370 
371             msg.append("assetEntryId=");
372             msg.append(assetEntryId);
373 
374             msg.append(StringPool.CLOSE_CURLY_BRACE);
375 
376             if (_log.isWarnEnabled()) {
377                 _log.warn(msg.toString());
378             }
379 
380             throw new NoSuchEquityAssetEntryException(msg.toString());
381         }
382 
383         return socialEquityAssetEntry;
384     }
385 
386     public SocialEquityAssetEntry fetchByAssetEntryId(long assetEntryId)
387         throws SystemException {
388         return fetchByAssetEntryId(assetEntryId, true);
389     }
390 
391     public SocialEquityAssetEntry fetchByAssetEntryId(long assetEntryId,
392         boolean retrieveFromCache) throws SystemException {
393         Object[] finderArgs = new Object[] { new Long(assetEntryId) };
394 
395         Object result = null;
396 
397         if (retrieveFromCache) {
398             result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_ASSETENTRYID,
399                     finderArgs, this);
400         }
401 
402         if (result == null) {
403             Session session = null;
404 
405             try {
406                 session = openSession();
407 
408                 StringBundler query = new StringBundler(2);
409 
410                 query.append(_SQL_SELECT_SOCIALEQUITYASSETENTRY_WHERE);
411 
412                 query.append(_FINDER_COLUMN_ASSETENTRYID_ASSETENTRYID_2);
413 
414                 String sql = query.toString();
415 
416                 Query q = session.createQuery(sql);
417 
418                 QueryPos qPos = QueryPos.getInstance(q);
419 
420                 qPos.add(assetEntryId);
421 
422                 List<SocialEquityAssetEntry> list = q.list();
423 
424                 result = list;
425 
426                 SocialEquityAssetEntry socialEquityAssetEntry = null;
427 
428                 if (list.isEmpty()) {
429                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_ASSETENTRYID,
430                         finderArgs, list);
431                 }
432                 else {
433                     socialEquityAssetEntry = list.get(0);
434 
435                     cacheResult(socialEquityAssetEntry);
436 
437                     if ((socialEquityAssetEntry.getAssetEntryId() != assetEntryId)) {
438                         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_ASSETENTRYID,
439                             finderArgs, socialEquityAssetEntry);
440                     }
441                 }
442 
443                 return socialEquityAssetEntry;
444             }
445             catch (Exception e) {
446                 throw processException(e);
447             }
448             finally {
449                 if (result == null) {
450                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_ASSETENTRYID,
451                         finderArgs, new ArrayList<SocialEquityAssetEntry>());
452                 }
453 
454                 closeSession(session);
455             }
456         }
457         else {
458             if (result instanceof List<?>) {
459                 return null;
460             }
461             else {
462                 return (SocialEquityAssetEntry)result;
463             }
464         }
465     }
466 
467     public List<SocialEquityAssetEntry> findAll() throws SystemException {
468         return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
469     }
470 
471     public List<SocialEquityAssetEntry> findAll(int start, int end)
472         throws SystemException {
473         return findAll(start, end, null);
474     }
475 
476     public List<SocialEquityAssetEntry> findAll(int start, int end,
477         OrderByComparator orderByComparator) throws SystemException {
478         Object[] finderArgs = new Object[] {
479                 String.valueOf(start), String.valueOf(end),
480                 String.valueOf(orderByComparator)
481             };
482 
483         List<SocialEquityAssetEntry> list = (List<SocialEquityAssetEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
484                 finderArgs, this);
485 
486         if (list == null) {
487             Session session = null;
488 
489             try {
490                 session = openSession();
491 
492                 StringBundler query = null;
493                 String sql = null;
494 
495                 if (orderByComparator != null) {
496                     query = new StringBundler(2 +
497                             (orderByComparator.getOrderByFields().length * 3));
498 
499                     query.append(_SQL_SELECT_SOCIALEQUITYASSETENTRY);
500 
501                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
502                         orderByComparator);
503 
504                     sql = query.toString();
505                 }
506 
507                 sql = _SQL_SELECT_SOCIALEQUITYASSETENTRY;
508 
509                 Query q = session.createQuery(sql);
510 
511                 if (orderByComparator == null) {
512                     list = (List<SocialEquityAssetEntry>)QueryUtil.list(q,
513                             getDialect(), start, end, false);
514 
515                     Collections.sort(list);
516                 }
517                 else {
518                     list = (List<SocialEquityAssetEntry>)QueryUtil.list(q,
519                             getDialect(), start, end);
520                 }
521             }
522             catch (Exception e) {
523                 throw processException(e);
524             }
525             finally {
526                 if (list == null) {
527                     list = new ArrayList<SocialEquityAssetEntry>();
528                 }
529 
530                 cacheResult(list);
531 
532                 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
533 
534                 closeSession(session);
535             }
536         }
537 
538         return list;
539     }
540 
541     public void removeByAssetEntryId(long assetEntryId)
542         throws NoSuchEquityAssetEntryException, SystemException {
543         SocialEquityAssetEntry socialEquityAssetEntry = findByAssetEntryId(assetEntryId);
544 
545         remove(socialEquityAssetEntry);
546     }
547 
548     public void removeAll() throws SystemException {
549         for (SocialEquityAssetEntry socialEquityAssetEntry : findAll()) {
550             remove(socialEquityAssetEntry);
551         }
552     }
553 
554     public int countByAssetEntryId(long assetEntryId) throws SystemException {
555         Object[] finderArgs = new Object[] { new Long(assetEntryId) };
556 
557         Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_ASSETENTRYID,
558                 finderArgs, this);
559 
560         if (count == null) {
561             Session session = null;
562 
563             try {
564                 session = openSession();
565 
566                 StringBundler query = new StringBundler(2);
567 
568                 query.append(_SQL_COUNT_SOCIALEQUITYASSETENTRY_WHERE);
569 
570                 query.append(_FINDER_COLUMN_ASSETENTRYID_ASSETENTRYID_2);
571 
572                 String sql = query.toString();
573 
574                 Query q = session.createQuery(sql);
575 
576                 QueryPos qPos = QueryPos.getInstance(q);
577 
578                 qPos.add(assetEntryId);
579 
580                 count = (Long)q.uniqueResult();
581             }
582             catch (Exception e) {
583                 throw processException(e);
584             }
585             finally {
586                 if (count == null) {
587                     count = Long.valueOf(0);
588                 }
589 
590                 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_ASSETENTRYID,
591                     finderArgs, count);
592 
593                 closeSession(session);
594             }
595         }
596 
597         return count.intValue();
598     }
599 
600     public int countAll() throws SystemException {
601         Object[] finderArgs = new Object[0];
602 
603         Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
604                 finderArgs, this);
605 
606         if (count == null) {
607             Session session = null;
608 
609             try {
610                 session = openSession();
611 
612                 Query q = session.createQuery(_SQL_COUNT_SOCIALEQUITYASSETENTRY);
613 
614                 count = (Long)q.uniqueResult();
615             }
616             catch (Exception e) {
617                 throw processException(e);
618             }
619             finally {
620                 if (count == null) {
621                     count = Long.valueOf(0);
622                 }
623 
624                 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
625                     count);
626 
627                 closeSession(session);
628             }
629         }
630 
631         return count.intValue();
632     }
633 
634     public void afterPropertiesSet() {
635         String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
636                     com.liferay.portal.util.PropsUtil.get(
637                         "value.object.listener.com.liferay.portlet.social.model.SocialEquityAssetEntry")));
638 
639         if (listenerClassNames.length > 0) {
640             try {
641                 List<ModelListener<SocialEquityAssetEntry>> listenersList = new ArrayList<ModelListener<SocialEquityAssetEntry>>();
642 
643                 for (String listenerClassName : listenerClassNames) {
644                     listenersList.add((ModelListener<SocialEquityAssetEntry>)InstanceFactory.newInstance(
645                             listenerClassName));
646                 }
647 
648                 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
649             }
650             catch (Exception e) {
651                 _log.error(e);
652             }
653         }
654     }
655 
656     @BeanReference(type = SocialActivityPersistence.class)
657     protected SocialActivityPersistence socialActivityPersistence;
658     @BeanReference(type = SocialEquityAssetEntryPersistence.class)
659     protected SocialEquityAssetEntryPersistence socialEquityAssetEntryPersistence;
660     @BeanReference(type = SocialEquityHistoryPersistence.class)
661     protected SocialEquityHistoryPersistence socialEquityHistoryPersistence;
662     @BeanReference(type = SocialEquityLogPersistence.class)
663     protected SocialEquityLogPersistence socialEquityLogPersistence;
664     @BeanReference(type = SocialEquitySettingPersistence.class)
665     protected SocialEquitySettingPersistence socialEquitySettingPersistence;
666     @BeanReference(type = SocialEquityUserPersistence.class)
667     protected SocialEquityUserPersistence socialEquityUserPersistence;
668     @BeanReference(type = SocialRelationPersistence.class)
669     protected SocialRelationPersistence socialRelationPersistence;
670     @BeanReference(type = SocialRequestPersistence.class)
671     protected SocialRequestPersistence socialRequestPersistence;
672     @BeanReference(type = ResourcePersistence.class)
673     protected ResourcePersistence resourcePersistence;
674     @BeanReference(type = UserPersistence.class)
675     protected UserPersistence userPersistence;
676     private static final String _SQL_SELECT_SOCIALEQUITYASSETENTRY = "SELECT socialEquityAssetEntry FROM SocialEquityAssetEntry socialEquityAssetEntry";
677     private static final String _SQL_SELECT_SOCIALEQUITYASSETENTRY_WHERE = "SELECT socialEquityAssetEntry FROM SocialEquityAssetEntry socialEquityAssetEntry WHERE ";
678     private static final String _SQL_COUNT_SOCIALEQUITYASSETENTRY = "SELECT COUNT(socialEquityAssetEntry) FROM SocialEquityAssetEntry socialEquityAssetEntry";
679     private static final String _SQL_COUNT_SOCIALEQUITYASSETENTRY_WHERE = "SELECT COUNT(socialEquityAssetEntry) FROM SocialEquityAssetEntry socialEquityAssetEntry WHERE ";
680     private static final String _FINDER_COLUMN_ASSETENTRYID_ASSETENTRYID_2 = "socialEquityAssetEntry.assetEntryId = ?";
681     private static final String _ORDER_BY_ENTITY_ALIAS = "socialEquityAssetEntry.";
682     private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No SocialEquityAssetEntry exists with the primary key ";
683     private static final String _NO_SUCH_ENTITY_WITH_KEY = "No SocialEquityAssetEntry exists with the key {";
684     private static Log _log = LogFactoryUtil.getLog(SocialEquityAssetEntryPersistenceImpl.class);
685 }