001
014
015 package com.liferay.portal.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.NoSuchWorkflowDefinitionLinkException;
019 import com.liferay.portal.kernel.bean.BeanReference;
020 import com.liferay.portal.kernel.cache.CacheRegistryUtil;
021 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
022 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
023 import com.liferay.portal.kernel.dao.orm.FinderPath;
024 import com.liferay.portal.kernel.dao.orm.Query;
025 import com.liferay.portal.kernel.dao.orm.QueryPos;
026 import com.liferay.portal.kernel.dao.orm.QueryUtil;
027 import com.liferay.portal.kernel.dao.orm.Session;
028 import com.liferay.portal.kernel.exception.SystemException;
029 import com.liferay.portal.kernel.log.Log;
030 import com.liferay.portal.kernel.log.LogFactoryUtil;
031 import com.liferay.portal.kernel.util.GetterUtil;
032 import com.liferay.portal.kernel.util.InstanceFactory;
033 import com.liferay.portal.kernel.util.OrderByComparator;
034 import com.liferay.portal.kernel.util.StringBundler;
035 import com.liferay.portal.kernel.util.StringPool;
036 import com.liferay.portal.kernel.util.StringUtil;
037 import com.liferay.portal.kernel.util.Validator;
038 import com.liferay.portal.model.CacheModel;
039 import com.liferay.portal.model.ModelListener;
040 import com.liferay.portal.model.WorkflowDefinitionLink;
041 import com.liferay.portal.model.impl.WorkflowDefinitionLinkImpl;
042 import com.liferay.portal.model.impl.WorkflowDefinitionLinkModelImpl;
043 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
044
045 import java.io.Serializable;
046
047 import java.util.ArrayList;
048 import java.util.Collections;
049 import java.util.List;
050
051
063 public class WorkflowDefinitionLinkPersistenceImpl extends BasePersistenceImpl<WorkflowDefinitionLink>
064 implements WorkflowDefinitionLinkPersistence {
065
070 public static final String FINDER_CLASS_NAME_ENTITY = WorkflowDefinitionLinkImpl.class.getName();
071 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
072 ".List1";
073 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
074 ".List2";
075 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID =
076 new FinderPath(WorkflowDefinitionLinkModelImpl.ENTITY_CACHE_ENABLED,
077 WorkflowDefinitionLinkModelImpl.FINDER_CACHE_ENABLED,
078 WorkflowDefinitionLinkImpl.class,
079 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByCompanyId",
080 new String[] {
081 Long.class.getName(),
082
083 "java.lang.Integer", "java.lang.Integer",
084 "com.liferay.portal.kernel.util.OrderByComparator"
085 });
086 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID =
087 new FinderPath(WorkflowDefinitionLinkModelImpl.ENTITY_CACHE_ENABLED,
088 WorkflowDefinitionLinkModelImpl.FINDER_CACHE_ENABLED,
089 WorkflowDefinitionLinkImpl.class,
090 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByCompanyId",
091 new String[] { Long.class.getName() },
092 WorkflowDefinitionLinkModelImpl.COMPANYID_COLUMN_BITMASK);
093 public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(WorkflowDefinitionLinkModelImpl.ENTITY_CACHE_ENABLED,
094 WorkflowDefinitionLinkModelImpl.FINDER_CACHE_ENABLED, Long.class,
095 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByCompanyId",
096 new String[] { Long.class.getName() });
097 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_W_W = new FinderPath(WorkflowDefinitionLinkModelImpl.ENTITY_CACHE_ENABLED,
098 WorkflowDefinitionLinkModelImpl.FINDER_CACHE_ENABLED,
099 WorkflowDefinitionLinkImpl.class,
100 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_W_W",
101 new String[] {
102 Long.class.getName(), String.class.getName(),
103 Integer.class.getName(),
104
105 "java.lang.Integer", "java.lang.Integer",
106 "com.liferay.portal.kernel.util.OrderByComparator"
107 });
108 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_W_W = new FinderPath(WorkflowDefinitionLinkModelImpl.ENTITY_CACHE_ENABLED,
109 WorkflowDefinitionLinkModelImpl.FINDER_CACHE_ENABLED,
110 WorkflowDefinitionLinkImpl.class,
111 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_W_W",
112 new String[] {
113 Long.class.getName(), String.class.getName(),
114 Integer.class.getName()
115 },
116 WorkflowDefinitionLinkModelImpl.COMPANYID_COLUMN_BITMASK |
117 WorkflowDefinitionLinkModelImpl.WORKFLOWDEFINITIONNAME_COLUMN_BITMASK |
118 WorkflowDefinitionLinkModelImpl.WORKFLOWDEFINITIONVERSION_COLUMN_BITMASK);
119 public static final FinderPath FINDER_PATH_COUNT_BY_C_W_W = new FinderPath(WorkflowDefinitionLinkModelImpl.ENTITY_CACHE_ENABLED,
120 WorkflowDefinitionLinkModelImpl.FINDER_CACHE_ENABLED, Long.class,
121 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_W_W",
122 new String[] {
123 Long.class.getName(), String.class.getName(),
124 Integer.class.getName()
125 });
126 public static final FinderPath FINDER_PATH_FETCH_BY_G_C_C_C_T = new FinderPath(WorkflowDefinitionLinkModelImpl.ENTITY_CACHE_ENABLED,
127 WorkflowDefinitionLinkModelImpl.FINDER_CACHE_ENABLED,
128 WorkflowDefinitionLinkImpl.class, FINDER_CLASS_NAME_ENTITY,
129 "fetchByG_C_C_C_T",
130 new String[] {
131 Long.class.getName(), Long.class.getName(), Long.class.getName(),
132 Long.class.getName(), Long.class.getName()
133 },
134 WorkflowDefinitionLinkModelImpl.GROUPID_COLUMN_BITMASK |
135 WorkflowDefinitionLinkModelImpl.COMPANYID_COLUMN_BITMASK |
136 WorkflowDefinitionLinkModelImpl.CLASSNAMEID_COLUMN_BITMASK |
137 WorkflowDefinitionLinkModelImpl.CLASSPK_COLUMN_BITMASK |
138 WorkflowDefinitionLinkModelImpl.TYPEPK_COLUMN_BITMASK);
139 public static final FinderPath FINDER_PATH_COUNT_BY_G_C_C_C_T = new FinderPath(WorkflowDefinitionLinkModelImpl.ENTITY_CACHE_ENABLED,
140 WorkflowDefinitionLinkModelImpl.FINDER_CACHE_ENABLED, Long.class,
141 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_C_C_C_T",
142 new String[] {
143 Long.class.getName(), Long.class.getName(), Long.class.getName(),
144 Long.class.getName(), Long.class.getName()
145 });
146 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(WorkflowDefinitionLinkModelImpl.ENTITY_CACHE_ENABLED,
147 WorkflowDefinitionLinkModelImpl.FINDER_CACHE_ENABLED,
148 WorkflowDefinitionLinkImpl.class,
149 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
150 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(WorkflowDefinitionLinkModelImpl.ENTITY_CACHE_ENABLED,
151 WorkflowDefinitionLinkModelImpl.FINDER_CACHE_ENABLED,
152 WorkflowDefinitionLinkImpl.class,
153 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
154 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(WorkflowDefinitionLinkModelImpl.ENTITY_CACHE_ENABLED,
155 WorkflowDefinitionLinkModelImpl.FINDER_CACHE_ENABLED, Long.class,
156 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
157
158
163 public void cacheResult(WorkflowDefinitionLink workflowDefinitionLink) {
164 EntityCacheUtil.putResult(WorkflowDefinitionLinkModelImpl.ENTITY_CACHE_ENABLED,
165 WorkflowDefinitionLinkImpl.class,
166 workflowDefinitionLink.getPrimaryKey(), workflowDefinitionLink);
167
168 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_C_C_C_T,
169 new Object[] {
170 Long.valueOf(workflowDefinitionLink.getGroupId()),
171 Long.valueOf(workflowDefinitionLink.getCompanyId()),
172 Long.valueOf(workflowDefinitionLink.getClassNameId()),
173 Long.valueOf(workflowDefinitionLink.getClassPK()),
174 Long.valueOf(workflowDefinitionLink.getTypePK())
175 }, workflowDefinitionLink);
176
177 workflowDefinitionLink.resetOriginalValues();
178 }
179
180
185 public void cacheResult(
186 List<WorkflowDefinitionLink> workflowDefinitionLinks) {
187 for (WorkflowDefinitionLink workflowDefinitionLink : workflowDefinitionLinks) {
188 if (EntityCacheUtil.getResult(
189 WorkflowDefinitionLinkModelImpl.ENTITY_CACHE_ENABLED,
190 WorkflowDefinitionLinkImpl.class,
191 workflowDefinitionLink.getPrimaryKey()) == null) {
192 cacheResult(workflowDefinitionLink);
193 }
194 else {
195 workflowDefinitionLink.resetOriginalValues();
196 }
197 }
198 }
199
200
207 @Override
208 public void clearCache() {
209 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
210 CacheRegistryUtil.clear(WorkflowDefinitionLinkImpl.class.getName());
211 }
212
213 EntityCacheUtil.clearCache(WorkflowDefinitionLinkImpl.class.getName());
214
215 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
216 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
217 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
218 }
219
220
227 @Override
228 public void clearCache(WorkflowDefinitionLink workflowDefinitionLink) {
229 EntityCacheUtil.removeResult(WorkflowDefinitionLinkModelImpl.ENTITY_CACHE_ENABLED,
230 WorkflowDefinitionLinkImpl.class,
231 workflowDefinitionLink.getPrimaryKey());
232
233 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
234 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
235
236 clearUniqueFindersCache(workflowDefinitionLink);
237 }
238
239 @Override
240 public void clearCache(List<WorkflowDefinitionLink> workflowDefinitionLinks) {
241 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
242 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
243
244 for (WorkflowDefinitionLink workflowDefinitionLink : workflowDefinitionLinks) {
245 EntityCacheUtil.removeResult(WorkflowDefinitionLinkModelImpl.ENTITY_CACHE_ENABLED,
246 WorkflowDefinitionLinkImpl.class,
247 workflowDefinitionLink.getPrimaryKey());
248
249 clearUniqueFindersCache(workflowDefinitionLink);
250 }
251 }
252
253 protected void clearUniqueFindersCache(
254 WorkflowDefinitionLink workflowDefinitionLink) {
255 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_C_C_C_T,
256 new Object[] {
257 Long.valueOf(workflowDefinitionLink.getGroupId()),
258 Long.valueOf(workflowDefinitionLink.getCompanyId()),
259 Long.valueOf(workflowDefinitionLink.getClassNameId()),
260 Long.valueOf(workflowDefinitionLink.getClassPK()),
261 Long.valueOf(workflowDefinitionLink.getTypePK())
262 });
263 }
264
265
271 public WorkflowDefinitionLink create(long workflowDefinitionLinkId) {
272 WorkflowDefinitionLink workflowDefinitionLink = new WorkflowDefinitionLinkImpl();
273
274 workflowDefinitionLink.setNew(true);
275 workflowDefinitionLink.setPrimaryKey(workflowDefinitionLinkId);
276
277 return workflowDefinitionLink;
278 }
279
280
288 public WorkflowDefinitionLink remove(long workflowDefinitionLinkId)
289 throws NoSuchWorkflowDefinitionLinkException, SystemException {
290 return remove(Long.valueOf(workflowDefinitionLinkId));
291 }
292
293
301 @Override
302 public WorkflowDefinitionLink remove(Serializable primaryKey)
303 throws NoSuchWorkflowDefinitionLinkException, SystemException {
304 Session session = null;
305
306 try {
307 session = openSession();
308
309 WorkflowDefinitionLink workflowDefinitionLink = (WorkflowDefinitionLink)session.get(WorkflowDefinitionLinkImpl.class,
310 primaryKey);
311
312 if (workflowDefinitionLink == null) {
313 if (_log.isWarnEnabled()) {
314 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
315 }
316
317 throw new NoSuchWorkflowDefinitionLinkException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
318 primaryKey);
319 }
320
321 return remove(workflowDefinitionLink);
322 }
323 catch (NoSuchWorkflowDefinitionLinkException nsee) {
324 throw nsee;
325 }
326 catch (Exception e) {
327 throw processException(e);
328 }
329 finally {
330 closeSession(session);
331 }
332 }
333
334 @Override
335 protected WorkflowDefinitionLink removeImpl(
336 WorkflowDefinitionLink workflowDefinitionLink)
337 throws SystemException {
338 workflowDefinitionLink = toUnwrappedModel(workflowDefinitionLink);
339
340 Session session = null;
341
342 try {
343 session = openSession();
344
345 if (workflowDefinitionLink.isCachedModel()) {
346 workflowDefinitionLink = (WorkflowDefinitionLink)session.get(WorkflowDefinitionLinkImpl.class,
347 workflowDefinitionLink.getPrimaryKeyObj());
348 }
349
350 session.delete(workflowDefinitionLink);
351 }
352 catch (Exception e) {
353 throw processException(e);
354 }
355 finally {
356 closeSession(session);
357 }
358
359 clearCache(workflowDefinitionLink);
360
361 return workflowDefinitionLink;
362 }
363
364 @Override
365 public WorkflowDefinitionLink updateImpl(
366 com.liferay.portal.model.WorkflowDefinitionLink workflowDefinitionLink)
367 throws SystemException {
368 workflowDefinitionLink = toUnwrappedModel(workflowDefinitionLink);
369
370 boolean isNew = workflowDefinitionLink.isNew();
371
372 WorkflowDefinitionLinkModelImpl workflowDefinitionLinkModelImpl = (WorkflowDefinitionLinkModelImpl)workflowDefinitionLink;
373
374 Session session = null;
375
376 try {
377 session = openSession();
378
379 if (workflowDefinitionLink.isNew()) {
380 session.save(workflowDefinitionLink);
381
382 workflowDefinitionLink.setNew(false);
383 }
384 else {
385 session.merge(workflowDefinitionLink);
386 }
387 }
388 catch (Exception e) {
389 throw processException(e);
390 }
391 finally {
392 closeSession(session);
393 }
394
395 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
396
397 if (isNew || !WorkflowDefinitionLinkModelImpl.COLUMN_BITMASK_ENABLED) {
398 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
399 }
400
401 else {
402 if ((workflowDefinitionLinkModelImpl.getColumnBitmask() &
403 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID.getColumnBitmask()) != 0) {
404 Object[] args = new Object[] {
405 Long.valueOf(workflowDefinitionLinkModelImpl.getOriginalCompanyId())
406 };
407
408 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID,
409 args);
410 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
411 args);
412
413 args = new Object[] {
414 Long.valueOf(workflowDefinitionLinkModelImpl.getCompanyId())
415 };
416
417 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID,
418 args);
419 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
420 args);
421 }
422
423 if ((workflowDefinitionLinkModelImpl.getColumnBitmask() &
424 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_W_W.getColumnBitmask()) != 0) {
425 Object[] args = new Object[] {
426 Long.valueOf(workflowDefinitionLinkModelImpl.getOriginalCompanyId()),
427
428 workflowDefinitionLinkModelImpl.getOriginalWorkflowDefinitionName(),
429 Integer.valueOf(workflowDefinitionLinkModelImpl.getOriginalWorkflowDefinitionVersion())
430 };
431
432 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_W_W, args);
433 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_W_W,
434 args);
435
436 args = new Object[] {
437 Long.valueOf(workflowDefinitionLinkModelImpl.getCompanyId()),
438
439 workflowDefinitionLinkModelImpl.getWorkflowDefinitionName(),
440 Integer.valueOf(workflowDefinitionLinkModelImpl.getWorkflowDefinitionVersion())
441 };
442
443 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_W_W, args);
444 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_W_W,
445 args);
446 }
447 }
448
449 EntityCacheUtil.putResult(WorkflowDefinitionLinkModelImpl.ENTITY_CACHE_ENABLED,
450 WorkflowDefinitionLinkImpl.class,
451 workflowDefinitionLink.getPrimaryKey(), workflowDefinitionLink);
452
453 if (isNew) {
454 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_C_C_C_T,
455 new Object[] {
456 Long.valueOf(workflowDefinitionLink.getGroupId()),
457 Long.valueOf(workflowDefinitionLink.getCompanyId()),
458 Long.valueOf(workflowDefinitionLink.getClassNameId()),
459 Long.valueOf(workflowDefinitionLink.getClassPK()),
460 Long.valueOf(workflowDefinitionLink.getTypePK())
461 }, workflowDefinitionLink);
462 }
463 else {
464 if ((workflowDefinitionLinkModelImpl.getColumnBitmask() &
465 FINDER_PATH_FETCH_BY_G_C_C_C_T.getColumnBitmask()) != 0) {
466 Object[] args = new Object[] {
467 Long.valueOf(workflowDefinitionLinkModelImpl.getOriginalGroupId()),
468 Long.valueOf(workflowDefinitionLinkModelImpl.getOriginalCompanyId()),
469 Long.valueOf(workflowDefinitionLinkModelImpl.getOriginalClassNameId()),
470 Long.valueOf(workflowDefinitionLinkModelImpl.getOriginalClassPK()),
471 Long.valueOf(workflowDefinitionLinkModelImpl.getOriginalTypePK())
472 };
473
474 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_C_C_C_T,
475 args);
476
477 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_C_C_C_T,
478 args);
479
480 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_C_C_C_T,
481 new Object[] {
482 Long.valueOf(workflowDefinitionLink.getGroupId()),
483 Long.valueOf(workflowDefinitionLink.getCompanyId()),
484 Long.valueOf(workflowDefinitionLink.getClassNameId()),
485 Long.valueOf(workflowDefinitionLink.getClassPK()),
486 Long.valueOf(workflowDefinitionLink.getTypePK())
487 }, workflowDefinitionLink);
488 }
489 }
490
491 return workflowDefinitionLink;
492 }
493
494 protected WorkflowDefinitionLink toUnwrappedModel(
495 WorkflowDefinitionLink workflowDefinitionLink) {
496 if (workflowDefinitionLink instanceof WorkflowDefinitionLinkImpl) {
497 return workflowDefinitionLink;
498 }
499
500 WorkflowDefinitionLinkImpl workflowDefinitionLinkImpl = new WorkflowDefinitionLinkImpl();
501
502 workflowDefinitionLinkImpl.setNew(workflowDefinitionLink.isNew());
503 workflowDefinitionLinkImpl.setPrimaryKey(workflowDefinitionLink.getPrimaryKey());
504
505 workflowDefinitionLinkImpl.setWorkflowDefinitionLinkId(workflowDefinitionLink.getWorkflowDefinitionLinkId());
506 workflowDefinitionLinkImpl.setGroupId(workflowDefinitionLink.getGroupId());
507 workflowDefinitionLinkImpl.setCompanyId(workflowDefinitionLink.getCompanyId());
508 workflowDefinitionLinkImpl.setUserId(workflowDefinitionLink.getUserId());
509 workflowDefinitionLinkImpl.setUserName(workflowDefinitionLink.getUserName());
510 workflowDefinitionLinkImpl.setCreateDate(workflowDefinitionLink.getCreateDate());
511 workflowDefinitionLinkImpl.setModifiedDate(workflowDefinitionLink.getModifiedDate());
512 workflowDefinitionLinkImpl.setClassNameId(workflowDefinitionLink.getClassNameId());
513 workflowDefinitionLinkImpl.setClassPK(workflowDefinitionLink.getClassPK());
514 workflowDefinitionLinkImpl.setTypePK(workflowDefinitionLink.getTypePK());
515 workflowDefinitionLinkImpl.setWorkflowDefinitionName(workflowDefinitionLink.getWorkflowDefinitionName());
516 workflowDefinitionLinkImpl.setWorkflowDefinitionVersion(workflowDefinitionLink.getWorkflowDefinitionVersion());
517
518 return workflowDefinitionLinkImpl;
519 }
520
521
529 @Override
530 public WorkflowDefinitionLink findByPrimaryKey(Serializable primaryKey)
531 throws NoSuchModelException, SystemException {
532 return findByPrimaryKey(((Long)primaryKey).longValue());
533 }
534
535
543 public WorkflowDefinitionLink findByPrimaryKey(
544 long workflowDefinitionLinkId)
545 throws NoSuchWorkflowDefinitionLinkException, SystemException {
546 WorkflowDefinitionLink workflowDefinitionLink = fetchByPrimaryKey(workflowDefinitionLinkId);
547
548 if (workflowDefinitionLink == null) {
549 if (_log.isWarnEnabled()) {
550 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
551 workflowDefinitionLinkId);
552 }
553
554 throw new NoSuchWorkflowDefinitionLinkException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
555 workflowDefinitionLinkId);
556 }
557
558 return workflowDefinitionLink;
559 }
560
561
568 @Override
569 public WorkflowDefinitionLink fetchByPrimaryKey(Serializable primaryKey)
570 throws SystemException {
571 return fetchByPrimaryKey(((Long)primaryKey).longValue());
572 }
573
574
581 public WorkflowDefinitionLink fetchByPrimaryKey(
582 long workflowDefinitionLinkId) throws SystemException {
583 WorkflowDefinitionLink workflowDefinitionLink = (WorkflowDefinitionLink)EntityCacheUtil.getResult(WorkflowDefinitionLinkModelImpl.ENTITY_CACHE_ENABLED,
584 WorkflowDefinitionLinkImpl.class, workflowDefinitionLinkId);
585
586 if (workflowDefinitionLink == _nullWorkflowDefinitionLink) {
587 return null;
588 }
589
590 if (workflowDefinitionLink == null) {
591 Session session = null;
592
593 boolean hasException = false;
594
595 try {
596 session = openSession();
597
598 workflowDefinitionLink = (WorkflowDefinitionLink)session.get(WorkflowDefinitionLinkImpl.class,
599 Long.valueOf(workflowDefinitionLinkId));
600 }
601 catch (Exception e) {
602 hasException = true;
603
604 throw processException(e);
605 }
606 finally {
607 if (workflowDefinitionLink != null) {
608 cacheResult(workflowDefinitionLink);
609 }
610 else if (!hasException) {
611 EntityCacheUtil.putResult(WorkflowDefinitionLinkModelImpl.ENTITY_CACHE_ENABLED,
612 WorkflowDefinitionLinkImpl.class,
613 workflowDefinitionLinkId, _nullWorkflowDefinitionLink);
614 }
615
616 closeSession(session);
617 }
618 }
619
620 return workflowDefinitionLink;
621 }
622
623
630 public List<WorkflowDefinitionLink> findByCompanyId(long companyId)
631 throws SystemException {
632 return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
633 null);
634 }
635
636
649 public List<WorkflowDefinitionLink> findByCompanyId(long companyId,
650 int start, int end) throws SystemException {
651 return findByCompanyId(companyId, start, end, null);
652 }
653
654
668 public List<WorkflowDefinitionLink> findByCompanyId(long companyId,
669 int start, int end, OrderByComparator orderByComparator)
670 throws SystemException {
671 FinderPath finderPath = null;
672 Object[] finderArgs = null;
673
674 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
675 (orderByComparator == null)) {
676 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID;
677 finderArgs = new Object[] { companyId };
678 }
679 else {
680 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID;
681 finderArgs = new Object[] { companyId, start, end, orderByComparator };
682 }
683
684 List<WorkflowDefinitionLink> list = (List<WorkflowDefinitionLink>)FinderCacheUtil.getResult(finderPath,
685 finderArgs, this);
686
687 if ((list != null) && !list.isEmpty()) {
688 for (WorkflowDefinitionLink workflowDefinitionLink : list) {
689 if ((companyId != workflowDefinitionLink.getCompanyId())) {
690 list = null;
691
692 break;
693 }
694 }
695 }
696
697 if (list == null) {
698 StringBundler query = null;
699
700 if (orderByComparator != null) {
701 query = new StringBundler(3 +
702 (orderByComparator.getOrderByFields().length * 3));
703 }
704 else {
705 query = new StringBundler(3);
706 }
707
708 query.append(_SQL_SELECT_WORKFLOWDEFINITIONLINK_WHERE);
709
710 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
711
712 if (orderByComparator != null) {
713 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
714 orderByComparator);
715 }
716
717 else {
718 query.append(WorkflowDefinitionLinkModelImpl.ORDER_BY_JPQL);
719 }
720
721 String sql = query.toString();
722
723 Session session = null;
724
725 try {
726 session = openSession();
727
728 Query q = session.createQuery(sql);
729
730 QueryPos qPos = QueryPos.getInstance(q);
731
732 qPos.add(companyId);
733
734 list = (List<WorkflowDefinitionLink>)QueryUtil.list(q,
735 getDialect(), start, end);
736 }
737 catch (Exception e) {
738 throw processException(e);
739 }
740 finally {
741 if (list == null) {
742 FinderCacheUtil.removeResult(finderPath, finderArgs);
743 }
744 else {
745 cacheResult(list);
746
747 FinderCacheUtil.putResult(finderPath, finderArgs, list);
748 }
749
750 closeSession(session);
751 }
752 }
753
754 return list;
755 }
756
757
766 public WorkflowDefinitionLink findByCompanyId_First(long companyId,
767 OrderByComparator orderByComparator)
768 throws NoSuchWorkflowDefinitionLinkException, SystemException {
769 WorkflowDefinitionLink workflowDefinitionLink = fetchByCompanyId_First(companyId,
770 orderByComparator);
771
772 if (workflowDefinitionLink != null) {
773 return workflowDefinitionLink;
774 }
775
776 StringBundler msg = new StringBundler(4);
777
778 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
779
780 msg.append("companyId=");
781 msg.append(companyId);
782
783 msg.append(StringPool.CLOSE_CURLY_BRACE);
784
785 throw new NoSuchWorkflowDefinitionLinkException(msg.toString());
786 }
787
788
796 public WorkflowDefinitionLink fetchByCompanyId_First(long companyId,
797 OrderByComparator orderByComparator) throws SystemException {
798 List<WorkflowDefinitionLink> list = findByCompanyId(companyId, 0, 1,
799 orderByComparator);
800
801 if (!list.isEmpty()) {
802 return list.get(0);
803 }
804
805 return null;
806 }
807
808
817 public WorkflowDefinitionLink findByCompanyId_Last(long companyId,
818 OrderByComparator orderByComparator)
819 throws NoSuchWorkflowDefinitionLinkException, SystemException {
820 WorkflowDefinitionLink workflowDefinitionLink = fetchByCompanyId_Last(companyId,
821 orderByComparator);
822
823 if (workflowDefinitionLink != null) {
824 return workflowDefinitionLink;
825 }
826
827 StringBundler msg = new StringBundler(4);
828
829 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
830
831 msg.append("companyId=");
832 msg.append(companyId);
833
834 msg.append(StringPool.CLOSE_CURLY_BRACE);
835
836 throw new NoSuchWorkflowDefinitionLinkException(msg.toString());
837 }
838
839
847 public WorkflowDefinitionLink fetchByCompanyId_Last(long companyId,
848 OrderByComparator orderByComparator) throws SystemException {
849 int count = countByCompanyId(companyId);
850
851 List<WorkflowDefinitionLink> list = findByCompanyId(companyId,
852 count - 1, count, orderByComparator);
853
854 if (!list.isEmpty()) {
855 return list.get(0);
856 }
857
858 return null;
859 }
860
861
871 public WorkflowDefinitionLink[] findByCompanyId_PrevAndNext(
872 long workflowDefinitionLinkId, long companyId,
873 OrderByComparator orderByComparator)
874 throws NoSuchWorkflowDefinitionLinkException, SystemException {
875 WorkflowDefinitionLink workflowDefinitionLink = findByPrimaryKey(workflowDefinitionLinkId);
876
877 Session session = null;
878
879 try {
880 session = openSession();
881
882 WorkflowDefinitionLink[] array = new WorkflowDefinitionLinkImpl[3];
883
884 array[0] = getByCompanyId_PrevAndNext(session,
885 workflowDefinitionLink, companyId, orderByComparator, true);
886
887 array[1] = workflowDefinitionLink;
888
889 array[2] = getByCompanyId_PrevAndNext(session,
890 workflowDefinitionLink, companyId, orderByComparator, false);
891
892 return array;
893 }
894 catch (Exception e) {
895 throw processException(e);
896 }
897 finally {
898 closeSession(session);
899 }
900 }
901
902 protected WorkflowDefinitionLink getByCompanyId_PrevAndNext(
903 Session session, WorkflowDefinitionLink workflowDefinitionLink,
904 long companyId, OrderByComparator orderByComparator, boolean previous) {
905 StringBundler query = null;
906
907 if (orderByComparator != null) {
908 query = new StringBundler(6 +
909 (orderByComparator.getOrderByFields().length * 6));
910 }
911 else {
912 query = new StringBundler(3);
913 }
914
915 query.append(_SQL_SELECT_WORKFLOWDEFINITIONLINK_WHERE);
916
917 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
918
919 if (orderByComparator != null) {
920 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
921
922 if (orderByConditionFields.length > 0) {
923 query.append(WHERE_AND);
924 }
925
926 for (int i = 0; i < orderByConditionFields.length; i++) {
927 query.append(_ORDER_BY_ENTITY_ALIAS);
928 query.append(orderByConditionFields[i]);
929
930 if ((i + 1) < orderByConditionFields.length) {
931 if (orderByComparator.isAscending() ^ previous) {
932 query.append(WHERE_GREATER_THAN_HAS_NEXT);
933 }
934 else {
935 query.append(WHERE_LESSER_THAN_HAS_NEXT);
936 }
937 }
938 else {
939 if (orderByComparator.isAscending() ^ previous) {
940 query.append(WHERE_GREATER_THAN);
941 }
942 else {
943 query.append(WHERE_LESSER_THAN);
944 }
945 }
946 }
947
948 query.append(ORDER_BY_CLAUSE);
949
950 String[] orderByFields = orderByComparator.getOrderByFields();
951
952 for (int i = 0; i < orderByFields.length; i++) {
953 query.append(_ORDER_BY_ENTITY_ALIAS);
954 query.append(orderByFields[i]);
955
956 if ((i + 1) < orderByFields.length) {
957 if (orderByComparator.isAscending() ^ previous) {
958 query.append(ORDER_BY_ASC_HAS_NEXT);
959 }
960 else {
961 query.append(ORDER_BY_DESC_HAS_NEXT);
962 }
963 }
964 else {
965 if (orderByComparator.isAscending() ^ previous) {
966 query.append(ORDER_BY_ASC);
967 }
968 else {
969 query.append(ORDER_BY_DESC);
970 }
971 }
972 }
973 }
974
975 else {
976 query.append(WorkflowDefinitionLinkModelImpl.ORDER_BY_JPQL);
977 }
978
979 String sql = query.toString();
980
981 Query q = session.createQuery(sql);
982
983 q.setFirstResult(0);
984 q.setMaxResults(2);
985
986 QueryPos qPos = QueryPos.getInstance(q);
987
988 qPos.add(companyId);
989
990 if (orderByComparator != null) {
991 Object[] values = orderByComparator.getOrderByConditionValues(workflowDefinitionLink);
992
993 for (Object value : values) {
994 qPos.add(value);
995 }
996 }
997
998 List<WorkflowDefinitionLink> list = q.list();
999
1000 if (list.size() == 2) {
1001 return list.get(1);
1002 }
1003 else {
1004 return null;
1005 }
1006 }
1007
1008
1017 public List<WorkflowDefinitionLink> findByC_W_W(long companyId,
1018 String workflowDefinitionName, int workflowDefinitionVersion)
1019 throws SystemException {
1020 return findByC_W_W(companyId, workflowDefinitionName,
1021 workflowDefinitionVersion, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1022 null);
1023 }
1024
1025
1040 public List<WorkflowDefinitionLink> findByC_W_W(long companyId,
1041 String workflowDefinitionName, int workflowDefinitionVersion,
1042 int start, int end) throws SystemException {
1043 return findByC_W_W(companyId, workflowDefinitionName,
1044 workflowDefinitionVersion, start, end, null);
1045 }
1046
1047
1063 public List<WorkflowDefinitionLink> findByC_W_W(long companyId,
1064 String workflowDefinitionName, int workflowDefinitionVersion,
1065 int start, int end, OrderByComparator orderByComparator)
1066 throws SystemException {
1067 FinderPath finderPath = null;
1068 Object[] finderArgs = null;
1069
1070 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1071 (orderByComparator == null)) {
1072 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_W_W;
1073 finderArgs = new Object[] {
1074 companyId, workflowDefinitionName, workflowDefinitionVersion
1075 };
1076 }
1077 else {
1078 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_W_W;
1079 finderArgs = new Object[] {
1080 companyId, workflowDefinitionName, workflowDefinitionVersion,
1081
1082 start, end, orderByComparator
1083 };
1084 }
1085
1086 List<WorkflowDefinitionLink> list = (List<WorkflowDefinitionLink>)FinderCacheUtil.getResult(finderPath,
1087 finderArgs, this);
1088
1089 if ((list != null) && !list.isEmpty()) {
1090 for (WorkflowDefinitionLink workflowDefinitionLink : list) {
1091 if ((companyId != workflowDefinitionLink.getCompanyId()) ||
1092 !Validator.equals(workflowDefinitionName,
1093 workflowDefinitionLink.getWorkflowDefinitionName()) ||
1094 (workflowDefinitionVersion != workflowDefinitionLink.getWorkflowDefinitionVersion())) {
1095 list = null;
1096
1097 break;
1098 }
1099 }
1100 }
1101
1102 if (list == null) {
1103 StringBundler query = null;
1104
1105 if (orderByComparator != null) {
1106 query = new StringBundler(5 +
1107 (orderByComparator.getOrderByFields().length * 3));
1108 }
1109 else {
1110 query = new StringBundler(5);
1111 }
1112
1113 query.append(_SQL_SELECT_WORKFLOWDEFINITIONLINK_WHERE);
1114
1115 query.append(_FINDER_COLUMN_C_W_W_COMPANYID_2);
1116
1117 if (workflowDefinitionName == null) {
1118 query.append(_FINDER_COLUMN_C_W_W_WORKFLOWDEFINITIONNAME_1);
1119 }
1120 else {
1121 if (workflowDefinitionName.equals(StringPool.BLANK)) {
1122 query.append(_FINDER_COLUMN_C_W_W_WORKFLOWDEFINITIONNAME_3);
1123 }
1124 else {
1125 query.append(_FINDER_COLUMN_C_W_W_WORKFLOWDEFINITIONNAME_2);
1126 }
1127 }
1128
1129 query.append(_FINDER_COLUMN_C_W_W_WORKFLOWDEFINITIONVERSION_2);
1130
1131 if (orderByComparator != null) {
1132 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1133 orderByComparator);
1134 }
1135
1136 else {
1137 query.append(WorkflowDefinitionLinkModelImpl.ORDER_BY_JPQL);
1138 }
1139
1140 String sql = query.toString();
1141
1142 Session session = null;
1143
1144 try {
1145 session = openSession();
1146
1147 Query q = session.createQuery(sql);
1148
1149 QueryPos qPos = QueryPos.getInstance(q);
1150
1151 qPos.add(companyId);
1152
1153 if (workflowDefinitionName != null) {
1154 qPos.add(workflowDefinitionName);
1155 }
1156
1157 qPos.add(workflowDefinitionVersion);
1158
1159 list = (List<WorkflowDefinitionLink>)QueryUtil.list(q,
1160 getDialect(), start, end);
1161 }
1162 catch (Exception e) {
1163 throw processException(e);
1164 }
1165 finally {
1166 if (list == null) {
1167 FinderCacheUtil.removeResult(finderPath, finderArgs);
1168 }
1169 else {
1170 cacheResult(list);
1171
1172 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1173 }
1174
1175 closeSession(session);
1176 }
1177 }
1178
1179 return list;
1180 }
1181
1182
1193 public WorkflowDefinitionLink findByC_W_W_First(long companyId,
1194 String workflowDefinitionName, int workflowDefinitionVersion,
1195 OrderByComparator orderByComparator)
1196 throws NoSuchWorkflowDefinitionLinkException, SystemException {
1197 WorkflowDefinitionLink workflowDefinitionLink = fetchByC_W_W_First(companyId,
1198 workflowDefinitionName, workflowDefinitionVersion,
1199 orderByComparator);
1200
1201 if (workflowDefinitionLink != null) {
1202 return workflowDefinitionLink;
1203 }
1204
1205 StringBundler msg = new StringBundler(8);
1206
1207 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1208
1209 msg.append("companyId=");
1210 msg.append(companyId);
1211
1212 msg.append(", workflowDefinitionName=");
1213 msg.append(workflowDefinitionName);
1214
1215 msg.append(", workflowDefinitionVersion=");
1216 msg.append(workflowDefinitionVersion);
1217
1218 msg.append(StringPool.CLOSE_CURLY_BRACE);
1219
1220 throw new NoSuchWorkflowDefinitionLinkException(msg.toString());
1221 }
1222
1223
1233 public WorkflowDefinitionLink fetchByC_W_W_First(long companyId,
1234 String workflowDefinitionName, int workflowDefinitionVersion,
1235 OrderByComparator orderByComparator) throws SystemException {
1236 List<WorkflowDefinitionLink> list = findByC_W_W(companyId,
1237 workflowDefinitionName, workflowDefinitionVersion, 0, 1,
1238 orderByComparator);
1239
1240 if (!list.isEmpty()) {
1241 return list.get(0);
1242 }
1243
1244 return null;
1245 }
1246
1247
1258 public WorkflowDefinitionLink findByC_W_W_Last(long companyId,
1259 String workflowDefinitionName, int workflowDefinitionVersion,
1260 OrderByComparator orderByComparator)
1261 throws NoSuchWorkflowDefinitionLinkException, SystemException {
1262 WorkflowDefinitionLink workflowDefinitionLink = fetchByC_W_W_Last(companyId,
1263 workflowDefinitionName, workflowDefinitionVersion,
1264 orderByComparator);
1265
1266 if (workflowDefinitionLink != null) {
1267 return workflowDefinitionLink;
1268 }
1269
1270 StringBundler msg = new StringBundler(8);
1271
1272 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1273
1274 msg.append("companyId=");
1275 msg.append(companyId);
1276
1277 msg.append(", workflowDefinitionName=");
1278 msg.append(workflowDefinitionName);
1279
1280 msg.append(", workflowDefinitionVersion=");
1281 msg.append(workflowDefinitionVersion);
1282
1283 msg.append(StringPool.CLOSE_CURLY_BRACE);
1284
1285 throw new NoSuchWorkflowDefinitionLinkException(msg.toString());
1286 }
1287
1288
1298 public WorkflowDefinitionLink fetchByC_W_W_Last(long companyId,
1299 String workflowDefinitionName, int workflowDefinitionVersion,
1300 OrderByComparator orderByComparator) throws SystemException {
1301 int count = countByC_W_W(companyId, workflowDefinitionName,
1302 workflowDefinitionVersion);
1303
1304 List<WorkflowDefinitionLink> list = findByC_W_W(companyId,
1305 workflowDefinitionName, workflowDefinitionVersion, count - 1,
1306 count, orderByComparator);
1307
1308 if (!list.isEmpty()) {
1309 return list.get(0);
1310 }
1311
1312 return null;
1313 }
1314
1315
1327 public WorkflowDefinitionLink[] findByC_W_W_PrevAndNext(
1328 long workflowDefinitionLinkId, long companyId,
1329 String workflowDefinitionName, int workflowDefinitionVersion,
1330 OrderByComparator orderByComparator)
1331 throws NoSuchWorkflowDefinitionLinkException, SystemException {
1332 WorkflowDefinitionLink workflowDefinitionLink = findByPrimaryKey(workflowDefinitionLinkId);
1333
1334 Session session = null;
1335
1336 try {
1337 session = openSession();
1338
1339 WorkflowDefinitionLink[] array = new WorkflowDefinitionLinkImpl[3];
1340
1341 array[0] = getByC_W_W_PrevAndNext(session, workflowDefinitionLink,
1342 companyId, workflowDefinitionName,
1343 workflowDefinitionVersion, orderByComparator, true);
1344
1345 array[1] = workflowDefinitionLink;
1346
1347 array[2] = getByC_W_W_PrevAndNext(session, workflowDefinitionLink,
1348 companyId, workflowDefinitionName,
1349 workflowDefinitionVersion, orderByComparator, false);
1350
1351 return array;
1352 }
1353 catch (Exception e) {
1354 throw processException(e);
1355 }
1356 finally {
1357 closeSession(session);
1358 }
1359 }
1360
1361 protected WorkflowDefinitionLink getByC_W_W_PrevAndNext(Session session,
1362 WorkflowDefinitionLink workflowDefinitionLink, long companyId,
1363 String workflowDefinitionName, int workflowDefinitionVersion,
1364 OrderByComparator orderByComparator, boolean previous) {
1365 StringBundler query = null;
1366
1367 if (orderByComparator != null) {
1368 query = new StringBundler(6 +
1369 (orderByComparator.getOrderByFields().length * 6));
1370 }
1371 else {
1372 query = new StringBundler(3);
1373 }
1374
1375 query.append(_SQL_SELECT_WORKFLOWDEFINITIONLINK_WHERE);
1376
1377 query.append(_FINDER_COLUMN_C_W_W_COMPANYID_2);
1378
1379 if (workflowDefinitionName == null) {
1380 query.append(_FINDER_COLUMN_C_W_W_WORKFLOWDEFINITIONNAME_1);
1381 }
1382 else {
1383 if (workflowDefinitionName.equals(StringPool.BLANK)) {
1384 query.append(_FINDER_COLUMN_C_W_W_WORKFLOWDEFINITIONNAME_3);
1385 }
1386 else {
1387 query.append(_FINDER_COLUMN_C_W_W_WORKFLOWDEFINITIONNAME_2);
1388 }
1389 }
1390
1391 query.append(_FINDER_COLUMN_C_W_W_WORKFLOWDEFINITIONVERSION_2);
1392
1393 if (orderByComparator != null) {
1394 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1395
1396 if (orderByConditionFields.length > 0) {
1397 query.append(WHERE_AND);
1398 }
1399
1400 for (int i = 0; i < orderByConditionFields.length; i++) {
1401 query.append(_ORDER_BY_ENTITY_ALIAS);
1402 query.append(orderByConditionFields[i]);
1403
1404 if ((i + 1) < orderByConditionFields.length) {
1405 if (orderByComparator.isAscending() ^ previous) {
1406 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1407 }
1408 else {
1409 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1410 }
1411 }
1412 else {
1413 if (orderByComparator.isAscending() ^ previous) {
1414 query.append(WHERE_GREATER_THAN);
1415 }
1416 else {
1417 query.append(WHERE_LESSER_THAN);
1418 }
1419 }
1420 }
1421
1422 query.append(ORDER_BY_CLAUSE);
1423
1424 String[] orderByFields = orderByComparator.getOrderByFields();
1425
1426 for (int i = 0; i < orderByFields.length; i++) {
1427 query.append(_ORDER_BY_ENTITY_ALIAS);
1428 query.append(orderByFields[i]);
1429
1430 if ((i + 1) < orderByFields.length) {
1431 if (orderByComparator.isAscending() ^ previous) {
1432 query.append(ORDER_BY_ASC_HAS_NEXT);
1433 }
1434 else {
1435 query.append(ORDER_BY_DESC_HAS_NEXT);
1436 }
1437 }
1438 else {
1439 if (orderByComparator.isAscending() ^ previous) {
1440 query.append(ORDER_BY_ASC);
1441 }
1442 else {
1443 query.append(ORDER_BY_DESC);
1444 }
1445 }
1446 }
1447 }
1448
1449 else {
1450 query.append(WorkflowDefinitionLinkModelImpl.ORDER_BY_JPQL);
1451 }
1452
1453 String sql = query.toString();
1454
1455 Query q = session.createQuery(sql);
1456
1457 q.setFirstResult(0);
1458 q.setMaxResults(2);
1459
1460 QueryPos qPos = QueryPos.getInstance(q);
1461
1462 qPos.add(companyId);
1463
1464 if (workflowDefinitionName != null) {
1465 qPos.add(workflowDefinitionName);
1466 }
1467
1468 qPos.add(workflowDefinitionVersion);
1469
1470 if (orderByComparator != null) {
1471 Object[] values = orderByComparator.getOrderByConditionValues(workflowDefinitionLink);
1472
1473 for (Object value : values) {
1474 qPos.add(value);
1475 }
1476 }
1477
1478 List<WorkflowDefinitionLink> list = q.list();
1479
1480 if (list.size() == 2) {
1481 return list.get(1);
1482 }
1483 else {
1484 return null;
1485 }
1486 }
1487
1488
1500 public WorkflowDefinitionLink findByG_C_C_C_T(long groupId, long companyId,
1501 long classNameId, long classPK, long typePK)
1502 throws NoSuchWorkflowDefinitionLinkException, SystemException {
1503 WorkflowDefinitionLink workflowDefinitionLink = fetchByG_C_C_C_T(groupId,
1504 companyId, classNameId, classPK, typePK);
1505
1506 if (workflowDefinitionLink == null) {
1507 StringBundler msg = new StringBundler(12);
1508
1509 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1510
1511 msg.append("groupId=");
1512 msg.append(groupId);
1513
1514 msg.append(", companyId=");
1515 msg.append(companyId);
1516
1517 msg.append(", classNameId=");
1518 msg.append(classNameId);
1519
1520 msg.append(", classPK=");
1521 msg.append(classPK);
1522
1523 msg.append(", typePK=");
1524 msg.append(typePK);
1525
1526 msg.append(StringPool.CLOSE_CURLY_BRACE);
1527
1528 if (_log.isWarnEnabled()) {
1529 _log.warn(msg.toString());
1530 }
1531
1532 throw new NoSuchWorkflowDefinitionLinkException(msg.toString());
1533 }
1534
1535 return workflowDefinitionLink;
1536 }
1537
1538
1549 public WorkflowDefinitionLink fetchByG_C_C_C_T(long groupId,
1550 long companyId, long classNameId, long classPK, long typePK)
1551 throws SystemException {
1552 return fetchByG_C_C_C_T(groupId, companyId, classNameId, classPK,
1553 typePK, true);
1554 }
1555
1556
1568 public WorkflowDefinitionLink fetchByG_C_C_C_T(long groupId,
1569 long companyId, long classNameId, long classPK, long typePK,
1570 boolean retrieveFromCache) throws SystemException {
1571 Object[] finderArgs = new Object[] {
1572 groupId, companyId, classNameId, classPK, typePK
1573 };
1574
1575 Object result = null;
1576
1577 if (retrieveFromCache) {
1578 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_C_C_C_T,
1579 finderArgs, this);
1580 }
1581
1582 if (result instanceof WorkflowDefinitionLink) {
1583 WorkflowDefinitionLink workflowDefinitionLink = (WorkflowDefinitionLink)result;
1584
1585 if ((groupId != workflowDefinitionLink.getGroupId()) ||
1586 (companyId != workflowDefinitionLink.getCompanyId()) ||
1587 (classNameId != workflowDefinitionLink.getClassNameId()) ||
1588 (classPK != workflowDefinitionLink.getClassPK()) ||
1589 (typePK != workflowDefinitionLink.getTypePK())) {
1590 result = null;
1591 }
1592 }
1593
1594 if (result == null) {
1595 StringBundler query = new StringBundler(7);
1596
1597 query.append(_SQL_SELECT_WORKFLOWDEFINITIONLINK_WHERE);
1598
1599 query.append(_FINDER_COLUMN_G_C_C_C_T_GROUPID_2);
1600
1601 query.append(_FINDER_COLUMN_G_C_C_C_T_COMPANYID_2);
1602
1603 query.append(_FINDER_COLUMN_G_C_C_C_T_CLASSNAMEID_2);
1604
1605 query.append(_FINDER_COLUMN_G_C_C_C_T_CLASSPK_2);
1606
1607 query.append(_FINDER_COLUMN_G_C_C_C_T_TYPEPK_2);
1608
1609 query.append(WorkflowDefinitionLinkModelImpl.ORDER_BY_JPQL);
1610
1611 String sql = query.toString();
1612
1613 Session session = null;
1614
1615 try {
1616 session = openSession();
1617
1618 Query q = session.createQuery(sql);
1619
1620 QueryPos qPos = QueryPos.getInstance(q);
1621
1622 qPos.add(groupId);
1623
1624 qPos.add(companyId);
1625
1626 qPos.add(classNameId);
1627
1628 qPos.add(classPK);
1629
1630 qPos.add(typePK);
1631
1632 List<WorkflowDefinitionLink> list = q.list();
1633
1634 result = list;
1635
1636 WorkflowDefinitionLink workflowDefinitionLink = null;
1637
1638 if (list.isEmpty()) {
1639 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_C_C_C_T,
1640 finderArgs, list);
1641 }
1642 else {
1643 workflowDefinitionLink = list.get(0);
1644
1645 cacheResult(workflowDefinitionLink);
1646
1647 if ((workflowDefinitionLink.getGroupId() != groupId) ||
1648 (workflowDefinitionLink.getCompanyId() != companyId) ||
1649 (workflowDefinitionLink.getClassNameId() != classNameId) ||
1650 (workflowDefinitionLink.getClassPK() != classPK) ||
1651 (workflowDefinitionLink.getTypePK() != typePK)) {
1652 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_C_C_C_T,
1653 finderArgs, workflowDefinitionLink);
1654 }
1655 }
1656
1657 return workflowDefinitionLink;
1658 }
1659 catch (Exception e) {
1660 throw processException(e);
1661 }
1662 finally {
1663 if (result == null) {
1664 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_C_C_C_T,
1665 finderArgs);
1666 }
1667
1668 closeSession(session);
1669 }
1670 }
1671 else {
1672 if (result instanceof List<?>) {
1673 return null;
1674 }
1675 else {
1676 return (WorkflowDefinitionLink)result;
1677 }
1678 }
1679 }
1680
1681
1687 public List<WorkflowDefinitionLink> findAll() throws SystemException {
1688 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1689 }
1690
1691
1703 public List<WorkflowDefinitionLink> findAll(int start, int end)
1704 throws SystemException {
1705 return findAll(start, end, null);
1706 }
1707
1708
1721 public List<WorkflowDefinitionLink> findAll(int start, int end,
1722 OrderByComparator orderByComparator) throws SystemException {
1723 FinderPath finderPath = null;
1724 Object[] finderArgs = new Object[] { start, end, orderByComparator };
1725
1726 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1727 (orderByComparator == null)) {
1728 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1729 finderArgs = FINDER_ARGS_EMPTY;
1730 }
1731 else {
1732 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1733 finderArgs = new Object[] { start, end, orderByComparator };
1734 }
1735
1736 List<WorkflowDefinitionLink> list = (List<WorkflowDefinitionLink>)FinderCacheUtil.getResult(finderPath,
1737 finderArgs, this);
1738
1739 if (list == null) {
1740 StringBundler query = null;
1741 String sql = null;
1742
1743 if (orderByComparator != null) {
1744 query = new StringBundler(2 +
1745 (orderByComparator.getOrderByFields().length * 3));
1746
1747 query.append(_SQL_SELECT_WORKFLOWDEFINITIONLINK);
1748
1749 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1750 orderByComparator);
1751
1752 sql = query.toString();
1753 }
1754 else {
1755 sql = _SQL_SELECT_WORKFLOWDEFINITIONLINK.concat(WorkflowDefinitionLinkModelImpl.ORDER_BY_JPQL);
1756 }
1757
1758 Session session = null;
1759
1760 try {
1761 session = openSession();
1762
1763 Query q = session.createQuery(sql);
1764
1765 if (orderByComparator == null) {
1766 list = (List<WorkflowDefinitionLink>)QueryUtil.list(q,
1767 getDialect(), start, end, false);
1768
1769 Collections.sort(list);
1770 }
1771 else {
1772 list = (List<WorkflowDefinitionLink>)QueryUtil.list(q,
1773 getDialect(), start, end);
1774 }
1775 }
1776 catch (Exception e) {
1777 throw processException(e);
1778 }
1779 finally {
1780 if (list == null) {
1781 FinderCacheUtil.removeResult(finderPath, finderArgs);
1782 }
1783 else {
1784 cacheResult(list);
1785
1786 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1787 }
1788
1789 closeSession(session);
1790 }
1791 }
1792
1793 return list;
1794 }
1795
1796
1802 public void removeByCompanyId(long companyId) throws SystemException {
1803 for (WorkflowDefinitionLink workflowDefinitionLink : findByCompanyId(
1804 companyId)) {
1805 remove(workflowDefinitionLink);
1806 }
1807 }
1808
1809
1817 public void removeByC_W_W(long companyId, String workflowDefinitionName,
1818 int workflowDefinitionVersion) throws SystemException {
1819 for (WorkflowDefinitionLink workflowDefinitionLink : findByC_W_W(
1820 companyId, workflowDefinitionName, workflowDefinitionVersion)) {
1821 remove(workflowDefinitionLink);
1822 }
1823 }
1824
1825
1836 public WorkflowDefinitionLink removeByG_C_C_C_T(long groupId,
1837 long companyId, long classNameId, long classPK, long typePK)
1838 throws NoSuchWorkflowDefinitionLinkException, SystemException {
1839 WorkflowDefinitionLink workflowDefinitionLink = findByG_C_C_C_T(groupId,
1840 companyId, classNameId, classPK, typePK);
1841
1842 return remove(workflowDefinitionLink);
1843 }
1844
1845
1850 public void removeAll() throws SystemException {
1851 for (WorkflowDefinitionLink workflowDefinitionLink : findAll()) {
1852 remove(workflowDefinitionLink);
1853 }
1854 }
1855
1856
1863 public int countByCompanyId(long companyId) throws SystemException {
1864 Object[] finderArgs = new Object[] { companyId };
1865
1866 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
1867 finderArgs, this);
1868
1869 if (count == null) {
1870 StringBundler query = new StringBundler(2);
1871
1872 query.append(_SQL_COUNT_WORKFLOWDEFINITIONLINK_WHERE);
1873
1874 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1875
1876 String sql = query.toString();
1877
1878 Session session = null;
1879
1880 try {
1881 session = openSession();
1882
1883 Query q = session.createQuery(sql);
1884
1885 QueryPos qPos = QueryPos.getInstance(q);
1886
1887 qPos.add(companyId);
1888
1889 count = (Long)q.uniqueResult();
1890 }
1891 catch (Exception e) {
1892 throw processException(e);
1893 }
1894 finally {
1895 if (count == null) {
1896 count = Long.valueOf(0);
1897 }
1898
1899 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
1900 finderArgs, count);
1901
1902 closeSession(session);
1903 }
1904 }
1905
1906 return count.intValue();
1907 }
1908
1909
1918 public int countByC_W_W(long companyId, String workflowDefinitionName,
1919 int workflowDefinitionVersion) throws SystemException {
1920 Object[] finderArgs = new Object[] {
1921 companyId, workflowDefinitionName, workflowDefinitionVersion
1922 };
1923
1924 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_W_W,
1925 finderArgs, this);
1926
1927 if (count == null) {
1928 StringBundler query = new StringBundler(4);
1929
1930 query.append(_SQL_COUNT_WORKFLOWDEFINITIONLINK_WHERE);
1931
1932 query.append(_FINDER_COLUMN_C_W_W_COMPANYID_2);
1933
1934 if (workflowDefinitionName == null) {
1935 query.append(_FINDER_COLUMN_C_W_W_WORKFLOWDEFINITIONNAME_1);
1936 }
1937 else {
1938 if (workflowDefinitionName.equals(StringPool.BLANK)) {
1939 query.append(_FINDER_COLUMN_C_W_W_WORKFLOWDEFINITIONNAME_3);
1940 }
1941 else {
1942 query.append(_FINDER_COLUMN_C_W_W_WORKFLOWDEFINITIONNAME_2);
1943 }
1944 }
1945
1946 query.append(_FINDER_COLUMN_C_W_W_WORKFLOWDEFINITIONVERSION_2);
1947
1948 String sql = query.toString();
1949
1950 Session session = null;
1951
1952 try {
1953 session = openSession();
1954
1955 Query q = session.createQuery(sql);
1956
1957 QueryPos qPos = QueryPos.getInstance(q);
1958
1959 qPos.add(companyId);
1960
1961 if (workflowDefinitionName != null) {
1962 qPos.add(workflowDefinitionName);
1963 }
1964
1965 qPos.add(workflowDefinitionVersion);
1966
1967 count = (Long)q.uniqueResult();
1968 }
1969 catch (Exception e) {
1970 throw processException(e);
1971 }
1972 finally {
1973 if (count == null) {
1974 count = Long.valueOf(0);
1975 }
1976
1977 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_W_W,
1978 finderArgs, count);
1979
1980 closeSession(session);
1981 }
1982 }
1983
1984 return count.intValue();
1985 }
1986
1987
1998 public int countByG_C_C_C_T(long groupId, long companyId, long classNameId,
1999 long classPK, long typePK) throws SystemException {
2000 Object[] finderArgs = new Object[] {
2001 groupId, companyId, classNameId, classPK, typePK
2002 };
2003
2004 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_C_C_C_T,
2005 finderArgs, this);
2006
2007 if (count == null) {
2008 StringBundler query = new StringBundler(6);
2009
2010 query.append(_SQL_COUNT_WORKFLOWDEFINITIONLINK_WHERE);
2011
2012 query.append(_FINDER_COLUMN_G_C_C_C_T_GROUPID_2);
2013
2014 query.append(_FINDER_COLUMN_G_C_C_C_T_COMPANYID_2);
2015
2016 query.append(_FINDER_COLUMN_G_C_C_C_T_CLASSNAMEID_2);
2017
2018 query.append(_FINDER_COLUMN_G_C_C_C_T_CLASSPK_2);
2019
2020 query.append(_FINDER_COLUMN_G_C_C_C_T_TYPEPK_2);
2021
2022 String sql = query.toString();
2023
2024 Session session = null;
2025
2026 try {
2027 session = openSession();
2028
2029 Query q = session.createQuery(sql);
2030
2031 QueryPos qPos = QueryPos.getInstance(q);
2032
2033 qPos.add(groupId);
2034
2035 qPos.add(companyId);
2036
2037 qPos.add(classNameId);
2038
2039 qPos.add(classPK);
2040
2041 qPos.add(typePK);
2042
2043 count = (Long)q.uniqueResult();
2044 }
2045 catch (Exception e) {
2046 throw processException(e);
2047 }
2048 finally {
2049 if (count == null) {
2050 count = Long.valueOf(0);
2051 }
2052
2053 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_C_C_C_T,
2054 finderArgs, count);
2055
2056 closeSession(session);
2057 }
2058 }
2059
2060 return count.intValue();
2061 }
2062
2063
2069 public int countAll() throws SystemException {
2070 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2071 FINDER_ARGS_EMPTY, this);
2072
2073 if (count == null) {
2074 Session session = null;
2075
2076 try {
2077 session = openSession();
2078
2079 Query q = session.createQuery(_SQL_COUNT_WORKFLOWDEFINITIONLINK);
2080
2081 count = (Long)q.uniqueResult();
2082 }
2083 catch (Exception e) {
2084 throw processException(e);
2085 }
2086 finally {
2087 if (count == null) {
2088 count = Long.valueOf(0);
2089 }
2090
2091 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
2092 FINDER_ARGS_EMPTY, count);
2093
2094 closeSession(session);
2095 }
2096 }
2097
2098 return count.intValue();
2099 }
2100
2101
2104 public void afterPropertiesSet() {
2105 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2106 com.liferay.portal.util.PropsUtil.get(
2107 "value.object.listener.com.liferay.portal.model.WorkflowDefinitionLink")));
2108
2109 if (listenerClassNames.length > 0) {
2110 try {
2111 List<ModelListener<WorkflowDefinitionLink>> listenersList = new ArrayList<ModelListener<WorkflowDefinitionLink>>();
2112
2113 for (String listenerClassName : listenerClassNames) {
2114 listenersList.add((ModelListener<WorkflowDefinitionLink>)InstanceFactory.newInstance(
2115 listenerClassName));
2116 }
2117
2118 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2119 }
2120 catch (Exception e) {
2121 _log.error(e);
2122 }
2123 }
2124 }
2125
2126 public void destroy() {
2127 EntityCacheUtil.removeCache(WorkflowDefinitionLinkImpl.class.getName());
2128 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
2129 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2130 }
2131
2132 @BeanReference(type = AccountPersistence.class)
2133 protected AccountPersistence accountPersistence;
2134 @BeanReference(type = AddressPersistence.class)
2135 protected AddressPersistence addressPersistence;
2136 @BeanReference(type = BrowserTrackerPersistence.class)
2137 protected BrowserTrackerPersistence browserTrackerPersistence;
2138 @BeanReference(type = ClassNamePersistence.class)
2139 protected ClassNamePersistence classNamePersistence;
2140 @BeanReference(type = ClusterGroupPersistence.class)
2141 protected ClusterGroupPersistence clusterGroupPersistence;
2142 @BeanReference(type = CompanyPersistence.class)
2143 protected CompanyPersistence companyPersistence;
2144 @BeanReference(type = ContactPersistence.class)
2145 protected ContactPersistence contactPersistence;
2146 @BeanReference(type = CountryPersistence.class)
2147 protected CountryPersistence countryPersistence;
2148 @BeanReference(type = EmailAddressPersistence.class)
2149 protected EmailAddressPersistence emailAddressPersistence;
2150 @BeanReference(type = GroupPersistence.class)
2151 protected GroupPersistence groupPersistence;
2152 @BeanReference(type = ImagePersistence.class)
2153 protected ImagePersistence imagePersistence;
2154 @BeanReference(type = LayoutPersistence.class)
2155 protected LayoutPersistence layoutPersistence;
2156 @BeanReference(type = LayoutBranchPersistence.class)
2157 protected LayoutBranchPersistence layoutBranchPersistence;
2158 @BeanReference(type = LayoutPrototypePersistence.class)
2159 protected LayoutPrototypePersistence layoutPrototypePersistence;
2160 @BeanReference(type = LayoutRevisionPersistence.class)
2161 protected LayoutRevisionPersistence layoutRevisionPersistence;
2162 @BeanReference(type = LayoutSetPersistence.class)
2163 protected LayoutSetPersistence layoutSetPersistence;
2164 @BeanReference(type = LayoutSetBranchPersistence.class)
2165 protected LayoutSetBranchPersistence layoutSetBranchPersistence;
2166 @BeanReference(type = LayoutSetPrototypePersistence.class)
2167 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
2168 @BeanReference(type = ListTypePersistence.class)
2169 protected ListTypePersistence listTypePersistence;
2170 @BeanReference(type = LockPersistence.class)
2171 protected LockPersistence lockPersistence;
2172 @BeanReference(type = MembershipRequestPersistence.class)
2173 protected MembershipRequestPersistence membershipRequestPersistence;
2174 @BeanReference(type = OrganizationPersistence.class)
2175 protected OrganizationPersistence organizationPersistence;
2176 @BeanReference(type = OrgGroupRolePersistence.class)
2177 protected OrgGroupRolePersistence orgGroupRolePersistence;
2178 @BeanReference(type = OrgLaborPersistence.class)
2179 protected OrgLaborPersistence orgLaborPersistence;
2180 @BeanReference(type = PasswordPolicyPersistence.class)
2181 protected PasswordPolicyPersistence passwordPolicyPersistence;
2182 @BeanReference(type = PasswordPolicyRelPersistence.class)
2183 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
2184 @BeanReference(type = PasswordTrackerPersistence.class)
2185 protected PasswordTrackerPersistence passwordTrackerPersistence;
2186 @BeanReference(type = PhonePersistence.class)
2187 protected PhonePersistence phonePersistence;
2188 @BeanReference(type = PluginSettingPersistence.class)
2189 protected PluginSettingPersistence pluginSettingPersistence;
2190 @BeanReference(type = PortalPreferencesPersistence.class)
2191 protected PortalPreferencesPersistence portalPreferencesPersistence;
2192 @BeanReference(type = PortletPersistence.class)
2193 protected PortletPersistence portletPersistence;
2194 @BeanReference(type = PortletItemPersistence.class)
2195 protected PortletItemPersistence portletItemPersistence;
2196 @BeanReference(type = PortletPreferencesPersistence.class)
2197 protected PortletPreferencesPersistence portletPreferencesPersistence;
2198 @BeanReference(type = RegionPersistence.class)
2199 protected RegionPersistence regionPersistence;
2200 @BeanReference(type = ReleasePersistence.class)
2201 protected ReleasePersistence releasePersistence;
2202 @BeanReference(type = RepositoryPersistence.class)
2203 protected RepositoryPersistence repositoryPersistence;
2204 @BeanReference(type = RepositoryEntryPersistence.class)
2205 protected RepositoryEntryPersistence repositoryEntryPersistence;
2206 @BeanReference(type = ResourceActionPersistence.class)
2207 protected ResourceActionPersistence resourceActionPersistence;
2208 @BeanReference(type = ResourceBlockPersistence.class)
2209 protected ResourceBlockPersistence resourceBlockPersistence;
2210 @BeanReference(type = ResourceBlockPermissionPersistence.class)
2211 protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
2212 @BeanReference(type = ResourcePermissionPersistence.class)
2213 protected ResourcePermissionPersistence resourcePermissionPersistence;
2214 @BeanReference(type = ResourceTypePermissionPersistence.class)
2215 protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
2216 @BeanReference(type = RolePersistence.class)
2217 protected RolePersistence rolePersistence;
2218 @BeanReference(type = ServiceComponentPersistence.class)
2219 protected ServiceComponentPersistence serviceComponentPersistence;
2220 @BeanReference(type = ShardPersistence.class)
2221 protected ShardPersistence shardPersistence;
2222 @BeanReference(type = SubscriptionPersistence.class)
2223 protected SubscriptionPersistence subscriptionPersistence;
2224 @BeanReference(type = TeamPersistence.class)
2225 protected TeamPersistence teamPersistence;
2226 @BeanReference(type = TicketPersistence.class)
2227 protected TicketPersistence ticketPersistence;
2228 @BeanReference(type = UserPersistence.class)
2229 protected UserPersistence userPersistence;
2230 @BeanReference(type = UserGroupPersistence.class)
2231 protected UserGroupPersistence userGroupPersistence;
2232 @BeanReference(type = UserGroupGroupRolePersistence.class)
2233 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
2234 @BeanReference(type = UserGroupRolePersistence.class)
2235 protected UserGroupRolePersistence userGroupRolePersistence;
2236 @BeanReference(type = UserIdMapperPersistence.class)
2237 protected UserIdMapperPersistence userIdMapperPersistence;
2238 @BeanReference(type = UserNotificationEventPersistence.class)
2239 protected UserNotificationEventPersistence userNotificationEventPersistence;
2240 @BeanReference(type = UserTrackerPersistence.class)
2241 protected UserTrackerPersistence userTrackerPersistence;
2242 @BeanReference(type = UserTrackerPathPersistence.class)
2243 protected UserTrackerPathPersistence userTrackerPathPersistence;
2244 @BeanReference(type = VirtualHostPersistence.class)
2245 protected VirtualHostPersistence virtualHostPersistence;
2246 @BeanReference(type = WebDAVPropsPersistence.class)
2247 protected WebDAVPropsPersistence webDAVPropsPersistence;
2248 @BeanReference(type = WebsitePersistence.class)
2249 protected WebsitePersistence websitePersistence;
2250 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
2251 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
2252 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
2253 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
2254 private static final String _SQL_SELECT_WORKFLOWDEFINITIONLINK = "SELECT workflowDefinitionLink FROM WorkflowDefinitionLink workflowDefinitionLink";
2255 private static final String _SQL_SELECT_WORKFLOWDEFINITIONLINK_WHERE = "SELECT workflowDefinitionLink FROM WorkflowDefinitionLink workflowDefinitionLink WHERE ";
2256 private static final String _SQL_COUNT_WORKFLOWDEFINITIONLINK = "SELECT COUNT(workflowDefinitionLink) FROM WorkflowDefinitionLink workflowDefinitionLink";
2257 private static final String _SQL_COUNT_WORKFLOWDEFINITIONLINK_WHERE = "SELECT COUNT(workflowDefinitionLink) FROM WorkflowDefinitionLink workflowDefinitionLink WHERE ";
2258 private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "workflowDefinitionLink.companyId = ?";
2259 private static final String _FINDER_COLUMN_C_W_W_COMPANYID_2 = "workflowDefinitionLink.companyId = ? AND ";
2260 private static final String _FINDER_COLUMN_C_W_W_WORKFLOWDEFINITIONNAME_1 = "workflowDefinitionLink.workflowDefinitionName IS NULL AND ";
2261 private static final String _FINDER_COLUMN_C_W_W_WORKFLOWDEFINITIONNAME_2 = "workflowDefinitionLink.workflowDefinitionName = ? AND ";
2262 private static final String _FINDER_COLUMN_C_W_W_WORKFLOWDEFINITIONNAME_3 = "(workflowDefinitionLink.workflowDefinitionName IS NULL OR workflowDefinitionLink.workflowDefinitionName = ?) AND ";
2263 private static final String _FINDER_COLUMN_C_W_W_WORKFLOWDEFINITIONVERSION_2 =
2264 "workflowDefinitionLink.workflowDefinitionVersion = ?";
2265 private static final String _FINDER_COLUMN_G_C_C_C_T_GROUPID_2 = "workflowDefinitionLink.groupId = ? AND ";
2266 private static final String _FINDER_COLUMN_G_C_C_C_T_COMPANYID_2 = "workflowDefinitionLink.companyId = ? AND ";
2267 private static final String _FINDER_COLUMN_G_C_C_C_T_CLASSNAMEID_2 = "workflowDefinitionLink.classNameId = ? AND ";
2268 private static final String _FINDER_COLUMN_G_C_C_C_T_CLASSPK_2 = "workflowDefinitionLink.classPK = ? AND ";
2269 private static final String _FINDER_COLUMN_G_C_C_C_T_TYPEPK_2 = "workflowDefinitionLink.typePK = ?";
2270 private static final String _ORDER_BY_ENTITY_ALIAS = "workflowDefinitionLink.";
2271 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No WorkflowDefinitionLink exists with the primary key ";
2272 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No WorkflowDefinitionLink exists with the key {";
2273 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
2274 private static Log _log = LogFactoryUtil.getLog(WorkflowDefinitionLinkPersistenceImpl.class);
2275 private static WorkflowDefinitionLink _nullWorkflowDefinitionLink = new WorkflowDefinitionLinkImpl() {
2276 @Override
2277 public Object clone() {
2278 return this;
2279 }
2280
2281 @Override
2282 public CacheModel<WorkflowDefinitionLink> toCacheModel() {
2283 return _nullWorkflowDefinitionLinkCacheModel;
2284 }
2285 };
2286
2287 private static CacheModel<WorkflowDefinitionLink> _nullWorkflowDefinitionLinkCacheModel =
2288 new CacheModel<WorkflowDefinitionLink>() {
2289 public WorkflowDefinitionLink toEntityModel() {
2290 return _nullWorkflowDefinitionLink;
2291 }
2292 };
2293 }