1
14
15 package com.liferay.portal.service.persistence;
16
17 import com.liferay.portal.NoSuchModelException;
18 import com.liferay.portal.NoSuchWorkflowInstanceLinkException;
19 import com.liferay.portal.kernel.annotation.BeanReference;
20 import com.liferay.portal.kernel.cache.CacheRegistry;
21 import com.liferay.portal.kernel.dao.orm.DynamicQuery;
22 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
23 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
24 import com.liferay.portal.kernel.dao.orm.FinderPath;
25 import com.liferay.portal.kernel.dao.orm.Query;
26 import com.liferay.portal.kernel.dao.orm.QueryPos;
27 import com.liferay.portal.kernel.dao.orm.QueryUtil;
28 import com.liferay.portal.kernel.dao.orm.Session;
29 import com.liferay.portal.kernel.exception.SystemException;
30 import com.liferay.portal.kernel.log.Log;
31 import com.liferay.portal.kernel.log.LogFactoryUtil;
32 import com.liferay.portal.kernel.util.GetterUtil;
33 import com.liferay.portal.kernel.util.OrderByComparator;
34 import com.liferay.portal.kernel.util.StringBundler;
35 import com.liferay.portal.kernel.util.StringPool;
36 import com.liferay.portal.kernel.util.StringUtil;
37 import com.liferay.portal.model.ModelListener;
38 import com.liferay.portal.model.WorkflowInstanceLink;
39 import com.liferay.portal.model.impl.WorkflowInstanceLinkImpl;
40 import com.liferay.portal.model.impl.WorkflowInstanceLinkModelImpl;
41 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
42
43 import java.io.Serializable;
44
45 import java.util.ArrayList;
46 import java.util.Collections;
47 import java.util.List;
48
49
62 public class WorkflowInstanceLinkPersistenceImpl extends BasePersistenceImpl<WorkflowInstanceLink>
63 implements WorkflowInstanceLinkPersistence {
64 public static final String FINDER_CLASS_NAME_ENTITY = WorkflowInstanceLinkImpl.class.getName();
65 public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
66 ".List";
67 public static final FinderPath FINDER_PATH_FETCH_BY_G_C_C_C = new FinderPath(WorkflowInstanceLinkModelImpl.ENTITY_CACHE_ENABLED,
68 WorkflowInstanceLinkModelImpl.FINDER_CACHE_ENABLED,
69 FINDER_CLASS_NAME_ENTITY, "fetchByG_C_C_C",
70 new String[] {
71 Long.class.getName(), Long.class.getName(), Long.class.getName(),
72 Long.class.getName()
73 });
74 public static final FinderPath FINDER_PATH_COUNT_BY_G_C_C_C = new FinderPath(WorkflowInstanceLinkModelImpl.ENTITY_CACHE_ENABLED,
75 WorkflowInstanceLinkModelImpl.FINDER_CACHE_ENABLED,
76 FINDER_CLASS_NAME_LIST, "countByG_C_C_C",
77 new String[] {
78 Long.class.getName(), Long.class.getName(), Long.class.getName(),
79 Long.class.getName()
80 });
81 public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(WorkflowInstanceLinkModelImpl.ENTITY_CACHE_ENABLED,
82 WorkflowInstanceLinkModelImpl.FINDER_CACHE_ENABLED,
83 FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
84 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(WorkflowInstanceLinkModelImpl.ENTITY_CACHE_ENABLED,
85 WorkflowInstanceLinkModelImpl.FINDER_CACHE_ENABLED,
86 FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
87
88 public void cacheResult(WorkflowInstanceLink workflowInstanceLink) {
89 EntityCacheUtil.putResult(WorkflowInstanceLinkModelImpl.ENTITY_CACHE_ENABLED,
90 WorkflowInstanceLinkImpl.class,
91 workflowInstanceLink.getPrimaryKey(), workflowInstanceLink);
92
93 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_C_C_C,
94 new Object[] {
95 new Long(workflowInstanceLink.getGroupId()),
96 new Long(workflowInstanceLink.getCompanyId()),
97 new Long(workflowInstanceLink.getClassNameId()),
98 new Long(workflowInstanceLink.getClassPK())
99 }, workflowInstanceLink);
100 }
101
102 public void cacheResult(List<WorkflowInstanceLink> workflowInstanceLinks) {
103 for (WorkflowInstanceLink workflowInstanceLink : workflowInstanceLinks) {
104 if (EntityCacheUtil.getResult(
105 WorkflowInstanceLinkModelImpl.ENTITY_CACHE_ENABLED,
106 WorkflowInstanceLinkImpl.class,
107 workflowInstanceLink.getPrimaryKey(), this) == null) {
108 cacheResult(workflowInstanceLink);
109 }
110 }
111 }
112
113 public void clearCache() {
114 CacheRegistry.clear(WorkflowInstanceLinkImpl.class.getName());
115 EntityCacheUtil.clearCache(WorkflowInstanceLinkImpl.class.getName());
116 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
117 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
118 }
119
120 public WorkflowInstanceLink create(long workflowInstanceLinkId) {
121 WorkflowInstanceLink workflowInstanceLink = new WorkflowInstanceLinkImpl();
122
123 workflowInstanceLink.setNew(true);
124 workflowInstanceLink.setPrimaryKey(workflowInstanceLinkId);
125
126 return workflowInstanceLink;
127 }
128
129 public WorkflowInstanceLink remove(Serializable primaryKey)
130 throws NoSuchModelException, SystemException {
131 return remove(((Long)primaryKey).longValue());
132 }
133
134 public WorkflowInstanceLink remove(long workflowInstanceLinkId)
135 throws NoSuchWorkflowInstanceLinkException, SystemException {
136 Session session = null;
137
138 try {
139 session = openSession();
140
141 WorkflowInstanceLink workflowInstanceLink = (WorkflowInstanceLink)session.get(WorkflowInstanceLinkImpl.class,
142 new Long(workflowInstanceLinkId));
143
144 if (workflowInstanceLink == null) {
145 if (_log.isWarnEnabled()) {
146 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
147 workflowInstanceLinkId);
148 }
149
150 throw new NoSuchWorkflowInstanceLinkException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
151 workflowInstanceLinkId);
152 }
153
154 return remove(workflowInstanceLink);
155 }
156 catch (NoSuchWorkflowInstanceLinkException nsee) {
157 throw nsee;
158 }
159 catch (Exception e) {
160 throw processException(e);
161 }
162 finally {
163 closeSession(session);
164 }
165 }
166
167 public WorkflowInstanceLink remove(
168 WorkflowInstanceLink workflowInstanceLink) throws SystemException {
169 for (ModelListener<WorkflowInstanceLink> listener : listeners) {
170 listener.onBeforeRemove(workflowInstanceLink);
171 }
172
173 workflowInstanceLink = removeImpl(workflowInstanceLink);
174
175 for (ModelListener<WorkflowInstanceLink> listener : listeners) {
176 listener.onAfterRemove(workflowInstanceLink);
177 }
178
179 return workflowInstanceLink;
180 }
181
182 protected WorkflowInstanceLink removeImpl(
183 WorkflowInstanceLink workflowInstanceLink) throws SystemException {
184 workflowInstanceLink = toUnwrappedModel(workflowInstanceLink);
185
186 Session session = null;
187
188 try {
189 session = openSession();
190
191 if (workflowInstanceLink.isCachedModel() ||
192 BatchSessionUtil.isEnabled()) {
193 Object staleObject = session.get(WorkflowInstanceLinkImpl.class,
194 workflowInstanceLink.getPrimaryKeyObj());
195
196 if (staleObject != null) {
197 session.evict(staleObject);
198 }
199 }
200
201 session.delete(workflowInstanceLink);
202
203 session.flush();
204 }
205 catch (Exception e) {
206 throw processException(e);
207 }
208 finally {
209 closeSession(session);
210 }
211
212 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
213
214 WorkflowInstanceLinkModelImpl workflowInstanceLinkModelImpl = (WorkflowInstanceLinkModelImpl)workflowInstanceLink;
215
216 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_C_C_C,
217 new Object[] {
218 new Long(workflowInstanceLinkModelImpl.getOriginalGroupId()),
219 new Long(workflowInstanceLinkModelImpl.getOriginalCompanyId()),
220 new Long(workflowInstanceLinkModelImpl.getOriginalClassNameId()),
221 new Long(workflowInstanceLinkModelImpl.getOriginalClassPK())
222 });
223
224 EntityCacheUtil.removeResult(WorkflowInstanceLinkModelImpl.ENTITY_CACHE_ENABLED,
225 WorkflowInstanceLinkImpl.class, workflowInstanceLink.getPrimaryKey());
226
227 return workflowInstanceLink;
228 }
229
230 public WorkflowInstanceLink updateImpl(
231 com.liferay.portal.model.WorkflowInstanceLink workflowInstanceLink,
232 boolean merge) throws SystemException {
233 workflowInstanceLink = toUnwrappedModel(workflowInstanceLink);
234
235 boolean isNew = workflowInstanceLink.isNew();
236
237 WorkflowInstanceLinkModelImpl workflowInstanceLinkModelImpl = (WorkflowInstanceLinkModelImpl)workflowInstanceLink;
238
239 Session session = null;
240
241 try {
242 session = openSession();
243
244 BatchSessionUtil.update(session, workflowInstanceLink, merge);
245
246 workflowInstanceLink.setNew(false);
247 }
248 catch (Exception e) {
249 throw processException(e);
250 }
251 finally {
252 closeSession(session);
253 }
254
255 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
256
257 EntityCacheUtil.putResult(WorkflowInstanceLinkModelImpl.ENTITY_CACHE_ENABLED,
258 WorkflowInstanceLinkImpl.class,
259 workflowInstanceLink.getPrimaryKey(), workflowInstanceLink);
260
261 if (!isNew &&
262 ((workflowInstanceLink.getGroupId() != workflowInstanceLinkModelImpl.getOriginalGroupId()) ||
263 (workflowInstanceLink.getCompanyId() != workflowInstanceLinkModelImpl.getOriginalCompanyId()) ||
264 (workflowInstanceLink.getClassNameId() != workflowInstanceLinkModelImpl.getOriginalClassNameId()) ||
265 (workflowInstanceLink.getClassPK() != workflowInstanceLinkModelImpl.getOriginalClassPK()))) {
266 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_C_C_C,
267 new Object[] {
268 new Long(workflowInstanceLinkModelImpl.getOriginalGroupId()),
269 new Long(workflowInstanceLinkModelImpl.getOriginalCompanyId()),
270 new Long(workflowInstanceLinkModelImpl.getOriginalClassNameId()),
271 new Long(workflowInstanceLinkModelImpl.getOriginalClassPK())
272 });
273 }
274
275 if (isNew ||
276 ((workflowInstanceLink.getGroupId() != workflowInstanceLinkModelImpl.getOriginalGroupId()) ||
277 (workflowInstanceLink.getCompanyId() != workflowInstanceLinkModelImpl.getOriginalCompanyId()) ||
278 (workflowInstanceLink.getClassNameId() != workflowInstanceLinkModelImpl.getOriginalClassNameId()) ||
279 (workflowInstanceLink.getClassPK() != workflowInstanceLinkModelImpl.getOriginalClassPK()))) {
280 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_C_C_C,
281 new Object[] {
282 new Long(workflowInstanceLink.getGroupId()),
283 new Long(workflowInstanceLink.getCompanyId()),
284 new Long(workflowInstanceLink.getClassNameId()),
285 new Long(workflowInstanceLink.getClassPK())
286 }, workflowInstanceLink);
287 }
288
289 return workflowInstanceLink;
290 }
291
292 protected WorkflowInstanceLink toUnwrappedModel(
293 WorkflowInstanceLink workflowInstanceLink) {
294 if (workflowInstanceLink instanceof WorkflowInstanceLinkImpl) {
295 return workflowInstanceLink;
296 }
297
298 WorkflowInstanceLinkImpl workflowInstanceLinkImpl = new WorkflowInstanceLinkImpl();
299
300 workflowInstanceLinkImpl.setNew(workflowInstanceLink.isNew());
301 workflowInstanceLinkImpl.setPrimaryKey(workflowInstanceLink.getPrimaryKey());
302
303 workflowInstanceLinkImpl.setWorkflowInstanceLinkId(workflowInstanceLink.getWorkflowInstanceLinkId());
304 workflowInstanceLinkImpl.setGroupId(workflowInstanceLink.getGroupId());
305 workflowInstanceLinkImpl.setCompanyId(workflowInstanceLink.getCompanyId());
306 workflowInstanceLinkImpl.setUserId(workflowInstanceLink.getUserId());
307 workflowInstanceLinkImpl.setUserName(workflowInstanceLink.getUserName());
308 workflowInstanceLinkImpl.setCreateDate(workflowInstanceLink.getCreateDate());
309 workflowInstanceLinkImpl.setModifiedDate(workflowInstanceLink.getModifiedDate());
310 workflowInstanceLinkImpl.setClassNameId(workflowInstanceLink.getClassNameId());
311 workflowInstanceLinkImpl.setClassPK(workflowInstanceLink.getClassPK());
312 workflowInstanceLinkImpl.setWorkflowInstanceId(workflowInstanceLink.getWorkflowInstanceId());
313
314 return workflowInstanceLinkImpl;
315 }
316
317 public WorkflowInstanceLink findByPrimaryKey(Serializable primaryKey)
318 throws NoSuchModelException, SystemException {
319 return findByPrimaryKey(((Long)primaryKey).longValue());
320 }
321
322 public WorkflowInstanceLink findByPrimaryKey(long workflowInstanceLinkId)
323 throws NoSuchWorkflowInstanceLinkException, SystemException {
324 WorkflowInstanceLink workflowInstanceLink = fetchByPrimaryKey(workflowInstanceLinkId);
325
326 if (workflowInstanceLink == null) {
327 if (_log.isWarnEnabled()) {
328 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
329 workflowInstanceLinkId);
330 }
331
332 throw new NoSuchWorkflowInstanceLinkException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
333 workflowInstanceLinkId);
334 }
335
336 return workflowInstanceLink;
337 }
338
339 public WorkflowInstanceLink fetchByPrimaryKey(Serializable primaryKey)
340 throws SystemException {
341 return fetchByPrimaryKey(((Long)primaryKey).longValue());
342 }
343
344 public WorkflowInstanceLink fetchByPrimaryKey(long workflowInstanceLinkId)
345 throws SystemException {
346 WorkflowInstanceLink workflowInstanceLink = (WorkflowInstanceLink)EntityCacheUtil.getResult(WorkflowInstanceLinkModelImpl.ENTITY_CACHE_ENABLED,
347 WorkflowInstanceLinkImpl.class, workflowInstanceLinkId, this);
348
349 if (workflowInstanceLink == null) {
350 Session session = null;
351
352 try {
353 session = openSession();
354
355 workflowInstanceLink = (WorkflowInstanceLink)session.get(WorkflowInstanceLinkImpl.class,
356 new Long(workflowInstanceLinkId));
357 }
358 catch (Exception e) {
359 throw processException(e);
360 }
361 finally {
362 if (workflowInstanceLink != null) {
363 cacheResult(workflowInstanceLink);
364 }
365
366 closeSession(session);
367 }
368 }
369
370 return workflowInstanceLink;
371 }
372
373 public WorkflowInstanceLink findByG_C_C_C(long groupId, long companyId,
374 long classNameId, long classPK)
375 throws NoSuchWorkflowInstanceLinkException, SystemException {
376 WorkflowInstanceLink workflowInstanceLink = fetchByG_C_C_C(groupId,
377 companyId, classNameId, classPK);
378
379 if (workflowInstanceLink == null) {
380 StringBundler msg = new StringBundler(10);
381
382 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
383
384 msg.append("groupId=");
385 msg.append(groupId);
386
387 msg.append(", companyId=");
388 msg.append(companyId);
389
390 msg.append(", classNameId=");
391 msg.append(classNameId);
392
393 msg.append(", classPK=");
394 msg.append(classPK);
395
396 msg.append(StringPool.CLOSE_CURLY_BRACE);
397
398 if (_log.isWarnEnabled()) {
399 _log.warn(msg.toString());
400 }
401
402 throw new NoSuchWorkflowInstanceLinkException(msg.toString());
403 }
404
405 return workflowInstanceLink;
406 }
407
408 public WorkflowInstanceLink fetchByG_C_C_C(long groupId, long companyId,
409 long classNameId, long classPK) throws SystemException {
410 return fetchByG_C_C_C(groupId, companyId, classNameId, classPK, true);
411 }
412
413 public WorkflowInstanceLink fetchByG_C_C_C(long groupId, long companyId,
414 long classNameId, long classPK, boolean retrieveFromCache)
415 throws SystemException {
416 Object[] finderArgs = new Object[] {
417 new Long(groupId), new Long(companyId), new Long(classNameId),
418 new Long(classPK)
419 };
420
421 Object result = null;
422
423 if (retrieveFromCache) {
424 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_C_C_C,
425 finderArgs, this);
426 }
427
428 if (result == null) {
429 Session session = null;
430
431 try {
432 session = openSession();
433
434 StringBundler query = new StringBundler(5);
435
436 query.append(_SQL_SELECT_WORKFLOWINSTANCELINK_WHERE);
437
438 query.append(_FINDER_COLUMN_G_C_C_C_GROUPID_2);
439
440 query.append(_FINDER_COLUMN_G_C_C_C_COMPANYID_2);
441
442 query.append(_FINDER_COLUMN_G_C_C_C_CLASSNAMEID_2);
443
444 query.append(_FINDER_COLUMN_G_C_C_C_CLASSPK_2);
445
446 String sql = query.toString();
447
448 Query q = session.createQuery(sql);
449
450 QueryPos qPos = QueryPos.getInstance(q);
451
452 qPos.add(groupId);
453
454 qPos.add(companyId);
455
456 qPos.add(classNameId);
457
458 qPos.add(classPK);
459
460 List<WorkflowInstanceLink> list = q.list();
461
462 result = list;
463
464 WorkflowInstanceLink workflowInstanceLink = null;
465
466 if (list.isEmpty()) {
467 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_C_C_C,
468 finderArgs, list);
469 }
470 else {
471 workflowInstanceLink = list.get(0);
472
473 cacheResult(workflowInstanceLink);
474
475 if ((workflowInstanceLink.getGroupId() != groupId) ||
476 (workflowInstanceLink.getCompanyId() != companyId) ||
477 (workflowInstanceLink.getClassNameId() != classNameId) ||
478 (workflowInstanceLink.getClassPK() != classPK)) {
479 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_C_C_C,
480 finderArgs, workflowInstanceLink);
481 }
482 }
483
484 return workflowInstanceLink;
485 }
486 catch (Exception e) {
487 throw processException(e);
488 }
489 finally {
490 if (result == null) {
491 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_C_C_C,
492 finderArgs, new ArrayList<WorkflowInstanceLink>());
493 }
494
495 closeSession(session);
496 }
497 }
498 else {
499 if (result instanceof List<?>) {
500 return null;
501 }
502 else {
503 return (WorkflowInstanceLink)result;
504 }
505 }
506 }
507
508 public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
509 throws SystemException {
510 Session session = null;
511
512 try {
513 session = openSession();
514
515 dynamicQuery.compile(session);
516
517 return dynamicQuery.list();
518 }
519 catch (Exception e) {
520 throw processException(e);
521 }
522 finally {
523 closeSession(session);
524 }
525 }
526
527 public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
528 int start, int end) throws SystemException {
529 Session session = null;
530
531 try {
532 session = openSession();
533
534 dynamicQuery.setLimit(start, end);
535
536 dynamicQuery.compile(session);
537
538 return dynamicQuery.list();
539 }
540 catch (Exception e) {
541 throw processException(e);
542 }
543 finally {
544 closeSession(session);
545 }
546 }
547
548 public List<WorkflowInstanceLink> findAll() throws SystemException {
549 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
550 }
551
552 public List<WorkflowInstanceLink> findAll(int start, int end)
553 throws SystemException {
554 return findAll(start, end, null);
555 }
556
557 public List<WorkflowInstanceLink> findAll(int start, int end,
558 OrderByComparator obc) throws SystemException {
559 Object[] finderArgs = new Object[] {
560 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
561 };
562
563 List<WorkflowInstanceLink> list = (List<WorkflowInstanceLink>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
564 finderArgs, this);
565
566 if (list == null) {
567 Session session = null;
568
569 try {
570 session = openSession();
571
572 StringBundler query = null;
573 String sql = null;
574
575 if (obc != null) {
576 query = new StringBundler(2 +
577 (obc.getOrderByFields().length * 3));
578
579 query.append(_SQL_SELECT_WORKFLOWINSTANCELINK);
580
581 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
582
583 sql = query.toString();
584 }
585
586 sql = _SQL_SELECT_WORKFLOWINSTANCELINK;
587
588 Query q = session.createQuery(sql);
589
590 if (obc == null) {
591 list = (List<WorkflowInstanceLink>)QueryUtil.list(q,
592 getDialect(), start, end, false);
593
594 Collections.sort(list);
595 }
596 else {
597 list = (List<WorkflowInstanceLink>)QueryUtil.list(q,
598 getDialect(), start, end);
599 }
600 }
601 catch (Exception e) {
602 throw processException(e);
603 }
604 finally {
605 if (list == null) {
606 list = new ArrayList<WorkflowInstanceLink>();
607 }
608
609 cacheResult(list);
610
611 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
612
613 closeSession(session);
614 }
615 }
616
617 return list;
618 }
619
620 public void removeByG_C_C_C(long groupId, long companyId, long classNameId,
621 long classPK)
622 throws NoSuchWorkflowInstanceLinkException, SystemException {
623 WorkflowInstanceLink workflowInstanceLink = findByG_C_C_C(groupId,
624 companyId, classNameId, classPK);
625
626 remove(workflowInstanceLink);
627 }
628
629 public void removeAll() throws SystemException {
630 for (WorkflowInstanceLink workflowInstanceLink : findAll()) {
631 remove(workflowInstanceLink);
632 }
633 }
634
635 public int countByG_C_C_C(long groupId, long companyId, long classNameId,
636 long classPK) throws SystemException {
637 Object[] finderArgs = new Object[] {
638 new Long(groupId), new Long(companyId), new Long(classNameId),
639 new Long(classPK)
640 };
641
642 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_C_C_C,
643 finderArgs, this);
644
645 if (count == null) {
646 Session session = null;
647
648 try {
649 session = openSession();
650
651 StringBundler query = new StringBundler(5);
652
653 query.append(_SQL_COUNT_WORKFLOWINSTANCELINK_WHERE);
654
655 query.append(_FINDER_COLUMN_G_C_C_C_GROUPID_2);
656
657 query.append(_FINDER_COLUMN_G_C_C_C_COMPANYID_2);
658
659 query.append(_FINDER_COLUMN_G_C_C_C_CLASSNAMEID_2);
660
661 query.append(_FINDER_COLUMN_G_C_C_C_CLASSPK_2);
662
663 String sql = query.toString();
664
665 Query q = session.createQuery(sql);
666
667 QueryPos qPos = QueryPos.getInstance(q);
668
669 qPos.add(groupId);
670
671 qPos.add(companyId);
672
673 qPos.add(classNameId);
674
675 qPos.add(classPK);
676
677 count = (Long)q.uniqueResult();
678 }
679 catch (Exception e) {
680 throw processException(e);
681 }
682 finally {
683 if (count == null) {
684 count = Long.valueOf(0);
685 }
686
687 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_C_C_C,
688 finderArgs, count);
689
690 closeSession(session);
691 }
692 }
693
694 return count.intValue();
695 }
696
697 public int countAll() throws SystemException {
698 Object[] finderArgs = new Object[0];
699
700 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
701 finderArgs, this);
702
703 if (count == null) {
704 Session session = null;
705
706 try {
707 session = openSession();
708
709 Query q = session.createQuery(_SQL_COUNT_WORKFLOWINSTANCELINK);
710
711 count = (Long)q.uniqueResult();
712 }
713 catch (Exception e) {
714 throw processException(e);
715 }
716 finally {
717 if (count == null) {
718 count = Long.valueOf(0);
719 }
720
721 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
722 count);
723
724 closeSession(session);
725 }
726 }
727
728 return count.intValue();
729 }
730
731 public void afterPropertiesSet() {
732 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
733 com.liferay.portal.util.PropsUtil.get(
734 "value.object.listener.com.liferay.portal.model.WorkflowInstanceLink")));
735
736 if (listenerClassNames.length > 0) {
737 try {
738 List<ModelListener<WorkflowInstanceLink>> listenersList = new ArrayList<ModelListener<WorkflowInstanceLink>>();
739
740 for (String listenerClassName : listenerClassNames) {
741 listenersList.add((ModelListener<WorkflowInstanceLink>)Class.forName(
742 listenerClassName).newInstance());
743 }
744
745 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
746 }
747 catch (Exception e) {
748 _log.error(e);
749 }
750 }
751 }
752
753 @BeanReference(name = "com.liferay.portal.service.persistence.AccountPersistence")
754 protected com.liferay.portal.service.persistence.AccountPersistence accountPersistence;
755 @BeanReference(name = "com.liferay.portal.service.persistence.AddressPersistence")
756 protected com.liferay.portal.service.persistence.AddressPersistence addressPersistence;
757 @BeanReference(name = "com.liferay.portal.service.persistence.BrowserTrackerPersistence")
758 protected com.liferay.portal.service.persistence.BrowserTrackerPersistence browserTrackerPersistence;
759 @BeanReference(name = "com.liferay.portal.service.persistence.ClassNamePersistence")
760 protected com.liferay.portal.service.persistence.ClassNamePersistence classNamePersistence;
761 @BeanReference(name = "com.liferay.portal.service.persistence.CompanyPersistence")
762 protected com.liferay.portal.service.persistence.CompanyPersistence companyPersistence;
763 @BeanReference(name = "com.liferay.portal.service.persistence.ContactPersistence")
764 protected com.liferay.portal.service.persistence.ContactPersistence contactPersistence;
765 @BeanReference(name = "com.liferay.portal.service.persistence.CountryPersistence")
766 protected com.liferay.portal.service.persistence.CountryPersistence countryPersistence;
767 @BeanReference(name = "com.liferay.portal.service.persistence.EmailAddressPersistence")
768 protected com.liferay.portal.service.persistence.EmailAddressPersistence emailAddressPersistence;
769 @BeanReference(name = "com.liferay.portal.service.persistence.GroupPersistence")
770 protected com.liferay.portal.service.persistence.GroupPersistence groupPersistence;
771 @BeanReference(name = "com.liferay.portal.service.persistence.ImagePersistence")
772 protected com.liferay.portal.service.persistence.ImagePersistence imagePersistence;
773 @BeanReference(name = "com.liferay.portal.service.persistence.LayoutPersistence")
774 protected com.liferay.portal.service.persistence.LayoutPersistence layoutPersistence;
775 @BeanReference(name = "com.liferay.portal.service.persistence.LayoutPrototypePersistence")
776 protected com.liferay.portal.service.persistence.LayoutPrototypePersistence layoutPrototypePersistence;
777 @BeanReference(name = "com.liferay.portal.service.persistence.LayoutSetPersistence")
778 protected com.liferay.portal.service.persistence.LayoutSetPersistence layoutSetPersistence;
779 @BeanReference(name = "com.liferay.portal.service.persistence.LayoutSetPrototypePersistence")
780 protected com.liferay.portal.service.persistence.LayoutSetPrototypePersistence layoutSetPrototypePersistence;
781 @BeanReference(name = "com.liferay.portal.service.persistence.ListTypePersistence")
782 protected com.liferay.portal.service.persistence.ListTypePersistence listTypePersistence;
783 @BeanReference(name = "com.liferay.portal.service.persistence.LockPersistence")
784 protected com.liferay.portal.service.persistence.LockPersistence lockPersistence;
785 @BeanReference(name = "com.liferay.portal.service.persistence.MembershipRequestPersistence")
786 protected com.liferay.portal.service.persistence.MembershipRequestPersistence membershipRequestPersistence;
787 @BeanReference(name = "com.liferay.portal.service.persistence.OrganizationPersistence")
788 protected com.liferay.portal.service.persistence.OrganizationPersistence organizationPersistence;
789 @BeanReference(name = "com.liferay.portal.service.persistence.OrgGroupPermissionPersistence")
790 protected com.liferay.portal.service.persistence.OrgGroupPermissionPersistence orgGroupPermissionPersistence;
791 @BeanReference(name = "com.liferay.portal.service.persistence.OrgGroupRolePersistence")
792 protected com.liferay.portal.service.persistence.OrgGroupRolePersistence orgGroupRolePersistence;
793 @BeanReference(name = "com.liferay.portal.service.persistence.OrgLaborPersistence")
794 protected com.liferay.portal.service.persistence.OrgLaborPersistence orgLaborPersistence;
795 @BeanReference(name = "com.liferay.portal.service.persistence.PasswordPolicyPersistence")
796 protected com.liferay.portal.service.persistence.PasswordPolicyPersistence passwordPolicyPersistence;
797 @BeanReference(name = "com.liferay.portal.service.persistence.PasswordPolicyRelPersistence")
798 protected com.liferay.portal.service.persistence.PasswordPolicyRelPersistence passwordPolicyRelPersistence;
799 @BeanReference(name = "com.liferay.portal.service.persistence.PasswordTrackerPersistence")
800 protected com.liferay.portal.service.persistence.PasswordTrackerPersistence passwordTrackerPersistence;
801 @BeanReference(name = "com.liferay.portal.service.persistence.PermissionPersistence")
802 protected com.liferay.portal.service.persistence.PermissionPersistence permissionPersistence;
803 @BeanReference(name = "com.liferay.portal.service.persistence.PhonePersistence")
804 protected com.liferay.portal.service.persistence.PhonePersistence phonePersistence;
805 @BeanReference(name = "com.liferay.portal.service.persistence.PluginSettingPersistence")
806 protected com.liferay.portal.service.persistence.PluginSettingPersistence pluginSettingPersistence;
807 @BeanReference(name = "com.liferay.portal.service.persistence.PortletPersistence")
808 protected com.liferay.portal.service.persistence.PortletPersistence portletPersistence;
809 @BeanReference(name = "com.liferay.portal.service.persistence.PortletItemPersistence")
810 protected com.liferay.portal.service.persistence.PortletItemPersistence portletItemPersistence;
811 @BeanReference(name = "com.liferay.portal.service.persistence.PortletPreferencesPersistence")
812 protected com.liferay.portal.service.persistence.PortletPreferencesPersistence portletPreferencesPersistence;
813 @BeanReference(name = "com.liferay.portal.service.persistence.RegionPersistence")
814 protected com.liferay.portal.service.persistence.RegionPersistence regionPersistence;
815 @BeanReference(name = "com.liferay.portal.service.persistence.ReleasePersistence")
816 protected com.liferay.portal.service.persistence.ReleasePersistence releasePersistence;
817 @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePersistence")
818 protected com.liferay.portal.service.persistence.ResourcePersistence resourcePersistence;
819 @BeanReference(name = "com.liferay.portal.service.persistence.ResourceActionPersistence")
820 protected com.liferay.portal.service.persistence.ResourceActionPersistence resourceActionPersistence;
821 @BeanReference(name = "com.liferay.portal.service.persistence.ResourceCodePersistence")
822 protected com.liferay.portal.service.persistence.ResourceCodePersistence resourceCodePersistence;
823 @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePermissionPersistence")
824 protected com.liferay.portal.service.persistence.ResourcePermissionPersistence resourcePermissionPersistence;
825 @BeanReference(name = "com.liferay.portal.service.persistence.RolePersistence")
826 protected com.liferay.portal.service.persistence.RolePersistence rolePersistence;
827 @BeanReference(name = "com.liferay.portal.service.persistence.ServiceComponentPersistence")
828 protected com.liferay.portal.service.persistence.ServiceComponentPersistence serviceComponentPersistence;
829 @BeanReference(name = "com.liferay.portal.service.persistence.ShardPersistence")
830 protected com.liferay.portal.service.persistence.ShardPersistence shardPersistence;
831 @BeanReference(name = "com.liferay.portal.service.persistence.SubscriptionPersistence")
832 protected com.liferay.portal.service.persistence.SubscriptionPersistence subscriptionPersistence;
833 @BeanReference(name = "com.liferay.portal.service.persistence.UserPersistence")
834 protected com.liferay.portal.service.persistence.UserPersistence userPersistence;
835 @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupPersistence")
836 protected com.liferay.portal.service.persistence.UserGroupPersistence userGroupPersistence;
837 @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupGroupRolePersistence")
838 protected com.liferay.portal.service.persistence.UserGroupGroupRolePersistence userGroupGroupRolePersistence;
839 @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupRolePersistence")
840 protected com.liferay.portal.service.persistence.UserGroupRolePersistence userGroupRolePersistence;
841 @BeanReference(name = "com.liferay.portal.service.persistence.UserIdMapperPersistence")
842 protected com.liferay.portal.service.persistence.UserIdMapperPersistence userIdMapperPersistence;
843 @BeanReference(name = "com.liferay.portal.service.persistence.UserTrackerPersistence")
844 protected com.liferay.portal.service.persistence.UserTrackerPersistence userTrackerPersistence;
845 @BeanReference(name = "com.liferay.portal.service.persistence.UserTrackerPathPersistence")
846 protected com.liferay.portal.service.persistence.UserTrackerPathPersistence userTrackerPathPersistence;
847 @BeanReference(name = "com.liferay.portal.service.persistence.WebDAVPropsPersistence")
848 protected com.liferay.portal.service.persistence.WebDAVPropsPersistence webDAVPropsPersistence;
849 @BeanReference(name = "com.liferay.portal.service.persistence.WebsitePersistence")
850 protected com.liferay.portal.service.persistence.WebsitePersistence websitePersistence;
851 @BeanReference(name = "com.liferay.portal.service.persistence.WorkflowDefinitionLinkPersistence")
852 protected com.liferay.portal.service.persistence.WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
853 @BeanReference(name = "com.liferay.portal.service.persistence.WorkflowInstanceLinkPersistence")
854 protected com.liferay.portal.service.persistence.WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
855 private static final String _SQL_SELECT_WORKFLOWINSTANCELINK = "SELECT workflowInstanceLink FROM WorkflowInstanceLink workflowInstanceLink";
856 private static final String _SQL_SELECT_WORKFLOWINSTANCELINK_WHERE = "SELECT workflowInstanceLink FROM WorkflowInstanceLink workflowInstanceLink WHERE ";
857 private static final String _SQL_COUNT_WORKFLOWINSTANCELINK = "SELECT COUNT(workflowInstanceLink) FROM WorkflowInstanceLink workflowInstanceLink";
858 private static final String _SQL_COUNT_WORKFLOWINSTANCELINK_WHERE = "SELECT COUNT(workflowInstanceLink) FROM WorkflowInstanceLink workflowInstanceLink WHERE ";
859 private static final String _FINDER_COLUMN_G_C_C_C_GROUPID_2 = "workflowInstanceLink.groupId = ? AND ";
860 private static final String _FINDER_COLUMN_G_C_C_C_COMPANYID_2 = "workflowInstanceLink.companyId = ? AND ";
861 private static final String _FINDER_COLUMN_G_C_C_C_CLASSNAMEID_2 = "workflowInstanceLink.classNameId = ? AND ";
862 private static final String _FINDER_COLUMN_G_C_C_C_CLASSPK_2 = "workflowInstanceLink.classPK = ?";
863 private static final String _ORDER_BY_ENTITY_ALIAS = "workflowInstanceLink.";
864 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No WorkflowInstanceLink exists with the primary key ";
865 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No WorkflowInstanceLink exists with the key {";
866 private static Log _log = LogFactoryUtil.getLog(WorkflowInstanceLinkPersistenceImpl.class);
867 }