1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.service.persistence;
24  
25  import com.liferay.portal.NoSuchOrgLaborException;
26  import com.liferay.portal.SystemException;
27  import com.liferay.portal.kernel.annotation.BeanReference;
28  import com.liferay.portal.kernel.cache.CacheRegistry;
29  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
30  import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
31  import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
32  import com.liferay.portal.kernel.dao.orm.FinderPath;
33  import com.liferay.portal.kernel.dao.orm.Query;
34  import com.liferay.portal.kernel.dao.orm.QueryPos;
35  import com.liferay.portal.kernel.dao.orm.QueryUtil;
36  import com.liferay.portal.kernel.dao.orm.Session;
37  import com.liferay.portal.kernel.log.Log;
38  import com.liferay.portal.kernel.log.LogFactoryUtil;
39  import com.liferay.portal.kernel.util.GetterUtil;
40  import com.liferay.portal.kernel.util.OrderByComparator;
41  import com.liferay.portal.kernel.util.StringPool;
42  import com.liferay.portal.kernel.util.StringUtil;
43  import com.liferay.portal.model.ModelListener;
44  import com.liferay.portal.model.OrgLabor;
45  import com.liferay.portal.model.impl.OrgLaborImpl;
46  import com.liferay.portal.model.impl.OrgLaborModelImpl;
47  import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
48  
49  import java.util.ArrayList;
50  import java.util.Collections;
51  import java.util.List;
52  
53  /**
54   * <a href="OrgLaborPersistenceImpl.java.html"><b><i>View Source</i></b></a>
55   *
56   * @author Brian Wing Shun Chan
57   *
58   */
59  public class OrgLaborPersistenceImpl extends BasePersistenceImpl
60      implements OrgLaborPersistence {
61      public static final String FINDER_CLASS_NAME_ENTITY = OrgLaborImpl.class.getName();
62      public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
63          ".List";
64      public static final FinderPath FINDER_PATH_FIND_BY_ORGANIZATIONID = new FinderPath(OrgLaborModelImpl.ENTITY_CACHE_ENABLED,
65              OrgLaborModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
66              "findByOrganizationId", new String[] { Long.class.getName() });
67      public static final FinderPath FINDER_PATH_FIND_BY_OBC_ORGANIZATIONID = new FinderPath(OrgLaborModelImpl.ENTITY_CACHE_ENABLED,
68              OrgLaborModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
69              "findByOrganizationId",
70              new String[] {
71                  Long.class.getName(),
72                  
73              "java.lang.Integer", "java.lang.Integer",
74                  "com.liferay.portal.kernel.util.OrderByComparator"
75              });
76      public static final FinderPath FINDER_PATH_COUNT_BY_ORGANIZATIONID = new FinderPath(OrgLaborModelImpl.ENTITY_CACHE_ENABLED,
77              OrgLaborModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
78              "countByOrganizationId", new String[] { Long.class.getName() });
79      public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(OrgLaborModelImpl.ENTITY_CACHE_ENABLED,
80              OrgLaborModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
81              "findAll", new String[0]);
82      public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(OrgLaborModelImpl.ENTITY_CACHE_ENABLED,
83              OrgLaborModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
84              "countAll", new String[0]);
85  
86      public void cacheResult(OrgLabor orgLabor) {
87          EntityCacheUtil.putResult(OrgLaborModelImpl.ENTITY_CACHE_ENABLED,
88              OrgLaborImpl.class, orgLabor.getPrimaryKey(), orgLabor);
89      }
90  
91      public void cacheResult(List<OrgLabor> orgLabors) {
92          for (OrgLabor orgLabor : orgLabors) {
93              if (EntityCacheUtil.getResult(
94                          OrgLaborModelImpl.ENTITY_CACHE_ENABLED,
95                          OrgLaborImpl.class, orgLabor.getPrimaryKey(), this) == null) {
96                  cacheResult(orgLabor);
97              }
98          }
99      }
100 
101     public void clearCache() {
102         CacheRegistry.clear(OrgLaborImpl.class.getName());
103         EntityCacheUtil.clearCache(OrgLaborImpl.class.getName());
104         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
105         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
106     }
107 
108     public OrgLabor create(long orgLaborId) {
109         OrgLabor orgLabor = new OrgLaborImpl();
110 
111         orgLabor.setNew(true);
112         orgLabor.setPrimaryKey(orgLaborId);
113 
114         return orgLabor;
115     }
116 
117     public OrgLabor remove(long orgLaborId)
118         throws NoSuchOrgLaborException, SystemException {
119         Session session = null;
120 
121         try {
122             session = openSession();
123 
124             OrgLabor orgLabor = (OrgLabor)session.get(OrgLaborImpl.class,
125                     new Long(orgLaborId));
126 
127             if (orgLabor == null) {
128                 if (_log.isWarnEnabled()) {
129                     _log.warn("No OrgLabor exists with the primary key " +
130                         orgLaborId);
131                 }
132 
133                 throw new NoSuchOrgLaborException(
134                     "No OrgLabor exists with the primary key " + orgLaborId);
135             }
136 
137             return remove(orgLabor);
138         }
139         catch (NoSuchOrgLaborException nsee) {
140             throw nsee;
141         }
142         catch (Exception e) {
143             throw processException(e);
144         }
145         finally {
146             closeSession(session);
147         }
148     }
149 
150     public OrgLabor remove(OrgLabor orgLabor) throws SystemException {
151         for (ModelListener<OrgLabor> listener : listeners) {
152             listener.onBeforeRemove(orgLabor);
153         }
154 
155         orgLabor = removeImpl(orgLabor);
156 
157         for (ModelListener<OrgLabor> listener : listeners) {
158             listener.onAfterRemove(orgLabor);
159         }
160 
161         return orgLabor;
162     }
163 
164     protected OrgLabor removeImpl(OrgLabor orgLabor) throws SystemException {
165         Session session = null;
166 
167         try {
168             session = openSession();
169 
170             if (orgLabor.isCachedModel() || BatchSessionUtil.isEnabled()) {
171                 Object staleObject = session.get(OrgLaborImpl.class,
172                         orgLabor.getPrimaryKeyObj());
173 
174                 if (staleObject != null) {
175                     session.evict(staleObject);
176                 }
177             }
178 
179             session.delete(orgLabor);
180 
181             session.flush();
182         }
183         catch (Exception e) {
184             throw processException(e);
185         }
186         finally {
187             closeSession(session);
188         }
189 
190         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
191 
192         EntityCacheUtil.removeResult(OrgLaborModelImpl.ENTITY_CACHE_ENABLED,
193             OrgLaborImpl.class, orgLabor.getPrimaryKey());
194 
195         return orgLabor;
196     }
197 
198     /**
199      * @deprecated Use <code>update(OrgLabor orgLabor, boolean merge)</code>.
200      */
201     public OrgLabor update(OrgLabor orgLabor) throws SystemException {
202         if (_log.isWarnEnabled()) {
203             _log.warn(
204                 "Using the deprecated update(OrgLabor orgLabor) method. Use update(OrgLabor orgLabor, boolean merge) instead.");
205         }
206 
207         return update(orgLabor, false);
208     }
209 
210     /**
211      * Add, update, or merge, the entity. This method also calls the model
212      * listeners to trigger the proper events associated with adding, deleting,
213      * or updating an entity.
214      *
215      * @param        orgLabor the entity to add, update, or merge
216      * @param        merge boolean value for whether to merge the entity. The
217      *                default value is false. Setting merge to true is more
218      *                expensive and should only be true when orgLabor is
219      *                transient. See LEP-5473 for a detailed discussion of this
220      *                method.
221      * @return        true if the portlet can be displayed via Ajax
222      */
223     public OrgLabor update(OrgLabor orgLabor, boolean merge)
224         throws SystemException {
225         boolean isNew = orgLabor.isNew();
226 
227         for (ModelListener<OrgLabor> listener : listeners) {
228             if (isNew) {
229                 listener.onBeforeCreate(orgLabor);
230             }
231             else {
232                 listener.onBeforeUpdate(orgLabor);
233             }
234         }
235 
236         orgLabor = updateImpl(orgLabor, merge);
237 
238         for (ModelListener<OrgLabor> listener : listeners) {
239             if (isNew) {
240                 listener.onAfterCreate(orgLabor);
241             }
242             else {
243                 listener.onAfterUpdate(orgLabor);
244             }
245         }
246 
247         return orgLabor;
248     }
249 
250     public OrgLabor updateImpl(com.liferay.portal.model.OrgLabor orgLabor,
251         boolean merge) throws SystemException {
252         Session session = null;
253 
254         try {
255             session = openSession();
256 
257             BatchSessionUtil.update(session, orgLabor, merge);
258 
259             orgLabor.setNew(false);
260         }
261         catch (Exception e) {
262             throw processException(e);
263         }
264         finally {
265             closeSession(session);
266         }
267 
268         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
269 
270         EntityCacheUtil.putResult(OrgLaborModelImpl.ENTITY_CACHE_ENABLED,
271             OrgLaborImpl.class, orgLabor.getPrimaryKey(), orgLabor);
272 
273         return orgLabor;
274     }
275 
276     public OrgLabor findByPrimaryKey(long orgLaborId)
277         throws NoSuchOrgLaborException, SystemException {
278         OrgLabor orgLabor = fetchByPrimaryKey(orgLaborId);
279 
280         if (orgLabor == null) {
281             if (_log.isWarnEnabled()) {
282                 _log.warn("No OrgLabor exists with the primary key " +
283                     orgLaborId);
284             }
285 
286             throw new NoSuchOrgLaborException(
287                 "No OrgLabor exists with the primary key " + orgLaborId);
288         }
289 
290         return orgLabor;
291     }
292 
293     public OrgLabor fetchByPrimaryKey(long orgLaborId)
294         throws SystemException {
295         OrgLabor orgLabor = (OrgLabor)EntityCacheUtil.getResult(OrgLaborModelImpl.ENTITY_CACHE_ENABLED,
296                 OrgLaborImpl.class, orgLaborId, this);
297 
298         if (orgLabor == null) {
299             Session session = null;
300 
301             try {
302                 session = openSession();
303 
304                 orgLabor = (OrgLabor)session.get(OrgLaborImpl.class,
305                         new Long(orgLaborId));
306             }
307             catch (Exception e) {
308                 throw processException(e);
309             }
310             finally {
311                 if (orgLabor != null) {
312                     cacheResult(orgLabor);
313                 }
314 
315                 closeSession(session);
316             }
317         }
318 
319         return orgLabor;
320     }
321 
322     public List<OrgLabor> findByOrganizationId(long organizationId)
323         throws SystemException {
324         Object[] finderArgs = new Object[] { new Long(organizationId) };
325 
326         List<OrgLabor> list = (List<OrgLabor>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_ORGANIZATIONID,
327                 finderArgs, this);
328 
329         if (list == null) {
330             Session session = null;
331 
332             try {
333                 session = openSession();
334 
335                 StringBuilder query = new StringBuilder();
336 
337                 query.append("FROM com.liferay.portal.model.OrgLabor WHERE ");
338 
339                 query.append("organizationId = ?");
340 
341                 query.append(" ");
342 
343                 query.append("ORDER BY ");
344 
345                 query.append("organizationId ASC, ");
346                 query.append("typeId ASC");
347 
348                 Query q = session.createQuery(query.toString());
349 
350                 QueryPos qPos = QueryPos.getInstance(q);
351 
352                 qPos.add(organizationId);
353 
354                 list = q.list();
355             }
356             catch (Exception e) {
357                 throw processException(e);
358             }
359             finally {
360                 if (list == null) {
361                     list = new ArrayList<OrgLabor>();
362                 }
363 
364                 cacheResult(list);
365 
366                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_ORGANIZATIONID,
367                     finderArgs, list);
368 
369                 closeSession(session);
370             }
371         }
372 
373         return list;
374     }
375 
376     public List<OrgLabor> findByOrganizationId(long organizationId, int start,
377         int end) throws SystemException {
378         return findByOrganizationId(organizationId, start, end, null);
379     }
380 
381     public List<OrgLabor> findByOrganizationId(long organizationId, int start,
382         int end, OrderByComparator obc) throws SystemException {
383         Object[] finderArgs = new Object[] {
384                 new Long(organizationId),
385                 
386                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
387             };
388 
389         List<OrgLabor> list = (List<OrgLabor>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_ORGANIZATIONID,
390                 finderArgs, this);
391 
392         if (list == null) {
393             Session session = null;
394 
395             try {
396                 session = openSession();
397 
398                 StringBuilder query = new StringBuilder();
399 
400                 query.append("FROM com.liferay.portal.model.OrgLabor WHERE ");
401 
402                 query.append("organizationId = ?");
403 
404                 query.append(" ");
405 
406                 if (obc != null) {
407                     query.append("ORDER BY ");
408                     query.append(obc.getOrderBy());
409                 }
410 
411                 else {
412                     query.append("ORDER BY ");
413 
414                     query.append("organizationId ASC, ");
415                     query.append("typeId ASC");
416                 }
417 
418                 Query q = session.createQuery(query.toString());
419 
420                 QueryPos qPos = QueryPos.getInstance(q);
421 
422                 qPos.add(organizationId);
423 
424                 list = (List<OrgLabor>)QueryUtil.list(q, getDialect(), start,
425                         end);
426             }
427             catch (Exception e) {
428                 throw processException(e);
429             }
430             finally {
431                 if (list == null) {
432                     list = new ArrayList<OrgLabor>();
433                 }
434 
435                 cacheResult(list);
436 
437                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_ORGANIZATIONID,
438                     finderArgs, list);
439 
440                 closeSession(session);
441             }
442         }
443 
444         return list;
445     }
446 
447     public OrgLabor findByOrganizationId_First(long organizationId,
448         OrderByComparator obc) throws NoSuchOrgLaborException, SystemException {
449         List<OrgLabor> list = findByOrganizationId(organizationId, 0, 1, obc);
450 
451         if (list.isEmpty()) {
452             StringBuilder msg = new StringBuilder();
453 
454             msg.append("No OrgLabor exists with the key {");
455 
456             msg.append("organizationId=" + organizationId);
457 
458             msg.append(StringPool.CLOSE_CURLY_BRACE);
459 
460             throw new NoSuchOrgLaborException(msg.toString());
461         }
462         else {
463             return list.get(0);
464         }
465     }
466 
467     public OrgLabor findByOrganizationId_Last(long organizationId,
468         OrderByComparator obc) throws NoSuchOrgLaborException, SystemException {
469         int count = countByOrganizationId(organizationId);
470 
471         List<OrgLabor> list = findByOrganizationId(organizationId, count - 1,
472                 count, obc);
473 
474         if (list.isEmpty()) {
475             StringBuilder msg = new StringBuilder();
476 
477             msg.append("No OrgLabor exists with the key {");
478 
479             msg.append("organizationId=" + organizationId);
480 
481             msg.append(StringPool.CLOSE_CURLY_BRACE);
482 
483             throw new NoSuchOrgLaborException(msg.toString());
484         }
485         else {
486             return list.get(0);
487         }
488     }
489 
490     public OrgLabor[] findByOrganizationId_PrevAndNext(long orgLaborId,
491         long organizationId, OrderByComparator obc)
492         throws NoSuchOrgLaborException, SystemException {
493         OrgLabor orgLabor = findByPrimaryKey(orgLaborId);
494 
495         int count = countByOrganizationId(organizationId);
496 
497         Session session = null;
498 
499         try {
500             session = openSession();
501 
502             StringBuilder query = new StringBuilder();
503 
504             query.append("FROM com.liferay.portal.model.OrgLabor WHERE ");
505 
506             query.append("organizationId = ?");
507 
508             query.append(" ");
509 
510             if (obc != null) {
511                 query.append("ORDER BY ");
512                 query.append(obc.getOrderBy());
513             }
514 
515             else {
516                 query.append("ORDER BY ");
517 
518                 query.append("organizationId ASC, ");
519                 query.append("typeId ASC");
520             }
521 
522             Query q = session.createQuery(query.toString());
523 
524             QueryPos qPos = QueryPos.getInstance(q);
525 
526             qPos.add(organizationId);
527 
528             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, orgLabor);
529 
530             OrgLabor[] array = new OrgLaborImpl[3];
531 
532             array[0] = (OrgLabor)objArray[0];
533             array[1] = (OrgLabor)objArray[1];
534             array[2] = (OrgLabor)objArray[2];
535 
536             return array;
537         }
538         catch (Exception e) {
539             throw processException(e);
540         }
541         finally {
542             closeSession(session);
543         }
544     }
545 
546     public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
547         throws SystemException {
548         Session session = null;
549 
550         try {
551             session = openSession();
552 
553             dynamicQuery.compile(session);
554 
555             return dynamicQuery.list();
556         }
557         catch (Exception e) {
558             throw processException(e);
559         }
560         finally {
561             closeSession(session);
562         }
563     }
564 
565     public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
566         int start, int end) throws SystemException {
567         Session session = null;
568 
569         try {
570             session = openSession();
571 
572             dynamicQuery.setLimit(start, end);
573 
574             dynamicQuery.compile(session);
575 
576             return dynamicQuery.list();
577         }
578         catch (Exception e) {
579             throw processException(e);
580         }
581         finally {
582             closeSession(session);
583         }
584     }
585 
586     public List<OrgLabor> findAll() throws SystemException {
587         return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
588     }
589 
590     public List<OrgLabor> findAll(int start, int end) throws SystemException {
591         return findAll(start, end, null);
592     }
593 
594     public List<OrgLabor> findAll(int start, int end, OrderByComparator obc)
595         throws SystemException {
596         Object[] finderArgs = new Object[] {
597                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
598             };
599 
600         List<OrgLabor> list = (List<OrgLabor>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
601                 finderArgs, this);
602 
603         if (list == null) {
604             Session session = null;
605 
606             try {
607                 session = openSession();
608 
609                 StringBuilder query = new StringBuilder();
610 
611                 query.append("FROM com.liferay.portal.model.OrgLabor ");
612 
613                 if (obc != null) {
614                     query.append("ORDER BY ");
615                     query.append(obc.getOrderBy());
616                 }
617 
618                 else {
619                     query.append("ORDER BY ");
620 
621                     query.append("organizationId ASC, ");
622                     query.append("typeId ASC");
623                 }
624 
625                 Query q = session.createQuery(query.toString());
626 
627                 if (obc == null) {
628                     list = (List<OrgLabor>)QueryUtil.list(q, getDialect(),
629                             start, end, false);
630 
631                     Collections.sort(list);
632                 }
633                 else {
634                     list = (List<OrgLabor>)QueryUtil.list(q, getDialect(),
635                             start, end);
636                 }
637             }
638             catch (Exception e) {
639                 throw processException(e);
640             }
641             finally {
642                 if (list == null) {
643                     list = new ArrayList<OrgLabor>();
644                 }
645 
646                 cacheResult(list);
647 
648                 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
649 
650                 closeSession(session);
651             }
652         }
653 
654         return list;
655     }
656 
657     public void removeByOrganizationId(long organizationId)
658         throws SystemException {
659         for (OrgLabor orgLabor : findByOrganizationId(organizationId)) {
660             remove(orgLabor);
661         }
662     }
663 
664     public void removeAll() throws SystemException {
665         for (OrgLabor orgLabor : findAll()) {
666             remove(orgLabor);
667         }
668     }
669 
670     public int countByOrganizationId(long organizationId)
671         throws SystemException {
672         Object[] finderArgs = new Object[] { new Long(organizationId) };
673 
674         Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_ORGANIZATIONID,
675                 finderArgs, this);
676 
677         if (count == null) {
678             Session session = null;
679 
680             try {
681                 session = openSession();
682 
683                 StringBuilder query = new StringBuilder();
684 
685                 query.append("SELECT COUNT(*) ");
686                 query.append("FROM com.liferay.portal.model.OrgLabor WHERE ");
687 
688                 query.append("organizationId = ?");
689 
690                 query.append(" ");
691 
692                 Query q = session.createQuery(query.toString());
693 
694                 QueryPos qPos = QueryPos.getInstance(q);
695 
696                 qPos.add(organizationId);
697 
698                 count = (Long)q.uniqueResult();
699             }
700             catch (Exception e) {
701                 throw processException(e);
702             }
703             finally {
704                 if (count == null) {
705                     count = Long.valueOf(0);
706                 }
707 
708                 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_ORGANIZATIONID,
709                     finderArgs, count);
710 
711                 closeSession(session);
712             }
713         }
714 
715         return count.intValue();
716     }
717 
718     public int countAll() throws SystemException {
719         Object[] finderArgs = new Object[0];
720 
721         Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
722                 finderArgs, this);
723 
724         if (count == null) {
725             Session session = null;
726 
727             try {
728                 session = openSession();
729 
730                 Query q = session.createQuery(
731                         "SELECT COUNT(*) FROM com.liferay.portal.model.OrgLabor");
732 
733                 count = (Long)q.uniqueResult();
734             }
735             catch (Exception e) {
736                 throw processException(e);
737             }
738             finally {
739                 if (count == null) {
740                     count = Long.valueOf(0);
741                 }
742 
743                 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
744                     count);
745 
746                 closeSession(session);
747             }
748         }
749 
750         return count.intValue();
751     }
752 
753     public void afterPropertiesSet() {
754         String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
755                     com.liferay.portal.util.PropsUtil.get(
756                         "value.object.listener.com.liferay.portal.model.OrgLabor")));
757 
758         if (listenerClassNames.length > 0) {
759             try {
760                 List<ModelListener<OrgLabor>> listenersList = new ArrayList<ModelListener<OrgLabor>>();
761 
762                 for (String listenerClassName : listenerClassNames) {
763                     listenersList.add((ModelListener<OrgLabor>)Class.forName(
764                             listenerClassName).newInstance());
765                 }
766 
767                 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
768             }
769             catch (Exception e) {
770                 _log.error(e);
771             }
772         }
773     }
774 
775     @BeanReference(name = "com.liferay.portal.service.persistence.AccountPersistence.impl")
776     protected com.liferay.portal.service.persistence.AccountPersistence accountPersistence;
777     @BeanReference(name = "com.liferay.portal.service.persistence.AddressPersistence.impl")
778     protected com.liferay.portal.service.persistence.AddressPersistence addressPersistence;
779     @BeanReference(name = "com.liferay.portal.service.persistence.BrowserTrackerPersistence.impl")
780     protected com.liferay.portal.service.persistence.BrowserTrackerPersistence browserTrackerPersistence;
781     @BeanReference(name = "com.liferay.portal.service.persistence.ClassNamePersistence.impl")
782     protected com.liferay.portal.service.persistence.ClassNamePersistence classNamePersistence;
783     @BeanReference(name = "com.liferay.portal.service.persistence.CompanyPersistence.impl")
784     protected com.liferay.portal.service.persistence.CompanyPersistence companyPersistence;
785     @BeanReference(name = "com.liferay.portal.service.persistence.ContactPersistence.impl")
786     protected com.liferay.portal.service.persistence.ContactPersistence contactPersistence;
787     @BeanReference(name = "com.liferay.portal.service.persistence.CountryPersistence.impl")
788     protected com.liferay.portal.service.persistence.CountryPersistence countryPersistence;
789     @BeanReference(name = "com.liferay.portal.service.persistence.EmailAddressPersistence.impl")
790     protected com.liferay.portal.service.persistence.EmailAddressPersistence emailAddressPersistence;
791     @BeanReference(name = "com.liferay.portal.service.persistence.GroupPersistence.impl")
792     protected com.liferay.portal.service.persistence.GroupPersistence groupPersistence;
793     @BeanReference(name = "com.liferay.portal.service.persistence.ImagePersistence.impl")
794     protected com.liferay.portal.service.persistence.ImagePersistence imagePersistence;
795     @BeanReference(name = "com.liferay.portal.service.persistence.LayoutPersistence.impl")
796     protected com.liferay.portal.service.persistence.LayoutPersistence layoutPersistence;
797     @BeanReference(name = "com.liferay.portal.service.persistence.LayoutSetPersistence.impl")
798     protected com.liferay.portal.service.persistence.LayoutSetPersistence layoutSetPersistence;
799     @BeanReference(name = "com.liferay.portal.service.persistence.ListTypePersistence.impl")
800     protected com.liferay.portal.service.persistence.ListTypePersistence listTypePersistence;
801     @BeanReference(name = "com.liferay.portal.service.persistence.MembershipRequestPersistence.impl")
802     protected com.liferay.portal.service.persistence.MembershipRequestPersistence membershipRequestPersistence;
803     @BeanReference(name = "com.liferay.portal.service.persistence.OrganizationPersistence.impl")
804     protected com.liferay.portal.service.persistence.OrganizationPersistence organizationPersistence;
805     @BeanReference(name = "com.liferay.portal.service.persistence.OrgGroupPermissionPersistence.impl")
806     protected com.liferay.portal.service.persistence.OrgGroupPermissionPersistence orgGroupPermissionPersistence;
807     @BeanReference(name = "com.liferay.portal.service.persistence.OrgGroupRolePersistence.impl")
808     protected com.liferay.portal.service.persistence.OrgGroupRolePersistence orgGroupRolePersistence;
809     @BeanReference(name = "com.liferay.portal.service.persistence.OrgLaborPersistence.impl")
810     protected com.liferay.portal.service.persistence.OrgLaborPersistence orgLaborPersistence;
811     @BeanReference(name = "com.liferay.portal.service.persistence.PasswordPolicyPersistence.impl")
812     protected com.liferay.portal.service.persistence.PasswordPolicyPersistence passwordPolicyPersistence;
813     @BeanReference(name = "com.liferay.portal.service.persistence.PasswordPolicyRelPersistence.impl")
814     protected com.liferay.portal.service.persistence.PasswordPolicyRelPersistence passwordPolicyRelPersistence;
815     @BeanReference(name = "com.liferay.portal.service.persistence.PasswordTrackerPersistence.impl")
816     protected com.liferay.portal.service.persistence.PasswordTrackerPersistence passwordTrackerPersistence;
817     @BeanReference(name = "com.liferay.portal.service.persistence.PermissionPersistence.impl")
818     protected com.liferay.portal.service.persistence.PermissionPersistence permissionPersistence;
819     @BeanReference(name = "com.liferay.portal.service.persistence.PhonePersistence.impl")
820     protected com.liferay.portal.service.persistence.PhonePersistence phonePersistence;
821     @BeanReference(name = "com.liferay.portal.service.persistence.PluginSettingPersistence.impl")
822     protected com.liferay.portal.service.persistence.PluginSettingPersistence pluginSettingPersistence;
823     @BeanReference(name = "com.liferay.portal.service.persistence.PortletPersistence.impl")
824     protected com.liferay.portal.service.persistence.PortletPersistence portletPersistence;
825     @BeanReference(name = "com.liferay.portal.service.persistence.PortletItemPersistence.impl")
826     protected com.liferay.portal.service.persistence.PortletItemPersistence portletItemPersistence;
827     @BeanReference(name = "com.liferay.portal.service.persistence.PortletPreferencesPersistence.impl")
828     protected com.liferay.portal.service.persistence.PortletPreferencesPersistence portletPreferencesPersistence;
829     @BeanReference(name = "com.liferay.portal.service.persistence.RegionPersistence.impl")
830     protected com.liferay.portal.service.persistence.RegionPersistence regionPersistence;
831     @BeanReference(name = "com.liferay.portal.service.persistence.ReleasePersistence.impl")
832     protected com.liferay.portal.service.persistence.ReleasePersistence releasePersistence;
833     @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePersistence.impl")
834     protected com.liferay.portal.service.persistence.ResourcePersistence resourcePersistence;
835     @BeanReference(name = "com.liferay.portal.service.persistence.ResourceActionPersistence.impl")
836     protected com.liferay.portal.service.persistence.ResourceActionPersistence resourceActionPersistence;
837     @BeanReference(name = "com.liferay.portal.service.persistence.ResourceCodePersistence.impl")
838     protected com.liferay.portal.service.persistence.ResourceCodePersistence resourceCodePersistence;
839     @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePermissionPersistence.impl")
840     protected com.liferay.portal.service.persistence.ResourcePermissionPersistence resourcePermissionPersistence;
841     @BeanReference(name = "com.liferay.portal.service.persistence.RolePersistence.impl")
842     protected com.liferay.portal.service.persistence.RolePersistence rolePersistence;
843     @BeanReference(name = "com.liferay.portal.service.persistence.ServiceComponentPersistence.impl")
844     protected com.liferay.portal.service.persistence.ServiceComponentPersistence serviceComponentPersistence;
845     @BeanReference(name = "com.liferay.portal.service.persistence.ShardPersistence.impl")
846     protected com.liferay.portal.service.persistence.ShardPersistence shardPersistence;
847     @BeanReference(name = "com.liferay.portal.service.persistence.SubscriptionPersistence.impl")
848     protected com.liferay.portal.service.persistence.SubscriptionPersistence subscriptionPersistence;
849     @BeanReference(name = "com.liferay.portal.service.persistence.UserPersistence.impl")
850     protected com.liferay.portal.service.persistence.UserPersistence userPersistence;
851     @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupPersistence.impl")
852     protected com.liferay.portal.service.persistence.UserGroupPersistence userGroupPersistence;
853     @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupRolePersistence.impl")
854     protected com.liferay.portal.service.persistence.UserGroupRolePersistence userGroupRolePersistence;
855     @BeanReference(name = "com.liferay.portal.service.persistence.UserIdMapperPersistence.impl")
856     protected com.liferay.portal.service.persistence.UserIdMapperPersistence userIdMapperPersistence;
857     @BeanReference(name = "com.liferay.portal.service.persistence.UserTrackerPersistence.impl")
858     protected com.liferay.portal.service.persistence.UserTrackerPersistence userTrackerPersistence;
859     @BeanReference(name = "com.liferay.portal.service.persistence.UserTrackerPathPersistence.impl")
860     protected com.liferay.portal.service.persistence.UserTrackerPathPersistence userTrackerPathPersistence;
861     @BeanReference(name = "com.liferay.portal.service.persistence.WebDAVPropsPersistence.impl")
862     protected com.liferay.portal.service.persistence.WebDAVPropsPersistence webDAVPropsPersistence;
863     @BeanReference(name = "com.liferay.portal.service.persistence.WebsitePersistence.impl")
864     protected com.liferay.portal.service.persistence.WebsitePersistence websitePersistence;
865     private static Log _log = LogFactoryUtil.getLog(OrgLaborPersistenceImpl.class);
866 }