001
014
015 package com.liferay.portlet.dynamicdatalists.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.kernel.bean.BeanReference;
019 import com.liferay.portal.kernel.cache.CacheRegistryUtil;
020 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
021 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
022 import com.liferay.portal.kernel.dao.orm.FinderPath;
023 import com.liferay.portal.kernel.dao.orm.Query;
024 import com.liferay.portal.kernel.dao.orm.QueryPos;
025 import com.liferay.portal.kernel.dao.orm.QueryUtil;
026 import com.liferay.portal.kernel.dao.orm.SQLQuery;
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.kernel.uuid.PortalUUIDUtil;
039 import com.liferay.portal.model.CacheModel;
040 import com.liferay.portal.model.ModelListener;
041 import com.liferay.portal.security.permission.InlineSQLHelperUtil;
042 import com.liferay.portal.service.persistence.BatchSessionUtil;
043 import com.liferay.portal.service.persistence.ResourcePersistence;
044 import com.liferay.portal.service.persistence.UserPersistence;
045 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
046
047 import com.liferay.portlet.dynamicdatalists.NoSuchRecordSetException;
048 import com.liferay.portlet.dynamicdatalists.model.DDLRecordSet;
049 import com.liferay.portlet.dynamicdatalists.model.impl.DDLRecordSetImpl;
050 import com.liferay.portlet.dynamicdatalists.model.impl.DDLRecordSetModelImpl;
051 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMStructureLinkPersistence;
052 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMStructurePersistence;
053
054 import java.io.Serializable;
055
056 import java.util.ArrayList;
057 import java.util.Collections;
058 import java.util.List;
059
060
072 public class DDLRecordSetPersistenceImpl extends BasePersistenceImpl<DDLRecordSet>
073 implements DDLRecordSetPersistence {
074
079 public static final String FINDER_CLASS_NAME_ENTITY = DDLRecordSetImpl.class.getName();
080 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
081 ".List1";
082 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
083 ".List2";
084 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID = new FinderPath(DDLRecordSetModelImpl.ENTITY_CACHE_ENABLED,
085 DDLRecordSetModelImpl.FINDER_CACHE_ENABLED, DDLRecordSetImpl.class,
086 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByUuid",
087 new String[] {
088 String.class.getName(),
089
090 "java.lang.Integer", "java.lang.Integer",
091 "com.liferay.portal.kernel.util.OrderByComparator"
092 });
093 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID = new FinderPath(DDLRecordSetModelImpl.ENTITY_CACHE_ENABLED,
094 DDLRecordSetModelImpl.FINDER_CACHE_ENABLED, DDLRecordSetImpl.class,
095 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUuid",
096 new String[] { String.class.getName() },
097 DDLRecordSetModelImpl.UUID_COLUMN_BITMASK);
098 public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(DDLRecordSetModelImpl.ENTITY_CACHE_ENABLED,
099 DDLRecordSetModelImpl.FINDER_CACHE_ENABLED, Long.class,
100 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUuid",
101 new String[] { String.class.getName() });
102 public static final FinderPath FINDER_PATH_FETCH_BY_UUID_G = new FinderPath(DDLRecordSetModelImpl.ENTITY_CACHE_ENABLED,
103 DDLRecordSetModelImpl.FINDER_CACHE_ENABLED, DDLRecordSetImpl.class,
104 FINDER_CLASS_NAME_ENTITY, "fetchByUUID_G",
105 new String[] { String.class.getName(), Long.class.getName() },
106 DDLRecordSetModelImpl.UUID_COLUMN_BITMASK |
107 DDLRecordSetModelImpl.GROUPID_COLUMN_BITMASK);
108 public static final FinderPath FINDER_PATH_COUNT_BY_UUID_G = new FinderPath(DDLRecordSetModelImpl.ENTITY_CACHE_ENABLED,
109 DDLRecordSetModelImpl.FINDER_CACHE_ENABLED, Long.class,
110 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUUID_G",
111 new String[] { String.class.getName(), Long.class.getName() });
112 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID = new FinderPath(DDLRecordSetModelImpl.ENTITY_CACHE_ENABLED,
113 DDLRecordSetModelImpl.FINDER_CACHE_ENABLED, DDLRecordSetImpl.class,
114 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByGroupId",
115 new String[] {
116 Long.class.getName(),
117
118 "java.lang.Integer", "java.lang.Integer",
119 "com.liferay.portal.kernel.util.OrderByComparator"
120 });
121 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID =
122 new FinderPath(DDLRecordSetModelImpl.ENTITY_CACHE_ENABLED,
123 DDLRecordSetModelImpl.FINDER_CACHE_ENABLED, DDLRecordSetImpl.class,
124 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByGroupId",
125 new String[] { Long.class.getName() },
126 DDLRecordSetModelImpl.GROUPID_COLUMN_BITMASK);
127 public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(DDLRecordSetModelImpl.ENTITY_CACHE_ENABLED,
128 DDLRecordSetModelImpl.FINDER_CACHE_ENABLED, Long.class,
129 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByGroupId",
130 new String[] { Long.class.getName() });
131 public static final FinderPath FINDER_PATH_FETCH_BY_G_R = new FinderPath(DDLRecordSetModelImpl.ENTITY_CACHE_ENABLED,
132 DDLRecordSetModelImpl.FINDER_CACHE_ENABLED, DDLRecordSetImpl.class,
133 FINDER_CLASS_NAME_ENTITY, "fetchByG_R",
134 new String[] { Long.class.getName(), String.class.getName() },
135 DDLRecordSetModelImpl.GROUPID_COLUMN_BITMASK |
136 DDLRecordSetModelImpl.RECORDSETKEY_COLUMN_BITMASK);
137 public static final FinderPath FINDER_PATH_COUNT_BY_G_R = new FinderPath(DDLRecordSetModelImpl.ENTITY_CACHE_ENABLED,
138 DDLRecordSetModelImpl.FINDER_CACHE_ENABLED, Long.class,
139 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_R",
140 new String[] { Long.class.getName(), String.class.getName() });
141 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(DDLRecordSetModelImpl.ENTITY_CACHE_ENABLED,
142 DDLRecordSetModelImpl.FINDER_CACHE_ENABLED, DDLRecordSetImpl.class,
143 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
144 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(DDLRecordSetModelImpl.ENTITY_CACHE_ENABLED,
145 DDLRecordSetModelImpl.FINDER_CACHE_ENABLED, DDLRecordSetImpl.class,
146 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
147 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(DDLRecordSetModelImpl.ENTITY_CACHE_ENABLED,
148 DDLRecordSetModelImpl.FINDER_CACHE_ENABLED, Long.class,
149 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
150
151
156 public void cacheResult(DDLRecordSet ddlRecordSet) {
157 EntityCacheUtil.putResult(DDLRecordSetModelImpl.ENTITY_CACHE_ENABLED,
158 DDLRecordSetImpl.class, ddlRecordSet.getPrimaryKey(), ddlRecordSet);
159
160 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
161 new Object[] {
162 ddlRecordSet.getUuid(), Long.valueOf(ddlRecordSet.getGroupId())
163 }, ddlRecordSet);
164
165 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_R,
166 new Object[] {
167 Long.valueOf(ddlRecordSet.getGroupId()),
168
169 ddlRecordSet.getRecordSetKey()
170 }, ddlRecordSet);
171
172 ddlRecordSet.resetOriginalValues();
173 }
174
175
180 public void cacheResult(List<DDLRecordSet> ddlRecordSets) {
181 for (DDLRecordSet ddlRecordSet : ddlRecordSets) {
182 if (EntityCacheUtil.getResult(
183 DDLRecordSetModelImpl.ENTITY_CACHE_ENABLED,
184 DDLRecordSetImpl.class, ddlRecordSet.getPrimaryKey()) == null) {
185 cacheResult(ddlRecordSet);
186 }
187 else {
188 ddlRecordSet.resetOriginalValues();
189 }
190 }
191 }
192
193
200 @Override
201 public void clearCache() {
202 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
203 CacheRegistryUtil.clear(DDLRecordSetImpl.class.getName());
204 }
205
206 EntityCacheUtil.clearCache(DDLRecordSetImpl.class.getName());
207
208 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
209 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
210 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
211 }
212
213
220 @Override
221 public void clearCache(DDLRecordSet ddlRecordSet) {
222 EntityCacheUtil.removeResult(DDLRecordSetModelImpl.ENTITY_CACHE_ENABLED,
223 DDLRecordSetImpl.class, ddlRecordSet.getPrimaryKey());
224
225 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
226 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
227
228 clearUniqueFindersCache(ddlRecordSet);
229 }
230
231 @Override
232 public void clearCache(List<DDLRecordSet> ddlRecordSets) {
233 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
234 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
235
236 for (DDLRecordSet ddlRecordSet : ddlRecordSets) {
237 EntityCacheUtil.removeResult(DDLRecordSetModelImpl.ENTITY_CACHE_ENABLED,
238 DDLRecordSetImpl.class, ddlRecordSet.getPrimaryKey());
239
240 clearUniqueFindersCache(ddlRecordSet);
241 }
242 }
243
244 protected void clearUniqueFindersCache(DDLRecordSet ddlRecordSet) {
245 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
246 new Object[] {
247 ddlRecordSet.getUuid(), Long.valueOf(ddlRecordSet.getGroupId())
248 });
249
250 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_R,
251 new Object[] {
252 Long.valueOf(ddlRecordSet.getGroupId()),
253
254 ddlRecordSet.getRecordSetKey()
255 });
256 }
257
258
264 public DDLRecordSet create(long recordSetId) {
265 DDLRecordSet ddlRecordSet = new DDLRecordSetImpl();
266
267 ddlRecordSet.setNew(true);
268 ddlRecordSet.setPrimaryKey(recordSetId);
269
270 String uuid = PortalUUIDUtil.generate();
271
272 ddlRecordSet.setUuid(uuid);
273
274 return ddlRecordSet;
275 }
276
277
285 public DDLRecordSet remove(long recordSetId)
286 throws NoSuchRecordSetException, SystemException {
287 return remove(Long.valueOf(recordSetId));
288 }
289
290
298 @Override
299 public DDLRecordSet remove(Serializable primaryKey)
300 throws NoSuchRecordSetException, SystemException {
301 Session session = null;
302
303 try {
304 session = openSession();
305
306 DDLRecordSet ddlRecordSet = (DDLRecordSet)session.get(DDLRecordSetImpl.class,
307 primaryKey);
308
309 if (ddlRecordSet == null) {
310 if (_log.isWarnEnabled()) {
311 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
312 }
313
314 throw new NoSuchRecordSetException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
315 primaryKey);
316 }
317
318 return remove(ddlRecordSet);
319 }
320 catch (NoSuchRecordSetException nsee) {
321 throw nsee;
322 }
323 catch (Exception e) {
324 throw processException(e);
325 }
326 finally {
327 closeSession(session);
328 }
329 }
330
331 @Override
332 protected DDLRecordSet removeImpl(DDLRecordSet ddlRecordSet)
333 throws SystemException {
334 ddlRecordSet = toUnwrappedModel(ddlRecordSet);
335
336 Session session = null;
337
338 try {
339 session = openSession();
340
341 BatchSessionUtil.delete(session, ddlRecordSet);
342 }
343 catch (Exception e) {
344 throw processException(e);
345 }
346 finally {
347 closeSession(session);
348 }
349
350 clearCache(ddlRecordSet);
351
352 return ddlRecordSet;
353 }
354
355 @Override
356 public DDLRecordSet updateImpl(
357 com.liferay.portlet.dynamicdatalists.model.DDLRecordSet ddlRecordSet,
358 boolean merge) throws SystemException {
359 ddlRecordSet = toUnwrappedModel(ddlRecordSet);
360
361 boolean isNew = ddlRecordSet.isNew();
362
363 DDLRecordSetModelImpl ddlRecordSetModelImpl = (DDLRecordSetModelImpl)ddlRecordSet;
364
365 if (Validator.isNull(ddlRecordSet.getUuid())) {
366 String uuid = PortalUUIDUtil.generate();
367
368 ddlRecordSet.setUuid(uuid);
369 }
370
371 Session session = null;
372
373 try {
374 session = openSession();
375
376 BatchSessionUtil.update(session, ddlRecordSet, merge);
377
378 ddlRecordSet.setNew(false);
379 }
380 catch (Exception e) {
381 throw processException(e);
382 }
383 finally {
384 closeSession(session);
385 }
386
387 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
388
389 if (isNew || !DDLRecordSetModelImpl.COLUMN_BITMASK_ENABLED) {
390 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
391 }
392
393 else {
394 if ((ddlRecordSetModelImpl.getColumnBitmask() &
395 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID.getColumnBitmask()) != 0) {
396 Object[] args = new Object[] {
397 ddlRecordSetModelImpl.getOriginalUuid()
398 };
399
400 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
401 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
402 args);
403
404 args = new Object[] { ddlRecordSetModelImpl.getUuid() };
405
406 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
407 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
408 args);
409 }
410
411 if ((ddlRecordSetModelImpl.getColumnBitmask() &
412 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID.getColumnBitmask()) != 0) {
413 Object[] args = new Object[] {
414 Long.valueOf(ddlRecordSetModelImpl.getOriginalGroupId())
415 };
416
417 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
418 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
419 args);
420
421 args = new Object[] {
422 Long.valueOf(ddlRecordSetModelImpl.getGroupId())
423 };
424
425 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
426 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
427 args);
428 }
429 }
430
431 EntityCacheUtil.putResult(DDLRecordSetModelImpl.ENTITY_CACHE_ENABLED,
432 DDLRecordSetImpl.class, ddlRecordSet.getPrimaryKey(), ddlRecordSet);
433
434 if (isNew) {
435 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
436 new Object[] {
437 ddlRecordSet.getUuid(),
438 Long.valueOf(ddlRecordSet.getGroupId())
439 }, ddlRecordSet);
440
441 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_R,
442 new Object[] {
443 Long.valueOf(ddlRecordSet.getGroupId()),
444
445 ddlRecordSet.getRecordSetKey()
446 }, ddlRecordSet);
447 }
448 else {
449 if ((ddlRecordSetModelImpl.getColumnBitmask() &
450 FINDER_PATH_FETCH_BY_UUID_G.getColumnBitmask()) != 0) {
451 Object[] args = new Object[] {
452 ddlRecordSetModelImpl.getOriginalUuid(),
453 Long.valueOf(ddlRecordSetModelImpl.getOriginalGroupId())
454 };
455
456 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID_G, args);
457 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G, args);
458
459 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
460 new Object[] {
461 ddlRecordSet.getUuid(),
462 Long.valueOf(ddlRecordSet.getGroupId())
463 }, ddlRecordSet);
464 }
465
466 if ((ddlRecordSetModelImpl.getColumnBitmask() &
467 FINDER_PATH_FETCH_BY_G_R.getColumnBitmask()) != 0) {
468 Object[] args = new Object[] {
469 Long.valueOf(ddlRecordSetModelImpl.getOriginalGroupId()),
470
471 ddlRecordSetModelImpl.getOriginalRecordSetKey()
472 };
473
474 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_R, args);
475 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_R, args);
476
477 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_R,
478 new Object[] {
479 Long.valueOf(ddlRecordSet.getGroupId()),
480
481 ddlRecordSet.getRecordSetKey()
482 }, ddlRecordSet);
483 }
484 }
485
486 return ddlRecordSet;
487 }
488
489 protected DDLRecordSet toUnwrappedModel(DDLRecordSet ddlRecordSet) {
490 if (ddlRecordSet instanceof DDLRecordSetImpl) {
491 return ddlRecordSet;
492 }
493
494 DDLRecordSetImpl ddlRecordSetImpl = new DDLRecordSetImpl();
495
496 ddlRecordSetImpl.setNew(ddlRecordSet.isNew());
497 ddlRecordSetImpl.setPrimaryKey(ddlRecordSet.getPrimaryKey());
498
499 ddlRecordSetImpl.setUuid(ddlRecordSet.getUuid());
500 ddlRecordSetImpl.setRecordSetId(ddlRecordSet.getRecordSetId());
501 ddlRecordSetImpl.setGroupId(ddlRecordSet.getGroupId());
502 ddlRecordSetImpl.setCompanyId(ddlRecordSet.getCompanyId());
503 ddlRecordSetImpl.setUserId(ddlRecordSet.getUserId());
504 ddlRecordSetImpl.setUserName(ddlRecordSet.getUserName());
505 ddlRecordSetImpl.setCreateDate(ddlRecordSet.getCreateDate());
506 ddlRecordSetImpl.setModifiedDate(ddlRecordSet.getModifiedDate());
507 ddlRecordSetImpl.setDDMStructureId(ddlRecordSet.getDDMStructureId());
508 ddlRecordSetImpl.setRecordSetKey(ddlRecordSet.getRecordSetKey());
509 ddlRecordSetImpl.setName(ddlRecordSet.getName());
510 ddlRecordSetImpl.setDescription(ddlRecordSet.getDescription());
511 ddlRecordSetImpl.setMinDisplayRows(ddlRecordSet.getMinDisplayRows());
512 ddlRecordSetImpl.setScope(ddlRecordSet.getScope());
513
514 return ddlRecordSetImpl;
515 }
516
517
525 @Override
526 public DDLRecordSet findByPrimaryKey(Serializable primaryKey)
527 throws NoSuchModelException, SystemException {
528 return findByPrimaryKey(((Long)primaryKey).longValue());
529 }
530
531
539 public DDLRecordSet findByPrimaryKey(long recordSetId)
540 throws NoSuchRecordSetException, SystemException {
541 DDLRecordSet ddlRecordSet = fetchByPrimaryKey(recordSetId);
542
543 if (ddlRecordSet == null) {
544 if (_log.isWarnEnabled()) {
545 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + recordSetId);
546 }
547
548 throw new NoSuchRecordSetException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
549 recordSetId);
550 }
551
552 return ddlRecordSet;
553 }
554
555
562 @Override
563 public DDLRecordSet fetchByPrimaryKey(Serializable primaryKey)
564 throws SystemException {
565 return fetchByPrimaryKey(((Long)primaryKey).longValue());
566 }
567
568
575 public DDLRecordSet fetchByPrimaryKey(long recordSetId)
576 throws SystemException {
577 DDLRecordSet ddlRecordSet = (DDLRecordSet)EntityCacheUtil.getResult(DDLRecordSetModelImpl.ENTITY_CACHE_ENABLED,
578 DDLRecordSetImpl.class, recordSetId);
579
580 if (ddlRecordSet == _nullDDLRecordSet) {
581 return null;
582 }
583
584 if (ddlRecordSet == null) {
585 Session session = null;
586
587 boolean hasException = false;
588
589 try {
590 session = openSession();
591
592 ddlRecordSet = (DDLRecordSet)session.get(DDLRecordSetImpl.class,
593 Long.valueOf(recordSetId));
594 }
595 catch (Exception e) {
596 hasException = true;
597
598 throw processException(e);
599 }
600 finally {
601 if (ddlRecordSet != null) {
602 cacheResult(ddlRecordSet);
603 }
604 else if (!hasException) {
605 EntityCacheUtil.putResult(DDLRecordSetModelImpl.ENTITY_CACHE_ENABLED,
606 DDLRecordSetImpl.class, recordSetId, _nullDDLRecordSet);
607 }
608
609 closeSession(session);
610 }
611 }
612
613 return ddlRecordSet;
614 }
615
616
623 public List<DDLRecordSet> findByUuid(String uuid) throws SystemException {
624 return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
625 }
626
627
640 public List<DDLRecordSet> findByUuid(String uuid, int start, int end)
641 throws SystemException {
642 return findByUuid(uuid, start, end, null);
643 }
644
645
659 public List<DDLRecordSet> findByUuid(String uuid, int start, int end,
660 OrderByComparator orderByComparator) throws SystemException {
661 FinderPath finderPath = null;
662 Object[] finderArgs = null;
663
664 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
665 (orderByComparator == null)) {
666 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID;
667 finderArgs = new Object[] { uuid };
668 }
669 else {
670 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID;
671 finderArgs = new Object[] { uuid, start, end, orderByComparator };
672 }
673
674 List<DDLRecordSet> list = (List<DDLRecordSet>)FinderCacheUtil.getResult(finderPath,
675 finderArgs, this);
676
677 if (list == null) {
678 StringBundler query = null;
679
680 if (orderByComparator != null) {
681 query = new StringBundler(3 +
682 (orderByComparator.getOrderByFields().length * 3));
683 }
684 else {
685 query = new StringBundler(2);
686 }
687
688 query.append(_SQL_SELECT_DDLRECORDSET_WHERE);
689
690 if (uuid == null) {
691 query.append(_FINDER_COLUMN_UUID_UUID_1);
692 }
693 else {
694 if (uuid.equals(StringPool.BLANK)) {
695 query.append(_FINDER_COLUMN_UUID_UUID_3);
696 }
697 else {
698 query.append(_FINDER_COLUMN_UUID_UUID_2);
699 }
700 }
701
702 if (orderByComparator != null) {
703 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
704 orderByComparator);
705 }
706
707 String sql = query.toString();
708
709 Session session = null;
710
711 try {
712 session = openSession();
713
714 Query q = session.createQuery(sql);
715
716 QueryPos qPos = QueryPos.getInstance(q);
717
718 if (uuid != null) {
719 qPos.add(uuid);
720 }
721
722 list = (List<DDLRecordSet>)QueryUtil.list(q, getDialect(),
723 start, end);
724 }
725 catch (Exception e) {
726 throw processException(e);
727 }
728 finally {
729 if (list == null) {
730 FinderCacheUtil.removeResult(finderPath, finderArgs);
731 }
732 else {
733 cacheResult(list);
734
735 FinderCacheUtil.putResult(finderPath, finderArgs, list);
736 }
737
738 closeSession(session);
739 }
740 }
741
742 return list;
743 }
744
745
758 public DDLRecordSet findByUuid_First(String uuid,
759 OrderByComparator orderByComparator)
760 throws NoSuchRecordSetException, SystemException {
761 List<DDLRecordSet> list = findByUuid(uuid, 0, 1, orderByComparator);
762
763 if (list.isEmpty()) {
764 StringBundler msg = new StringBundler(4);
765
766 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
767
768 msg.append("uuid=");
769 msg.append(uuid);
770
771 msg.append(StringPool.CLOSE_CURLY_BRACE);
772
773 throw new NoSuchRecordSetException(msg.toString());
774 }
775 else {
776 return list.get(0);
777 }
778 }
779
780
793 public DDLRecordSet findByUuid_Last(String uuid,
794 OrderByComparator orderByComparator)
795 throws NoSuchRecordSetException, SystemException {
796 int count = countByUuid(uuid);
797
798 List<DDLRecordSet> list = findByUuid(uuid, count - 1, count,
799 orderByComparator);
800
801 if (list.isEmpty()) {
802 StringBundler msg = new StringBundler(4);
803
804 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
805
806 msg.append("uuid=");
807 msg.append(uuid);
808
809 msg.append(StringPool.CLOSE_CURLY_BRACE);
810
811 throw new NoSuchRecordSetException(msg.toString());
812 }
813 else {
814 return list.get(0);
815 }
816 }
817
818
832 public DDLRecordSet[] findByUuid_PrevAndNext(long recordSetId, String uuid,
833 OrderByComparator orderByComparator)
834 throws NoSuchRecordSetException, SystemException {
835 DDLRecordSet ddlRecordSet = findByPrimaryKey(recordSetId);
836
837 Session session = null;
838
839 try {
840 session = openSession();
841
842 DDLRecordSet[] array = new DDLRecordSetImpl[3];
843
844 array[0] = getByUuid_PrevAndNext(session, ddlRecordSet, uuid,
845 orderByComparator, true);
846
847 array[1] = ddlRecordSet;
848
849 array[2] = getByUuid_PrevAndNext(session, ddlRecordSet, uuid,
850 orderByComparator, false);
851
852 return array;
853 }
854 catch (Exception e) {
855 throw processException(e);
856 }
857 finally {
858 closeSession(session);
859 }
860 }
861
862 protected DDLRecordSet getByUuid_PrevAndNext(Session session,
863 DDLRecordSet ddlRecordSet, String uuid,
864 OrderByComparator orderByComparator, boolean previous) {
865 StringBundler query = null;
866
867 if (orderByComparator != null) {
868 query = new StringBundler(6 +
869 (orderByComparator.getOrderByFields().length * 6));
870 }
871 else {
872 query = new StringBundler(3);
873 }
874
875 query.append(_SQL_SELECT_DDLRECORDSET_WHERE);
876
877 if (uuid == null) {
878 query.append(_FINDER_COLUMN_UUID_UUID_1);
879 }
880 else {
881 if (uuid.equals(StringPool.BLANK)) {
882 query.append(_FINDER_COLUMN_UUID_UUID_3);
883 }
884 else {
885 query.append(_FINDER_COLUMN_UUID_UUID_2);
886 }
887 }
888
889 if (orderByComparator != null) {
890 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
891
892 if (orderByConditionFields.length > 0) {
893 query.append(WHERE_AND);
894 }
895
896 for (int i = 0; i < orderByConditionFields.length; i++) {
897 query.append(_ORDER_BY_ENTITY_ALIAS);
898 query.append(orderByConditionFields[i]);
899
900 if ((i + 1) < orderByConditionFields.length) {
901 if (orderByComparator.isAscending() ^ previous) {
902 query.append(WHERE_GREATER_THAN_HAS_NEXT);
903 }
904 else {
905 query.append(WHERE_LESSER_THAN_HAS_NEXT);
906 }
907 }
908 else {
909 if (orderByComparator.isAscending() ^ previous) {
910 query.append(WHERE_GREATER_THAN);
911 }
912 else {
913 query.append(WHERE_LESSER_THAN);
914 }
915 }
916 }
917
918 query.append(ORDER_BY_CLAUSE);
919
920 String[] orderByFields = orderByComparator.getOrderByFields();
921
922 for (int i = 0; i < orderByFields.length; i++) {
923 query.append(_ORDER_BY_ENTITY_ALIAS);
924 query.append(orderByFields[i]);
925
926 if ((i + 1) < orderByFields.length) {
927 if (orderByComparator.isAscending() ^ previous) {
928 query.append(ORDER_BY_ASC_HAS_NEXT);
929 }
930 else {
931 query.append(ORDER_BY_DESC_HAS_NEXT);
932 }
933 }
934 else {
935 if (orderByComparator.isAscending() ^ previous) {
936 query.append(ORDER_BY_ASC);
937 }
938 else {
939 query.append(ORDER_BY_DESC);
940 }
941 }
942 }
943 }
944
945 String sql = query.toString();
946
947 Query q = session.createQuery(sql);
948
949 q.setFirstResult(0);
950 q.setMaxResults(2);
951
952 QueryPos qPos = QueryPos.getInstance(q);
953
954 if (uuid != null) {
955 qPos.add(uuid);
956 }
957
958 if (orderByComparator != null) {
959 Object[] values = orderByComparator.getOrderByConditionValues(ddlRecordSet);
960
961 for (Object value : values) {
962 qPos.add(value);
963 }
964 }
965
966 List<DDLRecordSet> list = q.list();
967
968 if (list.size() == 2) {
969 return list.get(1);
970 }
971 else {
972 return null;
973 }
974 }
975
976
985 public DDLRecordSet findByUUID_G(String uuid, long groupId)
986 throws NoSuchRecordSetException, SystemException {
987 DDLRecordSet ddlRecordSet = fetchByUUID_G(uuid, groupId);
988
989 if (ddlRecordSet == null) {
990 StringBundler msg = new StringBundler(6);
991
992 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
993
994 msg.append("uuid=");
995 msg.append(uuid);
996
997 msg.append(", groupId=");
998 msg.append(groupId);
999
1000 msg.append(StringPool.CLOSE_CURLY_BRACE);
1001
1002 if (_log.isWarnEnabled()) {
1003 _log.warn(msg.toString());
1004 }
1005
1006 throw new NoSuchRecordSetException(msg.toString());
1007 }
1008
1009 return ddlRecordSet;
1010 }
1011
1012
1020 public DDLRecordSet fetchByUUID_G(String uuid, long groupId)
1021 throws SystemException {
1022 return fetchByUUID_G(uuid, groupId, true);
1023 }
1024
1025
1034 public DDLRecordSet fetchByUUID_G(String uuid, long groupId,
1035 boolean retrieveFromCache) throws SystemException {
1036 Object[] finderArgs = new Object[] { uuid, groupId };
1037
1038 Object result = null;
1039
1040 if (retrieveFromCache) {
1041 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
1042 finderArgs, this);
1043 }
1044
1045 if (result == null) {
1046 StringBundler query = new StringBundler(3);
1047
1048 query.append(_SQL_SELECT_DDLRECORDSET_WHERE);
1049
1050 if (uuid == null) {
1051 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
1052 }
1053 else {
1054 if (uuid.equals(StringPool.BLANK)) {
1055 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
1056 }
1057 else {
1058 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
1059 }
1060 }
1061
1062 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
1063
1064 String sql = query.toString();
1065
1066 Session session = null;
1067
1068 try {
1069 session = openSession();
1070
1071 Query q = session.createQuery(sql);
1072
1073 QueryPos qPos = QueryPos.getInstance(q);
1074
1075 if (uuid != null) {
1076 qPos.add(uuid);
1077 }
1078
1079 qPos.add(groupId);
1080
1081 List<DDLRecordSet> list = q.list();
1082
1083 result = list;
1084
1085 DDLRecordSet ddlRecordSet = null;
1086
1087 if (list.isEmpty()) {
1088 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1089 finderArgs, list);
1090 }
1091 else {
1092 ddlRecordSet = list.get(0);
1093
1094 cacheResult(ddlRecordSet);
1095
1096 if ((ddlRecordSet.getUuid() == null) ||
1097 !ddlRecordSet.getUuid().equals(uuid) ||
1098 (ddlRecordSet.getGroupId() != groupId)) {
1099 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1100 finderArgs, ddlRecordSet);
1101 }
1102 }
1103
1104 return ddlRecordSet;
1105 }
1106 catch (Exception e) {
1107 throw processException(e);
1108 }
1109 finally {
1110 if (result == null) {
1111 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
1112 finderArgs);
1113 }
1114
1115 closeSession(session);
1116 }
1117 }
1118 else {
1119 if (result instanceof List<?>) {
1120 return null;
1121 }
1122 else {
1123 return (DDLRecordSet)result;
1124 }
1125 }
1126 }
1127
1128
1135 public List<DDLRecordSet> findByGroupId(long groupId)
1136 throws SystemException {
1137 return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1138 }
1139
1140
1153 public List<DDLRecordSet> findByGroupId(long groupId, int start, int end)
1154 throws SystemException {
1155 return findByGroupId(groupId, start, end, null);
1156 }
1157
1158
1172 public List<DDLRecordSet> findByGroupId(long groupId, int start, int end,
1173 OrderByComparator orderByComparator) throws SystemException {
1174 FinderPath finderPath = null;
1175 Object[] finderArgs = null;
1176
1177 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1178 (orderByComparator == null)) {
1179 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID;
1180 finderArgs = new Object[] { groupId };
1181 }
1182 else {
1183 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID;
1184 finderArgs = new Object[] { groupId, start, end, orderByComparator };
1185 }
1186
1187 List<DDLRecordSet> list = (List<DDLRecordSet>)FinderCacheUtil.getResult(finderPath,
1188 finderArgs, this);
1189
1190 if (list == null) {
1191 StringBundler query = null;
1192
1193 if (orderByComparator != null) {
1194 query = new StringBundler(3 +
1195 (orderByComparator.getOrderByFields().length * 3));
1196 }
1197 else {
1198 query = new StringBundler(2);
1199 }
1200
1201 query.append(_SQL_SELECT_DDLRECORDSET_WHERE);
1202
1203 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1204
1205 if (orderByComparator != null) {
1206 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1207 orderByComparator);
1208 }
1209
1210 String sql = query.toString();
1211
1212 Session session = null;
1213
1214 try {
1215 session = openSession();
1216
1217 Query q = session.createQuery(sql);
1218
1219 QueryPos qPos = QueryPos.getInstance(q);
1220
1221 qPos.add(groupId);
1222
1223 list = (List<DDLRecordSet>)QueryUtil.list(q, getDialect(),
1224 start, end);
1225 }
1226 catch (Exception e) {
1227 throw processException(e);
1228 }
1229 finally {
1230 if (list == null) {
1231 FinderCacheUtil.removeResult(finderPath, finderArgs);
1232 }
1233 else {
1234 cacheResult(list);
1235
1236 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1237 }
1238
1239 closeSession(session);
1240 }
1241 }
1242
1243 return list;
1244 }
1245
1246
1259 public DDLRecordSet findByGroupId_First(long groupId,
1260 OrderByComparator orderByComparator)
1261 throws NoSuchRecordSetException, SystemException {
1262 List<DDLRecordSet> list = findByGroupId(groupId, 0, 1, orderByComparator);
1263
1264 if (list.isEmpty()) {
1265 StringBundler msg = new StringBundler(4);
1266
1267 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1268
1269 msg.append("groupId=");
1270 msg.append(groupId);
1271
1272 msg.append(StringPool.CLOSE_CURLY_BRACE);
1273
1274 throw new NoSuchRecordSetException(msg.toString());
1275 }
1276 else {
1277 return list.get(0);
1278 }
1279 }
1280
1281
1294 public DDLRecordSet findByGroupId_Last(long groupId,
1295 OrderByComparator orderByComparator)
1296 throws NoSuchRecordSetException, SystemException {
1297 int count = countByGroupId(groupId);
1298
1299 List<DDLRecordSet> list = findByGroupId(groupId, count - 1, count,
1300 orderByComparator);
1301
1302 if (list.isEmpty()) {
1303 StringBundler msg = new StringBundler(4);
1304
1305 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1306
1307 msg.append("groupId=");
1308 msg.append(groupId);
1309
1310 msg.append(StringPool.CLOSE_CURLY_BRACE);
1311
1312 throw new NoSuchRecordSetException(msg.toString());
1313 }
1314 else {
1315 return list.get(0);
1316 }
1317 }
1318
1319
1333 public DDLRecordSet[] findByGroupId_PrevAndNext(long recordSetId,
1334 long groupId, OrderByComparator orderByComparator)
1335 throws NoSuchRecordSetException, SystemException {
1336 DDLRecordSet ddlRecordSet = findByPrimaryKey(recordSetId);
1337
1338 Session session = null;
1339
1340 try {
1341 session = openSession();
1342
1343 DDLRecordSet[] array = new DDLRecordSetImpl[3];
1344
1345 array[0] = getByGroupId_PrevAndNext(session, ddlRecordSet, groupId,
1346 orderByComparator, true);
1347
1348 array[1] = ddlRecordSet;
1349
1350 array[2] = getByGroupId_PrevAndNext(session, ddlRecordSet, groupId,
1351 orderByComparator, false);
1352
1353 return array;
1354 }
1355 catch (Exception e) {
1356 throw processException(e);
1357 }
1358 finally {
1359 closeSession(session);
1360 }
1361 }
1362
1363 protected DDLRecordSet getByGroupId_PrevAndNext(Session session,
1364 DDLRecordSet ddlRecordSet, long groupId,
1365 OrderByComparator orderByComparator, boolean previous) {
1366 StringBundler query = null;
1367
1368 if (orderByComparator != null) {
1369 query = new StringBundler(6 +
1370 (orderByComparator.getOrderByFields().length * 6));
1371 }
1372 else {
1373 query = new StringBundler(3);
1374 }
1375
1376 query.append(_SQL_SELECT_DDLRECORDSET_WHERE);
1377
1378 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1379
1380 if (orderByComparator != null) {
1381 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1382
1383 if (orderByConditionFields.length > 0) {
1384 query.append(WHERE_AND);
1385 }
1386
1387 for (int i = 0; i < orderByConditionFields.length; i++) {
1388 query.append(_ORDER_BY_ENTITY_ALIAS);
1389 query.append(orderByConditionFields[i]);
1390
1391 if ((i + 1) < orderByConditionFields.length) {
1392 if (orderByComparator.isAscending() ^ previous) {
1393 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1394 }
1395 else {
1396 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1397 }
1398 }
1399 else {
1400 if (orderByComparator.isAscending() ^ previous) {
1401 query.append(WHERE_GREATER_THAN);
1402 }
1403 else {
1404 query.append(WHERE_LESSER_THAN);
1405 }
1406 }
1407 }
1408
1409 query.append(ORDER_BY_CLAUSE);
1410
1411 String[] orderByFields = orderByComparator.getOrderByFields();
1412
1413 for (int i = 0; i < orderByFields.length; i++) {
1414 query.append(_ORDER_BY_ENTITY_ALIAS);
1415 query.append(orderByFields[i]);
1416
1417 if ((i + 1) < orderByFields.length) {
1418 if (orderByComparator.isAscending() ^ previous) {
1419 query.append(ORDER_BY_ASC_HAS_NEXT);
1420 }
1421 else {
1422 query.append(ORDER_BY_DESC_HAS_NEXT);
1423 }
1424 }
1425 else {
1426 if (orderByComparator.isAscending() ^ previous) {
1427 query.append(ORDER_BY_ASC);
1428 }
1429 else {
1430 query.append(ORDER_BY_DESC);
1431 }
1432 }
1433 }
1434 }
1435
1436 String sql = query.toString();
1437
1438 Query q = session.createQuery(sql);
1439
1440 q.setFirstResult(0);
1441 q.setMaxResults(2);
1442
1443 QueryPos qPos = QueryPos.getInstance(q);
1444
1445 qPos.add(groupId);
1446
1447 if (orderByComparator != null) {
1448 Object[] values = orderByComparator.getOrderByConditionValues(ddlRecordSet);
1449
1450 for (Object value : values) {
1451 qPos.add(value);
1452 }
1453 }
1454
1455 List<DDLRecordSet> list = q.list();
1456
1457 if (list.size() == 2) {
1458 return list.get(1);
1459 }
1460 else {
1461 return null;
1462 }
1463 }
1464
1465
1472 public List<DDLRecordSet> filterFindByGroupId(long groupId)
1473 throws SystemException {
1474 return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
1475 QueryUtil.ALL_POS, null);
1476 }
1477
1478
1491 public List<DDLRecordSet> filterFindByGroupId(long groupId, int start,
1492 int end) throws SystemException {
1493 return filterFindByGroupId(groupId, start, end, null);
1494 }
1495
1496
1510 public List<DDLRecordSet> filterFindByGroupId(long groupId, int start,
1511 int end, OrderByComparator orderByComparator) throws SystemException {
1512 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1513 return findByGroupId(groupId, start, end, orderByComparator);
1514 }
1515
1516 StringBundler query = null;
1517
1518 if (orderByComparator != null) {
1519 query = new StringBundler(3 +
1520 (orderByComparator.getOrderByFields().length * 3));
1521 }
1522 else {
1523 query = new StringBundler(2);
1524 }
1525
1526 if (getDB().isSupportsInlineDistinct()) {
1527 query.append(_FILTER_SQL_SELECT_DDLRECORDSET_WHERE);
1528 }
1529 else {
1530 query.append(_FILTER_SQL_SELECT_DDLRECORDSET_NO_INLINE_DISTINCT_WHERE_1);
1531 }
1532
1533 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1534
1535 if (!getDB().isSupportsInlineDistinct()) {
1536 query.append(_FILTER_SQL_SELECT_DDLRECORDSET_NO_INLINE_DISTINCT_WHERE_2);
1537 }
1538
1539 if (orderByComparator != null) {
1540 if (getDB().isSupportsInlineDistinct()) {
1541 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1542 orderByComparator);
1543 }
1544 else {
1545 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1546 orderByComparator);
1547 }
1548 }
1549
1550 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1551 DDLRecordSet.class.getName(),
1552 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
1553
1554 Session session = null;
1555
1556 try {
1557 session = openSession();
1558
1559 SQLQuery q = session.createSQLQuery(sql);
1560
1561 if (getDB().isSupportsInlineDistinct()) {
1562 q.addEntity(_FILTER_ENTITY_ALIAS, DDLRecordSetImpl.class);
1563 }
1564 else {
1565 q.addEntity(_FILTER_ENTITY_TABLE, DDLRecordSetImpl.class);
1566 }
1567
1568 QueryPos qPos = QueryPos.getInstance(q);
1569
1570 qPos.add(groupId);
1571
1572 return (List<DDLRecordSet>)QueryUtil.list(q, getDialect(), start,
1573 end);
1574 }
1575 catch (Exception e) {
1576 throw processException(e);
1577 }
1578 finally {
1579 closeSession(session);
1580 }
1581 }
1582
1583
1593 public DDLRecordSet[] filterFindByGroupId_PrevAndNext(long recordSetId,
1594 long groupId, OrderByComparator orderByComparator)
1595 throws NoSuchRecordSetException, SystemException {
1596 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1597 return findByGroupId_PrevAndNext(recordSetId, groupId,
1598 orderByComparator);
1599 }
1600
1601 DDLRecordSet ddlRecordSet = findByPrimaryKey(recordSetId);
1602
1603 Session session = null;
1604
1605 try {
1606 session = openSession();
1607
1608 DDLRecordSet[] array = new DDLRecordSetImpl[3];
1609
1610 array[0] = filterGetByGroupId_PrevAndNext(session, ddlRecordSet,
1611 groupId, orderByComparator, true);
1612
1613 array[1] = ddlRecordSet;
1614
1615 array[2] = filterGetByGroupId_PrevAndNext(session, ddlRecordSet,
1616 groupId, orderByComparator, false);
1617
1618 return array;
1619 }
1620 catch (Exception e) {
1621 throw processException(e);
1622 }
1623 finally {
1624 closeSession(session);
1625 }
1626 }
1627
1628 protected DDLRecordSet filterGetByGroupId_PrevAndNext(Session session,
1629 DDLRecordSet ddlRecordSet, long groupId,
1630 OrderByComparator orderByComparator, boolean previous) {
1631 StringBundler query = null;
1632
1633 if (orderByComparator != null) {
1634 query = new StringBundler(6 +
1635 (orderByComparator.getOrderByFields().length * 6));
1636 }
1637 else {
1638 query = new StringBundler(3);
1639 }
1640
1641 if (getDB().isSupportsInlineDistinct()) {
1642 query.append(_FILTER_SQL_SELECT_DDLRECORDSET_WHERE);
1643 }
1644 else {
1645 query.append(_FILTER_SQL_SELECT_DDLRECORDSET_NO_INLINE_DISTINCT_WHERE_1);
1646 }
1647
1648 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1649
1650 if (!getDB().isSupportsInlineDistinct()) {
1651 query.append(_FILTER_SQL_SELECT_DDLRECORDSET_NO_INLINE_DISTINCT_WHERE_2);
1652 }
1653
1654 if (orderByComparator != null) {
1655 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1656
1657 if (orderByConditionFields.length > 0) {
1658 query.append(WHERE_AND);
1659 }
1660
1661 for (int i = 0; i < orderByConditionFields.length; i++) {
1662 if (getDB().isSupportsInlineDistinct()) {
1663 query.append(_ORDER_BY_ENTITY_ALIAS);
1664 }
1665 else {
1666 query.append(_ORDER_BY_ENTITY_TABLE);
1667 }
1668
1669 query.append(orderByConditionFields[i]);
1670
1671 if ((i + 1) < orderByConditionFields.length) {
1672 if (orderByComparator.isAscending() ^ previous) {
1673 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1674 }
1675 else {
1676 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1677 }
1678 }
1679 else {
1680 if (orderByComparator.isAscending() ^ previous) {
1681 query.append(WHERE_GREATER_THAN);
1682 }
1683 else {
1684 query.append(WHERE_LESSER_THAN);
1685 }
1686 }
1687 }
1688
1689 query.append(ORDER_BY_CLAUSE);
1690
1691 String[] orderByFields = orderByComparator.getOrderByFields();
1692
1693 for (int i = 0; i < orderByFields.length; i++) {
1694 if (getDB().isSupportsInlineDistinct()) {
1695 query.append(_ORDER_BY_ENTITY_ALIAS);
1696 }
1697 else {
1698 query.append(_ORDER_BY_ENTITY_TABLE);
1699 }
1700
1701 query.append(orderByFields[i]);
1702
1703 if ((i + 1) < orderByFields.length) {
1704 if (orderByComparator.isAscending() ^ previous) {
1705 query.append(ORDER_BY_ASC_HAS_NEXT);
1706 }
1707 else {
1708 query.append(ORDER_BY_DESC_HAS_NEXT);
1709 }
1710 }
1711 else {
1712 if (orderByComparator.isAscending() ^ previous) {
1713 query.append(ORDER_BY_ASC);
1714 }
1715 else {
1716 query.append(ORDER_BY_DESC);
1717 }
1718 }
1719 }
1720 }
1721
1722 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1723 DDLRecordSet.class.getName(),
1724 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
1725
1726 SQLQuery q = session.createSQLQuery(sql);
1727
1728 q.setFirstResult(0);
1729 q.setMaxResults(2);
1730
1731 if (getDB().isSupportsInlineDistinct()) {
1732 q.addEntity(_FILTER_ENTITY_ALIAS, DDLRecordSetImpl.class);
1733 }
1734 else {
1735 q.addEntity(_FILTER_ENTITY_TABLE, DDLRecordSetImpl.class);
1736 }
1737
1738 QueryPos qPos = QueryPos.getInstance(q);
1739
1740 qPos.add(groupId);
1741
1742 if (orderByComparator != null) {
1743 Object[] values = orderByComparator.getOrderByConditionValues(ddlRecordSet);
1744
1745 for (Object value : values) {
1746 qPos.add(value);
1747 }
1748 }
1749
1750 List<DDLRecordSet> list = q.list();
1751
1752 if (list.size() == 2) {
1753 return list.get(1);
1754 }
1755 else {
1756 return null;
1757 }
1758 }
1759
1760
1769 public DDLRecordSet findByG_R(long groupId, String recordSetKey)
1770 throws NoSuchRecordSetException, SystemException {
1771 DDLRecordSet ddlRecordSet = fetchByG_R(groupId, recordSetKey);
1772
1773 if (ddlRecordSet == null) {
1774 StringBundler msg = new StringBundler(6);
1775
1776 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1777
1778 msg.append("groupId=");
1779 msg.append(groupId);
1780
1781 msg.append(", recordSetKey=");
1782 msg.append(recordSetKey);
1783
1784 msg.append(StringPool.CLOSE_CURLY_BRACE);
1785
1786 if (_log.isWarnEnabled()) {
1787 _log.warn(msg.toString());
1788 }
1789
1790 throw new NoSuchRecordSetException(msg.toString());
1791 }
1792
1793 return ddlRecordSet;
1794 }
1795
1796
1804 public DDLRecordSet fetchByG_R(long groupId, String recordSetKey)
1805 throws SystemException {
1806 return fetchByG_R(groupId, recordSetKey, true);
1807 }
1808
1809
1818 public DDLRecordSet fetchByG_R(long groupId, String recordSetKey,
1819 boolean retrieveFromCache) throws SystemException {
1820 Object[] finderArgs = new Object[] { groupId, recordSetKey };
1821
1822 Object result = null;
1823
1824 if (retrieveFromCache) {
1825 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_R,
1826 finderArgs, this);
1827 }
1828
1829 if (result == null) {
1830 StringBundler query = new StringBundler(3);
1831
1832 query.append(_SQL_SELECT_DDLRECORDSET_WHERE);
1833
1834 query.append(_FINDER_COLUMN_G_R_GROUPID_2);
1835
1836 if (recordSetKey == null) {
1837 query.append(_FINDER_COLUMN_G_R_RECORDSETKEY_1);
1838 }
1839 else {
1840 if (recordSetKey.equals(StringPool.BLANK)) {
1841 query.append(_FINDER_COLUMN_G_R_RECORDSETKEY_3);
1842 }
1843 else {
1844 query.append(_FINDER_COLUMN_G_R_RECORDSETKEY_2);
1845 }
1846 }
1847
1848 String sql = query.toString();
1849
1850 Session session = null;
1851
1852 try {
1853 session = openSession();
1854
1855 Query q = session.createQuery(sql);
1856
1857 QueryPos qPos = QueryPos.getInstance(q);
1858
1859 qPos.add(groupId);
1860
1861 if (recordSetKey != null) {
1862 qPos.add(recordSetKey);
1863 }
1864
1865 List<DDLRecordSet> list = q.list();
1866
1867 result = list;
1868
1869 DDLRecordSet ddlRecordSet = null;
1870
1871 if (list.isEmpty()) {
1872 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_R,
1873 finderArgs, list);
1874 }
1875 else {
1876 ddlRecordSet = list.get(0);
1877
1878 cacheResult(ddlRecordSet);
1879
1880 if ((ddlRecordSet.getGroupId() != groupId) ||
1881 (ddlRecordSet.getRecordSetKey() == null) ||
1882 !ddlRecordSet.getRecordSetKey().equals(recordSetKey)) {
1883 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_R,
1884 finderArgs, ddlRecordSet);
1885 }
1886 }
1887
1888 return ddlRecordSet;
1889 }
1890 catch (Exception e) {
1891 throw processException(e);
1892 }
1893 finally {
1894 if (result == null) {
1895 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_R,
1896 finderArgs);
1897 }
1898
1899 closeSession(session);
1900 }
1901 }
1902 else {
1903 if (result instanceof List<?>) {
1904 return null;
1905 }
1906 else {
1907 return (DDLRecordSet)result;
1908 }
1909 }
1910 }
1911
1912
1918 public List<DDLRecordSet> findAll() throws SystemException {
1919 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1920 }
1921
1922
1934 public List<DDLRecordSet> findAll(int start, int end)
1935 throws SystemException {
1936 return findAll(start, end, null);
1937 }
1938
1939
1952 public List<DDLRecordSet> findAll(int start, int end,
1953 OrderByComparator orderByComparator) throws SystemException {
1954 FinderPath finderPath = null;
1955 Object[] finderArgs = new Object[] { start, end, orderByComparator };
1956
1957 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1958 (orderByComparator == null)) {
1959 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1960 finderArgs = FINDER_ARGS_EMPTY;
1961 }
1962 else {
1963 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1964 finderArgs = new Object[] { start, end, orderByComparator };
1965 }
1966
1967 List<DDLRecordSet> list = (List<DDLRecordSet>)FinderCacheUtil.getResult(finderPath,
1968 finderArgs, this);
1969
1970 if (list == null) {
1971 StringBundler query = null;
1972 String sql = null;
1973
1974 if (orderByComparator != null) {
1975 query = new StringBundler(2 +
1976 (orderByComparator.getOrderByFields().length * 3));
1977
1978 query.append(_SQL_SELECT_DDLRECORDSET);
1979
1980 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1981 orderByComparator);
1982
1983 sql = query.toString();
1984 }
1985 else {
1986 sql = _SQL_SELECT_DDLRECORDSET;
1987 }
1988
1989 Session session = null;
1990
1991 try {
1992 session = openSession();
1993
1994 Query q = session.createQuery(sql);
1995
1996 if (orderByComparator == null) {
1997 list = (List<DDLRecordSet>)QueryUtil.list(q, getDialect(),
1998 start, end, false);
1999
2000 Collections.sort(list);
2001 }
2002 else {
2003 list = (List<DDLRecordSet>)QueryUtil.list(q, getDialect(),
2004 start, end);
2005 }
2006 }
2007 catch (Exception e) {
2008 throw processException(e);
2009 }
2010 finally {
2011 if (list == null) {
2012 FinderCacheUtil.removeResult(finderPath, finderArgs);
2013 }
2014 else {
2015 cacheResult(list);
2016
2017 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2018 }
2019
2020 closeSession(session);
2021 }
2022 }
2023
2024 return list;
2025 }
2026
2027
2033 public void removeByUuid(String uuid) throws SystemException {
2034 for (DDLRecordSet ddlRecordSet : findByUuid(uuid)) {
2035 remove(ddlRecordSet);
2036 }
2037 }
2038
2039
2046 public void removeByUUID_G(String uuid, long groupId)
2047 throws NoSuchRecordSetException, SystemException {
2048 DDLRecordSet ddlRecordSet = findByUUID_G(uuid, groupId);
2049
2050 remove(ddlRecordSet);
2051 }
2052
2053
2059 public void removeByGroupId(long groupId) throws SystemException {
2060 for (DDLRecordSet ddlRecordSet : findByGroupId(groupId)) {
2061 remove(ddlRecordSet);
2062 }
2063 }
2064
2065
2072 public void removeByG_R(long groupId, String recordSetKey)
2073 throws NoSuchRecordSetException, SystemException {
2074 DDLRecordSet ddlRecordSet = findByG_R(groupId, recordSetKey);
2075
2076 remove(ddlRecordSet);
2077 }
2078
2079
2084 public void removeAll() throws SystemException {
2085 for (DDLRecordSet ddlRecordSet : findAll()) {
2086 remove(ddlRecordSet);
2087 }
2088 }
2089
2090
2097 public int countByUuid(String uuid) throws SystemException {
2098 Object[] finderArgs = new Object[] { uuid };
2099
2100 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
2101 finderArgs, this);
2102
2103 if (count == null) {
2104 StringBundler query = new StringBundler(2);
2105
2106 query.append(_SQL_COUNT_DDLRECORDSET_WHERE);
2107
2108 if (uuid == null) {
2109 query.append(_FINDER_COLUMN_UUID_UUID_1);
2110 }
2111 else {
2112 if (uuid.equals(StringPool.BLANK)) {
2113 query.append(_FINDER_COLUMN_UUID_UUID_3);
2114 }
2115 else {
2116 query.append(_FINDER_COLUMN_UUID_UUID_2);
2117 }
2118 }
2119
2120 String sql = query.toString();
2121
2122 Session session = null;
2123
2124 try {
2125 session = openSession();
2126
2127 Query q = session.createQuery(sql);
2128
2129 QueryPos qPos = QueryPos.getInstance(q);
2130
2131 if (uuid != null) {
2132 qPos.add(uuid);
2133 }
2134
2135 count = (Long)q.uniqueResult();
2136 }
2137 catch (Exception e) {
2138 throw processException(e);
2139 }
2140 finally {
2141 if (count == null) {
2142 count = Long.valueOf(0);
2143 }
2144
2145 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
2146 finderArgs, count);
2147
2148 closeSession(session);
2149 }
2150 }
2151
2152 return count.intValue();
2153 }
2154
2155
2163 public int countByUUID_G(String uuid, long groupId)
2164 throws SystemException {
2165 Object[] finderArgs = new Object[] { uuid, groupId };
2166
2167 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
2168 finderArgs, this);
2169
2170 if (count == null) {
2171 StringBundler query = new StringBundler(3);
2172
2173 query.append(_SQL_COUNT_DDLRECORDSET_WHERE);
2174
2175 if (uuid == null) {
2176 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
2177 }
2178 else {
2179 if (uuid.equals(StringPool.BLANK)) {
2180 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
2181 }
2182 else {
2183 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
2184 }
2185 }
2186
2187 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
2188
2189 String sql = query.toString();
2190
2191 Session session = null;
2192
2193 try {
2194 session = openSession();
2195
2196 Query q = session.createQuery(sql);
2197
2198 QueryPos qPos = QueryPos.getInstance(q);
2199
2200 if (uuid != null) {
2201 qPos.add(uuid);
2202 }
2203
2204 qPos.add(groupId);
2205
2206 count = (Long)q.uniqueResult();
2207 }
2208 catch (Exception e) {
2209 throw processException(e);
2210 }
2211 finally {
2212 if (count == null) {
2213 count = Long.valueOf(0);
2214 }
2215
2216 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
2217 finderArgs, count);
2218
2219 closeSession(session);
2220 }
2221 }
2222
2223 return count.intValue();
2224 }
2225
2226
2233 public int countByGroupId(long groupId) throws SystemException {
2234 Object[] finderArgs = new Object[] { groupId };
2235
2236 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
2237 finderArgs, this);
2238
2239 if (count == null) {
2240 StringBundler query = new StringBundler(2);
2241
2242 query.append(_SQL_COUNT_DDLRECORDSET_WHERE);
2243
2244 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2245
2246 String sql = query.toString();
2247
2248 Session session = null;
2249
2250 try {
2251 session = openSession();
2252
2253 Query q = session.createQuery(sql);
2254
2255 QueryPos qPos = QueryPos.getInstance(q);
2256
2257 qPos.add(groupId);
2258
2259 count = (Long)q.uniqueResult();
2260 }
2261 catch (Exception e) {
2262 throw processException(e);
2263 }
2264 finally {
2265 if (count == null) {
2266 count = Long.valueOf(0);
2267 }
2268
2269 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
2270 finderArgs, count);
2271
2272 closeSession(session);
2273 }
2274 }
2275
2276 return count.intValue();
2277 }
2278
2279
2286 public int filterCountByGroupId(long groupId) throws SystemException {
2287 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2288 return countByGroupId(groupId);
2289 }
2290
2291 StringBundler query = new StringBundler(2);
2292
2293 query.append(_FILTER_SQL_COUNT_DDLRECORDSET_WHERE);
2294
2295 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2296
2297 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2298 DDLRecordSet.class.getName(),
2299 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
2300
2301 Session session = null;
2302
2303 try {
2304 session = openSession();
2305
2306 SQLQuery q = session.createSQLQuery(sql);
2307
2308 q.addScalar(COUNT_COLUMN_NAME,
2309 com.liferay.portal.kernel.dao.orm.Type.LONG);
2310
2311 QueryPos qPos = QueryPos.getInstance(q);
2312
2313 qPos.add(groupId);
2314
2315 Long count = (Long)q.uniqueResult();
2316
2317 return count.intValue();
2318 }
2319 catch (Exception e) {
2320 throw processException(e);
2321 }
2322 finally {
2323 closeSession(session);
2324 }
2325 }
2326
2327
2335 public int countByG_R(long groupId, String recordSetKey)
2336 throws SystemException {
2337 Object[] finderArgs = new Object[] { groupId, recordSetKey };
2338
2339 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_R,
2340 finderArgs, this);
2341
2342 if (count == null) {
2343 StringBundler query = new StringBundler(3);
2344
2345 query.append(_SQL_COUNT_DDLRECORDSET_WHERE);
2346
2347 query.append(_FINDER_COLUMN_G_R_GROUPID_2);
2348
2349 if (recordSetKey == null) {
2350 query.append(_FINDER_COLUMN_G_R_RECORDSETKEY_1);
2351 }
2352 else {
2353 if (recordSetKey.equals(StringPool.BLANK)) {
2354 query.append(_FINDER_COLUMN_G_R_RECORDSETKEY_3);
2355 }
2356 else {
2357 query.append(_FINDER_COLUMN_G_R_RECORDSETKEY_2);
2358 }
2359 }
2360
2361 String sql = query.toString();
2362
2363 Session session = null;
2364
2365 try {
2366 session = openSession();
2367
2368 Query q = session.createQuery(sql);
2369
2370 QueryPos qPos = QueryPos.getInstance(q);
2371
2372 qPos.add(groupId);
2373
2374 if (recordSetKey != null) {
2375 qPos.add(recordSetKey);
2376 }
2377
2378 count = (Long)q.uniqueResult();
2379 }
2380 catch (Exception e) {
2381 throw processException(e);
2382 }
2383 finally {
2384 if (count == null) {
2385 count = Long.valueOf(0);
2386 }
2387
2388 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_R, finderArgs,
2389 count);
2390
2391 closeSession(session);
2392 }
2393 }
2394
2395 return count.intValue();
2396 }
2397
2398
2404 public int countAll() throws SystemException {
2405 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2406 FINDER_ARGS_EMPTY, this);
2407
2408 if (count == null) {
2409 Session session = null;
2410
2411 try {
2412 session = openSession();
2413
2414 Query q = session.createQuery(_SQL_COUNT_DDLRECORDSET);
2415
2416 count = (Long)q.uniqueResult();
2417 }
2418 catch (Exception e) {
2419 throw processException(e);
2420 }
2421 finally {
2422 if (count == null) {
2423 count = Long.valueOf(0);
2424 }
2425
2426 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
2427 FINDER_ARGS_EMPTY, count);
2428
2429 closeSession(session);
2430 }
2431 }
2432
2433 return count.intValue();
2434 }
2435
2436
2439 public void afterPropertiesSet() {
2440 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2441 com.liferay.portal.util.PropsUtil.get(
2442 "value.object.listener.com.liferay.portlet.dynamicdatalists.model.DDLRecordSet")));
2443
2444 if (listenerClassNames.length > 0) {
2445 try {
2446 List<ModelListener<DDLRecordSet>> listenersList = new ArrayList<ModelListener<DDLRecordSet>>();
2447
2448 for (String listenerClassName : listenerClassNames) {
2449 listenersList.add((ModelListener<DDLRecordSet>)InstanceFactory.newInstance(
2450 listenerClassName));
2451 }
2452
2453 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2454 }
2455 catch (Exception e) {
2456 _log.error(e);
2457 }
2458 }
2459 }
2460
2461 public void destroy() {
2462 EntityCacheUtil.removeCache(DDLRecordSetImpl.class.getName());
2463 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
2464 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2465 }
2466
2467 @BeanReference(type = DDLRecordPersistence.class)
2468 protected DDLRecordPersistence ddlRecordPersistence;
2469 @BeanReference(type = DDLRecordSetPersistence.class)
2470 protected DDLRecordSetPersistence ddlRecordSetPersistence;
2471 @BeanReference(type = DDLRecordVersionPersistence.class)
2472 protected DDLRecordVersionPersistence ddlRecordVersionPersistence;
2473 @BeanReference(type = ResourcePersistence.class)
2474 protected ResourcePersistence resourcePersistence;
2475 @BeanReference(type = UserPersistence.class)
2476 protected UserPersistence userPersistence;
2477 @BeanReference(type = DDMStructurePersistence.class)
2478 protected DDMStructurePersistence ddmStructurePersistence;
2479 @BeanReference(type = DDMStructureLinkPersistence.class)
2480 protected DDMStructureLinkPersistence ddmStructureLinkPersistence;
2481 private static final String _SQL_SELECT_DDLRECORDSET = "SELECT ddlRecordSet FROM DDLRecordSet ddlRecordSet";
2482 private static final String _SQL_SELECT_DDLRECORDSET_WHERE = "SELECT ddlRecordSet FROM DDLRecordSet ddlRecordSet WHERE ";
2483 private static final String _SQL_COUNT_DDLRECORDSET = "SELECT COUNT(ddlRecordSet) FROM DDLRecordSet ddlRecordSet";
2484 private static final String _SQL_COUNT_DDLRECORDSET_WHERE = "SELECT COUNT(ddlRecordSet) FROM DDLRecordSet ddlRecordSet WHERE ";
2485 private static final String _FINDER_COLUMN_UUID_UUID_1 = "ddlRecordSet.uuid IS NULL";
2486 private static final String _FINDER_COLUMN_UUID_UUID_2 = "ddlRecordSet.uuid = ?";
2487 private static final String _FINDER_COLUMN_UUID_UUID_3 = "(ddlRecordSet.uuid IS NULL OR ddlRecordSet.uuid = ?)";
2488 private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "ddlRecordSet.uuid IS NULL AND ";
2489 private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "ddlRecordSet.uuid = ? AND ";
2490 private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(ddlRecordSet.uuid IS NULL OR ddlRecordSet.uuid = ?) AND ";
2491 private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "ddlRecordSet.groupId = ?";
2492 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "ddlRecordSet.groupId = ?";
2493 private static final String _FINDER_COLUMN_G_R_GROUPID_2 = "ddlRecordSet.groupId = ? AND ";
2494 private static final String _FINDER_COLUMN_G_R_RECORDSETKEY_1 = "ddlRecordSet.recordSetKey IS NULL";
2495 private static final String _FINDER_COLUMN_G_R_RECORDSETKEY_2 = "ddlRecordSet.recordSetKey = ?";
2496 private static final String _FINDER_COLUMN_G_R_RECORDSETKEY_3 = "(ddlRecordSet.recordSetKey IS NULL OR ddlRecordSet.recordSetKey = ?)";
2497 private static final String _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN = "ddlRecordSet.recordSetId";
2498 private static final String _FILTER_SQL_SELECT_DDLRECORDSET_WHERE = "SELECT DISTINCT {ddlRecordSet.*} FROM DDLRecordSet ddlRecordSet WHERE ";
2499 private static final String _FILTER_SQL_SELECT_DDLRECORDSET_NO_INLINE_DISTINCT_WHERE_1 =
2500 "SELECT {DDLRecordSet.*} FROM (SELECT DISTINCT ddlRecordSet.recordSetId FROM DDLRecordSet ddlRecordSet WHERE ";
2501 private static final String _FILTER_SQL_SELECT_DDLRECORDSET_NO_INLINE_DISTINCT_WHERE_2 =
2502 ") TEMP_TABLE INNER JOIN DDLRecordSet ON TEMP_TABLE.recordSetId = DDLRecordSet.recordSetId";
2503 private static final String _FILTER_SQL_COUNT_DDLRECORDSET_WHERE = "SELECT COUNT(DISTINCT ddlRecordSet.recordSetId) AS COUNT_VALUE FROM DDLRecordSet ddlRecordSet WHERE ";
2504 private static final String _FILTER_ENTITY_ALIAS = "ddlRecordSet";
2505 private static final String _FILTER_ENTITY_TABLE = "DDLRecordSet";
2506 private static final String _ORDER_BY_ENTITY_ALIAS = "ddlRecordSet.";
2507 private static final String _ORDER_BY_ENTITY_TABLE = "DDLRecordSet.";
2508 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No DDLRecordSet exists with the primary key ";
2509 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No DDLRecordSet exists with the key {";
2510 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
2511 private static Log _log = LogFactoryUtil.getLog(DDLRecordSetPersistenceImpl.class);
2512 private static DDLRecordSet _nullDDLRecordSet = new DDLRecordSetImpl() {
2513 @Override
2514 public Object clone() {
2515 return this;
2516 }
2517
2518 @Override
2519 public CacheModel<DDLRecordSet> toCacheModel() {
2520 return _nullDDLRecordSetCacheModel;
2521 }
2522 };
2523
2524 private static CacheModel<DDLRecordSet> _nullDDLRecordSetCacheModel = new CacheModel<DDLRecordSet>() {
2525 public DDLRecordSet toEntityModel() {
2526 return _nullDDLRecordSet;
2527 }
2528 };
2529 }