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_WITH_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_WITHOUT_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 else {
393 if ((ddlRecordSetModelImpl.getColumnBitmask() &
394 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID.getColumnBitmask()) != 0) {
395 Object[] args = new Object[] {
396 ddlRecordSetModelImpl.getOriginalUuid()
397 };
398
399 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
400 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
401 args);
402
403 args = new Object[] { ddlRecordSetModelImpl.getUuid() };
404
405 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
406 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
407 args);
408 }
409
410 if ((ddlRecordSetModelImpl.getColumnBitmask() &
411 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID.getColumnBitmask()) != 0) {
412 Object[] args = new Object[] {
413 Long.valueOf(ddlRecordSetModelImpl.getOriginalGroupId())
414 };
415
416 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
417 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
418 args);
419
420 args = new Object[] {
421 Long.valueOf(ddlRecordSetModelImpl.getGroupId())
422 };
423
424 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
425 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
426 args);
427 }
428 }
429
430 EntityCacheUtil.putResult(DDLRecordSetModelImpl.ENTITY_CACHE_ENABLED,
431 DDLRecordSetImpl.class, ddlRecordSet.getPrimaryKey(), ddlRecordSet);
432
433 if (isNew) {
434 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
435 new Object[] {
436 ddlRecordSet.getUuid(),
437 Long.valueOf(ddlRecordSet.getGroupId())
438 }, ddlRecordSet);
439
440 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_R,
441 new Object[] {
442 Long.valueOf(ddlRecordSet.getGroupId()),
443
444 ddlRecordSet.getRecordSetKey()
445 }, ddlRecordSet);
446 }
447 else {
448 if ((ddlRecordSetModelImpl.getColumnBitmask() &
449 FINDER_PATH_FETCH_BY_UUID_G.getColumnBitmask()) != 0) {
450 Object[] args = new Object[] {
451 ddlRecordSetModelImpl.getOriginalUuid(),
452 Long.valueOf(ddlRecordSetModelImpl.getOriginalGroupId())
453 };
454
455 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID_G, args);
456 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G, args);
457
458 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
459 new Object[] {
460 ddlRecordSet.getUuid(),
461 Long.valueOf(ddlRecordSet.getGroupId())
462 }, ddlRecordSet);
463 }
464
465 if ((ddlRecordSetModelImpl.getColumnBitmask() &
466 FINDER_PATH_FETCH_BY_G_R.getColumnBitmask()) != 0) {
467 Object[] args = new Object[] {
468 Long.valueOf(ddlRecordSetModelImpl.getOriginalGroupId()),
469
470 ddlRecordSetModelImpl.getOriginalRecordSetKey()
471 };
472
473 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_R, args);
474 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_R, args);
475
476 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_R,
477 new Object[] {
478 Long.valueOf(ddlRecordSet.getGroupId()),
479
480 ddlRecordSet.getRecordSetKey()
481 }, ddlRecordSet);
482 }
483 }
484
485 return ddlRecordSet;
486 }
487
488 protected DDLRecordSet toUnwrappedModel(DDLRecordSet ddlRecordSet) {
489 if (ddlRecordSet instanceof DDLRecordSetImpl) {
490 return ddlRecordSet;
491 }
492
493 DDLRecordSetImpl ddlRecordSetImpl = new DDLRecordSetImpl();
494
495 ddlRecordSetImpl.setNew(ddlRecordSet.isNew());
496 ddlRecordSetImpl.setPrimaryKey(ddlRecordSet.getPrimaryKey());
497
498 ddlRecordSetImpl.setUuid(ddlRecordSet.getUuid());
499 ddlRecordSetImpl.setRecordSetId(ddlRecordSet.getRecordSetId());
500 ddlRecordSetImpl.setGroupId(ddlRecordSet.getGroupId());
501 ddlRecordSetImpl.setCompanyId(ddlRecordSet.getCompanyId());
502 ddlRecordSetImpl.setUserId(ddlRecordSet.getUserId());
503 ddlRecordSetImpl.setUserName(ddlRecordSet.getUserName());
504 ddlRecordSetImpl.setCreateDate(ddlRecordSet.getCreateDate());
505 ddlRecordSetImpl.setModifiedDate(ddlRecordSet.getModifiedDate());
506 ddlRecordSetImpl.setDDMStructureId(ddlRecordSet.getDDMStructureId());
507 ddlRecordSetImpl.setRecordSetKey(ddlRecordSet.getRecordSetKey());
508 ddlRecordSetImpl.setName(ddlRecordSet.getName());
509 ddlRecordSetImpl.setDescription(ddlRecordSet.getDescription());
510 ddlRecordSetImpl.setMinDisplayRows(ddlRecordSet.getMinDisplayRows());
511 ddlRecordSetImpl.setScope(ddlRecordSet.getScope());
512
513 return ddlRecordSetImpl;
514 }
515
516
524 @Override
525 public DDLRecordSet findByPrimaryKey(Serializable primaryKey)
526 throws NoSuchModelException, SystemException {
527 return findByPrimaryKey(((Long)primaryKey).longValue());
528 }
529
530
538 public DDLRecordSet findByPrimaryKey(long recordSetId)
539 throws NoSuchRecordSetException, SystemException {
540 DDLRecordSet ddlRecordSet = fetchByPrimaryKey(recordSetId);
541
542 if (ddlRecordSet == null) {
543 if (_log.isWarnEnabled()) {
544 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + recordSetId);
545 }
546
547 throw new NoSuchRecordSetException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
548 recordSetId);
549 }
550
551 return ddlRecordSet;
552 }
553
554
561 @Override
562 public DDLRecordSet fetchByPrimaryKey(Serializable primaryKey)
563 throws SystemException {
564 return fetchByPrimaryKey(((Long)primaryKey).longValue());
565 }
566
567
574 public DDLRecordSet fetchByPrimaryKey(long recordSetId)
575 throws SystemException {
576 DDLRecordSet ddlRecordSet = (DDLRecordSet)EntityCacheUtil.getResult(DDLRecordSetModelImpl.ENTITY_CACHE_ENABLED,
577 DDLRecordSetImpl.class, recordSetId);
578
579 if (ddlRecordSet == _nullDDLRecordSet) {
580 return null;
581 }
582
583 if (ddlRecordSet == null) {
584 Session session = null;
585
586 boolean hasException = false;
587
588 try {
589 session = openSession();
590
591 ddlRecordSet = (DDLRecordSet)session.get(DDLRecordSetImpl.class,
592 Long.valueOf(recordSetId));
593 }
594 catch (Exception e) {
595 hasException = true;
596
597 throw processException(e);
598 }
599 finally {
600 if (ddlRecordSet != null) {
601 cacheResult(ddlRecordSet);
602 }
603 else if (!hasException) {
604 EntityCacheUtil.putResult(DDLRecordSetModelImpl.ENTITY_CACHE_ENABLED,
605 DDLRecordSetImpl.class, recordSetId, _nullDDLRecordSet);
606 }
607
608 closeSession(session);
609 }
610 }
611
612 return ddlRecordSet;
613 }
614
615
622 public List<DDLRecordSet> findByUuid(String uuid) throws SystemException {
623 return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
624 }
625
626
639 public List<DDLRecordSet> findByUuid(String uuid, int start, int end)
640 throws SystemException {
641 return findByUuid(uuid, start, end, null);
642 }
643
644
658 public List<DDLRecordSet> findByUuid(String uuid, int start, int end,
659 OrderByComparator orderByComparator) throws SystemException {
660 FinderPath finderPath = null;
661 Object[] finderArgs = null;
662
663 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
664 (orderByComparator == null)) {
665 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID;
666 finderArgs = new Object[] { uuid };
667 }
668 else {
669 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID;
670 finderArgs = new Object[] { uuid, start, end, orderByComparator };
671 }
672
673 List<DDLRecordSet> list = (List<DDLRecordSet>)FinderCacheUtil.getResult(finderPath,
674 finderArgs, this);
675
676 if ((list != null) && !list.isEmpty()) {
677 for (DDLRecordSet ddlRecordSet : list) {
678 if (!Validator.equals(uuid, ddlRecordSet.getUuid())) {
679 list = null;
680
681 break;
682 }
683 }
684 }
685
686 if (list == null) {
687 StringBundler query = null;
688
689 if (orderByComparator != null) {
690 query = new StringBundler(3 +
691 (orderByComparator.getOrderByFields().length * 3));
692 }
693 else {
694 query = new StringBundler(2);
695 }
696
697 query.append(_SQL_SELECT_DDLRECORDSET_WHERE);
698
699 if (uuid == null) {
700 query.append(_FINDER_COLUMN_UUID_UUID_1);
701 }
702 else {
703 if (uuid.equals(StringPool.BLANK)) {
704 query.append(_FINDER_COLUMN_UUID_UUID_3);
705 }
706 else {
707 query.append(_FINDER_COLUMN_UUID_UUID_2);
708 }
709 }
710
711 if (orderByComparator != null) {
712 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
713 orderByComparator);
714 }
715
716 String sql = query.toString();
717
718 Session session = null;
719
720 try {
721 session = openSession();
722
723 Query q = session.createQuery(sql);
724
725 QueryPos qPos = QueryPos.getInstance(q);
726
727 if (uuid != null) {
728 qPos.add(uuid);
729 }
730
731 list = (List<DDLRecordSet>)QueryUtil.list(q, getDialect(),
732 start, end);
733 }
734 catch (Exception e) {
735 throw processException(e);
736 }
737 finally {
738 if (list == null) {
739 FinderCacheUtil.removeResult(finderPath, finderArgs);
740 }
741 else {
742 cacheResult(list);
743
744 FinderCacheUtil.putResult(finderPath, finderArgs, list);
745 }
746
747 closeSession(session);
748 }
749 }
750
751 return list;
752 }
753
754
767 public DDLRecordSet findByUuid_First(String uuid,
768 OrderByComparator orderByComparator)
769 throws NoSuchRecordSetException, SystemException {
770 List<DDLRecordSet> list = findByUuid(uuid, 0, 1, orderByComparator);
771
772 if (list.isEmpty()) {
773 StringBundler msg = new StringBundler(4);
774
775 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
776
777 msg.append("uuid=");
778 msg.append(uuid);
779
780 msg.append(StringPool.CLOSE_CURLY_BRACE);
781
782 throw new NoSuchRecordSetException(msg.toString());
783 }
784 else {
785 return list.get(0);
786 }
787 }
788
789
802 public DDLRecordSet findByUuid_Last(String uuid,
803 OrderByComparator orderByComparator)
804 throws NoSuchRecordSetException, SystemException {
805 int count = countByUuid(uuid);
806
807 List<DDLRecordSet> list = findByUuid(uuid, count - 1, count,
808 orderByComparator);
809
810 if (list.isEmpty()) {
811 StringBundler msg = new StringBundler(4);
812
813 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
814
815 msg.append("uuid=");
816 msg.append(uuid);
817
818 msg.append(StringPool.CLOSE_CURLY_BRACE);
819
820 throw new NoSuchRecordSetException(msg.toString());
821 }
822 else {
823 return list.get(0);
824 }
825 }
826
827
841 public DDLRecordSet[] findByUuid_PrevAndNext(long recordSetId, String uuid,
842 OrderByComparator orderByComparator)
843 throws NoSuchRecordSetException, SystemException {
844 DDLRecordSet ddlRecordSet = findByPrimaryKey(recordSetId);
845
846 Session session = null;
847
848 try {
849 session = openSession();
850
851 DDLRecordSet[] array = new DDLRecordSetImpl[3];
852
853 array[0] = getByUuid_PrevAndNext(session, ddlRecordSet, uuid,
854 orderByComparator, true);
855
856 array[1] = ddlRecordSet;
857
858 array[2] = getByUuid_PrevAndNext(session, ddlRecordSet, uuid,
859 orderByComparator, false);
860
861 return array;
862 }
863 catch (Exception e) {
864 throw processException(e);
865 }
866 finally {
867 closeSession(session);
868 }
869 }
870
871 protected DDLRecordSet getByUuid_PrevAndNext(Session session,
872 DDLRecordSet ddlRecordSet, String uuid,
873 OrderByComparator orderByComparator, boolean previous) {
874 StringBundler query = null;
875
876 if (orderByComparator != null) {
877 query = new StringBundler(6 +
878 (orderByComparator.getOrderByFields().length * 6));
879 }
880 else {
881 query = new StringBundler(3);
882 }
883
884 query.append(_SQL_SELECT_DDLRECORDSET_WHERE);
885
886 if (uuid == null) {
887 query.append(_FINDER_COLUMN_UUID_UUID_1);
888 }
889 else {
890 if (uuid.equals(StringPool.BLANK)) {
891 query.append(_FINDER_COLUMN_UUID_UUID_3);
892 }
893 else {
894 query.append(_FINDER_COLUMN_UUID_UUID_2);
895 }
896 }
897
898 if (orderByComparator != null) {
899 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
900
901 if (orderByConditionFields.length > 0) {
902 query.append(WHERE_AND);
903 }
904
905 for (int i = 0; i < orderByConditionFields.length; i++) {
906 query.append(_ORDER_BY_ENTITY_ALIAS);
907 query.append(orderByConditionFields[i]);
908
909 if ((i + 1) < orderByConditionFields.length) {
910 if (orderByComparator.isAscending() ^ previous) {
911 query.append(WHERE_GREATER_THAN_HAS_NEXT);
912 }
913 else {
914 query.append(WHERE_LESSER_THAN_HAS_NEXT);
915 }
916 }
917 else {
918 if (orderByComparator.isAscending() ^ previous) {
919 query.append(WHERE_GREATER_THAN);
920 }
921 else {
922 query.append(WHERE_LESSER_THAN);
923 }
924 }
925 }
926
927 query.append(ORDER_BY_CLAUSE);
928
929 String[] orderByFields = orderByComparator.getOrderByFields();
930
931 for (int i = 0; i < orderByFields.length; i++) {
932 query.append(_ORDER_BY_ENTITY_ALIAS);
933 query.append(orderByFields[i]);
934
935 if ((i + 1) < orderByFields.length) {
936 if (orderByComparator.isAscending() ^ previous) {
937 query.append(ORDER_BY_ASC_HAS_NEXT);
938 }
939 else {
940 query.append(ORDER_BY_DESC_HAS_NEXT);
941 }
942 }
943 else {
944 if (orderByComparator.isAscending() ^ previous) {
945 query.append(ORDER_BY_ASC);
946 }
947 else {
948 query.append(ORDER_BY_DESC);
949 }
950 }
951 }
952 }
953
954 String sql = query.toString();
955
956 Query q = session.createQuery(sql);
957
958 q.setFirstResult(0);
959 q.setMaxResults(2);
960
961 QueryPos qPos = QueryPos.getInstance(q);
962
963 if (uuid != null) {
964 qPos.add(uuid);
965 }
966
967 if (orderByComparator != null) {
968 Object[] values = orderByComparator.getOrderByConditionValues(ddlRecordSet);
969
970 for (Object value : values) {
971 qPos.add(value);
972 }
973 }
974
975 List<DDLRecordSet> list = q.list();
976
977 if (list.size() == 2) {
978 return list.get(1);
979 }
980 else {
981 return null;
982 }
983 }
984
985
994 public DDLRecordSet findByUUID_G(String uuid, long groupId)
995 throws NoSuchRecordSetException, SystemException {
996 DDLRecordSet ddlRecordSet = fetchByUUID_G(uuid, groupId);
997
998 if (ddlRecordSet == null) {
999 StringBundler msg = new StringBundler(6);
1000
1001 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1002
1003 msg.append("uuid=");
1004 msg.append(uuid);
1005
1006 msg.append(", groupId=");
1007 msg.append(groupId);
1008
1009 msg.append(StringPool.CLOSE_CURLY_BRACE);
1010
1011 if (_log.isWarnEnabled()) {
1012 _log.warn(msg.toString());
1013 }
1014
1015 throw new NoSuchRecordSetException(msg.toString());
1016 }
1017
1018 return ddlRecordSet;
1019 }
1020
1021
1029 public DDLRecordSet fetchByUUID_G(String uuid, long groupId)
1030 throws SystemException {
1031 return fetchByUUID_G(uuid, groupId, true);
1032 }
1033
1034
1043 public DDLRecordSet fetchByUUID_G(String uuid, long groupId,
1044 boolean retrieveFromCache) throws SystemException {
1045 Object[] finderArgs = new Object[] { uuid, groupId };
1046
1047 Object result = null;
1048
1049 if (retrieveFromCache) {
1050 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
1051 finderArgs, this);
1052 }
1053
1054 if (result instanceof DDLRecordSet) {
1055 DDLRecordSet ddlRecordSet = (DDLRecordSet)result;
1056
1057 if (!Validator.equals(uuid, ddlRecordSet.getUuid()) ||
1058 (groupId != ddlRecordSet.getGroupId())) {
1059 result = null;
1060 }
1061 }
1062
1063 if (result == null) {
1064 StringBundler query = new StringBundler(3);
1065
1066 query.append(_SQL_SELECT_DDLRECORDSET_WHERE);
1067
1068 if (uuid == null) {
1069 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
1070 }
1071 else {
1072 if (uuid.equals(StringPool.BLANK)) {
1073 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
1074 }
1075 else {
1076 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
1077 }
1078 }
1079
1080 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
1081
1082 String sql = query.toString();
1083
1084 Session session = null;
1085
1086 try {
1087 session = openSession();
1088
1089 Query q = session.createQuery(sql);
1090
1091 QueryPos qPos = QueryPos.getInstance(q);
1092
1093 if (uuid != null) {
1094 qPos.add(uuid);
1095 }
1096
1097 qPos.add(groupId);
1098
1099 List<DDLRecordSet> list = q.list();
1100
1101 result = list;
1102
1103 DDLRecordSet ddlRecordSet = null;
1104
1105 if (list.isEmpty()) {
1106 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1107 finderArgs, list);
1108 }
1109 else {
1110 ddlRecordSet = list.get(0);
1111
1112 cacheResult(ddlRecordSet);
1113
1114 if ((ddlRecordSet.getUuid() == null) ||
1115 !ddlRecordSet.getUuid().equals(uuid) ||
1116 (ddlRecordSet.getGroupId() != groupId)) {
1117 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1118 finderArgs, ddlRecordSet);
1119 }
1120 }
1121
1122 return ddlRecordSet;
1123 }
1124 catch (Exception e) {
1125 throw processException(e);
1126 }
1127 finally {
1128 if (result == null) {
1129 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
1130 finderArgs);
1131 }
1132
1133 closeSession(session);
1134 }
1135 }
1136 else {
1137 if (result instanceof List<?>) {
1138 return null;
1139 }
1140 else {
1141 return (DDLRecordSet)result;
1142 }
1143 }
1144 }
1145
1146
1153 public List<DDLRecordSet> findByGroupId(long groupId)
1154 throws SystemException {
1155 return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1156 }
1157
1158
1171 public List<DDLRecordSet> findByGroupId(long groupId, int start, int end)
1172 throws SystemException {
1173 return findByGroupId(groupId, start, end, null);
1174 }
1175
1176
1190 public List<DDLRecordSet> findByGroupId(long groupId, int start, int end,
1191 OrderByComparator orderByComparator) throws SystemException {
1192 FinderPath finderPath = null;
1193 Object[] finderArgs = null;
1194
1195 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1196 (orderByComparator == null)) {
1197 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID;
1198 finderArgs = new Object[] { groupId };
1199 }
1200 else {
1201 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID;
1202 finderArgs = new Object[] { groupId, start, end, orderByComparator };
1203 }
1204
1205 List<DDLRecordSet> list = (List<DDLRecordSet>)FinderCacheUtil.getResult(finderPath,
1206 finderArgs, this);
1207
1208 if ((list != null) && !list.isEmpty()) {
1209 for (DDLRecordSet ddlRecordSet : list) {
1210 if ((groupId != ddlRecordSet.getGroupId())) {
1211 list = null;
1212
1213 break;
1214 }
1215 }
1216 }
1217
1218 if (list == null) {
1219 StringBundler query = null;
1220
1221 if (orderByComparator != null) {
1222 query = new StringBundler(3 +
1223 (orderByComparator.getOrderByFields().length * 3));
1224 }
1225 else {
1226 query = new StringBundler(2);
1227 }
1228
1229 query.append(_SQL_SELECT_DDLRECORDSET_WHERE);
1230
1231 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1232
1233 if (orderByComparator != null) {
1234 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1235 orderByComparator);
1236 }
1237
1238 String sql = query.toString();
1239
1240 Session session = null;
1241
1242 try {
1243 session = openSession();
1244
1245 Query q = session.createQuery(sql);
1246
1247 QueryPos qPos = QueryPos.getInstance(q);
1248
1249 qPos.add(groupId);
1250
1251 list = (List<DDLRecordSet>)QueryUtil.list(q, getDialect(),
1252 start, end);
1253 }
1254 catch (Exception e) {
1255 throw processException(e);
1256 }
1257 finally {
1258 if (list == null) {
1259 FinderCacheUtil.removeResult(finderPath, finderArgs);
1260 }
1261 else {
1262 cacheResult(list);
1263
1264 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1265 }
1266
1267 closeSession(session);
1268 }
1269 }
1270
1271 return list;
1272 }
1273
1274
1287 public DDLRecordSet findByGroupId_First(long groupId,
1288 OrderByComparator orderByComparator)
1289 throws NoSuchRecordSetException, SystemException {
1290 List<DDLRecordSet> list = findByGroupId(groupId, 0, 1, orderByComparator);
1291
1292 if (list.isEmpty()) {
1293 StringBundler msg = new StringBundler(4);
1294
1295 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1296
1297 msg.append("groupId=");
1298 msg.append(groupId);
1299
1300 msg.append(StringPool.CLOSE_CURLY_BRACE);
1301
1302 throw new NoSuchRecordSetException(msg.toString());
1303 }
1304 else {
1305 return list.get(0);
1306 }
1307 }
1308
1309
1322 public DDLRecordSet findByGroupId_Last(long groupId,
1323 OrderByComparator orderByComparator)
1324 throws NoSuchRecordSetException, SystemException {
1325 int count = countByGroupId(groupId);
1326
1327 List<DDLRecordSet> list = findByGroupId(groupId, count - 1, count,
1328 orderByComparator);
1329
1330 if (list.isEmpty()) {
1331 StringBundler msg = new StringBundler(4);
1332
1333 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1334
1335 msg.append("groupId=");
1336 msg.append(groupId);
1337
1338 msg.append(StringPool.CLOSE_CURLY_BRACE);
1339
1340 throw new NoSuchRecordSetException(msg.toString());
1341 }
1342 else {
1343 return list.get(0);
1344 }
1345 }
1346
1347
1361 public DDLRecordSet[] findByGroupId_PrevAndNext(long recordSetId,
1362 long groupId, OrderByComparator orderByComparator)
1363 throws NoSuchRecordSetException, SystemException {
1364 DDLRecordSet ddlRecordSet = findByPrimaryKey(recordSetId);
1365
1366 Session session = null;
1367
1368 try {
1369 session = openSession();
1370
1371 DDLRecordSet[] array = new DDLRecordSetImpl[3];
1372
1373 array[0] = getByGroupId_PrevAndNext(session, ddlRecordSet, groupId,
1374 orderByComparator, true);
1375
1376 array[1] = ddlRecordSet;
1377
1378 array[2] = getByGroupId_PrevAndNext(session, ddlRecordSet, groupId,
1379 orderByComparator, false);
1380
1381 return array;
1382 }
1383 catch (Exception e) {
1384 throw processException(e);
1385 }
1386 finally {
1387 closeSession(session);
1388 }
1389 }
1390
1391 protected DDLRecordSet getByGroupId_PrevAndNext(Session session,
1392 DDLRecordSet ddlRecordSet, long groupId,
1393 OrderByComparator orderByComparator, boolean previous) {
1394 StringBundler query = null;
1395
1396 if (orderByComparator != null) {
1397 query = new StringBundler(6 +
1398 (orderByComparator.getOrderByFields().length * 6));
1399 }
1400 else {
1401 query = new StringBundler(3);
1402 }
1403
1404 query.append(_SQL_SELECT_DDLRECORDSET_WHERE);
1405
1406 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1407
1408 if (orderByComparator != null) {
1409 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1410
1411 if (orderByConditionFields.length > 0) {
1412 query.append(WHERE_AND);
1413 }
1414
1415 for (int i = 0; i < orderByConditionFields.length; i++) {
1416 query.append(_ORDER_BY_ENTITY_ALIAS);
1417 query.append(orderByConditionFields[i]);
1418
1419 if ((i + 1) < orderByConditionFields.length) {
1420 if (orderByComparator.isAscending() ^ previous) {
1421 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1422 }
1423 else {
1424 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1425 }
1426 }
1427 else {
1428 if (orderByComparator.isAscending() ^ previous) {
1429 query.append(WHERE_GREATER_THAN);
1430 }
1431 else {
1432 query.append(WHERE_LESSER_THAN);
1433 }
1434 }
1435 }
1436
1437 query.append(ORDER_BY_CLAUSE);
1438
1439 String[] orderByFields = orderByComparator.getOrderByFields();
1440
1441 for (int i = 0; i < orderByFields.length; i++) {
1442 query.append(_ORDER_BY_ENTITY_ALIAS);
1443 query.append(orderByFields[i]);
1444
1445 if ((i + 1) < orderByFields.length) {
1446 if (orderByComparator.isAscending() ^ previous) {
1447 query.append(ORDER_BY_ASC_HAS_NEXT);
1448 }
1449 else {
1450 query.append(ORDER_BY_DESC_HAS_NEXT);
1451 }
1452 }
1453 else {
1454 if (orderByComparator.isAscending() ^ previous) {
1455 query.append(ORDER_BY_ASC);
1456 }
1457 else {
1458 query.append(ORDER_BY_DESC);
1459 }
1460 }
1461 }
1462 }
1463
1464 String sql = query.toString();
1465
1466 Query q = session.createQuery(sql);
1467
1468 q.setFirstResult(0);
1469 q.setMaxResults(2);
1470
1471 QueryPos qPos = QueryPos.getInstance(q);
1472
1473 qPos.add(groupId);
1474
1475 if (orderByComparator != null) {
1476 Object[] values = orderByComparator.getOrderByConditionValues(ddlRecordSet);
1477
1478 for (Object value : values) {
1479 qPos.add(value);
1480 }
1481 }
1482
1483 List<DDLRecordSet> list = q.list();
1484
1485 if (list.size() == 2) {
1486 return list.get(1);
1487 }
1488 else {
1489 return null;
1490 }
1491 }
1492
1493
1500 public List<DDLRecordSet> filterFindByGroupId(long groupId)
1501 throws SystemException {
1502 return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
1503 QueryUtil.ALL_POS, null);
1504 }
1505
1506
1519 public List<DDLRecordSet> filterFindByGroupId(long groupId, int start,
1520 int end) throws SystemException {
1521 return filterFindByGroupId(groupId, start, end, null);
1522 }
1523
1524
1538 public List<DDLRecordSet> filterFindByGroupId(long groupId, int start,
1539 int end, OrderByComparator orderByComparator) throws SystemException {
1540 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1541 return findByGroupId(groupId, start, end, orderByComparator);
1542 }
1543
1544 StringBundler query = null;
1545
1546 if (orderByComparator != null) {
1547 query = new StringBundler(3 +
1548 (orderByComparator.getOrderByFields().length * 3));
1549 }
1550 else {
1551 query = new StringBundler(2);
1552 }
1553
1554 if (getDB().isSupportsInlineDistinct()) {
1555 query.append(_FILTER_SQL_SELECT_DDLRECORDSET_WHERE);
1556 }
1557 else {
1558 query.append(_FILTER_SQL_SELECT_DDLRECORDSET_NO_INLINE_DISTINCT_WHERE_1);
1559 }
1560
1561 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1562
1563 if (!getDB().isSupportsInlineDistinct()) {
1564 query.append(_FILTER_SQL_SELECT_DDLRECORDSET_NO_INLINE_DISTINCT_WHERE_2);
1565 }
1566
1567 if (orderByComparator != null) {
1568 if (getDB().isSupportsInlineDistinct()) {
1569 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1570 orderByComparator);
1571 }
1572 else {
1573 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1574 orderByComparator);
1575 }
1576 }
1577
1578 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1579 DDLRecordSet.class.getName(),
1580 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
1581
1582 Session session = null;
1583
1584 try {
1585 session = openSession();
1586
1587 SQLQuery q = session.createSQLQuery(sql);
1588
1589 if (getDB().isSupportsInlineDistinct()) {
1590 q.addEntity(_FILTER_ENTITY_ALIAS, DDLRecordSetImpl.class);
1591 }
1592 else {
1593 q.addEntity(_FILTER_ENTITY_TABLE, DDLRecordSetImpl.class);
1594 }
1595
1596 QueryPos qPos = QueryPos.getInstance(q);
1597
1598 qPos.add(groupId);
1599
1600 return (List<DDLRecordSet>)QueryUtil.list(q, getDialect(), start,
1601 end);
1602 }
1603 catch (Exception e) {
1604 throw processException(e);
1605 }
1606 finally {
1607 closeSession(session);
1608 }
1609 }
1610
1611
1621 public DDLRecordSet[] filterFindByGroupId_PrevAndNext(long recordSetId,
1622 long groupId, OrderByComparator orderByComparator)
1623 throws NoSuchRecordSetException, SystemException {
1624 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1625 return findByGroupId_PrevAndNext(recordSetId, groupId,
1626 orderByComparator);
1627 }
1628
1629 DDLRecordSet ddlRecordSet = findByPrimaryKey(recordSetId);
1630
1631 Session session = null;
1632
1633 try {
1634 session = openSession();
1635
1636 DDLRecordSet[] array = new DDLRecordSetImpl[3];
1637
1638 array[0] = filterGetByGroupId_PrevAndNext(session, ddlRecordSet,
1639 groupId, orderByComparator, true);
1640
1641 array[1] = ddlRecordSet;
1642
1643 array[2] = filterGetByGroupId_PrevAndNext(session, ddlRecordSet,
1644 groupId, orderByComparator, false);
1645
1646 return array;
1647 }
1648 catch (Exception e) {
1649 throw processException(e);
1650 }
1651 finally {
1652 closeSession(session);
1653 }
1654 }
1655
1656 protected DDLRecordSet filterGetByGroupId_PrevAndNext(Session session,
1657 DDLRecordSet ddlRecordSet, long groupId,
1658 OrderByComparator orderByComparator, boolean previous) {
1659 StringBundler query = null;
1660
1661 if (orderByComparator != null) {
1662 query = new StringBundler(6 +
1663 (orderByComparator.getOrderByFields().length * 6));
1664 }
1665 else {
1666 query = new StringBundler(3);
1667 }
1668
1669 if (getDB().isSupportsInlineDistinct()) {
1670 query.append(_FILTER_SQL_SELECT_DDLRECORDSET_WHERE);
1671 }
1672 else {
1673 query.append(_FILTER_SQL_SELECT_DDLRECORDSET_NO_INLINE_DISTINCT_WHERE_1);
1674 }
1675
1676 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1677
1678 if (!getDB().isSupportsInlineDistinct()) {
1679 query.append(_FILTER_SQL_SELECT_DDLRECORDSET_NO_INLINE_DISTINCT_WHERE_2);
1680 }
1681
1682 if (orderByComparator != null) {
1683 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1684
1685 if (orderByConditionFields.length > 0) {
1686 query.append(WHERE_AND);
1687 }
1688
1689 for (int i = 0; i < orderByConditionFields.length; i++) {
1690 if (getDB().isSupportsInlineDistinct()) {
1691 query.append(_ORDER_BY_ENTITY_ALIAS);
1692 }
1693 else {
1694 query.append(_ORDER_BY_ENTITY_TABLE);
1695 }
1696
1697 query.append(orderByConditionFields[i]);
1698
1699 if ((i + 1) < orderByConditionFields.length) {
1700 if (orderByComparator.isAscending() ^ previous) {
1701 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1702 }
1703 else {
1704 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1705 }
1706 }
1707 else {
1708 if (orderByComparator.isAscending() ^ previous) {
1709 query.append(WHERE_GREATER_THAN);
1710 }
1711 else {
1712 query.append(WHERE_LESSER_THAN);
1713 }
1714 }
1715 }
1716
1717 query.append(ORDER_BY_CLAUSE);
1718
1719 String[] orderByFields = orderByComparator.getOrderByFields();
1720
1721 for (int i = 0; i < orderByFields.length; i++) {
1722 if (getDB().isSupportsInlineDistinct()) {
1723 query.append(_ORDER_BY_ENTITY_ALIAS);
1724 }
1725 else {
1726 query.append(_ORDER_BY_ENTITY_TABLE);
1727 }
1728
1729 query.append(orderByFields[i]);
1730
1731 if ((i + 1) < orderByFields.length) {
1732 if (orderByComparator.isAscending() ^ previous) {
1733 query.append(ORDER_BY_ASC_HAS_NEXT);
1734 }
1735 else {
1736 query.append(ORDER_BY_DESC_HAS_NEXT);
1737 }
1738 }
1739 else {
1740 if (orderByComparator.isAscending() ^ previous) {
1741 query.append(ORDER_BY_ASC);
1742 }
1743 else {
1744 query.append(ORDER_BY_DESC);
1745 }
1746 }
1747 }
1748 }
1749
1750 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1751 DDLRecordSet.class.getName(),
1752 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
1753
1754 SQLQuery q = session.createSQLQuery(sql);
1755
1756 q.setFirstResult(0);
1757 q.setMaxResults(2);
1758
1759 if (getDB().isSupportsInlineDistinct()) {
1760 q.addEntity(_FILTER_ENTITY_ALIAS, DDLRecordSetImpl.class);
1761 }
1762 else {
1763 q.addEntity(_FILTER_ENTITY_TABLE, DDLRecordSetImpl.class);
1764 }
1765
1766 QueryPos qPos = QueryPos.getInstance(q);
1767
1768 qPos.add(groupId);
1769
1770 if (orderByComparator != null) {
1771 Object[] values = orderByComparator.getOrderByConditionValues(ddlRecordSet);
1772
1773 for (Object value : values) {
1774 qPos.add(value);
1775 }
1776 }
1777
1778 List<DDLRecordSet> list = q.list();
1779
1780 if (list.size() == 2) {
1781 return list.get(1);
1782 }
1783 else {
1784 return null;
1785 }
1786 }
1787
1788
1797 public DDLRecordSet findByG_R(long groupId, String recordSetKey)
1798 throws NoSuchRecordSetException, SystemException {
1799 DDLRecordSet ddlRecordSet = fetchByG_R(groupId, recordSetKey);
1800
1801 if (ddlRecordSet == null) {
1802 StringBundler msg = new StringBundler(6);
1803
1804 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1805
1806 msg.append("groupId=");
1807 msg.append(groupId);
1808
1809 msg.append(", recordSetKey=");
1810 msg.append(recordSetKey);
1811
1812 msg.append(StringPool.CLOSE_CURLY_BRACE);
1813
1814 if (_log.isWarnEnabled()) {
1815 _log.warn(msg.toString());
1816 }
1817
1818 throw new NoSuchRecordSetException(msg.toString());
1819 }
1820
1821 return ddlRecordSet;
1822 }
1823
1824
1832 public DDLRecordSet fetchByG_R(long groupId, String recordSetKey)
1833 throws SystemException {
1834 return fetchByG_R(groupId, recordSetKey, true);
1835 }
1836
1837
1846 public DDLRecordSet fetchByG_R(long groupId, String recordSetKey,
1847 boolean retrieveFromCache) throws SystemException {
1848 Object[] finderArgs = new Object[] { groupId, recordSetKey };
1849
1850 Object result = null;
1851
1852 if (retrieveFromCache) {
1853 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_R,
1854 finderArgs, this);
1855 }
1856
1857 if (result instanceof DDLRecordSet) {
1858 DDLRecordSet ddlRecordSet = (DDLRecordSet)result;
1859
1860 if ((groupId != ddlRecordSet.getGroupId()) ||
1861 !Validator.equals(recordSetKey,
1862 ddlRecordSet.getRecordSetKey())) {
1863 result = null;
1864 }
1865 }
1866
1867 if (result == null) {
1868 StringBundler query = new StringBundler(3);
1869
1870 query.append(_SQL_SELECT_DDLRECORDSET_WHERE);
1871
1872 query.append(_FINDER_COLUMN_G_R_GROUPID_2);
1873
1874 if (recordSetKey == null) {
1875 query.append(_FINDER_COLUMN_G_R_RECORDSETKEY_1);
1876 }
1877 else {
1878 if (recordSetKey.equals(StringPool.BLANK)) {
1879 query.append(_FINDER_COLUMN_G_R_RECORDSETKEY_3);
1880 }
1881 else {
1882 query.append(_FINDER_COLUMN_G_R_RECORDSETKEY_2);
1883 }
1884 }
1885
1886 String sql = query.toString();
1887
1888 Session session = null;
1889
1890 try {
1891 session = openSession();
1892
1893 Query q = session.createQuery(sql);
1894
1895 QueryPos qPos = QueryPos.getInstance(q);
1896
1897 qPos.add(groupId);
1898
1899 if (recordSetKey != null) {
1900 qPos.add(recordSetKey);
1901 }
1902
1903 List<DDLRecordSet> list = q.list();
1904
1905 result = list;
1906
1907 DDLRecordSet ddlRecordSet = null;
1908
1909 if (list.isEmpty()) {
1910 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_R,
1911 finderArgs, list);
1912 }
1913 else {
1914 ddlRecordSet = list.get(0);
1915
1916 cacheResult(ddlRecordSet);
1917
1918 if ((ddlRecordSet.getGroupId() != groupId) ||
1919 (ddlRecordSet.getRecordSetKey() == null) ||
1920 !ddlRecordSet.getRecordSetKey().equals(recordSetKey)) {
1921 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_R,
1922 finderArgs, ddlRecordSet);
1923 }
1924 }
1925
1926 return ddlRecordSet;
1927 }
1928 catch (Exception e) {
1929 throw processException(e);
1930 }
1931 finally {
1932 if (result == null) {
1933 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_R,
1934 finderArgs);
1935 }
1936
1937 closeSession(session);
1938 }
1939 }
1940 else {
1941 if (result instanceof List<?>) {
1942 return null;
1943 }
1944 else {
1945 return (DDLRecordSet)result;
1946 }
1947 }
1948 }
1949
1950
1956 public List<DDLRecordSet> findAll() throws SystemException {
1957 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1958 }
1959
1960
1972 public List<DDLRecordSet> findAll(int start, int end)
1973 throws SystemException {
1974 return findAll(start, end, null);
1975 }
1976
1977
1990 public List<DDLRecordSet> findAll(int start, int end,
1991 OrderByComparator orderByComparator) throws SystemException {
1992 FinderPath finderPath = null;
1993 Object[] finderArgs = new Object[] { start, end, orderByComparator };
1994
1995 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1996 (orderByComparator == null)) {
1997 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1998 finderArgs = FINDER_ARGS_EMPTY;
1999 }
2000 else {
2001 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
2002 finderArgs = new Object[] { start, end, orderByComparator };
2003 }
2004
2005 List<DDLRecordSet> list = (List<DDLRecordSet>)FinderCacheUtil.getResult(finderPath,
2006 finderArgs, this);
2007
2008 if (list == null) {
2009 StringBundler query = null;
2010 String sql = null;
2011
2012 if (orderByComparator != null) {
2013 query = new StringBundler(2 +
2014 (orderByComparator.getOrderByFields().length * 3));
2015
2016 query.append(_SQL_SELECT_DDLRECORDSET);
2017
2018 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2019 orderByComparator);
2020
2021 sql = query.toString();
2022 }
2023 else {
2024 sql = _SQL_SELECT_DDLRECORDSET;
2025 }
2026
2027 Session session = null;
2028
2029 try {
2030 session = openSession();
2031
2032 Query q = session.createQuery(sql);
2033
2034 if (orderByComparator == null) {
2035 list = (List<DDLRecordSet>)QueryUtil.list(q, getDialect(),
2036 start, end, false);
2037
2038 Collections.sort(list);
2039 }
2040 else {
2041 list = (List<DDLRecordSet>)QueryUtil.list(q, getDialect(),
2042 start, end);
2043 }
2044 }
2045 catch (Exception e) {
2046 throw processException(e);
2047 }
2048 finally {
2049 if (list == null) {
2050 FinderCacheUtil.removeResult(finderPath, finderArgs);
2051 }
2052 else {
2053 cacheResult(list);
2054
2055 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2056 }
2057
2058 closeSession(session);
2059 }
2060 }
2061
2062 return list;
2063 }
2064
2065
2071 public void removeByUuid(String uuid) throws SystemException {
2072 for (DDLRecordSet ddlRecordSet : findByUuid(uuid)) {
2073 remove(ddlRecordSet);
2074 }
2075 }
2076
2077
2084 public void removeByUUID_G(String uuid, long groupId)
2085 throws NoSuchRecordSetException, SystemException {
2086 DDLRecordSet ddlRecordSet = findByUUID_G(uuid, groupId);
2087
2088 remove(ddlRecordSet);
2089 }
2090
2091
2097 public void removeByGroupId(long groupId) throws SystemException {
2098 for (DDLRecordSet ddlRecordSet : findByGroupId(groupId)) {
2099 remove(ddlRecordSet);
2100 }
2101 }
2102
2103
2110 public void removeByG_R(long groupId, String recordSetKey)
2111 throws NoSuchRecordSetException, SystemException {
2112 DDLRecordSet ddlRecordSet = findByG_R(groupId, recordSetKey);
2113
2114 remove(ddlRecordSet);
2115 }
2116
2117
2122 public void removeAll() throws SystemException {
2123 for (DDLRecordSet ddlRecordSet : findAll()) {
2124 remove(ddlRecordSet);
2125 }
2126 }
2127
2128
2135 public int countByUuid(String uuid) throws SystemException {
2136 Object[] finderArgs = new Object[] { uuid };
2137
2138 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
2139 finderArgs, this);
2140
2141 if (count == null) {
2142 StringBundler query = new StringBundler(2);
2143
2144 query.append(_SQL_COUNT_DDLRECORDSET_WHERE);
2145
2146 if (uuid == null) {
2147 query.append(_FINDER_COLUMN_UUID_UUID_1);
2148 }
2149 else {
2150 if (uuid.equals(StringPool.BLANK)) {
2151 query.append(_FINDER_COLUMN_UUID_UUID_3);
2152 }
2153 else {
2154 query.append(_FINDER_COLUMN_UUID_UUID_2);
2155 }
2156 }
2157
2158 String sql = query.toString();
2159
2160 Session session = null;
2161
2162 try {
2163 session = openSession();
2164
2165 Query q = session.createQuery(sql);
2166
2167 QueryPos qPos = QueryPos.getInstance(q);
2168
2169 if (uuid != null) {
2170 qPos.add(uuid);
2171 }
2172
2173 count = (Long)q.uniqueResult();
2174 }
2175 catch (Exception e) {
2176 throw processException(e);
2177 }
2178 finally {
2179 if (count == null) {
2180 count = Long.valueOf(0);
2181 }
2182
2183 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
2184 finderArgs, count);
2185
2186 closeSession(session);
2187 }
2188 }
2189
2190 return count.intValue();
2191 }
2192
2193
2201 public int countByUUID_G(String uuid, long groupId)
2202 throws SystemException {
2203 Object[] finderArgs = new Object[] { uuid, groupId };
2204
2205 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
2206 finderArgs, this);
2207
2208 if (count == null) {
2209 StringBundler query = new StringBundler(3);
2210
2211 query.append(_SQL_COUNT_DDLRECORDSET_WHERE);
2212
2213 if (uuid == null) {
2214 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
2215 }
2216 else {
2217 if (uuid.equals(StringPool.BLANK)) {
2218 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
2219 }
2220 else {
2221 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
2222 }
2223 }
2224
2225 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
2226
2227 String sql = query.toString();
2228
2229 Session session = null;
2230
2231 try {
2232 session = openSession();
2233
2234 Query q = session.createQuery(sql);
2235
2236 QueryPos qPos = QueryPos.getInstance(q);
2237
2238 if (uuid != null) {
2239 qPos.add(uuid);
2240 }
2241
2242 qPos.add(groupId);
2243
2244 count = (Long)q.uniqueResult();
2245 }
2246 catch (Exception e) {
2247 throw processException(e);
2248 }
2249 finally {
2250 if (count == null) {
2251 count = Long.valueOf(0);
2252 }
2253
2254 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
2255 finderArgs, count);
2256
2257 closeSession(session);
2258 }
2259 }
2260
2261 return count.intValue();
2262 }
2263
2264
2271 public int countByGroupId(long groupId) throws SystemException {
2272 Object[] finderArgs = new Object[] { groupId };
2273
2274 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
2275 finderArgs, this);
2276
2277 if (count == null) {
2278 StringBundler query = new StringBundler(2);
2279
2280 query.append(_SQL_COUNT_DDLRECORDSET_WHERE);
2281
2282 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2283
2284 String sql = query.toString();
2285
2286 Session session = null;
2287
2288 try {
2289 session = openSession();
2290
2291 Query q = session.createQuery(sql);
2292
2293 QueryPos qPos = QueryPos.getInstance(q);
2294
2295 qPos.add(groupId);
2296
2297 count = (Long)q.uniqueResult();
2298 }
2299 catch (Exception e) {
2300 throw processException(e);
2301 }
2302 finally {
2303 if (count == null) {
2304 count = Long.valueOf(0);
2305 }
2306
2307 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
2308 finderArgs, count);
2309
2310 closeSession(session);
2311 }
2312 }
2313
2314 return count.intValue();
2315 }
2316
2317
2324 public int filterCountByGroupId(long groupId) throws SystemException {
2325 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2326 return countByGroupId(groupId);
2327 }
2328
2329 StringBundler query = new StringBundler(2);
2330
2331 query.append(_FILTER_SQL_COUNT_DDLRECORDSET_WHERE);
2332
2333 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2334
2335 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2336 DDLRecordSet.class.getName(),
2337 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
2338
2339 Session session = null;
2340
2341 try {
2342 session = openSession();
2343
2344 SQLQuery q = session.createSQLQuery(sql);
2345
2346 q.addScalar(COUNT_COLUMN_NAME,
2347 com.liferay.portal.kernel.dao.orm.Type.LONG);
2348
2349 QueryPos qPos = QueryPos.getInstance(q);
2350
2351 qPos.add(groupId);
2352
2353 Long count = (Long)q.uniqueResult();
2354
2355 return count.intValue();
2356 }
2357 catch (Exception e) {
2358 throw processException(e);
2359 }
2360 finally {
2361 closeSession(session);
2362 }
2363 }
2364
2365
2373 public int countByG_R(long groupId, String recordSetKey)
2374 throws SystemException {
2375 Object[] finderArgs = new Object[] { groupId, recordSetKey };
2376
2377 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_R,
2378 finderArgs, this);
2379
2380 if (count == null) {
2381 StringBundler query = new StringBundler(3);
2382
2383 query.append(_SQL_COUNT_DDLRECORDSET_WHERE);
2384
2385 query.append(_FINDER_COLUMN_G_R_GROUPID_2);
2386
2387 if (recordSetKey == null) {
2388 query.append(_FINDER_COLUMN_G_R_RECORDSETKEY_1);
2389 }
2390 else {
2391 if (recordSetKey.equals(StringPool.BLANK)) {
2392 query.append(_FINDER_COLUMN_G_R_RECORDSETKEY_3);
2393 }
2394 else {
2395 query.append(_FINDER_COLUMN_G_R_RECORDSETKEY_2);
2396 }
2397 }
2398
2399 String sql = query.toString();
2400
2401 Session session = null;
2402
2403 try {
2404 session = openSession();
2405
2406 Query q = session.createQuery(sql);
2407
2408 QueryPos qPos = QueryPos.getInstance(q);
2409
2410 qPos.add(groupId);
2411
2412 if (recordSetKey != null) {
2413 qPos.add(recordSetKey);
2414 }
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_BY_G_R, finderArgs,
2427 count);
2428
2429 closeSession(session);
2430 }
2431 }
2432
2433 return count.intValue();
2434 }
2435
2436
2442 public int countAll() throws SystemException {
2443 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2444 FINDER_ARGS_EMPTY, this);
2445
2446 if (count == null) {
2447 Session session = null;
2448
2449 try {
2450 session = openSession();
2451
2452 Query q = session.createQuery(_SQL_COUNT_DDLRECORDSET);
2453
2454 count = (Long)q.uniqueResult();
2455 }
2456 catch (Exception e) {
2457 throw processException(e);
2458 }
2459 finally {
2460 if (count == null) {
2461 count = Long.valueOf(0);
2462 }
2463
2464 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
2465 FINDER_ARGS_EMPTY, count);
2466
2467 closeSession(session);
2468 }
2469 }
2470
2471 return count.intValue();
2472 }
2473
2474
2477 public void afterPropertiesSet() {
2478 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2479 com.liferay.portal.util.PropsUtil.get(
2480 "value.object.listener.com.liferay.portlet.dynamicdatalists.model.DDLRecordSet")));
2481
2482 if (listenerClassNames.length > 0) {
2483 try {
2484 List<ModelListener<DDLRecordSet>> listenersList = new ArrayList<ModelListener<DDLRecordSet>>();
2485
2486 for (String listenerClassName : listenerClassNames) {
2487 listenersList.add((ModelListener<DDLRecordSet>)InstanceFactory.newInstance(
2488 listenerClassName));
2489 }
2490
2491 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2492 }
2493 catch (Exception e) {
2494 _log.error(e);
2495 }
2496 }
2497 }
2498
2499 public void destroy() {
2500 EntityCacheUtil.removeCache(DDLRecordSetImpl.class.getName());
2501 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
2502 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2503 }
2504
2505 @BeanReference(type = DDLRecordPersistence.class)
2506 protected DDLRecordPersistence ddlRecordPersistence;
2507 @BeanReference(type = DDLRecordSetPersistence.class)
2508 protected DDLRecordSetPersistence ddlRecordSetPersistence;
2509 @BeanReference(type = DDLRecordVersionPersistence.class)
2510 protected DDLRecordVersionPersistence ddlRecordVersionPersistence;
2511 @BeanReference(type = ResourcePersistence.class)
2512 protected ResourcePersistence resourcePersistence;
2513 @BeanReference(type = UserPersistence.class)
2514 protected UserPersistence userPersistence;
2515 @BeanReference(type = DDMStructurePersistence.class)
2516 protected DDMStructurePersistence ddmStructurePersistence;
2517 @BeanReference(type = DDMStructureLinkPersistence.class)
2518 protected DDMStructureLinkPersistence ddmStructureLinkPersistence;
2519 private static final String _SQL_SELECT_DDLRECORDSET = "SELECT ddlRecordSet FROM DDLRecordSet ddlRecordSet";
2520 private static final String _SQL_SELECT_DDLRECORDSET_WHERE = "SELECT ddlRecordSet FROM DDLRecordSet ddlRecordSet WHERE ";
2521 private static final String _SQL_COUNT_DDLRECORDSET = "SELECT COUNT(ddlRecordSet) FROM DDLRecordSet ddlRecordSet";
2522 private static final String _SQL_COUNT_DDLRECORDSET_WHERE = "SELECT COUNT(ddlRecordSet) FROM DDLRecordSet ddlRecordSet WHERE ";
2523 private static final String _FINDER_COLUMN_UUID_UUID_1 = "ddlRecordSet.uuid IS NULL";
2524 private static final String _FINDER_COLUMN_UUID_UUID_2 = "ddlRecordSet.uuid = ?";
2525 private static final String _FINDER_COLUMN_UUID_UUID_3 = "(ddlRecordSet.uuid IS NULL OR ddlRecordSet.uuid = ?)";
2526 private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "ddlRecordSet.uuid IS NULL AND ";
2527 private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "ddlRecordSet.uuid = ? AND ";
2528 private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(ddlRecordSet.uuid IS NULL OR ddlRecordSet.uuid = ?) AND ";
2529 private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "ddlRecordSet.groupId = ?";
2530 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "ddlRecordSet.groupId = ?";
2531 private static final String _FINDER_COLUMN_G_R_GROUPID_2 = "ddlRecordSet.groupId = ? AND ";
2532 private static final String _FINDER_COLUMN_G_R_RECORDSETKEY_1 = "ddlRecordSet.recordSetKey IS NULL";
2533 private static final String _FINDER_COLUMN_G_R_RECORDSETKEY_2 = "ddlRecordSet.recordSetKey = ?";
2534 private static final String _FINDER_COLUMN_G_R_RECORDSETKEY_3 = "(ddlRecordSet.recordSetKey IS NULL OR ddlRecordSet.recordSetKey = ?)";
2535 private static final String _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN = "ddlRecordSet.recordSetId";
2536 private static final String _FILTER_SQL_SELECT_DDLRECORDSET_WHERE = "SELECT DISTINCT {ddlRecordSet.*} FROM DDLRecordSet ddlRecordSet WHERE ";
2537 private static final String _FILTER_SQL_SELECT_DDLRECORDSET_NO_INLINE_DISTINCT_WHERE_1 =
2538 "SELECT {DDLRecordSet.*} FROM (SELECT DISTINCT ddlRecordSet.recordSetId FROM DDLRecordSet ddlRecordSet WHERE ";
2539 private static final String _FILTER_SQL_SELECT_DDLRECORDSET_NO_INLINE_DISTINCT_WHERE_2 =
2540 ") TEMP_TABLE INNER JOIN DDLRecordSet ON TEMP_TABLE.recordSetId = DDLRecordSet.recordSetId";
2541 private static final String _FILTER_SQL_COUNT_DDLRECORDSET_WHERE = "SELECT COUNT(DISTINCT ddlRecordSet.recordSetId) AS COUNT_VALUE FROM DDLRecordSet ddlRecordSet WHERE ";
2542 private static final String _FILTER_ENTITY_ALIAS = "ddlRecordSet";
2543 private static final String _FILTER_ENTITY_TABLE = "DDLRecordSet";
2544 private static final String _ORDER_BY_ENTITY_ALIAS = "ddlRecordSet.";
2545 private static final String _ORDER_BY_ENTITY_TABLE = "DDLRecordSet.";
2546 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No DDLRecordSet exists with the primary key ";
2547 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No DDLRecordSet exists with the key {";
2548 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
2549 private static Log _log = LogFactoryUtil.getLog(DDLRecordSetPersistenceImpl.class);
2550 private static DDLRecordSet _nullDDLRecordSet = new DDLRecordSetImpl() {
2551 @Override
2552 public Object clone() {
2553 return this;
2554 }
2555
2556 @Override
2557 public CacheModel<DDLRecordSet> toCacheModel() {
2558 return _nullDDLRecordSetCacheModel;
2559 }
2560 };
2561
2562 private static CacheModel<DDLRecordSet> _nullDDLRecordSetCacheModel = new CacheModel<DDLRecordSet>() {
2563 public DDLRecordSet toEntityModel() {
2564 return _nullDDLRecordSet;
2565 }
2566 };
2567 }