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 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
229 new Object[] {
230 ddlRecordSet.getUuid(), Long.valueOf(ddlRecordSet.getGroupId())
231 });
232
233 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_R,
234 new Object[] {
235 Long.valueOf(ddlRecordSet.getGroupId()),
236
237 ddlRecordSet.getRecordSetKey()
238 });
239 }
240
241
247 public DDLRecordSet create(long recordSetId) {
248 DDLRecordSet ddlRecordSet = new DDLRecordSetImpl();
249
250 ddlRecordSet.setNew(true);
251 ddlRecordSet.setPrimaryKey(recordSetId);
252
253 String uuid = PortalUUIDUtil.generate();
254
255 ddlRecordSet.setUuid(uuid);
256
257 return ddlRecordSet;
258 }
259
260
268 @Override
269 public DDLRecordSet remove(Serializable primaryKey)
270 throws NoSuchModelException, SystemException {
271 return remove(((Long)primaryKey).longValue());
272 }
273
274
282 public DDLRecordSet remove(long recordSetId)
283 throws NoSuchRecordSetException, SystemException {
284 Session session = null;
285
286 try {
287 session = openSession();
288
289 DDLRecordSet ddlRecordSet = (DDLRecordSet)session.get(DDLRecordSetImpl.class,
290 Long.valueOf(recordSetId));
291
292 if (ddlRecordSet == null) {
293 if (_log.isWarnEnabled()) {
294 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + recordSetId);
295 }
296
297 throw new NoSuchRecordSetException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
298 recordSetId);
299 }
300
301 return ddlRecordSetPersistence.remove(ddlRecordSet);
302 }
303 catch (NoSuchRecordSetException nsee) {
304 throw nsee;
305 }
306 catch (Exception e) {
307 throw processException(e);
308 }
309 finally {
310 closeSession(session);
311 }
312 }
313
314
321 @Override
322 public DDLRecordSet remove(DDLRecordSet ddlRecordSet)
323 throws SystemException {
324 return super.remove(ddlRecordSet);
325 }
326
327 @Override
328 protected DDLRecordSet removeImpl(DDLRecordSet ddlRecordSet)
329 throws SystemException {
330 ddlRecordSet = toUnwrappedModel(ddlRecordSet);
331
332 Session session = null;
333
334 try {
335 session = openSession();
336
337 BatchSessionUtil.delete(session, ddlRecordSet);
338 }
339 catch (Exception e) {
340 throw processException(e);
341 }
342 finally {
343 closeSession(session);
344 }
345
346 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
347 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
348
349 DDLRecordSetModelImpl ddlRecordSetModelImpl = (DDLRecordSetModelImpl)ddlRecordSet;
350
351 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
352 new Object[] {
353 ddlRecordSetModelImpl.getUuid(),
354 Long.valueOf(ddlRecordSetModelImpl.getGroupId())
355 });
356
357 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_R,
358 new Object[] {
359 Long.valueOf(ddlRecordSetModelImpl.getGroupId()),
360
361 ddlRecordSetModelImpl.getRecordSetKey()
362 });
363
364 EntityCacheUtil.removeResult(DDLRecordSetModelImpl.ENTITY_CACHE_ENABLED,
365 DDLRecordSetImpl.class, ddlRecordSet.getPrimaryKey());
366
367 return ddlRecordSet;
368 }
369
370 @Override
371 public DDLRecordSet updateImpl(
372 com.liferay.portlet.dynamicdatalists.model.DDLRecordSet ddlRecordSet,
373 boolean merge) throws SystemException {
374 ddlRecordSet = toUnwrappedModel(ddlRecordSet);
375
376 boolean isNew = ddlRecordSet.isNew();
377
378 DDLRecordSetModelImpl ddlRecordSetModelImpl = (DDLRecordSetModelImpl)ddlRecordSet;
379
380 if (Validator.isNull(ddlRecordSet.getUuid())) {
381 String uuid = PortalUUIDUtil.generate();
382
383 ddlRecordSet.setUuid(uuid);
384 }
385
386 Session session = null;
387
388 try {
389 session = openSession();
390
391 BatchSessionUtil.update(session, ddlRecordSet, merge);
392
393 ddlRecordSet.setNew(false);
394 }
395 catch (Exception e) {
396 throw processException(e);
397 }
398 finally {
399 closeSession(session);
400 }
401
402 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
403
404 if (isNew || !DDLRecordSetModelImpl.COLUMN_BITMASK_ENABLED) {
405 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
406 }
407
408 else {
409 if ((ddlRecordSetModelImpl.getColumnBitmask() &
410 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID.getColumnBitmask()) != 0) {
411 Object[] args = new Object[] {
412 ddlRecordSetModelImpl.getOriginalUuid()
413 };
414
415 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
416 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
417 args);
418
419 args = new Object[] { ddlRecordSetModelImpl.getUuid() };
420
421 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
422 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
423 args);
424 }
425
426 if ((ddlRecordSetModelImpl.getColumnBitmask() &
427 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID.getColumnBitmask()) != 0) {
428 Object[] args = new Object[] {
429 Long.valueOf(ddlRecordSetModelImpl.getOriginalGroupId())
430 };
431
432 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
433 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
434 args);
435
436 args = new Object[] {
437 Long.valueOf(ddlRecordSetModelImpl.getGroupId())
438 };
439
440 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
441 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
442 args);
443 }
444 }
445
446 EntityCacheUtil.putResult(DDLRecordSetModelImpl.ENTITY_CACHE_ENABLED,
447 DDLRecordSetImpl.class, ddlRecordSet.getPrimaryKey(), ddlRecordSet);
448
449 if (isNew) {
450 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
451 new Object[] {
452 ddlRecordSet.getUuid(),
453 Long.valueOf(ddlRecordSet.getGroupId())
454 }, ddlRecordSet);
455
456 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_R,
457 new Object[] {
458 Long.valueOf(ddlRecordSet.getGroupId()),
459
460 ddlRecordSet.getRecordSetKey()
461 }, ddlRecordSet);
462 }
463 else {
464 if ((ddlRecordSetModelImpl.getColumnBitmask() &
465 FINDER_PATH_FETCH_BY_UUID_G.getColumnBitmask()) != 0) {
466 Object[] args = new Object[] {
467 ddlRecordSetModelImpl.getOriginalUuid(),
468 Long.valueOf(ddlRecordSetModelImpl.getOriginalGroupId())
469 };
470
471 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID_G, args);
472 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G, args);
473
474 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
475 new Object[] {
476 ddlRecordSet.getUuid(),
477 Long.valueOf(ddlRecordSet.getGroupId())
478 }, ddlRecordSet);
479 }
480
481 if ((ddlRecordSetModelImpl.getColumnBitmask() &
482 FINDER_PATH_FETCH_BY_G_R.getColumnBitmask()) != 0) {
483 Object[] args = new Object[] {
484 Long.valueOf(ddlRecordSetModelImpl.getOriginalGroupId()),
485
486 ddlRecordSetModelImpl.getOriginalRecordSetKey()
487 };
488
489 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_R, args);
490 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_R, args);
491
492 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_R,
493 new Object[] {
494 Long.valueOf(ddlRecordSet.getGroupId()),
495
496 ddlRecordSet.getRecordSetKey()
497 }, ddlRecordSet);
498 }
499 }
500
501 return ddlRecordSet;
502 }
503
504 protected DDLRecordSet toUnwrappedModel(DDLRecordSet ddlRecordSet) {
505 if (ddlRecordSet instanceof DDLRecordSetImpl) {
506 return ddlRecordSet;
507 }
508
509 DDLRecordSetImpl ddlRecordSetImpl = new DDLRecordSetImpl();
510
511 ddlRecordSetImpl.setNew(ddlRecordSet.isNew());
512 ddlRecordSetImpl.setPrimaryKey(ddlRecordSet.getPrimaryKey());
513
514 ddlRecordSetImpl.setUuid(ddlRecordSet.getUuid());
515 ddlRecordSetImpl.setRecordSetId(ddlRecordSet.getRecordSetId());
516 ddlRecordSetImpl.setGroupId(ddlRecordSet.getGroupId());
517 ddlRecordSetImpl.setCompanyId(ddlRecordSet.getCompanyId());
518 ddlRecordSetImpl.setUserId(ddlRecordSet.getUserId());
519 ddlRecordSetImpl.setUserName(ddlRecordSet.getUserName());
520 ddlRecordSetImpl.setCreateDate(ddlRecordSet.getCreateDate());
521 ddlRecordSetImpl.setModifiedDate(ddlRecordSet.getModifiedDate());
522 ddlRecordSetImpl.setDDMStructureId(ddlRecordSet.getDDMStructureId());
523 ddlRecordSetImpl.setRecordSetKey(ddlRecordSet.getRecordSetKey());
524 ddlRecordSetImpl.setName(ddlRecordSet.getName());
525 ddlRecordSetImpl.setDescription(ddlRecordSet.getDescription());
526 ddlRecordSetImpl.setMinDisplayRows(ddlRecordSet.getMinDisplayRows());
527 ddlRecordSetImpl.setScope(ddlRecordSet.getScope());
528
529 return ddlRecordSetImpl;
530 }
531
532
540 @Override
541 public DDLRecordSet findByPrimaryKey(Serializable primaryKey)
542 throws NoSuchModelException, SystemException {
543 return findByPrimaryKey(((Long)primaryKey).longValue());
544 }
545
546
554 public DDLRecordSet findByPrimaryKey(long recordSetId)
555 throws NoSuchRecordSetException, SystemException {
556 DDLRecordSet ddlRecordSet = fetchByPrimaryKey(recordSetId);
557
558 if (ddlRecordSet == null) {
559 if (_log.isWarnEnabled()) {
560 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + recordSetId);
561 }
562
563 throw new NoSuchRecordSetException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
564 recordSetId);
565 }
566
567 return ddlRecordSet;
568 }
569
570
577 @Override
578 public DDLRecordSet fetchByPrimaryKey(Serializable primaryKey)
579 throws SystemException {
580 return fetchByPrimaryKey(((Long)primaryKey).longValue());
581 }
582
583
590 public DDLRecordSet fetchByPrimaryKey(long recordSetId)
591 throws SystemException {
592 DDLRecordSet ddlRecordSet = (DDLRecordSet)EntityCacheUtil.getResult(DDLRecordSetModelImpl.ENTITY_CACHE_ENABLED,
593 DDLRecordSetImpl.class, recordSetId);
594
595 if (ddlRecordSet == _nullDDLRecordSet) {
596 return null;
597 }
598
599 if (ddlRecordSet == null) {
600 Session session = null;
601
602 boolean hasException = false;
603
604 try {
605 session = openSession();
606
607 ddlRecordSet = (DDLRecordSet)session.get(DDLRecordSetImpl.class,
608 Long.valueOf(recordSetId));
609 }
610 catch (Exception e) {
611 hasException = true;
612
613 throw processException(e);
614 }
615 finally {
616 if (ddlRecordSet != null) {
617 cacheResult(ddlRecordSet);
618 }
619 else if (!hasException) {
620 EntityCacheUtil.putResult(DDLRecordSetModelImpl.ENTITY_CACHE_ENABLED,
621 DDLRecordSetImpl.class, recordSetId, _nullDDLRecordSet);
622 }
623
624 closeSession(session);
625 }
626 }
627
628 return ddlRecordSet;
629 }
630
631
638 public List<DDLRecordSet> findByUuid(String uuid) throws SystemException {
639 return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
640 }
641
642
655 public List<DDLRecordSet> findByUuid(String uuid, int start, int end)
656 throws SystemException {
657 return findByUuid(uuid, start, end, null);
658 }
659
660
674 public List<DDLRecordSet> findByUuid(String uuid, int start, int end,
675 OrderByComparator orderByComparator) throws SystemException {
676 FinderPath finderPath = null;
677 Object[] finderArgs = null;
678
679 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
680 (orderByComparator == null)) {
681 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID;
682 finderArgs = new Object[] { uuid };
683 }
684 else {
685 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID;
686 finderArgs = new Object[] { uuid, start, end, orderByComparator };
687 }
688
689 List<DDLRecordSet> list = (List<DDLRecordSet>)FinderCacheUtil.getResult(finderPath,
690 finderArgs, this);
691
692 if (list == null) {
693 StringBundler query = null;
694
695 if (orderByComparator != null) {
696 query = new StringBundler(3 +
697 (orderByComparator.getOrderByFields().length * 3));
698 }
699 else {
700 query = new StringBundler(2);
701 }
702
703 query.append(_SQL_SELECT_DDLRECORDSET_WHERE);
704
705 if (uuid == null) {
706 query.append(_FINDER_COLUMN_UUID_UUID_1);
707 }
708 else {
709 if (uuid.equals(StringPool.BLANK)) {
710 query.append(_FINDER_COLUMN_UUID_UUID_3);
711 }
712 else {
713 query.append(_FINDER_COLUMN_UUID_UUID_2);
714 }
715 }
716
717 if (orderByComparator != null) {
718 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
719 orderByComparator);
720 }
721
722 String sql = query.toString();
723
724 Session session = null;
725
726 try {
727 session = openSession();
728
729 Query q = session.createQuery(sql);
730
731 QueryPos qPos = QueryPos.getInstance(q);
732
733 if (uuid != null) {
734 qPos.add(uuid);
735 }
736
737 list = (List<DDLRecordSet>)QueryUtil.list(q, getDialect(),
738 start, end);
739 }
740 catch (Exception e) {
741 throw processException(e);
742 }
743 finally {
744 if (list == null) {
745 FinderCacheUtil.removeResult(finderPath, finderArgs);
746 }
747 else {
748 cacheResult(list);
749
750 FinderCacheUtil.putResult(finderPath, finderArgs, list);
751 }
752
753 closeSession(session);
754 }
755 }
756
757 return list;
758 }
759
760
773 public DDLRecordSet findByUuid_First(String uuid,
774 OrderByComparator orderByComparator)
775 throws NoSuchRecordSetException, SystemException {
776 List<DDLRecordSet> list = findByUuid(uuid, 0, 1, orderByComparator);
777
778 if (list.isEmpty()) {
779 StringBundler msg = new StringBundler(4);
780
781 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
782
783 msg.append("uuid=");
784 msg.append(uuid);
785
786 msg.append(StringPool.CLOSE_CURLY_BRACE);
787
788 throw new NoSuchRecordSetException(msg.toString());
789 }
790 else {
791 return list.get(0);
792 }
793 }
794
795
808 public DDLRecordSet findByUuid_Last(String uuid,
809 OrderByComparator orderByComparator)
810 throws NoSuchRecordSetException, SystemException {
811 int count = countByUuid(uuid);
812
813 List<DDLRecordSet> list = findByUuid(uuid, count - 1, count,
814 orderByComparator);
815
816 if (list.isEmpty()) {
817 StringBundler msg = new StringBundler(4);
818
819 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
820
821 msg.append("uuid=");
822 msg.append(uuid);
823
824 msg.append(StringPool.CLOSE_CURLY_BRACE);
825
826 throw new NoSuchRecordSetException(msg.toString());
827 }
828 else {
829 return list.get(0);
830 }
831 }
832
833
847 public DDLRecordSet[] findByUuid_PrevAndNext(long recordSetId, String uuid,
848 OrderByComparator orderByComparator)
849 throws NoSuchRecordSetException, SystemException {
850 DDLRecordSet ddlRecordSet = findByPrimaryKey(recordSetId);
851
852 Session session = null;
853
854 try {
855 session = openSession();
856
857 DDLRecordSet[] array = new DDLRecordSetImpl[3];
858
859 array[0] = getByUuid_PrevAndNext(session, ddlRecordSet, uuid,
860 orderByComparator, true);
861
862 array[1] = ddlRecordSet;
863
864 array[2] = getByUuid_PrevAndNext(session, ddlRecordSet, uuid,
865 orderByComparator, false);
866
867 return array;
868 }
869 catch (Exception e) {
870 throw processException(e);
871 }
872 finally {
873 closeSession(session);
874 }
875 }
876
877 protected DDLRecordSet getByUuid_PrevAndNext(Session session,
878 DDLRecordSet ddlRecordSet, String uuid,
879 OrderByComparator orderByComparator, boolean previous) {
880 StringBundler query = null;
881
882 if (orderByComparator != null) {
883 query = new StringBundler(6 +
884 (orderByComparator.getOrderByFields().length * 6));
885 }
886 else {
887 query = new StringBundler(3);
888 }
889
890 query.append(_SQL_SELECT_DDLRECORDSET_WHERE);
891
892 if (uuid == null) {
893 query.append(_FINDER_COLUMN_UUID_UUID_1);
894 }
895 else {
896 if (uuid.equals(StringPool.BLANK)) {
897 query.append(_FINDER_COLUMN_UUID_UUID_3);
898 }
899 else {
900 query.append(_FINDER_COLUMN_UUID_UUID_2);
901 }
902 }
903
904 if (orderByComparator != null) {
905 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
906
907 if (orderByConditionFields.length > 0) {
908 query.append(WHERE_AND);
909 }
910
911 for (int i = 0; i < orderByConditionFields.length; i++) {
912 query.append(_ORDER_BY_ENTITY_ALIAS);
913 query.append(orderByConditionFields[i]);
914
915 if ((i + 1) < orderByConditionFields.length) {
916 if (orderByComparator.isAscending() ^ previous) {
917 query.append(WHERE_GREATER_THAN_HAS_NEXT);
918 }
919 else {
920 query.append(WHERE_LESSER_THAN_HAS_NEXT);
921 }
922 }
923 else {
924 if (orderByComparator.isAscending() ^ previous) {
925 query.append(WHERE_GREATER_THAN);
926 }
927 else {
928 query.append(WHERE_LESSER_THAN);
929 }
930 }
931 }
932
933 query.append(ORDER_BY_CLAUSE);
934
935 String[] orderByFields = orderByComparator.getOrderByFields();
936
937 for (int i = 0; i < orderByFields.length; i++) {
938 query.append(_ORDER_BY_ENTITY_ALIAS);
939 query.append(orderByFields[i]);
940
941 if ((i + 1) < orderByFields.length) {
942 if (orderByComparator.isAscending() ^ previous) {
943 query.append(ORDER_BY_ASC_HAS_NEXT);
944 }
945 else {
946 query.append(ORDER_BY_DESC_HAS_NEXT);
947 }
948 }
949 else {
950 if (orderByComparator.isAscending() ^ previous) {
951 query.append(ORDER_BY_ASC);
952 }
953 else {
954 query.append(ORDER_BY_DESC);
955 }
956 }
957 }
958 }
959
960 String sql = query.toString();
961
962 Query q = session.createQuery(sql);
963
964 q.setFirstResult(0);
965 q.setMaxResults(2);
966
967 QueryPos qPos = QueryPos.getInstance(q);
968
969 if (uuid != null) {
970 qPos.add(uuid);
971 }
972
973 if (orderByComparator != null) {
974 Object[] values = orderByComparator.getOrderByConditionValues(ddlRecordSet);
975
976 for (Object value : values) {
977 qPos.add(value);
978 }
979 }
980
981 List<DDLRecordSet> list = q.list();
982
983 if (list.size() == 2) {
984 return list.get(1);
985 }
986 else {
987 return null;
988 }
989 }
990
991
1000 public DDLRecordSet findByUUID_G(String uuid, long groupId)
1001 throws NoSuchRecordSetException, SystemException {
1002 DDLRecordSet ddlRecordSet = fetchByUUID_G(uuid, groupId);
1003
1004 if (ddlRecordSet == null) {
1005 StringBundler msg = new StringBundler(6);
1006
1007 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1008
1009 msg.append("uuid=");
1010 msg.append(uuid);
1011
1012 msg.append(", groupId=");
1013 msg.append(groupId);
1014
1015 msg.append(StringPool.CLOSE_CURLY_BRACE);
1016
1017 if (_log.isWarnEnabled()) {
1018 _log.warn(msg.toString());
1019 }
1020
1021 throw new NoSuchRecordSetException(msg.toString());
1022 }
1023
1024 return ddlRecordSet;
1025 }
1026
1027
1035 public DDLRecordSet fetchByUUID_G(String uuid, long groupId)
1036 throws SystemException {
1037 return fetchByUUID_G(uuid, groupId, true);
1038 }
1039
1040
1049 public DDLRecordSet fetchByUUID_G(String uuid, long groupId,
1050 boolean retrieveFromCache) throws SystemException {
1051 Object[] finderArgs = new Object[] { uuid, groupId };
1052
1053 Object result = null;
1054
1055 if (retrieveFromCache) {
1056 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
1057 finderArgs, this);
1058 }
1059
1060 if (result == null) {
1061 StringBundler query = new StringBundler(3);
1062
1063 query.append(_SQL_SELECT_DDLRECORDSET_WHERE);
1064
1065 if (uuid == null) {
1066 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
1067 }
1068 else {
1069 if (uuid.equals(StringPool.BLANK)) {
1070 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
1071 }
1072 else {
1073 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
1074 }
1075 }
1076
1077 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
1078
1079 String sql = query.toString();
1080
1081 Session session = null;
1082
1083 try {
1084 session = openSession();
1085
1086 Query q = session.createQuery(sql);
1087
1088 QueryPos qPos = QueryPos.getInstance(q);
1089
1090 if (uuid != null) {
1091 qPos.add(uuid);
1092 }
1093
1094 qPos.add(groupId);
1095
1096 List<DDLRecordSet> list = q.list();
1097
1098 result = list;
1099
1100 DDLRecordSet ddlRecordSet = null;
1101
1102 if (list.isEmpty()) {
1103 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1104 finderArgs, list);
1105 }
1106 else {
1107 ddlRecordSet = list.get(0);
1108
1109 cacheResult(ddlRecordSet);
1110
1111 if ((ddlRecordSet.getUuid() == null) ||
1112 !ddlRecordSet.getUuid().equals(uuid) ||
1113 (ddlRecordSet.getGroupId() != groupId)) {
1114 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1115 finderArgs, ddlRecordSet);
1116 }
1117 }
1118
1119 return ddlRecordSet;
1120 }
1121 catch (Exception e) {
1122 throw processException(e);
1123 }
1124 finally {
1125 if (result == null) {
1126 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
1127 finderArgs);
1128 }
1129
1130 closeSession(session);
1131 }
1132 }
1133 else {
1134 if (result instanceof List<?>) {
1135 return null;
1136 }
1137 else {
1138 return (DDLRecordSet)result;
1139 }
1140 }
1141 }
1142
1143
1150 public List<DDLRecordSet> findByGroupId(long groupId)
1151 throws SystemException {
1152 return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1153 }
1154
1155
1168 public List<DDLRecordSet> findByGroupId(long groupId, int start, int end)
1169 throws SystemException {
1170 return findByGroupId(groupId, start, end, null);
1171 }
1172
1173
1187 public List<DDLRecordSet> findByGroupId(long groupId, int start, int end,
1188 OrderByComparator orderByComparator) throws SystemException {
1189 FinderPath finderPath = null;
1190 Object[] finderArgs = null;
1191
1192 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1193 (orderByComparator == null)) {
1194 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID;
1195 finderArgs = new Object[] { groupId };
1196 }
1197 else {
1198 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID;
1199 finderArgs = new Object[] { groupId, start, end, orderByComparator };
1200 }
1201
1202 List<DDLRecordSet> list = (List<DDLRecordSet>)FinderCacheUtil.getResult(finderPath,
1203 finderArgs, this);
1204
1205 if (list == null) {
1206 StringBundler query = null;
1207
1208 if (orderByComparator != null) {
1209 query = new StringBundler(3 +
1210 (orderByComparator.getOrderByFields().length * 3));
1211 }
1212 else {
1213 query = new StringBundler(2);
1214 }
1215
1216 query.append(_SQL_SELECT_DDLRECORDSET_WHERE);
1217
1218 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1219
1220 if (orderByComparator != null) {
1221 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1222 orderByComparator);
1223 }
1224
1225 String sql = query.toString();
1226
1227 Session session = null;
1228
1229 try {
1230 session = openSession();
1231
1232 Query q = session.createQuery(sql);
1233
1234 QueryPos qPos = QueryPos.getInstance(q);
1235
1236 qPos.add(groupId);
1237
1238 list = (List<DDLRecordSet>)QueryUtil.list(q, getDialect(),
1239 start, end);
1240 }
1241 catch (Exception e) {
1242 throw processException(e);
1243 }
1244 finally {
1245 if (list == null) {
1246 FinderCacheUtil.removeResult(finderPath, finderArgs);
1247 }
1248 else {
1249 cacheResult(list);
1250
1251 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1252 }
1253
1254 closeSession(session);
1255 }
1256 }
1257
1258 return list;
1259 }
1260
1261
1274 public DDLRecordSet findByGroupId_First(long groupId,
1275 OrderByComparator orderByComparator)
1276 throws NoSuchRecordSetException, SystemException {
1277 List<DDLRecordSet> list = findByGroupId(groupId, 0, 1, orderByComparator);
1278
1279 if (list.isEmpty()) {
1280 StringBundler msg = new StringBundler(4);
1281
1282 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1283
1284 msg.append("groupId=");
1285 msg.append(groupId);
1286
1287 msg.append(StringPool.CLOSE_CURLY_BRACE);
1288
1289 throw new NoSuchRecordSetException(msg.toString());
1290 }
1291 else {
1292 return list.get(0);
1293 }
1294 }
1295
1296
1309 public DDLRecordSet findByGroupId_Last(long groupId,
1310 OrderByComparator orderByComparator)
1311 throws NoSuchRecordSetException, SystemException {
1312 int count = countByGroupId(groupId);
1313
1314 List<DDLRecordSet> list = findByGroupId(groupId, count - 1, count,
1315 orderByComparator);
1316
1317 if (list.isEmpty()) {
1318 StringBundler msg = new StringBundler(4);
1319
1320 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1321
1322 msg.append("groupId=");
1323 msg.append(groupId);
1324
1325 msg.append(StringPool.CLOSE_CURLY_BRACE);
1326
1327 throw new NoSuchRecordSetException(msg.toString());
1328 }
1329 else {
1330 return list.get(0);
1331 }
1332 }
1333
1334
1348 public DDLRecordSet[] findByGroupId_PrevAndNext(long recordSetId,
1349 long groupId, OrderByComparator orderByComparator)
1350 throws NoSuchRecordSetException, SystemException {
1351 DDLRecordSet ddlRecordSet = findByPrimaryKey(recordSetId);
1352
1353 Session session = null;
1354
1355 try {
1356 session = openSession();
1357
1358 DDLRecordSet[] array = new DDLRecordSetImpl[3];
1359
1360 array[0] = getByGroupId_PrevAndNext(session, ddlRecordSet, groupId,
1361 orderByComparator, true);
1362
1363 array[1] = ddlRecordSet;
1364
1365 array[2] = getByGroupId_PrevAndNext(session, ddlRecordSet, groupId,
1366 orderByComparator, false);
1367
1368 return array;
1369 }
1370 catch (Exception e) {
1371 throw processException(e);
1372 }
1373 finally {
1374 closeSession(session);
1375 }
1376 }
1377
1378 protected DDLRecordSet getByGroupId_PrevAndNext(Session session,
1379 DDLRecordSet ddlRecordSet, long groupId,
1380 OrderByComparator orderByComparator, boolean previous) {
1381 StringBundler query = null;
1382
1383 if (orderByComparator != null) {
1384 query = new StringBundler(6 +
1385 (orderByComparator.getOrderByFields().length * 6));
1386 }
1387 else {
1388 query = new StringBundler(3);
1389 }
1390
1391 query.append(_SQL_SELECT_DDLRECORDSET_WHERE);
1392
1393 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1394
1395 if (orderByComparator != null) {
1396 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1397
1398 if (orderByConditionFields.length > 0) {
1399 query.append(WHERE_AND);
1400 }
1401
1402 for (int i = 0; i < orderByConditionFields.length; i++) {
1403 query.append(_ORDER_BY_ENTITY_ALIAS);
1404 query.append(orderByConditionFields[i]);
1405
1406 if ((i + 1) < orderByConditionFields.length) {
1407 if (orderByComparator.isAscending() ^ previous) {
1408 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1409 }
1410 else {
1411 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1412 }
1413 }
1414 else {
1415 if (orderByComparator.isAscending() ^ previous) {
1416 query.append(WHERE_GREATER_THAN);
1417 }
1418 else {
1419 query.append(WHERE_LESSER_THAN);
1420 }
1421 }
1422 }
1423
1424 query.append(ORDER_BY_CLAUSE);
1425
1426 String[] orderByFields = orderByComparator.getOrderByFields();
1427
1428 for (int i = 0; i < orderByFields.length; i++) {
1429 query.append(_ORDER_BY_ENTITY_ALIAS);
1430 query.append(orderByFields[i]);
1431
1432 if ((i + 1) < orderByFields.length) {
1433 if (orderByComparator.isAscending() ^ previous) {
1434 query.append(ORDER_BY_ASC_HAS_NEXT);
1435 }
1436 else {
1437 query.append(ORDER_BY_DESC_HAS_NEXT);
1438 }
1439 }
1440 else {
1441 if (orderByComparator.isAscending() ^ previous) {
1442 query.append(ORDER_BY_ASC);
1443 }
1444 else {
1445 query.append(ORDER_BY_DESC);
1446 }
1447 }
1448 }
1449 }
1450
1451 String sql = query.toString();
1452
1453 Query q = session.createQuery(sql);
1454
1455 q.setFirstResult(0);
1456 q.setMaxResults(2);
1457
1458 QueryPos qPos = QueryPos.getInstance(q);
1459
1460 qPos.add(groupId);
1461
1462 if (orderByComparator != null) {
1463 Object[] values = orderByComparator.getOrderByConditionValues(ddlRecordSet);
1464
1465 for (Object value : values) {
1466 qPos.add(value);
1467 }
1468 }
1469
1470 List<DDLRecordSet> list = q.list();
1471
1472 if (list.size() == 2) {
1473 return list.get(1);
1474 }
1475 else {
1476 return null;
1477 }
1478 }
1479
1480
1487 public List<DDLRecordSet> filterFindByGroupId(long groupId)
1488 throws SystemException {
1489 return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
1490 QueryUtil.ALL_POS, null);
1491 }
1492
1493
1506 public List<DDLRecordSet> filterFindByGroupId(long groupId, int start,
1507 int end) throws SystemException {
1508 return filterFindByGroupId(groupId, start, end, null);
1509 }
1510
1511
1525 public List<DDLRecordSet> filterFindByGroupId(long groupId, int start,
1526 int end, OrderByComparator orderByComparator) throws SystemException {
1527 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1528 return findByGroupId(groupId, start, end, orderByComparator);
1529 }
1530
1531 StringBundler query = null;
1532
1533 if (orderByComparator != null) {
1534 query = new StringBundler(3 +
1535 (orderByComparator.getOrderByFields().length * 3));
1536 }
1537 else {
1538 query = new StringBundler(2);
1539 }
1540
1541 if (getDB().isSupportsInlineDistinct()) {
1542 query.append(_FILTER_SQL_SELECT_DDLRECORDSET_WHERE);
1543 }
1544 else {
1545 query.append(_FILTER_SQL_SELECT_DDLRECORDSET_NO_INLINE_DISTINCT_WHERE_1);
1546 }
1547
1548 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1549
1550 if (!getDB().isSupportsInlineDistinct()) {
1551 query.append(_FILTER_SQL_SELECT_DDLRECORDSET_NO_INLINE_DISTINCT_WHERE_2);
1552 }
1553
1554 if (orderByComparator != null) {
1555 if (getDB().isSupportsInlineDistinct()) {
1556 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1557 orderByComparator);
1558 }
1559 else {
1560 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1561 orderByComparator);
1562 }
1563 }
1564
1565 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1566 DDLRecordSet.class.getName(),
1567 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
1568
1569 Session session = null;
1570
1571 try {
1572 session = openSession();
1573
1574 SQLQuery q = session.createSQLQuery(sql);
1575
1576 if (getDB().isSupportsInlineDistinct()) {
1577 q.addEntity(_FILTER_ENTITY_ALIAS, DDLRecordSetImpl.class);
1578 }
1579 else {
1580 q.addEntity(_FILTER_ENTITY_TABLE, DDLRecordSetImpl.class);
1581 }
1582
1583 QueryPos qPos = QueryPos.getInstance(q);
1584
1585 qPos.add(groupId);
1586
1587 return (List<DDLRecordSet>)QueryUtil.list(q, getDialect(), start,
1588 end);
1589 }
1590 catch (Exception e) {
1591 throw processException(e);
1592 }
1593 finally {
1594 closeSession(session);
1595 }
1596 }
1597
1598
1608 public DDLRecordSet[] filterFindByGroupId_PrevAndNext(long recordSetId,
1609 long groupId, OrderByComparator orderByComparator)
1610 throws NoSuchRecordSetException, SystemException {
1611 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1612 return findByGroupId_PrevAndNext(recordSetId, groupId,
1613 orderByComparator);
1614 }
1615
1616 DDLRecordSet ddlRecordSet = findByPrimaryKey(recordSetId);
1617
1618 Session session = null;
1619
1620 try {
1621 session = openSession();
1622
1623 DDLRecordSet[] array = new DDLRecordSetImpl[3];
1624
1625 array[0] = filterGetByGroupId_PrevAndNext(session, ddlRecordSet,
1626 groupId, orderByComparator, true);
1627
1628 array[1] = ddlRecordSet;
1629
1630 array[2] = filterGetByGroupId_PrevAndNext(session, ddlRecordSet,
1631 groupId, orderByComparator, false);
1632
1633 return array;
1634 }
1635 catch (Exception e) {
1636 throw processException(e);
1637 }
1638 finally {
1639 closeSession(session);
1640 }
1641 }
1642
1643 protected DDLRecordSet filterGetByGroupId_PrevAndNext(Session session,
1644 DDLRecordSet ddlRecordSet, long groupId,
1645 OrderByComparator orderByComparator, boolean previous) {
1646 StringBundler query = null;
1647
1648 if (orderByComparator != null) {
1649 query = new StringBundler(6 +
1650 (orderByComparator.getOrderByFields().length * 6));
1651 }
1652 else {
1653 query = new StringBundler(3);
1654 }
1655
1656 if (getDB().isSupportsInlineDistinct()) {
1657 query.append(_FILTER_SQL_SELECT_DDLRECORDSET_WHERE);
1658 }
1659 else {
1660 query.append(_FILTER_SQL_SELECT_DDLRECORDSET_NO_INLINE_DISTINCT_WHERE_1);
1661 }
1662
1663 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1664
1665 if (!getDB().isSupportsInlineDistinct()) {
1666 query.append(_FILTER_SQL_SELECT_DDLRECORDSET_NO_INLINE_DISTINCT_WHERE_2);
1667 }
1668
1669 if (orderByComparator != null) {
1670 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1671
1672 if (orderByConditionFields.length > 0) {
1673 query.append(WHERE_AND);
1674 }
1675
1676 for (int i = 0; i < orderByConditionFields.length; i++) {
1677 if (getDB().isSupportsInlineDistinct()) {
1678 query.append(_ORDER_BY_ENTITY_ALIAS);
1679 }
1680 else {
1681 query.append(_ORDER_BY_ENTITY_TABLE);
1682 }
1683
1684 query.append(orderByConditionFields[i]);
1685
1686 if ((i + 1) < orderByConditionFields.length) {
1687 if (orderByComparator.isAscending() ^ previous) {
1688 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1689 }
1690 else {
1691 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1692 }
1693 }
1694 else {
1695 if (orderByComparator.isAscending() ^ previous) {
1696 query.append(WHERE_GREATER_THAN);
1697 }
1698 else {
1699 query.append(WHERE_LESSER_THAN);
1700 }
1701 }
1702 }
1703
1704 query.append(ORDER_BY_CLAUSE);
1705
1706 String[] orderByFields = orderByComparator.getOrderByFields();
1707
1708 for (int i = 0; i < orderByFields.length; i++) {
1709 if (getDB().isSupportsInlineDistinct()) {
1710 query.append(_ORDER_BY_ENTITY_ALIAS);
1711 }
1712 else {
1713 query.append(_ORDER_BY_ENTITY_TABLE);
1714 }
1715
1716 query.append(orderByFields[i]);
1717
1718 if ((i + 1) < orderByFields.length) {
1719 if (orderByComparator.isAscending() ^ previous) {
1720 query.append(ORDER_BY_ASC_HAS_NEXT);
1721 }
1722 else {
1723 query.append(ORDER_BY_DESC_HAS_NEXT);
1724 }
1725 }
1726 else {
1727 if (orderByComparator.isAscending() ^ previous) {
1728 query.append(ORDER_BY_ASC);
1729 }
1730 else {
1731 query.append(ORDER_BY_DESC);
1732 }
1733 }
1734 }
1735 }
1736
1737 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1738 DDLRecordSet.class.getName(),
1739 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
1740
1741 SQLQuery q = session.createSQLQuery(sql);
1742
1743 q.setFirstResult(0);
1744 q.setMaxResults(2);
1745
1746 if (getDB().isSupportsInlineDistinct()) {
1747 q.addEntity(_FILTER_ENTITY_ALIAS, DDLRecordSetImpl.class);
1748 }
1749 else {
1750 q.addEntity(_FILTER_ENTITY_TABLE, DDLRecordSetImpl.class);
1751 }
1752
1753 QueryPos qPos = QueryPos.getInstance(q);
1754
1755 qPos.add(groupId);
1756
1757 if (orderByComparator != null) {
1758 Object[] values = orderByComparator.getOrderByConditionValues(ddlRecordSet);
1759
1760 for (Object value : values) {
1761 qPos.add(value);
1762 }
1763 }
1764
1765 List<DDLRecordSet> list = q.list();
1766
1767 if (list.size() == 2) {
1768 return list.get(1);
1769 }
1770 else {
1771 return null;
1772 }
1773 }
1774
1775
1784 public DDLRecordSet findByG_R(long groupId, String recordSetKey)
1785 throws NoSuchRecordSetException, SystemException {
1786 DDLRecordSet ddlRecordSet = fetchByG_R(groupId, recordSetKey);
1787
1788 if (ddlRecordSet == null) {
1789 StringBundler msg = new StringBundler(6);
1790
1791 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1792
1793 msg.append("groupId=");
1794 msg.append(groupId);
1795
1796 msg.append(", recordSetKey=");
1797 msg.append(recordSetKey);
1798
1799 msg.append(StringPool.CLOSE_CURLY_BRACE);
1800
1801 if (_log.isWarnEnabled()) {
1802 _log.warn(msg.toString());
1803 }
1804
1805 throw new NoSuchRecordSetException(msg.toString());
1806 }
1807
1808 return ddlRecordSet;
1809 }
1810
1811
1819 public DDLRecordSet fetchByG_R(long groupId, String recordSetKey)
1820 throws SystemException {
1821 return fetchByG_R(groupId, recordSetKey, true);
1822 }
1823
1824
1833 public DDLRecordSet fetchByG_R(long groupId, String recordSetKey,
1834 boolean retrieveFromCache) throws SystemException {
1835 Object[] finderArgs = new Object[] { groupId, recordSetKey };
1836
1837 Object result = null;
1838
1839 if (retrieveFromCache) {
1840 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_R,
1841 finderArgs, this);
1842 }
1843
1844 if (result == null) {
1845 StringBundler query = new StringBundler(3);
1846
1847 query.append(_SQL_SELECT_DDLRECORDSET_WHERE);
1848
1849 query.append(_FINDER_COLUMN_G_R_GROUPID_2);
1850
1851 if (recordSetKey == null) {
1852 query.append(_FINDER_COLUMN_G_R_RECORDSETKEY_1);
1853 }
1854 else {
1855 if (recordSetKey.equals(StringPool.BLANK)) {
1856 query.append(_FINDER_COLUMN_G_R_RECORDSETKEY_3);
1857 }
1858 else {
1859 query.append(_FINDER_COLUMN_G_R_RECORDSETKEY_2);
1860 }
1861 }
1862
1863 String sql = query.toString();
1864
1865 Session session = null;
1866
1867 try {
1868 session = openSession();
1869
1870 Query q = session.createQuery(sql);
1871
1872 QueryPos qPos = QueryPos.getInstance(q);
1873
1874 qPos.add(groupId);
1875
1876 if (recordSetKey != null) {
1877 qPos.add(recordSetKey);
1878 }
1879
1880 List<DDLRecordSet> list = q.list();
1881
1882 result = list;
1883
1884 DDLRecordSet ddlRecordSet = null;
1885
1886 if (list.isEmpty()) {
1887 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_R,
1888 finderArgs, list);
1889 }
1890 else {
1891 ddlRecordSet = list.get(0);
1892
1893 cacheResult(ddlRecordSet);
1894
1895 if ((ddlRecordSet.getGroupId() != groupId) ||
1896 (ddlRecordSet.getRecordSetKey() == null) ||
1897 !ddlRecordSet.getRecordSetKey().equals(recordSetKey)) {
1898 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_R,
1899 finderArgs, ddlRecordSet);
1900 }
1901 }
1902
1903 return ddlRecordSet;
1904 }
1905 catch (Exception e) {
1906 throw processException(e);
1907 }
1908 finally {
1909 if (result == null) {
1910 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_R,
1911 finderArgs);
1912 }
1913
1914 closeSession(session);
1915 }
1916 }
1917 else {
1918 if (result instanceof List<?>) {
1919 return null;
1920 }
1921 else {
1922 return (DDLRecordSet)result;
1923 }
1924 }
1925 }
1926
1927
1933 public List<DDLRecordSet> findAll() throws SystemException {
1934 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1935 }
1936
1937
1949 public List<DDLRecordSet> findAll(int start, int end)
1950 throws SystemException {
1951 return findAll(start, end, null);
1952 }
1953
1954
1967 public List<DDLRecordSet> findAll(int start, int end,
1968 OrderByComparator orderByComparator) throws SystemException {
1969 FinderPath finderPath = null;
1970 Object[] finderArgs = new Object[] { start, end, orderByComparator };
1971
1972 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1973 (orderByComparator == null)) {
1974 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1975 finderArgs = FINDER_ARGS_EMPTY;
1976 }
1977 else {
1978 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1979 finderArgs = new Object[] { start, end, orderByComparator };
1980 }
1981
1982 List<DDLRecordSet> list = (List<DDLRecordSet>)FinderCacheUtil.getResult(finderPath,
1983 finderArgs, this);
1984
1985 if (list == null) {
1986 StringBundler query = null;
1987 String sql = null;
1988
1989 if (orderByComparator != null) {
1990 query = new StringBundler(2 +
1991 (orderByComparator.getOrderByFields().length * 3));
1992
1993 query.append(_SQL_SELECT_DDLRECORDSET);
1994
1995 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1996 orderByComparator);
1997
1998 sql = query.toString();
1999 }
2000 else {
2001 sql = _SQL_SELECT_DDLRECORDSET;
2002 }
2003
2004 Session session = null;
2005
2006 try {
2007 session = openSession();
2008
2009 Query q = session.createQuery(sql);
2010
2011 if (orderByComparator == null) {
2012 list = (List<DDLRecordSet>)QueryUtil.list(q, getDialect(),
2013 start, end, false);
2014
2015 Collections.sort(list);
2016 }
2017 else {
2018 list = (List<DDLRecordSet>)QueryUtil.list(q, getDialect(),
2019 start, end);
2020 }
2021 }
2022 catch (Exception e) {
2023 throw processException(e);
2024 }
2025 finally {
2026 if (list == null) {
2027 FinderCacheUtil.removeResult(finderPath, finderArgs);
2028 }
2029 else {
2030 cacheResult(list);
2031
2032 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2033 }
2034
2035 closeSession(session);
2036 }
2037 }
2038
2039 return list;
2040 }
2041
2042
2048 public void removeByUuid(String uuid) throws SystemException {
2049 for (DDLRecordSet ddlRecordSet : findByUuid(uuid)) {
2050 ddlRecordSetPersistence.remove(ddlRecordSet);
2051 }
2052 }
2053
2054
2061 public void removeByUUID_G(String uuid, long groupId)
2062 throws NoSuchRecordSetException, SystemException {
2063 DDLRecordSet ddlRecordSet = findByUUID_G(uuid, groupId);
2064
2065 ddlRecordSetPersistence.remove(ddlRecordSet);
2066 }
2067
2068
2074 public void removeByGroupId(long groupId) throws SystemException {
2075 for (DDLRecordSet ddlRecordSet : findByGroupId(groupId)) {
2076 ddlRecordSetPersistence.remove(ddlRecordSet);
2077 }
2078 }
2079
2080
2087 public void removeByG_R(long groupId, String recordSetKey)
2088 throws NoSuchRecordSetException, SystemException {
2089 DDLRecordSet ddlRecordSet = findByG_R(groupId, recordSetKey);
2090
2091 ddlRecordSetPersistence.remove(ddlRecordSet);
2092 }
2093
2094
2099 public void removeAll() throws SystemException {
2100 for (DDLRecordSet ddlRecordSet : findAll()) {
2101 ddlRecordSetPersistence.remove(ddlRecordSet);
2102 }
2103 }
2104
2105
2112 public int countByUuid(String uuid) throws SystemException {
2113 Object[] finderArgs = new Object[] { uuid };
2114
2115 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
2116 finderArgs, this);
2117
2118 if (count == null) {
2119 StringBundler query = new StringBundler(2);
2120
2121 query.append(_SQL_COUNT_DDLRECORDSET_WHERE);
2122
2123 if (uuid == null) {
2124 query.append(_FINDER_COLUMN_UUID_UUID_1);
2125 }
2126 else {
2127 if (uuid.equals(StringPool.BLANK)) {
2128 query.append(_FINDER_COLUMN_UUID_UUID_3);
2129 }
2130 else {
2131 query.append(_FINDER_COLUMN_UUID_UUID_2);
2132 }
2133 }
2134
2135 String sql = query.toString();
2136
2137 Session session = null;
2138
2139 try {
2140 session = openSession();
2141
2142 Query q = session.createQuery(sql);
2143
2144 QueryPos qPos = QueryPos.getInstance(q);
2145
2146 if (uuid != null) {
2147 qPos.add(uuid);
2148 }
2149
2150 count = (Long)q.uniqueResult();
2151 }
2152 catch (Exception e) {
2153 throw processException(e);
2154 }
2155 finally {
2156 if (count == null) {
2157 count = Long.valueOf(0);
2158 }
2159
2160 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
2161 finderArgs, count);
2162
2163 closeSession(session);
2164 }
2165 }
2166
2167 return count.intValue();
2168 }
2169
2170
2178 public int countByUUID_G(String uuid, long groupId)
2179 throws SystemException {
2180 Object[] finderArgs = new Object[] { uuid, groupId };
2181
2182 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
2183 finderArgs, this);
2184
2185 if (count == null) {
2186 StringBundler query = new StringBundler(3);
2187
2188 query.append(_SQL_COUNT_DDLRECORDSET_WHERE);
2189
2190 if (uuid == null) {
2191 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
2192 }
2193 else {
2194 if (uuid.equals(StringPool.BLANK)) {
2195 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
2196 }
2197 else {
2198 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
2199 }
2200 }
2201
2202 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
2203
2204 String sql = query.toString();
2205
2206 Session session = null;
2207
2208 try {
2209 session = openSession();
2210
2211 Query q = session.createQuery(sql);
2212
2213 QueryPos qPos = QueryPos.getInstance(q);
2214
2215 if (uuid != null) {
2216 qPos.add(uuid);
2217 }
2218
2219 qPos.add(groupId);
2220
2221 count = (Long)q.uniqueResult();
2222 }
2223 catch (Exception e) {
2224 throw processException(e);
2225 }
2226 finally {
2227 if (count == null) {
2228 count = Long.valueOf(0);
2229 }
2230
2231 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
2232 finderArgs, count);
2233
2234 closeSession(session);
2235 }
2236 }
2237
2238 return count.intValue();
2239 }
2240
2241
2248 public int countByGroupId(long groupId) throws SystemException {
2249 Object[] finderArgs = new Object[] { groupId };
2250
2251 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
2252 finderArgs, this);
2253
2254 if (count == null) {
2255 StringBundler query = new StringBundler(2);
2256
2257 query.append(_SQL_COUNT_DDLRECORDSET_WHERE);
2258
2259 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2260
2261 String sql = query.toString();
2262
2263 Session session = null;
2264
2265 try {
2266 session = openSession();
2267
2268 Query q = session.createQuery(sql);
2269
2270 QueryPos qPos = QueryPos.getInstance(q);
2271
2272 qPos.add(groupId);
2273
2274 count = (Long)q.uniqueResult();
2275 }
2276 catch (Exception e) {
2277 throw processException(e);
2278 }
2279 finally {
2280 if (count == null) {
2281 count = Long.valueOf(0);
2282 }
2283
2284 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
2285 finderArgs, count);
2286
2287 closeSession(session);
2288 }
2289 }
2290
2291 return count.intValue();
2292 }
2293
2294
2301 public int filterCountByGroupId(long groupId) throws SystemException {
2302 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2303 return countByGroupId(groupId);
2304 }
2305
2306 StringBundler query = new StringBundler(2);
2307
2308 query.append(_FILTER_SQL_COUNT_DDLRECORDSET_WHERE);
2309
2310 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2311
2312 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2313 DDLRecordSet.class.getName(),
2314 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
2315
2316 Session session = null;
2317
2318 try {
2319 session = openSession();
2320
2321 SQLQuery q = session.createSQLQuery(sql);
2322
2323 q.addScalar(COUNT_COLUMN_NAME,
2324 com.liferay.portal.kernel.dao.orm.Type.LONG);
2325
2326 QueryPos qPos = QueryPos.getInstance(q);
2327
2328 qPos.add(groupId);
2329
2330 Long count = (Long)q.uniqueResult();
2331
2332 return count.intValue();
2333 }
2334 catch (Exception e) {
2335 throw processException(e);
2336 }
2337 finally {
2338 closeSession(session);
2339 }
2340 }
2341
2342
2350 public int countByG_R(long groupId, String recordSetKey)
2351 throws SystemException {
2352 Object[] finderArgs = new Object[] { groupId, recordSetKey };
2353
2354 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_R,
2355 finderArgs, this);
2356
2357 if (count == null) {
2358 StringBundler query = new StringBundler(3);
2359
2360 query.append(_SQL_COUNT_DDLRECORDSET_WHERE);
2361
2362 query.append(_FINDER_COLUMN_G_R_GROUPID_2);
2363
2364 if (recordSetKey == null) {
2365 query.append(_FINDER_COLUMN_G_R_RECORDSETKEY_1);
2366 }
2367 else {
2368 if (recordSetKey.equals(StringPool.BLANK)) {
2369 query.append(_FINDER_COLUMN_G_R_RECORDSETKEY_3);
2370 }
2371 else {
2372 query.append(_FINDER_COLUMN_G_R_RECORDSETKEY_2);
2373 }
2374 }
2375
2376 String sql = query.toString();
2377
2378 Session session = null;
2379
2380 try {
2381 session = openSession();
2382
2383 Query q = session.createQuery(sql);
2384
2385 QueryPos qPos = QueryPos.getInstance(q);
2386
2387 qPos.add(groupId);
2388
2389 if (recordSetKey != null) {
2390 qPos.add(recordSetKey);
2391 }
2392
2393 count = (Long)q.uniqueResult();
2394 }
2395 catch (Exception e) {
2396 throw processException(e);
2397 }
2398 finally {
2399 if (count == null) {
2400 count = Long.valueOf(0);
2401 }
2402
2403 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_R, finderArgs,
2404 count);
2405
2406 closeSession(session);
2407 }
2408 }
2409
2410 return count.intValue();
2411 }
2412
2413
2419 public int countAll() throws SystemException {
2420 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2421 FINDER_ARGS_EMPTY, this);
2422
2423 if (count == null) {
2424 Session session = null;
2425
2426 try {
2427 session = openSession();
2428
2429 Query q = session.createQuery(_SQL_COUNT_DDLRECORDSET);
2430
2431 count = (Long)q.uniqueResult();
2432 }
2433 catch (Exception e) {
2434 throw processException(e);
2435 }
2436 finally {
2437 if (count == null) {
2438 count = Long.valueOf(0);
2439 }
2440
2441 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
2442 FINDER_ARGS_EMPTY, count);
2443
2444 closeSession(session);
2445 }
2446 }
2447
2448 return count.intValue();
2449 }
2450
2451
2454 public void afterPropertiesSet() {
2455 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2456 com.liferay.portal.util.PropsUtil.get(
2457 "value.object.listener.com.liferay.portlet.dynamicdatalists.model.DDLRecordSet")));
2458
2459 if (listenerClassNames.length > 0) {
2460 try {
2461 List<ModelListener<DDLRecordSet>> listenersList = new ArrayList<ModelListener<DDLRecordSet>>();
2462
2463 for (String listenerClassName : listenerClassNames) {
2464 listenersList.add((ModelListener<DDLRecordSet>)InstanceFactory.newInstance(
2465 listenerClassName));
2466 }
2467
2468 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2469 }
2470 catch (Exception e) {
2471 _log.error(e);
2472 }
2473 }
2474 }
2475
2476 public void destroy() {
2477 EntityCacheUtil.removeCache(DDLRecordSetImpl.class.getName());
2478 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
2479 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2480 }
2481
2482 @BeanReference(type = DDLRecordPersistence.class)
2483 protected DDLRecordPersistence ddlRecordPersistence;
2484 @BeanReference(type = DDLRecordSetPersistence.class)
2485 protected DDLRecordSetPersistence ddlRecordSetPersistence;
2486 @BeanReference(type = DDLRecordVersionPersistence.class)
2487 protected DDLRecordVersionPersistence ddlRecordVersionPersistence;
2488 @BeanReference(type = ResourcePersistence.class)
2489 protected ResourcePersistence resourcePersistence;
2490 @BeanReference(type = UserPersistence.class)
2491 protected UserPersistence userPersistence;
2492 @BeanReference(type = DDMStructurePersistence.class)
2493 protected DDMStructurePersistence ddmStructurePersistence;
2494 @BeanReference(type = DDMStructureLinkPersistence.class)
2495 protected DDMStructureLinkPersistence ddmStructureLinkPersistence;
2496 private static final String _SQL_SELECT_DDLRECORDSET = "SELECT ddlRecordSet FROM DDLRecordSet ddlRecordSet";
2497 private static final String _SQL_SELECT_DDLRECORDSET_WHERE = "SELECT ddlRecordSet FROM DDLRecordSet ddlRecordSet WHERE ";
2498 private static final String _SQL_COUNT_DDLRECORDSET = "SELECT COUNT(ddlRecordSet) FROM DDLRecordSet ddlRecordSet";
2499 private static final String _SQL_COUNT_DDLRECORDSET_WHERE = "SELECT COUNT(ddlRecordSet) FROM DDLRecordSet ddlRecordSet WHERE ";
2500 private static final String _FINDER_COLUMN_UUID_UUID_1 = "ddlRecordSet.uuid IS NULL";
2501 private static final String _FINDER_COLUMN_UUID_UUID_2 = "ddlRecordSet.uuid = ?";
2502 private static final String _FINDER_COLUMN_UUID_UUID_3 = "(ddlRecordSet.uuid IS NULL OR ddlRecordSet.uuid = ?)";
2503 private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "ddlRecordSet.uuid IS NULL AND ";
2504 private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "ddlRecordSet.uuid = ? AND ";
2505 private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(ddlRecordSet.uuid IS NULL OR ddlRecordSet.uuid = ?) AND ";
2506 private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "ddlRecordSet.groupId = ?";
2507 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "ddlRecordSet.groupId = ?";
2508 private static final String _FINDER_COLUMN_G_R_GROUPID_2 = "ddlRecordSet.groupId = ? AND ";
2509 private static final String _FINDER_COLUMN_G_R_RECORDSETKEY_1 = "ddlRecordSet.recordSetKey IS NULL";
2510 private static final String _FINDER_COLUMN_G_R_RECORDSETKEY_2 = "ddlRecordSet.recordSetKey = ?";
2511 private static final String _FINDER_COLUMN_G_R_RECORDSETKEY_3 = "(ddlRecordSet.recordSetKey IS NULL OR ddlRecordSet.recordSetKey = ?)";
2512 private static final String _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN = "ddlRecordSet.recordSetId";
2513 private static final String _FILTER_SQL_SELECT_DDLRECORDSET_WHERE = "SELECT DISTINCT {ddlRecordSet.*} FROM DDLRecordSet ddlRecordSet WHERE ";
2514 private static final String _FILTER_SQL_SELECT_DDLRECORDSET_NO_INLINE_DISTINCT_WHERE_1 =
2515 "SELECT {DDLRecordSet.*} FROM (SELECT DISTINCT ddlRecordSet.recordSetId FROM DDLRecordSet ddlRecordSet WHERE ";
2516 private static final String _FILTER_SQL_SELECT_DDLRECORDSET_NO_INLINE_DISTINCT_WHERE_2 =
2517 ") TEMP_TABLE INNER JOIN DDLRecordSet ON TEMP_TABLE.recordSetId = DDLRecordSet.recordSetId";
2518 private static final String _FILTER_SQL_COUNT_DDLRECORDSET_WHERE = "SELECT COUNT(DISTINCT ddlRecordSet.recordSetId) AS COUNT_VALUE FROM DDLRecordSet ddlRecordSet WHERE ";
2519 private static final String _FILTER_ENTITY_ALIAS = "ddlRecordSet";
2520 private static final String _FILTER_ENTITY_TABLE = "DDLRecordSet";
2521 private static final String _ORDER_BY_ENTITY_ALIAS = "ddlRecordSet.";
2522 private static final String _ORDER_BY_ENTITY_TABLE = "DDLRecordSet.";
2523 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No DDLRecordSet exists with the primary key ";
2524 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No DDLRecordSet exists with the key {";
2525 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
2526 private static Log _log = LogFactoryUtil.getLog(DDLRecordSetPersistenceImpl.class);
2527 private static DDLRecordSet _nullDDLRecordSet = new DDLRecordSetImpl() {
2528 @Override
2529 public Object clone() {
2530 return this;
2531 }
2532
2533 @Override
2534 public CacheModel<DDLRecordSet> toCacheModel() {
2535 return _nullDDLRecordSetCacheModel;
2536 }
2537 };
2538
2539 private static CacheModel<DDLRecordSet> _nullDDLRecordSetCacheModel = new CacheModel<DDLRecordSet>() {
2540 public DDLRecordSet toEntityModel() {
2541 return _nullDDLRecordSet;
2542 }
2543 };
2544 }