001
014
015 package com.liferay.portlet.documentlibrary.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.jdbc.MappingSqlQuery;
021 import com.liferay.portal.kernel.dao.jdbc.MappingSqlQueryFactoryUtil;
022 import com.liferay.portal.kernel.dao.jdbc.RowMapper;
023 import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
024 import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
025 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
026 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
027 import com.liferay.portal.kernel.dao.orm.FinderPath;
028 import com.liferay.portal.kernel.dao.orm.Query;
029 import com.liferay.portal.kernel.dao.orm.QueryPos;
030 import com.liferay.portal.kernel.dao.orm.QueryUtil;
031 import com.liferay.portal.kernel.dao.orm.SQLQuery;
032 import com.liferay.portal.kernel.dao.orm.Session;
033 import com.liferay.portal.kernel.exception.SystemException;
034 import com.liferay.portal.kernel.log.Log;
035 import com.liferay.portal.kernel.log.LogFactoryUtil;
036 import com.liferay.portal.kernel.util.ArrayUtil;
037 import com.liferay.portal.kernel.util.GetterUtil;
038 import com.liferay.portal.kernel.util.InstanceFactory;
039 import com.liferay.portal.kernel.util.OrderByComparator;
040 import com.liferay.portal.kernel.util.SetUtil;
041 import com.liferay.portal.kernel.util.StringBundler;
042 import com.liferay.portal.kernel.util.StringPool;
043 import com.liferay.portal.kernel.util.StringUtil;
044 import com.liferay.portal.kernel.util.Validator;
045 import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
046 import com.liferay.portal.model.CacheModel;
047 import com.liferay.portal.model.ModelListener;
048 import com.liferay.portal.security.permission.InlineSQLHelperUtil;
049 import com.liferay.portal.service.persistence.BatchSessionUtil;
050 import com.liferay.portal.service.persistence.ResourcePersistence;
051 import com.liferay.portal.service.persistence.UserPersistence;
052 import com.liferay.portal.service.persistence.WorkflowDefinitionLinkPersistence;
053 import com.liferay.portal.service.persistence.WorkflowInstanceLinkPersistence;
054 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
055
056 import com.liferay.portlet.documentlibrary.NoSuchFileEntryTypeException;
057 import com.liferay.portlet.documentlibrary.model.DLFileEntryType;
058 import com.liferay.portlet.documentlibrary.model.impl.DLFileEntryTypeImpl;
059 import com.liferay.portlet.documentlibrary.model.impl.DLFileEntryTypeModelImpl;
060 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMStructurePersistence;
061
062 import java.io.Serializable;
063
064 import java.util.ArrayList;
065 import java.util.Collections;
066 import java.util.List;
067 import java.util.Set;
068
069
081 public class DLFileEntryTypePersistenceImpl extends BasePersistenceImpl<DLFileEntryType>
082 implements DLFileEntryTypePersistence {
083
088 public static final String FINDER_CLASS_NAME_ENTITY = DLFileEntryTypeImpl.class.getName();
089 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
090 ".List1";
091 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
092 ".List2";
093 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID = new FinderPath(DLFileEntryTypeModelImpl.ENTITY_CACHE_ENABLED,
094 DLFileEntryTypeModelImpl.FINDER_CACHE_ENABLED,
095 DLFileEntryTypeImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
096 "findByUuid",
097 new String[] {
098 String.class.getName(),
099
100 "java.lang.Integer", "java.lang.Integer",
101 "com.liferay.portal.kernel.util.OrderByComparator"
102 });
103 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID = new FinderPath(DLFileEntryTypeModelImpl.ENTITY_CACHE_ENABLED,
104 DLFileEntryTypeModelImpl.FINDER_CACHE_ENABLED,
105 DLFileEntryTypeImpl.class,
106 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUuid",
107 new String[] { String.class.getName() },
108 DLFileEntryTypeModelImpl.UUID_COLUMN_BITMASK);
109 public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(DLFileEntryTypeModelImpl.ENTITY_CACHE_ENABLED,
110 DLFileEntryTypeModelImpl.FINDER_CACHE_ENABLED, Long.class,
111 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUuid",
112 new String[] { String.class.getName() });
113 public static final FinderPath FINDER_PATH_FETCH_BY_UUID_G = new FinderPath(DLFileEntryTypeModelImpl.ENTITY_CACHE_ENABLED,
114 DLFileEntryTypeModelImpl.FINDER_CACHE_ENABLED,
115 DLFileEntryTypeImpl.class, FINDER_CLASS_NAME_ENTITY,
116 "fetchByUUID_G",
117 new String[] { String.class.getName(), Long.class.getName() },
118 DLFileEntryTypeModelImpl.UUID_COLUMN_BITMASK |
119 DLFileEntryTypeModelImpl.GROUPID_COLUMN_BITMASK);
120 public static final FinderPath FINDER_PATH_COUNT_BY_UUID_G = new FinderPath(DLFileEntryTypeModelImpl.ENTITY_CACHE_ENABLED,
121 DLFileEntryTypeModelImpl.FINDER_CACHE_ENABLED, Long.class,
122 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUUID_G",
123 new String[] { String.class.getName(), Long.class.getName() });
124 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID = new FinderPath(DLFileEntryTypeModelImpl.ENTITY_CACHE_ENABLED,
125 DLFileEntryTypeModelImpl.FINDER_CACHE_ENABLED,
126 DLFileEntryTypeImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
127 "findByGroupId",
128 new String[] {
129 Long.class.getName(),
130
131 "java.lang.Integer", "java.lang.Integer",
132 "com.liferay.portal.kernel.util.OrderByComparator"
133 });
134 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID =
135 new FinderPath(DLFileEntryTypeModelImpl.ENTITY_CACHE_ENABLED,
136 DLFileEntryTypeModelImpl.FINDER_CACHE_ENABLED,
137 DLFileEntryTypeImpl.class,
138 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByGroupId",
139 new String[] { Long.class.getName() },
140 DLFileEntryTypeModelImpl.GROUPID_COLUMN_BITMASK);
141 public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(DLFileEntryTypeModelImpl.ENTITY_CACHE_ENABLED,
142 DLFileEntryTypeModelImpl.FINDER_CACHE_ENABLED, Long.class,
143 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByGroupId",
144 new String[] { Long.class.getName() });
145 public static final FinderPath FINDER_PATH_WITH_PAGINATION_COUNT_BY_GROUPID = new FinderPath(DLFileEntryTypeModelImpl.ENTITY_CACHE_ENABLED,
146 DLFileEntryTypeModelImpl.FINDER_CACHE_ENABLED, Long.class,
147 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByGroupId",
148 new String[] { Long.class.getName() });
149 public static final FinderPath FINDER_PATH_FETCH_BY_G_N = new FinderPath(DLFileEntryTypeModelImpl.ENTITY_CACHE_ENABLED,
150 DLFileEntryTypeModelImpl.FINDER_CACHE_ENABLED,
151 DLFileEntryTypeImpl.class, FINDER_CLASS_NAME_ENTITY, "fetchByG_N",
152 new String[] { Long.class.getName(), String.class.getName() },
153 DLFileEntryTypeModelImpl.GROUPID_COLUMN_BITMASK |
154 DLFileEntryTypeModelImpl.NAME_COLUMN_BITMASK);
155 public static final FinderPath FINDER_PATH_COUNT_BY_G_N = new FinderPath(DLFileEntryTypeModelImpl.ENTITY_CACHE_ENABLED,
156 DLFileEntryTypeModelImpl.FINDER_CACHE_ENABLED, Long.class,
157 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_N",
158 new String[] { Long.class.getName(), String.class.getName() });
159 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(DLFileEntryTypeModelImpl.ENTITY_CACHE_ENABLED,
160 DLFileEntryTypeModelImpl.FINDER_CACHE_ENABLED,
161 DLFileEntryTypeImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
162 "findAll", new String[0]);
163 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(DLFileEntryTypeModelImpl.ENTITY_CACHE_ENABLED,
164 DLFileEntryTypeModelImpl.FINDER_CACHE_ENABLED,
165 DLFileEntryTypeImpl.class,
166 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
167 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(DLFileEntryTypeModelImpl.ENTITY_CACHE_ENABLED,
168 DLFileEntryTypeModelImpl.FINDER_CACHE_ENABLED, Long.class,
169 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
170
171
176 public void cacheResult(DLFileEntryType dlFileEntryType) {
177 EntityCacheUtil.putResult(DLFileEntryTypeModelImpl.ENTITY_CACHE_ENABLED,
178 DLFileEntryTypeImpl.class, dlFileEntryType.getPrimaryKey(),
179 dlFileEntryType);
180
181 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
182 new Object[] {
183 dlFileEntryType.getUuid(),
184 Long.valueOf(dlFileEntryType.getGroupId())
185 }, dlFileEntryType);
186
187 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N,
188 new Object[] {
189 Long.valueOf(dlFileEntryType.getGroupId()),
190
191 dlFileEntryType.getName()
192 }, dlFileEntryType);
193
194 dlFileEntryType.resetOriginalValues();
195 }
196
197
202 public void cacheResult(List<DLFileEntryType> dlFileEntryTypes) {
203 for (DLFileEntryType dlFileEntryType : dlFileEntryTypes) {
204 if (EntityCacheUtil.getResult(
205 DLFileEntryTypeModelImpl.ENTITY_CACHE_ENABLED,
206 DLFileEntryTypeImpl.class,
207 dlFileEntryType.getPrimaryKey()) == null) {
208 cacheResult(dlFileEntryType);
209 }
210 else {
211 dlFileEntryType.resetOriginalValues();
212 }
213 }
214 }
215
216
223 @Override
224 public void clearCache() {
225 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
226 CacheRegistryUtil.clear(DLFileEntryTypeImpl.class.getName());
227 }
228
229 EntityCacheUtil.clearCache(DLFileEntryTypeImpl.class.getName());
230
231 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
232 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
233 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
234 }
235
236
243 @Override
244 public void clearCache(DLFileEntryType dlFileEntryType) {
245 EntityCacheUtil.removeResult(DLFileEntryTypeModelImpl.ENTITY_CACHE_ENABLED,
246 DLFileEntryTypeImpl.class, dlFileEntryType.getPrimaryKey());
247
248 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
249 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
250
251 clearUniqueFindersCache(dlFileEntryType);
252 }
253
254 @Override
255 public void clearCache(List<DLFileEntryType> dlFileEntryTypes) {
256 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
257 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
258
259 for (DLFileEntryType dlFileEntryType : dlFileEntryTypes) {
260 EntityCacheUtil.removeResult(DLFileEntryTypeModelImpl.ENTITY_CACHE_ENABLED,
261 DLFileEntryTypeImpl.class, dlFileEntryType.getPrimaryKey());
262
263 clearUniqueFindersCache(dlFileEntryType);
264 }
265 }
266
267 protected void cacheUniqueFindersCache(DLFileEntryType dlFileEntryType) {
268 if (dlFileEntryType.isNew()) {
269 Object[] args = new Object[] {
270 dlFileEntryType.getUuid(),
271 Long.valueOf(dlFileEntryType.getGroupId())
272 };
273
274 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G, args,
275 Long.valueOf(1));
276 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G, args,
277 dlFileEntryType);
278
279 args = new Object[] {
280 Long.valueOf(dlFileEntryType.getGroupId()),
281
282 dlFileEntryType.getName()
283 };
284
285 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_N, args,
286 Long.valueOf(1));
287 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N, args,
288 dlFileEntryType);
289 }
290 else {
291 DLFileEntryTypeModelImpl dlFileEntryTypeModelImpl = (DLFileEntryTypeModelImpl)dlFileEntryType;
292
293 if ((dlFileEntryTypeModelImpl.getColumnBitmask() &
294 FINDER_PATH_FETCH_BY_UUID_G.getColumnBitmask()) != 0) {
295 Object[] args = new Object[] {
296 dlFileEntryType.getUuid(),
297 Long.valueOf(dlFileEntryType.getGroupId())
298 };
299
300 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G, args,
301 Long.valueOf(1));
302 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G, args,
303 dlFileEntryType);
304 }
305
306 if ((dlFileEntryTypeModelImpl.getColumnBitmask() &
307 FINDER_PATH_FETCH_BY_G_N.getColumnBitmask()) != 0) {
308 Object[] args = new Object[] {
309 Long.valueOf(dlFileEntryType.getGroupId()),
310
311 dlFileEntryType.getName()
312 };
313
314 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_N, args,
315 Long.valueOf(1));
316 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N, args,
317 dlFileEntryType);
318 }
319 }
320 }
321
322 protected void clearUniqueFindersCache(DLFileEntryType dlFileEntryType) {
323 DLFileEntryTypeModelImpl dlFileEntryTypeModelImpl = (DLFileEntryTypeModelImpl)dlFileEntryType;
324
325 Object[] args = new Object[] {
326 dlFileEntryType.getUuid(),
327 Long.valueOf(dlFileEntryType.getGroupId())
328 };
329
330 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID_G, args);
331 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G, args);
332
333 if ((dlFileEntryTypeModelImpl.getColumnBitmask() &
334 FINDER_PATH_FETCH_BY_UUID_G.getColumnBitmask()) != 0) {
335 args = new Object[] {
336 dlFileEntryTypeModelImpl.getOriginalUuid(),
337 Long.valueOf(dlFileEntryTypeModelImpl.getOriginalGroupId())
338 };
339
340 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID_G, args);
341 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G, args);
342 }
343
344 args = new Object[] {
345 Long.valueOf(dlFileEntryType.getGroupId()),
346
347 dlFileEntryType.getName()
348 };
349
350 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_N, args);
351 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_N, args);
352
353 if ((dlFileEntryTypeModelImpl.getColumnBitmask() &
354 FINDER_PATH_FETCH_BY_G_N.getColumnBitmask()) != 0) {
355 args = new Object[] {
356 Long.valueOf(dlFileEntryTypeModelImpl.getOriginalGroupId()),
357
358 dlFileEntryTypeModelImpl.getOriginalName()
359 };
360
361 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_N, args);
362 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_N, args);
363 }
364 }
365
366
372 public DLFileEntryType create(long fileEntryTypeId) {
373 DLFileEntryType dlFileEntryType = new DLFileEntryTypeImpl();
374
375 dlFileEntryType.setNew(true);
376 dlFileEntryType.setPrimaryKey(fileEntryTypeId);
377
378 String uuid = PortalUUIDUtil.generate();
379
380 dlFileEntryType.setUuid(uuid);
381
382 return dlFileEntryType;
383 }
384
385
393 public DLFileEntryType remove(long fileEntryTypeId)
394 throws NoSuchFileEntryTypeException, SystemException {
395 return remove(Long.valueOf(fileEntryTypeId));
396 }
397
398
406 @Override
407 public DLFileEntryType remove(Serializable primaryKey)
408 throws NoSuchFileEntryTypeException, SystemException {
409 Session session = null;
410
411 try {
412 session = openSession();
413
414 DLFileEntryType dlFileEntryType = (DLFileEntryType)session.get(DLFileEntryTypeImpl.class,
415 primaryKey);
416
417 if (dlFileEntryType == null) {
418 if (_log.isWarnEnabled()) {
419 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
420 }
421
422 throw new NoSuchFileEntryTypeException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
423 primaryKey);
424 }
425
426 return remove(dlFileEntryType);
427 }
428 catch (NoSuchFileEntryTypeException nsee) {
429 throw nsee;
430 }
431 catch (Exception e) {
432 throw processException(e);
433 }
434 finally {
435 closeSession(session);
436 }
437 }
438
439 @Override
440 protected DLFileEntryType removeImpl(DLFileEntryType dlFileEntryType)
441 throws SystemException {
442 dlFileEntryType = toUnwrappedModel(dlFileEntryType);
443
444 try {
445 clearDLFolders.clear(dlFileEntryType.getPrimaryKey());
446 }
447 catch (Exception e) {
448 throw processException(e);
449 }
450 finally {
451 FinderCacheUtil.clearCache(DLFileEntryTypeModelImpl.MAPPING_TABLE_DLFILEENTRYTYPES_DLFOLDERS_NAME);
452 }
453
454 try {
455 clearDDMStructures.clear(dlFileEntryType.getPrimaryKey());
456 }
457 catch (Exception e) {
458 throw processException(e);
459 }
460 finally {
461 FinderCacheUtil.clearCache(DLFileEntryTypeModelImpl.MAPPING_TABLE_DLFILEENTRYTYPES_DDMSTRUCTURES_NAME);
462 }
463
464 Session session = null;
465
466 try {
467 session = openSession();
468
469 BatchSessionUtil.delete(session, dlFileEntryType);
470 }
471 catch (Exception e) {
472 throw processException(e);
473 }
474 finally {
475 closeSession(session);
476 }
477
478 clearCache(dlFileEntryType);
479
480 return dlFileEntryType;
481 }
482
483 @Override
484 public DLFileEntryType updateImpl(
485 com.liferay.portlet.documentlibrary.model.DLFileEntryType dlFileEntryType,
486 boolean merge) throws SystemException {
487 dlFileEntryType = toUnwrappedModel(dlFileEntryType);
488
489 boolean isNew = dlFileEntryType.isNew();
490
491 DLFileEntryTypeModelImpl dlFileEntryTypeModelImpl = (DLFileEntryTypeModelImpl)dlFileEntryType;
492
493 if (Validator.isNull(dlFileEntryType.getUuid())) {
494 String uuid = PortalUUIDUtil.generate();
495
496 dlFileEntryType.setUuid(uuid);
497 }
498
499 Session session = null;
500
501 try {
502 session = openSession();
503
504 BatchSessionUtil.update(session, dlFileEntryType, merge);
505
506 dlFileEntryType.setNew(false);
507 }
508 catch (Exception e) {
509 throw processException(e);
510 }
511 finally {
512 closeSession(session);
513 }
514
515 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
516
517 if (isNew || !DLFileEntryTypeModelImpl.COLUMN_BITMASK_ENABLED) {
518 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
519 }
520
521 else {
522 if ((dlFileEntryTypeModelImpl.getColumnBitmask() &
523 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID.getColumnBitmask()) != 0) {
524 Object[] args = new Object[] {
525 dlFileEntryTypeModelImpl.getOriginalUuid()
526 };
527
528 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
529 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
530 args);
531
532 args = new Object[] { dlFileEntryTypeModelImpl.getUuid() };
533
534 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
535 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
536 args);
537 }
538
539 if ((dlFileEntryTypeModelImpl.getColumnBitmask() &
540 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID.getColumnBitmask()) != 0) {
541 Object[] args = new Object[] {
542 Long.valueOf(dlFileEntryTypeModelImpl.getOriginalGroupId())
543 };
544
545 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
546 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
547 args);
548
549 args = new Object[] {
550 Long.valueOf(dlFileEntryTypeModelImpl.getGroupId())
551 };
552
553 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
554 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
555 args);
556 }
557 }
558
559 EntityCacheUtil.putResult(DLFileEntryTypeModelImpl.ENTITY_CACHE_ENABLED,
560 DLFileEntryTypeImpl.class, dlFileEntryType.getPrimaryKey(),
561 dlFileEntryType);
562
563 clearUniqueFindersCache(dlFileEntryType);
564 cacheUniqueFindersCache(dlFileEntryType);
565
566 return dlFileEntryType;
567 }
568
569 protected DLFileEntryType toUnwrappedModel(DLFileEntryType dlFileEntryType) {
570 if (dlFileEntryType instanceof DLFileEntryTypeImpl) {
571 return dlFileEntryType;
572 }
573
574 DLFileEntryTypeImpl dlFileEntryTypeImpl = new DLFileEntryTypeImpl();
575
576 dlFileEntryTypeImpl.setNew(dlFileEntryType.isNew());
577 dlFileEntryTypeImpl.setPrimaryKey(dlFileEntryType.getPrimaryKey());
578
579 dlFileEntryTypeImpl.setUuid(dlFileEntryType.getUuid());
580 dlFileEntryTypeImpl.setFileEntryTypeId(dlFileEntryType.getFileEntryTypeId());
581 dlFileEntryTypeImpl.setGroupId(dlFileEntryType.getGroupId());
582 dlFileEntryTypeImpl.setCompanyId(dlFileEntryType.getCompanyId());
583 dlFileEntryTypeImpl.setUserId(dlFileEntryType.getUserId());
584 dlFileEntryTypeImpl.setUserName(dlFileEntryType.getUserName());
585 dlFileEntryTypeImpl.setCreateDate(dlFileEntryType.getCreateDate());
586 dlFileEntryTypeImpl.setModifiedDate(dlFileEntryType.getModifiedDate());
587 dlFileEntryTypeImpl.setName(dlFileEntryType.getName());
588 dlFileEntryTypeImpl.setDescription(dlFileEntryType.getDescription());
589
590 return dlFileEntryTypeImpl;
591 }
592
593
601 @Override
602 public DLFileEntryType findByPrimaryKey(Serializable primaryKey)
603 throws NoSuchModelException, SystemException {
604 return findByPrimaryKey(((Long)primaryKey).longValue());
605 }
606
607
615 public DLFileEntryType findByPrimaryKey(long fileEntryTypeId)
616 throws NoSuchFileEntryTypeException, SystemException {
617 DLFileEntryType dlFileEntryType = fetchByPrimaryKey(fileEntryTypeId);
618
619 if (dlFileEntryType == null) {
620 if (_log.isWarnEnabled()) {
621 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + fileEntryTypeId);
622 }
623
624 throw new NoSuchFileEntryTypeException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
625 fileEntryTypeId);
626 }
627
628 return dlFileEntryType;
629 }
630
631
638 @Override
639 public DLFileEntryType fetchByPrimaryKey(Serializable primaryKey)
640 throws SystemException {
641 return fetchByPrimaryKey(((Long)primaryKey).longValue());
642 }
643
644
651 public DLFileEntryType fetchByPrimaryKey(long fileEntryTypeId)
652 throws SystemException {
653 DLFileEntryType dlFileEntryType = (DLFileEntryType)EntityCacheUtil.getResult(DLFileEntryTypeModelImpl.ENTITY_CACHE_ENABLED,
654 DLFileEntryTypeImpl.class, fileEntryTypeId);
655
656 if (dlFileEntryType == _nullDLFileEntryType) {
657 return null;
658 }
659
660 if (dlFileEntryType == null) {
661 Session session = null;
662
663 boolean hasException = false;
664
665 try {
666 session = openSession();
667
668 dlFileEntryType = (DLFileEntryType)session.get(DLFileEntryTypeImpl.class,
669 Long.valueOf(fileEntryTypeId));
670 }
671 catch (Exception e) {
672 hasException = true;
673
674 throw processException(e);
675 }
676 finally {
677 if (dlFileEntryType != null) {
678 cacheResult(dlFileEntryType);
679 }
680 else if (!hasException) {
681 EntityCacheUtil.putResult(DLFileEntryTypeModelImpl.ENTITY_CACHE_ENABLED,
682 DLFileEntryTypeImpl.class, fileEntryTypeId,
683 _nullDLFileEntryType);
684 }
685
686 closeSession(session);
687 }
688 }
689
690 return dlFileEntryType;
691 }
692
693
700 public List<DLFileEntryType> findByUuid(String uuid)
701 throws SystemException {
702 return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
703 }
704
705
718 public List<DLFileEntryType> findByUuid(String uuid, int start, int end)
719 throws SystemException {
720 return findByUuid(uuid, start, end, null);
721 }
722
723
737 public List<DLFileEntryType> findByUuid(String uuid, int start, int end,
738 OrderByComparator orderByComparator) throws SystemException {
739 FinderPath finderPath = null;
740 Object[] finderArgs = null;
741
742 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
743 (orderByComparator == null)) {
744 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID;
745 finderArgs = new Object[] { uuid };
746 }
747 else {
748 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID;
749 finderArgs = new Object[] { uuid, start, end, orderByComparator };
750 }
751
752 List<DLFileEntryType> list = (List<DLFileEntryType>)FinderCacheUtil.getResult(finderPath,
753 finderArgs, this);
754
755 if ((list != null) && !list.isEmpty()) {
756 for (DLFileEntryType dlFileEntryType : list) {
757 if (!Validator.equals(uuid, dlFileEntryType.getUuid())) {
758 list = null;
759
760 break;
761 }
762 }
763 }
764
765 if (list == null) {
766 StringBundler query = null;
767
768 if (orderByComparator != null) {
769 query = new StringBundler(3 +
770 (orderByComparator.getOrderByFields().length * 3));
771 }
772 else {
773 query = new StringBundler(2);
774 }
775
776 query.append(_SQL_SELECT_DLFILEENTRYTYPE_WHERE);
777
778 if (uuid == null) {
779 query.append(_FINDER_COLUMN_UUID_UUID_1);
780 }
781 else {
782 if (uuid.equals(StringPool.BLANK)) {
783 query.append(_FINDER_COLUMN_UUID_UUID_3);
784 }
785 else {
786 query.append(_FINDER_COLUMN_UUID_UUID_2);
787 }
788 }
789
790 if (orderByComparator != null) {
791 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
792 orderByComparator);
793 }
794
795 String sql = query.toString();
796
797 Session session = null;
798
799 try {
800 session = openSession();
801
802 Query q = session.createQuery(sql);
803
804 QueryPos qPos = QueryPos.getInstance(q);
805
806 if (uuid != null) {
807 qPos.add(uuid);
808 }
809
810 list = (List<DLFileEntryType>)QueryUtil.list(q, getDialect(),
811 start, end);
812 }
813 catch (Exception e) {
814 throw processException(e);
815 }
816 finally {
817 if (list == null) {
818 FinderCacheUtil.removeResult(finderPath, finderArgs);
819 }
820 else {
821 cacheResult(list);
822
823 FinderCacheUtil.putResult(finderPath, finderArgs, list);
824 }
825
826 closeSession(session);
827 }
828 }
829
830 return list;
831 }
832
833
842 public DLFileEntryType findByUuid_First(String uuid,
843 OrderByComparator orderByComparator)
844 throws NoSuchFileEntryTypeException, SystemException {
845 DLFileEntryType dlFileEntryType = fetchByUuid_First(uuid,
846 orderByComparator);
847
848 if (dlFileEntryType != null) {
849 return dlFileEntryType;
850 }
851
852 StringBundler msg = new StringBundler(4);
853
854 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
855
856 msg.append("uuid=");
857 msg.append(uuid);
858
859 msg.append(StringPool.CLOSE_CURLY_BRACE);
860
861 throw new NoSuchFileEntryTypeException(msg.toString());
862 }
863
864
872 public DLFileEntryType fetchByUuid_First(String uuid,
873 OrderByComparator orderByComparator) throws SystemException {
874 List<DLFileEntryType> list = findByUuid(uuid, 0, 1, orderByComparator);
875
876 if (!list.isEmpty()) {
877 return list.get(0);
878 }
879
880 return null;
881 }
882
883
892 public DLFileEntryType findByUuid_Last(String uuid,
893 OrderByComparator orderByComparator)
894 throws NoSuchFileEntryTypeException, SystemException {
895 DLFileEntryType dlFileEntryType = fetchByUuid_Last(uuid,
896 orderByComparator);
897
898 if (dlFileEntryType != null) {
899 return dlFileEntryType;
900 }
901
902 StringBundler msg = new StringBundler(4);
903
904 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
905
906 msg.append("uuid=");
907 msg.append(uuid);
908
909 msg.append(StringPool.CLOSE_CURLY_BRACE);
910
911 throw new NoSuchFileEntryTypeException(msg.toString());
912 }
913
914
922 public DLFileEntryType fetchByUuid_Last(String uuid,
923 OrderByComparator orderByComparator) throws SystemException {
924 int count = countByUuid(uuid);
925
926 List<DLFileEntryType> list = findByUuid(uuid, count - 1, count,
927 orderByComparator);
928
929 if (!list.isEmpty()) {
930 return list.get(0);
931 }
932
933 return null;
934 }
935
936
946 public DLFileEntryType[] findByUuid_PrevAndNext(long fileEntryTypeId,
947 String uuid, OrderByComparator orderByComparator)
948 throws NoSuchFileEntryTypeException, SystemException {
949 DLFileEntryType dlFileEntryType = findByPrimaryKey(fileEntryTypeId);
950
951 Session session = null;
952
953 try {
954 session = openSession();
955
956 DLFileEntryType[] array = new DLFileEntryTypeImpl[3];
957
958 array[0] = getByUuid_PrevAndNext(session, dlFileEntryType, uuid,
959 orderByComparator, true);
960
961 array[1] = dlFileEntryType;
962
963 array[2] = getByUuid_PrevAndNext(session, dlFileEntryType, uuid,
964 orderByComparator, false);
965
966 return array;
967 }
968 catch (Exception e) {
969 throw processException(e);
970 }
971 finally {
972 closeSession(session);
973 }
974 }
975
976 protected DLFileEntryType getByUuid_PrevAndNext(Session session,
977 DLFileEntryType dlFileEntryType, String uuid,
978 OrderByComparator orderByComparator, boolean previous) {
979 StringBundler query = null;
980
981 if (orderByComparator != null) {
982 query = new StringBundler(6 +
983 (orderByComparator.getOrderByFields().length * 6));
984 }
985 else {
986 query = new StringBundler(3);
987 }
988
989 query.append(_SQL_SELECT_DLFILEENTRYTYPE_WHERE);
990
991 if (uuid == null) {
992 query.append(_FINDER_COLUMN_UUID_UUID_1);
993 }
994 else {
995 if (uuid.equals(StringPool.BLANK)) {
996 query.append(_FINDER_COLUMN_UUID_UUID_3);
997 }
998 else {
999 query.append(_FINDER_COLUMN_UUID_UUID_2);
1000 }
1001 }
1002
1003 if (orderByComparator != null) {
1004 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1005
1006 if (orderByConditionFields.length > 0) {
1007 query.append(WHERE_AND);
1008 }
1009
1010 for (int i = 0; i < orderByConditionFields.length; i++) {
1011 query.append(_ORDER_BY_ENTITY_ALIAS);
1012 query.append(orderByConditionFields[i]);
1013
1014 if ((i + 1) < orderByConditionFields.length) {
1015 if (orderByComparator.isAscending() ^ previous) {
1016 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1017 }
1018 else {
1019 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1020 }
1021 }
1022 else {
1023 if (orderByComparator.isAscending() ^ previous) {
1024 query.append(WHERE_GREATER_THAN);
1025 }
1026 else {
1027 query.append(WHERE_LESSER_THAN);
1028 }
1029 }
1030 }
1031
1032 query.append(ORDER_BY_CLAUSE);
1033
1034 String[] orderByFields = orderByComparator.getOrderByFields();
1035
1036 for (int i = 0; i < orderByFields.length; i++) {
1037 query.append(_ORDER_BY_ENTITY_ALIAS);
1038 query.append(orderByFields[i]);
1039
1040 if ((i + 1) < orderByFields.length) {
1041 if (orderByComparator.isAscending() ^ previous) {
1042 query.append(ORDER_BY_ASC_HAS_NEXT);
1043 }
1044 else {
1045 query.append(ORDER_BY_DESC_HAS_NEXT);
1046 }
1047 }
1048 else {
1049 if (orderByComparator.isAscending() ^ previous) {
1050 query.append(ORDER_BY_ASC);
1051 }
1052 else {
1053 query.append(ORDER_BY_DESC);
1054 }
1055 }
1056 }
1057 }
1058
1059 String sql = query.toString();
1060
1061 Query q = session.createQuery(sql);
1062
1063 q.setFirstResult(0);
1064 q.setMaxResults(2);
1065
1066 QueryPos qPos = QueryPos.getInstance(q);
1067
1068 if (uuid != null) {
1069 qPos.add(uuid);
1070 }
1071
1072 if (orderByComparator != null) {
1073 Object[] values = orderByComparator.getOrderByConditionValues(dlFileEntryType);
1074
1075 for (Object value : values) {
1076 qPos.add(value);
1077 }
1078 }
1079
1080 List<DLFileEntryType> list = q.list();
1081
1082 if (list.size() == 2) {
1083 return list.get(1);
1084 }
1085 else {
1086 return null;
1087 }
1088 }
1089
1090
1099 public DLFileEntryType findByUUID_G(String uuid, long groupId)
1100 throws NoSuchFileEntryTypeException, SystemException {
1101 DLFileEntryType dlFileEntryType = fetchByUUID_G(uuid, groupId);
1102
1103 if (dlFileEntryType == null) {
1104 StringBundler msg = new StringBundler(6);
1105
1106 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1107
1108 msg.append("uuid=");
1109 msg.append(uuid);
1110
1111 msg.append(", groupId=");
1112 msg.append(groupId);
1113
1114 msg.append(StringPool.CLOSE_CURLY_BRACE);
1115
1116 if (_log.isWarnEnabled()) {
1117 _log.warn(msg.toString());
1118 }
1119
1120 throw new NoSuchFileEntryTypeException(msg.toString());
1121 }
1122
1123 return dlFileEntryType;
1124 }
1125
1126
1134 public DLFileEntryType fetchByUUID_G(String uuid, long groupId)
1135 throws SystemException {
1136 return fetchByUUID_G(uuid, groupId, true);
1137 }
1138
1139
1148 public DLFileEntryType fetchByUUID_G(String uuid, long groupId,
1149 boolean retrieveFromCache) throws SystemException {
1150 Object[] finderArgs = new Object[] { uuid, groupId };
1151
1152 Object result = null;
1153
1154 if (retrieveFromCache) {
1155 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
1156 finderArgs, this);
1157 }
1158
1159 if (result instanceof DLFileEntryType) {
1160 DLFileEntryType dlFileEntryType = (DLFileEntryType)result;
1161
1162 if (!Validator.equals(uuid, dlFileEntryType.getUuid()) ||
1163 (groupId != dlFileEntryType.getGroupId())) {
1164 result = null;
1165 }
1166 }
1167
1168 if (result == null) {
1169 StringBundler query = new StringBundler(3);
1170
1171 query.append(_SQL_SELECT_DLFILEENTRYTYPE_WHERE);
1172
1173 if (uuid == null) {
1174 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
1175 }
1176 else {
1177 if (uuid.equals(StringPool.BLANK)) {
1178 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
1179 }
1180 else {
1181 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
1182 }
1183 }
1184
1185 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
1186
1187 String sql = query.toString();
1188
1189 Session session = null;
1190
1191 try {
1192 session = openSession();
1193
1194 Query q = session.createQuery(sql);
1195
1196 QueryPos qPos = QueryPos.getInstance(q);
1197
1198 if (uuid != null) {
1199 qPos.add(uuid);
1200 }
1201
1202 qPos.add(groupId);
1203
1204 List<DLFileEntryType> list = q.list();
1205
1206 result = list;
1207
1208 DLFileEntryType dlFileEntryType = null;
1209
1210 if (list.isEmpty()) {
1211 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1212 finderArgs, list);
1213 }
1214 else {
1215 dlFileEntryType = list.get(0);
1216
1217 cacheResult(dlFileEntryType);
1218
1219 if ((dlFileEntryType.getUuid() == null) ||
1220 !dlFileEntryType.getUuid().equals(uuid) ||
1221 (dlFileEntryType.getGroupId() != groupId)) {
1222 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1223 finderArgs, dlFileEntryType);
1224 }
1225 }
1226
1227 return dlFileEntryType;
1228 }
1229 catch (Exception e) {
1230 throw processException(e);
1231 }
1232 finally {
1233 if (result == null) {
1234 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
1235 finderArgs);
1236 }
1237
1238 closeSession(session);
1239 }
1240 }
1241 else {
1242 if (result instanceof List<?>) {
1243 return null;
1244 }
1245 else {
1246 return (DLFileEntryType)result;
1247 }
1248 }
1249 }
1250
1251
1258 public List<DLFileEntryType> findByGroupId(long groupId)
1259 throws SystemException {
1260 return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1261 }
1262
1263
1276 public List<DLFileEntryType> findByGroupId(long groupId, int start, int end)
1277 throws SystemException {
1278 return findByGroupId(groupId, start, end, null);
1279 }
1280
1281
1295 public List<DLFileEntryType> findByGroupId(long groupId, int start,
1296 int end, OrderByComparator orderByComparator) throws SystemException {
1297 FinderPath finderPath = null;
1298 Object[] finderArgs = null;
1299
1300 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1301 (orderByComparator == null)) {
1302 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID;
1303 finderArgs = new Object[] { groupId };
1304 }
1305 else {
1306 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID;
1307 finderArgs = new Object[] { groupId, start, end, orderByComparator };
1308 }
1309
1310 List<DLFileEntryType> list = (List<DLFileEntryType>)FinderCacheUtil.getResult(finderPath,
1311 finderArgs, this);
1312
1313 if ((list != null) && !list.isEmpty()) {
1314 for (DLFileEntryType dlFileEntryType : list) {
1315 if ((groupId != dlFileEntryType.getGroupId())) {
1316 list = null;
1317
1318 break;
1319 }
1320 }
1321 }
1322
1323 if (list == null) {
1324 StringBundler query = null;
1325
1326 if (orderByComparator != null) {
1327 query = new StringBundler(3 +
1328 (orderByComparator.getOrderByFields().length * 3));
1329 }
1330 else {
1331 query = new StringBundler(2);
1332 }
1333
1334 query.append(_SQL_SELECT_DLFILEENTRYTYPE_WHERE);
1335
1336 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1337
1338 if (orderByComparator != null) {
1339 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1340 orderByComparator);
1341 }
1342
1343 String sql = query.toString();
1344
1345 Session session = null;
1346
1347 try {
1348 session = openSession();
1349
1350 Query q = session.createQuery(sql);
1351
1352 QueryPos qPos = QueryPos.getInstance(q);
1353
1354 qPos.add(groupId);
1355
1356 list = (List<DLFileEntryType>)QueryUtil.list(q, getDialect(),
1357 start, end);
1358 }
1359 catch (Exception e) {
1360 throw processException(e);
1361 }
1362 finally {
1363 if (list == null) {
1364 FinderCacheUtil.removeResult(finderPath, finderArgs);
1365 }
1366 else {
1367 cacheResult(list);
1368
1369 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1370 }
1371
1372 closeSession(session);
1373 }
1374 }
1375
1376 return list;
1377 }
1378
1379
1388 public DLFileEntryType findByGroupId_First(long groupId,
1389 OrderByComparator orderByComparator)
1390 throws NoSuchFileEntryTypeException, SystemException {
1391 DLFileEntryType dlFileEntryType = fetchByGroupId_First(groupId,
1392 orderByComparator);
1393
1394 if (dlFileEntryType != null) {
1395 return dlFileEntryType;
1396 }
1397
1398 StringBundler msg = new StringBundler(4);
1399
1400 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1401
1402 msg.append("groupId=");
1403 msg.append(groupId);
1404
1405 msg.append(StringPool.CLOSE_CURLY_BRACE);
1406
1407 throw new NoSuchFileEntryTypeException(msg.toString());
1408 }
1409
1410
1418 public DLFileEntryType fetchByGroupId_First(long groupId,
1419 OrderByComparator orderByComparator) throws SystemException {
1420 List<DLFileEntryType> list = findByGroupId(groupId, 0, 1,
1421 orderByComparator);
1422
1423 if (!list.isEmpty()) {
1424 return list.get(0);
1425 }
1426
1427 return null;
1428 }
1429
1430
1439 public DLFileEntryType findByGroupId_Last(long groupId,
1440 OrderByComparator orderByComparator)
1441 throws NoSuchFileEntryTypeException, SystemException {
1442 DLFileEntryType dlFileEntryType = fetchByGroupId_Last(groupId,
1443 orderByComparator);
1444
1445 if (dlFileEntryType != null) {
1446 return dlFileEntryType;
1447 }
1448
1449 StringBundler msg = new StringBundler(4);
1450
1451 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1452
1453 msg.append("groupId=");
1454 msg.append(groupId);
1455
1456 msg.append(StringPool.CLOSE_CURLY_BRACE);
1457
1458 throw new NoSuchFileEntryTypeException(msg.toString());
1459 }
1460
1461
1469 public DLFileEntryType fetchByGroupId_Last(long groupId,
1470 OrderByComparator orderByComparator) throws SystemException {
1471 int count = countByGroupId(groupId);
1472
1473 List<DLFileEntryType> list = findByGroupId(groupId, count - 1, count,
1474 orderByComparator);
1475
1476 if (!list.isEmpty()) {
1477 return list.get(0);
1478 }
1479
1480 return null;
1481 }
1482
1483
1493 public DLFileEntryType[] findByGroupId_PrevAndNext(long fileEntryTypeId,
1494 long groupId, OrderByComparator orderByComparator)
1495 throws NoSuchFileEntryTypeException, SystemException {
1496 DLFileEntryType dlFileEntryType = findByPrimaryKey(fileEntryTypeId);
1497
1498 Session session = null;
1499
1500 try {
1501 session = openSession();
1502
1503 DLFileEntryType[] array = new DLFileEntryTypeImpl[3];
1504
1505 array[0] = getByGroupId_PrevAndNext(session, dlFileEntryType,
1506 groupId, orderByComparator, true);
1507
1508 array[1] = dlFileEntryType;
1509
1510 array[2] = getByGroupId_PrevAndNext(session, dlFileEntryType,
1511 groupId, orderByComparator, false);
1512
1513 return array;
1514 }
1515 catch (Exception e) {
1516 throw processException(e);
1517 }
1518 finally {
1519 closeSession(session);
1520 }
1521 }
1522
1523 protected DLFileEntryType getByGroupId_PrevAndNext(Session session,
1524 DLFileEntryType dlFileEntryType, long groupId,
1525 OrderByComparator orderByComparator, boolean previous) {
1526 StringBundler query = null;
1527
1528 if (orderByComparator != null) {
1529 query = new StringBundler(6 +
1530 (orderByComparator.getOrderByFields().length * 6));
1531 }
1532 else {
1533 query = new StringBundler(3);
1534 }
1535
1536 query.append(_SQL_SELECT_DLFILEENTRYTYPE_WHERE);
1537
1538 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1539
1540 if (orderByComparator != null) {
1541 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1542
1543 if (orderByConditionFields.length > 0) {
1544 query.append(WHERE_AND);
1545 }
1546
1547 for (int i = 0; i < orderByConditionFields.length; i++) {
1548 query.append(_ORDER_BY_ENTITY_ALIAS);
1549 query.append(orderByConditionFields[i]);
1550
1551 if ((i + 1) < orderByConditionFields.length) {
1552 if (orderByComparator.isAscending() ^ previous) {
1553 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1554 }
1555 else {
1556 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1557 }
1558 }
1559 else {
1560 if (orderByComparator.isAscending() ^ previous) {
1561 query.append(WHERE_GREATER_THAN);
1562 }
1563 else {
1564 query.append(WHERE_LESSER_THAN);
1565 }
1566 }
1567 }
1568
1569 query.append(ORDER_BY_CLAUSE);
1570
1571 String[] orderByFields = orderByComparator.getOrderByFields();
1572
1573 for (int i = 0; i < orderByFields.length; i++) {
1574 query.append(_ORDER_BY_ENTITY_ALIAS);
1575 query.append(orderByFields[i]);
1576
1577 if ((i + 1) < orderByFields.length) {
1578 if (orderByComparator.isAscending() ^ previous) {
1579 query.append(ORDER_BY_ASC_HAS_NEXT);
1580 }
1581 else {
1582 query.append(ORDER_BY_DESC_HAS_NEXT);
1583 }
1584 }
1585 else {
1586 if (orderByComparator.isAscending() ^ previous) {
1587 query.append(ORDER_BY_ASC);
1588 }
1589 else {
1590 query.append(ORDER_BY_DESC);
1591 }
1592 }
1593 }
1594 }
1595
1596 String sql = query.toString();
1597
1598 Query q = session.createQuery(sql);
1599
1600 q.setFirstResult(0);
1601 q.setMaxResults(2);
1602
1603 QueryPos qPos = QueryPos.getInstance(q);
1604
1605 qPos.add(groupId);
1606
1607 if (orderByComparator != null) {
1608 Object[] values = orderByComparator.getOrderByConditionValues(dlFileEntryType);
1609
1610 for (Object value : values) {
1611 qPos.add(value);
1612 }
1613 }
1614
1615 List<DLFileEntryType> list = q.list();
1616
1617 if (list.size() == 2) {
1618 return list.get(1);
1619 }
1620 else {
1621 return null;
1622 }
1623 }
1624
1625
1636 public List<DLFileEntryType> findByGroupId(long[] groupIds)
1637 throws SystemException {
1638 return findByGroupId(groupIds, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1639 null);
1640 }
1641
1642
1655 public List<DLFileEntryType> findByGroupId(long[] groupIds, int start,
1656 int end) throws SystemException {
1657 return findByGroupId(groupIds, start, end, null);
1658 }
1659
1660
1674 public List<DLFileEntryType> findByGroupId(long[] groupIds, int start,
1675 int end, OrderByComparator orderByComparator) throws SystemException {
1676 FinderPath finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID;
1677 Object[] finderArgs = null;
1678
1679 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1680 (orderByComparator == null)) {
1681 finderArgs = new Object[] { StringUtil.merge(groupIds) };
1682 }
1683 else {
1684 finderArgs = new Object[] {
1685 StringUtil.merge(groupIds),
1686
1687 start, end, orderByComparator
1688 };
1689 }
1690
1691 List<DLFileEntryType> list = (List<DLFileEntryType>)FinderCacheUtil.getResult(finderPath,
1692 finderArgs, this);
1693
1694 if ((list != null) && !list.isEmpty()) {
1695 for (DLFileEntryType dlFileEntryType : list) {
1696 if (!ArrayUtil.contains(groupIds, dlFileEntryType.getGroupId())) {
1697 list = null;
1698
1699 break;
1700 }
1701 }
1702 }
1703
1704 if (list == null) {
1705 StringBundler query = new StringBundler();
1706
1707 query.append(_SQL_SELECT_DLFILEENTRYTYPE_WHERE);
1708
1709 boolean conjunctionable = false;
1710
1711 if ((groupIds == null) || (groupIds.length > 0)) {
1712 if (conjunctionable) {
1713 query.append(WHERE_AND);
1714 }
1715
1716 query.append(StringPool.OPEN_PARENTHESIS);
1717
1718 for (int i = 0; i < groupIds.length; i++) {
1719 query.append(_FINDER_COLUMN_GROUPID_GROUPID_5);
1720
1721 if ((i + 1) < groupIds.length) {
1722 query.append(WHERE_OR);
1723 }
1724 }
1725
1726 query.append(StringPool.CLOSE_PARENTHESIS);
1727
1728 conjunctionable = true;
1729 }
1730
1731 if (orderByComparator != null) {
1732 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1733 orderByComparator);
1734 }
1735
1736 String sql = query.toString();
1737
1738 Session session = null;
1739
1740 try {
1741 session = openSession();
1742
1743 Query q = session.createQuery(sql);
1744
1745 QueryPos qPos = QueryPos.getInstance(q);
1746
1747 if (groupIds != null) {
1748 qPos.add(groupIds);
1749 }
1750
1751 list = (List<DLFileEntryType>)QueryUtil.list(q, getDialect(),
1752 start, end);
1753 }
1754 catch (Exception e) {
1755 throw processException(e);
1756 }
1757 finally {
1758 if (list == null) {
1759 FinderCacheUtil.removeResult(finderPath, finderArgs);
1760 }
1761 else {
1762 cacheResult(list);
1763
1764 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1765 }
1766
1767 closeSession(session);
1768 }
1769 }
1770
1771 return list;
1772 }
1773
1774
1781 public List<DLFileEntryType> filterFindByGroupId(long groupId)
1782 throws SystemException {
1783 return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
1784 QueryUtil.ALL_POS, null);
1785 }
1786
1787
1800 public List<DLFileEntryType> filterFindByGroupId(long groupId, int start,
1801 int end) throws SystemException {
1802 return filterFindByGroupId(groupId, start, end, null);
1803 }
1804
1805
1819 public List<DLFileEntryType> filterFindByGroupId(long groupId, int start,
1820 int end, OrderByComparator orderByComparator) throws SystemException {
1821 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1822 return findByGroupId(groupId, start, end, orderByComparator);
1823 }
1824
1825 StringBundler query = null;
1826
1827 if (orderByComparator != null) {
1828 query = new StringBundler(3 +
1829 (orderByComparator.getOrderByFields().length * 3));
1830 }
1831 else {
1832 query = new StringBundler(2);
1833 }
1834
1835 if (getDB().isSupportsInlineDistinct()) {
1836 query.append(_FILTER_SQL_SELECT_DLFILEENTRYTYPE_WHERE);
1837 }
1838 else {
1839 query.append(_FILTER_SQL_SELECT_DLFILEENTRYTYPE_NO_INLINE_DISTINCT_WHERE_1);
1840 }
1841
1842 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1843
1844 if (!getDB().isSupportsInlineDistinct()) {
1845 query.append(_FILTER_SQL_SELECT_DLFILEENTRYTYPE_NO_INLINE_DISTINCT_WHERE_2);
1846 }
1847
1848 if (orderByComparator != null) {
1849 if (getDB().isSupportsInlineDistinct()) {
1850 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1851 orderByComparator);
1852 }
1853 else {
1854 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1855 orderByComparator);
1856 }
1857 }
1858
1859 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1860 DLFileEntryType.class.getName(),
1861 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
1862
1863 Session session = null;
1864
1865 try {
1866 session = openSession();
1867
1868 SQLQuery q = session.createSQLQuery(sql);
1869
1870 if (getDB().isSupportsInlineDistinct()) {
1871 q.addEntity(_FILTER_ENTITY_ALIAS, DLFileEntryTypeImpl.class);
1872 }
1873 else {
1874 q.addEntity(_FILTER_ENTITY_TABLE, DLFileEntryTypeImpl.class);
1875 }
1876
1877 QueryPos qPos = QueryPos.getInstance(q);
1878
1879 qPos.add(groupId);
1880
1881 return (List<DLFileEntryType>)QueryUtil.list(q, getDialect(),
1882 start, end);
1883 }
1884 catch (Exception e) {
1885 throw processException(e);
1886 }
1887 finally {
1888 closeSession(session);
1889 }
1890 }
1891
1892
1902 public DLFileEntryType[] filterFindByGroupId_PrevAndNext(
1903 long fileEntryTypeId, long groupId, OrderByComparator orderByComparator)
1904 throws NoSuchFileEntryTypeException, SystemException {
1905 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1906 return findByGroupId_PrevAndNext(fileEntryTypeId, groupId,
1907 orderByComparator);
1908 }
1909
1910 DLFileEntryType dlFileEntryType = findByPrimaryKey(fileEntryTypeId);
1911
1912 Session session = null;
1913
1914 try {
1915 session = openSession();
1916
1917 DLFileEntryType[] array = new DLFileEntryTypeImpl[3];
1918
1919 array[0] = filterGetByGroupId_PrevAndNext(session, dlFileEntryType,
1920 groupId, orderByComparator, true);
1921
1922 array[1] = dlFileEntryType;
1923
1924 array[2] = filterGetByGroupId_PrevAndNext(session, dlFileEntryType,
1925 groupId, orderByComparator, false);
1926
1927 return array;
1928 }
1929 catch (Exception e) {
1930 throw processException(e);
1931 }
1932 finally {
1933 closeSession(session);
1934 }
1935 }
1936
1937 protected DLFileEntryType filterGetByGroupId_PrevAndNext(Session session,
1938 DLFileEntryType dlFileEntryType, long groupId,
1939 OrderByComparator orderByComparator, boolean previous) {
1940 StringBundler query = null;
1941
1942 if (orderByComparator != null) {
1943 query = new StringBundler(6 +
1944 (orderByComparator.getOrderByFields().length * 6));
1945 }
1946 else {
1947 query = new StringBundler(3);
1948 }
1949
1950 if (getDB().isSupportsInlineDistinct()) {
1951 query.append(_FILTER_SQL_SELECT_DLFILEENTRYTYPE_WHERE);
1952 }
1953 else {
1954 query.append(_FILTER_SQL_SELECT_DLFILEENTRYTYPE_NO_INLINE_DISTINCT_WHERE_1);
1955 }
1956
1957 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1958
1959 if (!getDB().isSupportsInlineDistinct()) {
1960 query.append(_FILTER_SQL_SELECT_DLFILEENTRYTYPE_NO_INLINE_DISTINCT_WHERE_2);
1961 }
1962
1963 if (orderByComparator != null) {
1964 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1965
1966 if (orderByConditionFields.length > 0) {
1967 query.append(WHERE_AND);
1968 }
1969
1970 for (int i = 0; i < orderByConditionFields.length; i++) {
1971 if (getDB().isSupportsInlineDistinct()) {
1972 query.append(_ORDER_BY_ENTITY_ALIAS);
1973 }
1974 else {
1975 query.append(_ORDER_BY_ENTITY_TABLE);
1976 }
1977
1978 query.append(orderByConditionFields[i]);
1979
1980 if ((i + 1) < orderByConditionFields.length) {
1981 if (orderByComparator.isAscending() ^ previous) {
1982 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1983 }
1984 else {
1985 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1986 }
1987 }
1988 else {
1989 if (orderByComparator.isAscending() ^ previous) {
1990 query.append(WHERE_GREATER_THAN);
1991 }
1992 else {
1993 query.append(WHERE_LESSER_THAN);
1994 }
1995 }
1996 }
1997
1998 query.append(ORDER_BY_CLAUSE);
1999
2000 String[] orderByFields = orderByComparator.getOrderByFields();
2001
2002 for (int i = 0; i < orderByFields.length; i++) {
2003 if (getDB().isSupportsInlineDistinct()) {
2004 query.append(_ORDER_BY_ENTITY_ALIAS);
2005 }
2006 else {
2007 query.append(_ORDER_BY_ENTITY_TABLE);
2008 }
2009
2010 query.append(orderByFields[i]);
2011
2012 if ((i + 1) < orderByFields.length) {
2013 if (orderByComparator.isAscending() ^ previous) {
2014 query.append(ORDER_BY_ASC_HAS_NEXT);
2015 }
2016 else {
2017 query.append(ORDER_BY_DESC_HAS_NEXT);
2018 }
2019 }
2020 else {
2021 if (orderByComparator.isAscending() ^ previous) {
2022 query.append(ORDER_BY_ASC);
2023 }
2024 else {
2025 query.append(ORDER_BY_DESC);
2026 }
2027 }
2028 }
2029 }
2030
2031 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2032 DLFileEntryType.class.getName(),
2033 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
2034
2035 SQLQuery q = session.createSQLQuery(sql);
2036
2037 q.setFirstResult(0);
2038 q.setMaxResults(2);
2039
2040 if (getDB().isSupportsInlineDistinct()) {
2041 q.addEntity(_FILTER_ENTITY_ALIAS, DLFileEntryTypeImpl.class);
2042 }
2043 else {
2044 q.addEntity(_FILTER_ENTITY_TABLE, DLFileEntryTypeImpl.class);
2045 }
2046
2047 QueryPos qPos = QueryPos.getInstance(q);
2048
2049 qPos.add(groupId);
2050
2051 if (orderByComparator != null) {
2052 Object[] values = orderByComparator.getOrderByConditionValues(dlFileEntryType);
2053
2054 for (Object value : values) {
2055 qPos.add(value);
2056 }
2057 }
2058
2059 List<DLFileEntryType> list = q.list();
2060
2061 if (list.size() == 2) {
2062 return list.get(1);
2063 }
2064 else {
2065 return null;
2066 }
2067 }
2068
2069
2076 public List<DLFileEntryType> filterFindByGroupId(long[] groupIds)
2077 throws SystemException {
2078 return filterFindByGroupId(groupIds, QueryUtil.ALL_POS,
2079 QueryUtil.ALL_POS, null);
2080 }
2081
2082
2095 public List<DLFileEntryType> filterFindByGroupId(long[] groupIds,
2096 int start, int end) throws SystemException {
2097 return filterFindByGroupId(groupIds, start, end, null);
2098 }
2099
2100
2114 public List<DLFileEntryType> filterFindByGroupId(long[] groupIds,
2115 int start, int end, OrderByComparator orderByComparator)
2116 throws SystemException {
2117 if (!InlineSQLHelperUtil.isEnabled(groupIds)) {
2118 return findByGroupId(groupIds, start, end, orderByComparator);
2119 }
2120
2121 StringBundler query = new StringBundler();
2122
2123 if (getDB().isSupportsInlineDistinct()) {
2124 query.append(_FILTER_SQL_SELECT_DLFILEENTRYTYPE_WHERE);
2125 }
2126 else {
2127 query.append(_FILTER_SQL_SELECT_DLFILEENTRYTYPE_NO_INLINE_DISTINCT_WHERE_1);
2128 }
2129
2130 boolean conjunctionable = false;
2131
2132 if ((groupIds == null) || (groupIds.length > 0)) {
2133 if (conjunctionable) {
2134 query.append(WHERE_AND);
2135 }
2136
2137 query.append(StringPool.OPEN_PARENTHESIS);
2138
2139 for (int i = 0; i < groupIds.length; i++) {
2140 query.append(_FINDER_COLUMN_GROUPID_GROUPID_5);
2141
2142 if ((i + 1) < groupIds.length) {
2143 query.append(WHERE_OR);
2144 }
2145 }
2146
2147 query.append(StringPool.CLOSE_PARENTHESIS);
2148
2149 conjunctionable = true;
2150 }
2151
2152 if (!getDB().isSupportsInlineDistinct()) {
2153 query.append(_FILTER_SQL_SELECT_DLFILEENTRYTYPE_NO_INLINE_DISTINCT_WHERE_2);
2154 }
2155
2156 if (orderByComparator != null) {
2157 if (getDB().isSupportsInlineDistinct()) {
2158 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2159 orderByComparator);
2160 }
2161 else {
2162 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
2163 orderByComparator);
2164 }
2165 }
2166
2167 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2168 DLFileEntryType.class.getName(),
2169 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupIds);
2170
2171 Session session = null;
2172
2173 try {
2174 session = openSession();
2175
2176 SQLQuery q = session.createSQLQuery(sql);
2177
2178 if (getDB().isSupportsInlineDistinct()) {
2179 q.addEntity(_FILTER_ENTITY_ALIAS, DLFileEntryTypeImpl.class);
2180 }
2181 else {
2182 q.addEntity(_FILTER_ENTITY_TABLE, DLFileEntryTypeImpl.class);
2183 }
2184
2185 QueryPos qPos = QueryPos.getInstance(q);
2186
2187 if (groupIds != null) {
2188 qPos.add(groupIds);
2189 }
2190
2191 return (List<DLFileEntryType>)QueryUtil.list(q, getDialect(),
2192 start, end);
2193 }
2194 catch (Exception e) {
2195 throw processException(e);
2196 }
2197 finally {
2198 closeSession(session);
2199 }
2200 }
2201
2202
2211 public DLFileEntryType findByG_N(long groupId, String name)
2212 throws NoSuchFileEntryTypeException, SystemException {
2213 DLFileEntryType dlFileEntryType = fetchByG_N(groupId, name);
2214
2215 if (dlFileEntryType == null) {
2216 StringBundler msg = new StringBundler(6);
2217
2218 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2219
2220 msg.append("groupId=");
2221 msg.append(groupId);
2222
2223 msg.append(", name=");
2224 msg.append(name);
2225
2226 msg.append(StringPool.CLOSE_CURLY_BRACE);
2227
2228 if (_log.isWarnEnabled()) {
2229 _log.warn(msg.toString());
2230 }
2231
2232 throw new NoSuchFileEntryTypeException(msg.toString());
2233 }
2234
2235 return dlFileEntryType;
2236 }
2237
2238
2246 public DLFileEntryType fetchByG_N(long groupId, String name)
2247 throws SystemException {
2248 return fetchByG_N(groupId, name, true);
2249 }
2250
2251
2260 public DLFileEntryType fetchByG_N(long groupId, String name,
2261 boolean retrieveFromCache) throws SystemException {
2262 Object[] finderArgs = new Object[] { groupId, name };
2263
2264 Object result = null;
2265
2266 if (retrieveFromCache) {
2267 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_N,
2268 finderArgs, this);
2269 }
2270
2271 if (result instanceof DLFileEntryType) {
2272 DLFileEntryType dlFileEntryType = (DLFileEntryType)result;
2273
2274 if ((groupId != dlFileEntryType.getGroupId()) ||
2275 !Validator.equals(name, dlFileEntryType.getName())) {
2276 result = null;
2277 }
2278 }
2279
2280 if (result == null) {
2281 StringBundler query = new StringBundler(3);
2282
2283 query.append(_SQL_SELECT_DLFILEENTRYTYPE_WHERE);
2284
2285 query.append(_FINDER_COLUMN_G_N_GROUPID_2);
2286
2287 if (name == null) {
2288 query.append(_FINDER_COLUMN_G_N_NAME_1);
2289 }
2290 else {
2291 if (name.equals(StringPool.BLANK)) {
2292 query.append(_FINDER_COLUMN_G_N_NAME_3);
2293 }
2294 else {
2295 query.append(_FINDER_COLUMN_G_N_NAME_2);
2296 }
2297 }
2298
2299 String sql = query.toString();
2300
2301 Session session = null;
2302
2303 try {
2304 session = openSession();
2305
2306 Query q = session.createQuery(sql);
2307
2308 QueryPos qPos = QueryPos.getInstance(q);
2309
2310 qPos.add(groupId);
2311
2312 if (name != null) {
2313 qPos.add(name);
2314 }
2315
2316 List<DLFileEntryType> list = q.list();
2317
2318 result = list;
2319
2320 DLFileEntryType dlFileEntryType = null;
2321
2322 if (list.isEmpty()) {
2323 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N,
2324 finderArgs, list);
2325 }
2326 else {
2327 dlFileEntryType = list.get(0);
2328
2329 cacheResult(dlFileEntryType);
2330
2331 if ((dlFileEntryType.getGroupId() != groupId) ||
2332 (dlFileEntryType.getName() == null) ||
2333 !dlFileEntryType.getName().equals(name)) {
2334 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N,
2335 finderArgs, dlFileEntryType);
2336 }
2337 }
2338
2339 return dlFileEntryType;
2340 }
2341 catch (Exception e) {
2342 throw processException(e);
2343 }
2344 finally {
2345 if (result == null) {
2346 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_N,
2347 finderArgs);
2348 }
2349
2350 closeSession(session);
2351 }
2352 }
2353 else {
2354 if (result instanceof List<?>) {
2355 return null;
2356 }
2357 else {
2358 return (DLFileEntryType)result;
2359 }
2360 }
2361 }
2362
2363
2369 public List<DLFileEntryType> findAll() throws SystemException {
2370 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2371 }
2372
2373
2385 public List<DLFileEntryType> findAll(int start, int end)
2386 throws SystemException {
2387 return findAll(start, end, null);
2388 }
2389
2390
2403 public List<DLFileEntryType> findAll(int start, int end,
2404 OrderByComparator orderByComparator) throws SystemException {
2405 FinderPath finderPath = null;
2406 Object[] finderArgs = new Object[] { start, end, orderByComparator };
2407
2408 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2409 (orderByComparator == null)) {
2410 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
2411 finderArgs = FINDER_ARGS_EMPTY;
2412 }
2413 else {
2414 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
2415 finderArgs = new Object[] { start, end, orderByComparator };
2416 }
2417
2418 List<DLFileEntryType> list = (List<DLFileEntryType>)FinderCacheUtil.getResult(finderPath,
2419 finderArgs, this);
2420
2421 if (list == null) {
2422 StringBundler query = null;
2423 String sql = null;
2424
2425 if (orderByComparator != null) {
2426 query = new StringBundler(2 +
2427 (orderByComparator.getOrderByFields().length * 3));
2428
2429 query.append(_SQL_SELECT_DLFILEENTRYTYPE);
2430
2431 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2432 orderByComparator);
2433
2434 sql = query.toString();
2435 }
2436 else {
2437 sql = _SQL_SELECT_DLFILEENTRYTYPE;
2438 }
2439
2440 Session session = null;
2441
2442 try {
2443 session = openSession();
2444
2445 Query q = session.createQuery(sql);
2446
2447 if (orderByComparator == null) {
2448 list = (List<DLFileEntryType>)QueryUtil.list(q,
2449 getDialect(), start, end, false);
2450
2451 Collections.sort(list);
2452 }
2453 else {
2454 list = (List<DLFileEntryType>)QueryUtil.list(q,
2455 getDialect(), start, end);
2456 }
2457 }
2458 catch (Exception e) {
2459 throw processException(e);
2460 }
2461 finally {
2462 if (list == null) {
2463 FinderCacheUtil.removeResult(finderPath, finderArgs);
2464 }
2465 else {
2466 cacheResult(list);
2467
2468 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2469 }
2470
2471 closeSession(session);
2472 }
2473 }
2474
2475 return list;
2476 }
2477
2478
2484 public void removeByUuid(String uuid) throws SystemException {
2485 for (DLFileEntryType dlFileEntryType : findByUuid(uuid)) {
2486 remove(dlFileEntryType);
2487 }
2488 }
2489
2490
2498 public DLFileEntryType removeByUUID_G(String uuid, long groupId)
2499 throws NoSuchFileEntryTypeException, SystemException {
2500 DLFileEntryType dlFileEntryType = findByUUID_G(uuid, groupId);
2501
2502 return remove(dlFileEntryType);
2503 }
2504
2505
2511 public void removeByGroupId(long groupId) throws SystemException {
2512 for (DLFileEntryType dlFileEntryType : findByGroupId(groupId)) {
2513 remove(dlFileEntryType);
2514 }
2515 }
2516
2517
2525 public DLFileEntryType removeByG_N(long groupId, String name)
2526 throws NoSuchFileEntryTypeException, SystemException {
2527 DLFileEntryType dlFileEntryType = findByG_N(groupId, name);
2528
2529 return remove(dlFileEntryType);
2530 }
2531
2532
2537 public void removeAll() throws SystemException {
2538 for (DLFileEntryType dlFileEntryType : findAll()) {
2539 remove(dlFileEntryType);
2540 }
2541 }
2542
2543
2550 public int countByUuid(String uuid) throws SystemException {
2551 Object[] finderArgs = new Object[] { uuid };
2552
2553 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
2554 finderArgs, this);
2555
2556 if (count == null) {
2557 StringBundler query = new StringBundler(2);
2558
2559 query.append(_SQL_COUNT_DLFILEENTRYTYPE_WHERE);
2560
2561 if (uuid == null) {
2562 query.append(_FINDER_COLUMN_UUID_UUID_1);
2563 }
2564 else {
2565 if (uuid.equals(StringPool.BLANK)) {
2566 query.append(_FINDER_COLUMN_UUID_UUID_3);
2567 }
2568 else {
2569 query.append(_FINDER_COLUMN_UUID_UUID_2);
2570 }
2571 }
2572
2573 String sql = query.toString();
2574
2575 Session session = null;
2576
2577 try {
2578 session = openSession();
2579
2580 Query q = session.createQuery(sql);
2581
2582 QueryPos qPos = QueryPos.getInstance(q);
2583
2584 if (uuid != null) {
2585 qPos.add(uuid);
2586 }
2587
2588 count = (Long)q.uniqueResult();
2589 }
2590 catch (Exception e) {
2591 throw processException(e);
2592 }
2593 finally {
2594 if (count == null) {
2595 count = Long.valueOf(0);
2596 }
2597
2598 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
2599 finderArgs, count);
2600
2601 closeSession(session);
2602 }
2603 }
2604
2605 return count.intValue();
2606 }
2607
2608
2616 public int countByUUID_G(String uuid, long groupId)
2617 throws SystemException {
2618 Object[] finderArgs = new Object[] { uuid, groupId };
2619
2620 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
2621 finderArgs, this);
2622
2623 if (count == null) {
2624 StringBundler query = new StringBundler(3);
2625
2626 query.append(_SQL_COUNT_DLFILEENTRYTYPE_WHERE);
2627
2628 if (uuid == null) {
2629 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
2630 }
2631 else {
2632 if (uuid.equals(StringPool.BLANK)) {
2633 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
2634 }
2635 else {
2636 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
2637 }
2638 }
2639
2640 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
2641
2642 String sql = query.toString();
2643
2644 Session session = null;
2645
2646 try {
2647 session = openSession();
2648
2649 Query q = session.createQuery(sql);
2650
2651 QueryPos qPos = QueryPos.getInstance(q);
2652
2653 if (uuid != null) {
2654 qPos.add(uuid);
2655 }
2656
2657 qPos.add(groupId);
2658
2659 count = (Long)q.uniqueResult();
2660 }
2661 catch (Exception e) {
2662 throw processException(e);
2663 }
2664 finally {
2665 if (count == null) {
2666 count = Long.valueOf(0);
2667 }
2668
2669 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
2670 finderArgs, count);
2671
2672 closeSession(session);
2673 }
2674 }
2675
2676 return count.intValue();
2677 }
2678
2679
2686 public int countByGroupId(long groupId) throws SystemException {
2687 Object[] finderArgs = new Object[] { groupId };
2688
2689 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
2690 finderArgs, this);
2691
2692 if (count == null) {
2693 StringBundler query = new StringBundler(2);
2694
2695 query.append(_SQL_COUNT_DLFILEENTRYTYPE_WHERE);
2696
2697 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2698
2699 String sql = query.toString();
2700
2701 Session session = null;
2702
2703 try {
2704 session = openSession();
2705
2706 Query q = session.createQuery(sql);
2707
2708 QueryPos qPos = QueryPos.getInstance(q);
2709
2710 qPos.add(groupId);
2711
2712 count = (Long)q.uniqueResult();
2713 }
2714 catch (Exception e) {
2715 throw processException(e);
2716 }
2717 finally {
2718 if (count == null) {
2719 count = Long.valueOf(0);
2720 }
2721
2722 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
2723 finderArgs, count);
2724
2725 closeSession(session);
2726 }
2727 }
2728
2729 return count.intValue();
2730 }
2731
2732
2739 public int countByGroupId(long[] groupIds) throws SystemException {
2740 Object[] finderArgs = new Object[] { StringUtil.merge(groupIds) };
2741
2742 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_GROUPID,
2743 finderArgs, this);
2744
2745 if (count == null) {
2746 StringBundler query = new StringBundler();
2747
2748 query.append(_SQL_COUNT_DLFILEENTRYTYPE_WHERE);
2749
2750 boolean conjunctionable = false;
2751
2752 if ((groupIds == null) || (groupIds.length > 0)) {
2753 if (conjunctionable) {
2754 query.append(WHERE_AND);
2755 }
2756
2757 query.append(StringPool.OPEN_PARENTHESIS);
2758
2759 for (int i = 0; i < groupIds.length; i++) {
2760 query.append(_FINDER_COLUMN_GROUPID_GROUPID_5);
2761
2762 if ((i + 1) < groupIds.length) {
2763 query.append(WHERE_OR);
2764 }
2765 }
2766
2767 query.append(StringPool.CLOSE_PARENTHESIS);
2768
2769 conjunctionable = true;
2770 }
2771
2772 String sql = query.toString();
2773
2774 Session session = null;
2775
2776 try {
2777 session = openSession();
2778
2779 Query q = session.createQuery(sql);
2780
2781 QueryPos qPos = QueryPos.getInstance(q);
2782
2783 if (groupIds != null) {
2784 qPos.add(groupIds);
2785 }
2786
2787 count = (Long)q.uniqueResult();
2788 }
2789 catch (Exception e) {
2790 throw processException(e);
2791 }
2792 finally {
2793 if (count == null) {
2794 count = Long.valueOf(0);
2795 }
2796
2797 FinderCacheUtil.putResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_GROUPID,
2798 finderArgs, count);
2799
2800 closeSession(session);
2801 }
2802 }
2803
2804 return count.intValue();
2805 }
2806
2807
2814 public int filterCountByGroupId(long groupId) throws SystemException {
2815 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2816 return countByGroupId(groupId);
2817 }
2818
2819 StringBundler query = new StringBundler(2);
2820
2821 query.append(_FILTER_SQL_COUNT_DLFILEENTRYTYPE_WHERE);
2822
2823 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2824
2825 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2826 DLFileEntryType.class.getName(),
2827 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
2828
2829 Session session = null;
2830
2831 try {
2832 session = openSession();
2833
2834 SQLQuery q = session.createSQLQuery(sql);
2835
2836 q.addScalar(COUNT_COLUMN_NAME,
2837 com.liferay.portal.kernel.dao.orm.Type.LONG);
2838
2839 QueryPos qPos = QueryPos.getInstance(q);
2840
2841 qPos.add(groupId);
2842
2843 Long count = (Long)q.uniqueResult();
2844
2845 return count.intValue();
2846 }
2847 catch (Exception e) {
2848 throw processException(e);
2849 }
2850 finally {
2851 closeSession(session);
2852 }
2853 }
2854
2855
2862 public int filterCountByGroupId(long[] groupIds) throws SystemException {
2863 if (!InlineSQLHelperUtil.isEnabled(groupIds)) {
2864 return countByGroupId(groupIds);
2865 }
2866
2867 StringBundler query = new StringBundler();
2868
2869 query.append(_FILTER_SQL_COUNT_DLFILEENTRYTYPE_WHERE);
2870
2871 boolean conjunctionable = false;
2872
2873 if ((groupIds == null) || (groupIds.length > 0)) {
2874 if (conjunctionable) {
2875 query.append(WHERE_AND);
2876 }
2877
2878 query.append(StringPool.OPEN_PARENTHESIS);
2879
2880 for (int i = 0; i < groupIds.length; i++) {
2881 query.append(_FINDER_COLUMN_GROUPID_GROUPID_5);
2882
2883 if ((i + 1) < groupIds.length) {
2884 query.append(WHERE_OR);
2885 }
2886 }
2887
2888 query.append(StringPool.CLOSE_PARENTHESIS);
2889
2890 conjunctionable = true;
2891 }
2892
2893 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2894 DLFileEntryType.class.getName(),
2895 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupIds);
2896
2897 Session session = null;
2898
2899 try {
2900 session = openSession();
2901
2902 SQLQuery q = session.createSQLQuery(sql);
2903
2904 q.addScalar(COUNT_COLUMN_NAME,
2905 com.liferay.portal.kernel.dao.orm.Type.LONG);
2906
2907 QueryPos qPos = QueryPos.getInstance(q);
2908
2909 if (groupIds != null) {
2910 qPos.add(groupIds);
2911 }
2912
2913 Long count = (Long)q.uniqueResult();
2914
2915 return count.intValue();
2916 }
2917 catch (Exception e) {
2918 throw processException(e);
2919 }
2920 finally {
2921 closeSession(session);
2922 }
2923 }
2924
2925
2933 public int countByG_N(long groupId, String name) throws SystemException {
2934 Object[] finderArgs = new Object[] { groupId, name };
2935
2936 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_N,
2937 finderArgs, this);
2938
2939 if (count == null) {
2940 StringBundler query = new StringBundler(3);
2941
2942 query.append(_SQL_COUNT_DLFILEENTRYTYPE_WHERE);
2943
2944 query.append(_FINDER_COLUMN_G_N_GROUPID_2);
2945
2946 if (name == null) {
2947 query.append(_FINDER_COLUMN_G_N_NAME_1);
2948 }
2949 else {
2950 if (name.equals(StringPool.BLANK)) {
2951 query.append(_FINDER_COLUMN_G_N_NAME_3);
2952 }
2953 else {
2954 query.append(_FINDER_COLUMN_G_N_NAME_2);
2955 }
2956 }
2957
2958 String sql = query.toString();
2959
2960 Session session = null;
2961
2962 try {
2963 session = openSession();
2964
2965 Query q = session.createQuery(sql);
2966
2967 QueryPos qPos = QueryPos.getInstance(q);
2968
2969 qPos.add(groupId);
2970
2971 if (name != null) {
2972 qPos.add(name);
2973 }
2974
2975 count = (Long)q.uniqueResult();
2976 }
2977 catch (Exception e) {
2978 throw processException(e);
2979 }
2980 finally {
2981 if (count == null) {
2982 count = Long.valueOf(0);
2983 }
2984
2985 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_N, finderArgs,
2986 count);
2987
2988 closeSession(session);
2989 }
2990 }
2991
2992 return count.intValue();
2993 }
2994
2995
3001 public int countAll() throws SystemException {
3002 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3003 FINDER_ARGS_EMPTY, this);
3004
3005 if (count == null) {
3006 Session session = null;
3007
3008 try {
3009 session = openSession();
3010
3011 Query q = session.createQuery(_SQL_COUNT_DLFILEENTRYTYPE);
3012
3013 count = (Long)q.uniqueResult();
3014 }
3015 catch (Exception e) {
3016 throw processException(e);
3017 }
3018 finally {
3019 if (count == null) {
3020 count = Long.valueOf(0);
3021 }
3022
3023 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
3024 FINDER_ARGS_EMPTY, count);
3025
3026 closeSession(session);
3027 }
3028 }
3029
3030 return count.intValue();
3031 }
3032
3033
3040 public List<com.liferay.portlet.documentlibrary.model.DLFolder> getDLFolders(
3041 long pk) throws SystemException {
3042 return getDLFolders(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
3043 }
3044
3045
3058 public List<com.liferay.portlet.documentlibrary.model.DLFolder> getDLFolders(
3059 long pk, int start, int end) throws SystemException {
3060 return getDLFolders(pk, start, end, null);
3061 }
3062
3063 public static final FinderPath FINDER_PATH_GET_DLFOLDERS = new FinderPath(com.liferay.portlet.documentlibrary.model.impl.DLFolderModelImpl.ENTITY_CACHE_ENABLED,
3064 DLFileEntryTypeModelImpl.FINDER_CACHE_ENABLED_DLFILEENTRYTYPES_DLFOLDERS,
3065 com.liferay.portlet.documentlibrary.model.impl.DLFolderImpl.class,
3066 DLFileEntryTypeModelImpl.MAPPING_TABLE_DLFILEENTRYTYPES_DLFOLDERS_NAME,
3067 "getDLFolders",
3068 new String[] {
3069 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
3070 "com.liferay.portal.kernel.util.OrderByComparator"
3071 });
3072
3073 static {
3074 FINDER_PATH_GET_DLFOLDERS.setCacheKeyGeneratorCacheName(null);
3075 }
3076
3077
3091 public List<com.liferay.portlet.documentlibrary.model.DLFolder> getDLFolders(
3092 long pk, int start, int end, OrderByComparator orderByComparator)
3093 throws SystemException {
3094 Object[] finderArgs = new Object[] { pk, start, end, orderByComparator };
3095
3096 List<com.liferay.portlet.documentlibrary.model.DLFolder> list = (List<com.liferay.portlet.documentlibrary.model.DLFolder>)FinderCacheUtil.getResult(FINDER_PATH_GET_DLFOLDERS,
3097 finderArgs, this);
3098
3099 if (list == null) {
3100 Session session = null;
3101
3102 try {
3103 session = openSession();
3104
3105 String sql = null;
3106
3107 if (orderByComparator != null) {
3108 sql = _SQL_GETDLFOLDERS.concat(ORDER_BY_CLAUSE)
3109 .concat(orderByComparator.getOrderBy());
3110 }
3111 else {
3112 sql = _SQL_GETDLFOLDERS.concat(com.liferay.portlet.documentlibrary.model.impl.DLFolderModelImpl.ORDER_BY_SQL);
3113 }
3114
3115 SQLQuery q = session.createSQLQuery(sql);
3116
3117 q.addEntity("DLFolder",
3118 com.liferay.portlet.documentlibrary.model.impl.DLFolderImpl.class);
3119
3120 QueryPos qPos = QueryPos.getInstance(q);
3121
3122 qPos.add(pk);
3123
3124 list = (List<com.liferay.portlet.documentlibrary.model.DLFolder>)QueryUtil.list(q,
3125 getDialect(), start, end);
3126 }
3127 catch (Exception e) {
3128 throw processException(e);
3129 }
3130 finally {
3131 if (list == null) {
3132 FinderCacheUtil.removeResult(FINDER_PATH_GET_DLFOLDERS,
3133 finderArgs);
3134 }
3135 else {
3136 dlFolderPersistence.cacheResult(list);
3137
3138 FinderCacheUtil.putResult(FINDER_PATH_GET_DLFOLDERS,
3139 finderArgs, list);
3140 }
3141
3142 closeSession(session);
3143 }
3144 }
3145
3146 return list;
3147 }
3148
3149 public static final FinderPath FINDER_PATH_GET_DLFOLDERS_SIZE = new FinderPath(com.liferay.portlet.documentlibrary.model.impl.DLFolderModelImpl.ENTITY_CACHE_ENABLED,
3150 DLFileEntryTypeModelImpl.FINDER_CACHE_ENABLED_DLFILEENTRYTYPES_DLFOLDERS,
3151 Long.class,
3152 DLFileEntryTypeModelImpl.MAPPING_TABLE_DLFILEENTRYTYPES_DLFOLDERS_NAME,
3153 "getDLFoldersSize", new String[] { Long.class.getName() });
3154
3155 static {
3156 FINDER_PATH_GET_DLFOLDERS_SIZE.setCacheKeyGeneratorCacheName(null);
3157 }
3158
3159
3166 public int getDLFoldersSize(long pk) throws SystemException {
3167 Object[] finderArgs = new Object[] { pk };
3168
3169 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_DLFOLDERS_SIZE,
3170 finderArgs, this);
3171
3172 if (count == null) {
3173 Session session = null;
3174
3175 try {
3176 session = openSession();
3177
3178 SQLQuery q = session.createSQLQuery(_SQL_GETDLFOLDERSSIZE);
3179
3180 q.addScalar(COUNT_COLUMN_NAME,
3181 com.liferay.portal.kernel.dao.orm.Type.LONG);
3182
3183 QueryPos qPos = QueryPos.getInstance(q);
3184
3185 qPos.add(pk);
3186
3187 count = (Long)q.uniqueResult();
3188 }
3189 catch (Exception e) {
3190 throw processException(e);
3191 }
3192 finally {
3193 if (count == null) {
3194 count = Long.valueOf(0);
3195 }
3196
3197 FinderCacheUtil.putResult(FINDER_PATH_GET_DLFOLDERS_SIZE,
3198 finderArgs, count);
3199
3200 closeSession(session);
3201 }
3202 }
3203
3204 return count.intValue();
3205 }
3206
3207 public static final FinderPath FINDER_PATH_CONTAINS_DLFOLDER = new FinderPath(com.liferay.portlet.documentlibrary.model.impl.DLFolderModelImpl.ENTITY_CACHE_ENABLED,
3208 DLFileEntryTypeModelImpl.FINDER_CACHE_ENABLED_DLFILEENTRYTYPES_DLFOLDERS,
3209 Boolean.class,
3210 DLFileEntryTypeModelImpl.MAPPING_TABLE_DLFILEENTRYTYPES_DLFOLDERS_NAME,
3211 "containsDLFolder",
3212 new String[] { Long.class.getName(), Long.class.getName() });
3213
3214
3222 public boolean containsDLFolder(long pk, long dlFolderPK)
3223 throws SystemException {
3224 Object[] finderArgs = new Object[] { pk, dlFolderPK };
3225
3226 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_DLFOLDER,
3227 finderArgs, this);
3228
3229 if (value == null) {
3230 try {
3231 value = Boolean.valueOf(containsDLFolder.contains(pk, dlFolderPK));
3232 }
3233 catch (Exception e) {
3234 throw processException(e);
3235 }
3236 finally {
3237 if (value == null) {
3238 value = Boolean.FALSE;
3239 }
3240
3241 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_DLFOLDER,
3242 finderArgs, value);
3243 }
3244 }
3245
3246 return value.booleanValue();
3247 }
3248
3249
3256 public boolean containsDLFolders(long pk) throws SystemException {
3257 if (getDLFoldersSize(pk) > 0) {
3258 return true;
3259 }
3260 else {
3261 return false;
3262 }
3263 }
3264
3265
3272 public void addDLFolder(long pk, long dlFolderPK) throws SystemException {
3273 try {
3274 addDLFolder.add(pk, dlFolderPK);
3275 }
3276 catch (Exception e) {
3277 throw processException(e);
3278 }
3279 finally {
3280 FinderCacheUtil.clearCache(DLFileEntryTypeModelImpl.MAPPING_TABLE_DLFILEENTRYTYPES_DLFOLDERS_NAME);
3281 }
3282 }
3283
3284
3291 public void addDLFolder(long pk,
3292 com.liferay.portlet.documentlibrary.model.DLFolder dlFolder)
3293 throws SystemException {
3294 try {
3295 addDLFolder.add(pk, dlFolder.getPrimaryKey());
3296 }
3297 catch (Exception e) {
3298 throw processException(e);
3299 }
3300 finally {
3301 FinderCacheUtil.clearCache(DLFileEntryTypeModelImpl.MAPPING_TABLE_DLFILEENTRYTYPES_DLFOLDERS_NAME);
3302 }
3303 }
3304
3305
3312 public void addDLFolders(long pk, long[] dlFolderPKs)
3313 throws SystemException {
3314 try {
3315 for (long dlFolderPK : dlFolderPKs) {
3316 addDLFolder.add(pk, dlFolderPK);
3317 }
3318 }
3319 catch (Exception e) {
3320 throw processException(e);
3321 }
3322 finally {
3323 FinderCacheUtil.clearCache(DLFileEntryTypeModelImpl.MAPPING_TABLE_DLFILEENTRYTYPES_DLFOLDERS_NAME);
3324 }
3325 }
3326
3327
3334 public void addDLFolders(long pk,
3335 List<com.liferay.portlet.documentlibrary.model.DLFolder> dlFolders)
3336 throws SystemException {
3337 try {
3338 for (com.liferay.portlet.documentlibrary.model.DLFolder dlFolder : dlFolders) {
3339 addDLFolder.add(pk, dlFolder.getPrimaryKey());
3340 }
3341 }
3342 catch (Exception e) {
3343 throw processException(e);
3344 }
3345 finally {
3346 FinderCacheUtil.clearCache(DLFileEntryTypeModelImpl.MAPPING_TABLE_DLFILEENTRYTYPES_DLFOLDERS_NAME);
3347 }
3348 }
3349
3350
3356 public void clearDLFolders(long pk) throws SystemException {
3357 try {
3358 clearDLFolders.clear(pk);
3359 }
3360 catch (Exception e) {
3361 throw processException(e);
3362 }
3363 finally {
3364 FinderCacheUtil.clearCache(DLFileEntryTypeModelImpl.MAPPING_TABLE_DLFILEENTRYTYPES_DLFOLDERS_NAME);
3365 }
3366 }
3367
3368
3375 public void removeDLFolder(long pk, long dlFolderPK)
3376 throws SystemException {
3377 try {
3378 removeDLFolder.remove(pk, dlFolderPK);
3379 }
3380 catch (Exception e) {
3381 throw processException(e);
3382 }
3383 finally {
3384 FinderCacheUtil.clearCache(DLFileEntryTypeModelImpl.MAPPING_TABLE_DLFILEENTRYTYPES_DLFOLDERS_NAME);
3385 }
3386 }
3387
3388
3395 public void removeDLFolder(long pk,
3396 com.liferay.portlet.documentlibrary.model.DLFolder dlFolder)
3397 throws SystemException {
3398 try {
3399 removeDLFolder.remove(pk, dlFolder.getPrimaryKey());
3400 }
3401 catch (Exception e) {
3402 throw processException(e);
3403 }
3404 finally {
3405 FinderCacheUtil.clearCache(DLFileEntryTypeModelImpl.MAPPING_TABLE_DLFILEENTRYTYPES_DLFOLDERS_NAME);
3406 }
3407 }
3408
3409
3416 public void removeDLFolders(long pk, long[] dlFolderPKs)
3417 throws SystemException {
3418 try {
3419 for (long dlFolderPK : dlFolderPKs) {
3420 removeDLFolder.remove(pk, dlFolderPK);
3421 }
3422 }
3423 catch (Exception e) {
3424 throw processException(e);
3425 }
3426 finally {
3427 FinderCacheUtil.clearCache(DLFileEntryTypeModelImpl.MAPPING_TABLE_DLFILEENTRYTYPES_DLFOLDERS_NAME);
3428 }
3429 }
3430
3431
3438 public void removeDLFolders(long pk,
3439 List<com.liferay.portlet.documentlibrary.model.DLFolder> dlFolders)
3440 throws SystemException {
3441 try {
3442 for (com.liferay.portlet.documentlibrary.model.DLFolder dlFolder : dlFolders) {
3443 removeDLFolder.remove(pk, dlFolder.getPrimaryKey());
3444 }
3445 }
3446 catch (Exception e) {
3447 throw processException(e);
3448 }
3449 finally {
3450 FinderCacheUtil.clearCache(DLFileEntryTypeModelImpl.MAPPING_TABLE_DLFILEENTRYTYPES_DLFOLDERS_NAME);
3451 }
3452 }
3453
3454
3461 public void setDLFolders(long pk, long[] dlFolderPKs)
3462 throws SystemException {
3463 try {
3464 Set<Long> dlFolderPKSet = SetUtil.fromArray(dlFolderPKs);
3465
3466 List<com.liferay.portlet.documentlibrary.model.DLFolder> dlFolders = getDLFolders(pk);
3467
3468 for (com.liferay.portlet.documentlibrary.model.DLFolder dlFolder : dlFolders) {
3469 if (!dlFolderPKSet.remove(dlFolder.getPrimaryKey())) {
3470 removeDLFolder.remove(pk, dlFolder.getPrimaryKey());
3471 }
3472 }
3473
3474 for (Long dlFolderPK : dlFolderPKSet) {
3475 addDLFolder.add(pk, dlFolderPK);
3476 }
3477 }
3478 catch (Exception e) {
3479 throw processException(e);
3480 }
3481 finally {
3482 FinderCacheUtil.clearCache(DLFileEntryTypeModelImpl.MAPPING_TABLE_DLFILEENTRYTYPES_DLFOLDERS_NAME);
3483 }
3484 }
3485
3486
3493 public void setDLFolders(long pk,
3494 List<com.liferay.portlet.documentlibrary.model.DLFolder> dlFolders)
3495 throws SystemException {
3496 try {
3497 long[] dlFolderPKs = new long[dlFolders.size()];
3498
3499 for (int i = 0; i < dlFolders.size(); i++) {
3500 com.liferay.portlet.documentlibrary.model.DLFolder dlFolder = dlFolders.get(i);
3501
3502 dlFolderPKs[i] = dlFolder.getPrimaryKey();
3503 }
3504
3505 setDLFolders(pk, dlFolderPKs);
3506 }
3507 catch (Exception e) {
3508 throw processException(e);
3509 }
3510 finally {
3511 FinderCacheUtil.clearCache(DLFileEntryTypeModelImpl.MAPPING_TABLE_DLFILEENTRYTYPES_DLFOLDERS_NAME);
3512 }
3513 }
3514
3515
3522 public List<com.liferay.portlet.dynamicdatamapping.model.DDMStructure> getDDMStructures(
3523 long pk) throws SystemException {
3524 return getDDMStructures(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
3525 }
3526
3527
3540 public List<com.liferay.portlet.dynamicdatamapping.model.DDMStructure> getDDMStructures(
3541 long pk, int start, int end) throws SystemException {
3542 return getDDMStructures(pk, start, end, null);
3543 }
3544
3545 public static final FinderPath FINDER_PATH_GET_DDMSTRUCTURES = new FinderPath(com.liferay.portlet.dynamicdatamapping.model.impl.DDMStructureModelImpl.ENTITY_CACHE_ENABLED,
3546 DLFileEntryTypeModelImpl.FINDER_CACHE_ENABLED_DLFILEENTRYTYPES_DDMSTRUCTURES,
3547 com.liferay.portlet.dynamicdatamapping.model.impl.DDMStructureImpl.class,
3548 DLFileEntryTypeModelImpl.MAPPING_TABLE_DLFILEENTRYTYPES_DDMSTRUCTURES_NAME,
3549 "getDDMStructures",
3550 new String[] {
3551 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
3552 "com.liferay.portal.kernel.util.OrderByComparator"
3553 });
3554
3555 static {
3556 FINDER_PATH_GET_DDMSTRUCTURES.setCacheKeyGeneratorCacheName(null);
3557 }
3558
3559
3573 public List<com.liferay.portlet.dynamicdatamapping.model.DDMStructure> getDDMStructures(
3574 long pk, int start, int end, OrderByComparator orderByComparator)
3575 throws SystemException {
3576 Object[] finderArgs = new Object[] { pk, start, end, orderByComparator };
3577
3578 List<com.liferay.portlet.dynamicdatamapping.model.DDMStructure> list = (List<com.liferay.portlet.dynamicdatamapping.model.DDMStructure>)FinderCacheUtil.getResult(FINDER_PATH_GET_DDMSTRUCTURES,
3579 finderArgs, this);
3580
3581 if (list == null) {
3582 Session session = null;
3583
3584 try {
3585 session = openSession();
3586
3587 String sql = null;
3588
3589 if (orderByComparator != null) {
3590 sql = _SQL_GETDDMSTRUCTURES.concat(ORDER_BY_CLAUSE)
3591 .concat(orderByComparator.getOrderBy());
3592 }
3593 else {
3594 sql = _SQL_GETDDMSTRUCTURES;
3595 }
3596
3597 SQLQuery q = session.createSQLQuery(sql);
3598
3599 q.addEntity("DDMStructure",
3600 com.liferay.portlet.dynamicdatamapping.model.impl.DDMStructureImpl.class);
3601
3602 QueryPos qPos = QueryPos.getInstance(q);
3603
3604 qPos.add(pk);
3605
3606 list = (List<com.liferay.portlet.dynamicdatamapping.model.DDMStructure>)QueryUtil.list(q,
3607 getDialect(), start, end);
3608 }
3609 catch (Exception e) {
3610 throw processException(e);
3611 }
3612 finally {
3613 if (list == null) {
3614 FinderCacheUtil.removeResult(FINDER_PATH_GET_DDMSTRUCTURES,
3615 finderArgs);
3616 }
3617 else {
3618 ddmStructurePersistence.cacheResult(list);
3619
3620 FinderCacheUtil.putResult(FINDER_PATH_GET_DDMSTRUCTURES,
3621 finderArgs, list);
3622 }
3623
3624 closeSession(session);
3625 }
3626 }
3627
3628 return list;
3629 }
3630
3631 public static final FinderPath FINDER_PATH_GET_DDMSTRUCTURES_SIZE = new FinderPath(com.liferay.portlet.dynamicdatamapping.model.impl.DDMStructureModelImpl.ENTITY_CACHE_ENABLED,
3632 DLFileEntryTypeModelImpl.FINDER_CACHE_ENABLED_DLFILEENTRYTYPES_DDMSTRUCTURES,
3633 Long.class,
3634 DLFileEntryTypeModelImpl.MAPPING_TABLE_DLFILEENTRYTYPES_DDMSTRUCTURES_NAME,
3635 "getDDMStructuresSize", new String[] { Long.class.getName() });
3636
3637 static {
3638 FINDER_PATH_GET_DDMSTRUCTURES_SIZE.setCacheKeyGeneratorCacheName(null);
3639 }
3640
3641
3648 public int getDDMStructuresSize(long pk) throws SystemException {
3649 Object[] finderArgs = new Object[] { pk };
3650
3651 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_DDMSTRUCTURES_SIZE,
3652 finderArgs, this);
3653
3654 if (count == null) {
3655 Session session = null;
3656
3657 try {
3658 session = openSession();
3659
3660 SQLQuery q = session.createSQLQuery(_SQL_GETDDMSTRUCTURESSIZE);
3661
3662 q.addScalar(COUNT_COLUMN_NAME,
3663 com.liferay.portal.kernel.dao.orm.Type.LONG);
3664
3665 QueryPos qPos = QueryPos.getInstance(q);
3666
3667 qPos.add(pk);
3668
3669 count = (Long)q.uniqueResult();
3670 }
3671 catch (Exception e) {
3672 throw processException(e);
3673 }
3674 finally {
3675 if (count == null) {
3676 count = Long.valueOf(0);
3677 }
3678
3679 FinderCacheUtil.putResult(FINDER_PATH_GET_DDMSTRUCTURES_SIZE,
3680 finderArgs, count);
3681
3682 closeSession(session);
3683 }
3684 }
3685
3686 return count.intValue();
3687 }
3688
3689 public static final FinderPath FINDER_PATH_CONTAINS_DDMSTRUCTURE = new FinderPath(com.liferay.portlet.dynamicdatamapping.model.impl.DDMStructureModelImpl.ENTITY_CACHE_ENABLED,
3690 DLFileEntryTypeModelImpl.FINDER_CACHE_ENABLED_DLFILEENTRYTYPES_DDMSTRUCTURES,
3691 Boolean.class,
3692 DLFileEntryTypeModelImpl.MAPPING_TABLE_DLFILEENTRYTYPES_DDMSTRUCTURES_NAME,
3693 "containsDDMStructure",
3694 new String[] { Long.class.getName(), Long.class.getName() });
3695
3696
3704 public boolean containsDDMStructure(long pk, long ddmStructurePK)
3705 throws SystemException {
3706 Object[] finderArgs = new Object[] { pk, ddmStructurePK };
3707
3708 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_DDMSTRUCTURE,
3709 finderArgs, this);
3710
3711 if (value == null) {
3712 try {
3713 value = Boolean.valueOf(containsDDMStructure.contains(pk,
3714 ddmStructurePK));
3715 }
3716 catch (Exception e) {
3717 throw processException(e);
3718 }
3719 finally {
3720 if (value == null) {
3721 value = Boolean.FALSE;
3722 }
3723
3724 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_DDMSTRUCTURE,
3725 finderArgs, value);
3726 }
3727 }
3728
3729 return value.booleanValue();
3730 }
3731
3732
3739 public boolean containsDDMStructures(long pk) throws SystemException {
3740 if (getDDMStructuresSize(pk) > 0) {
3741 return true;
3742 }
3743 else {
3744 return false;
3745 }
3746 }
3747
3748
3755 public void addDDMStructure(long pk, long ddmStructurePK)
3756 throws SystemException {
3757 try {
3758 addDDMStructure.add(pk, ddmStructurePK);
3759 }
3760 catch (Exception e) {
3761 throw processException(e);
3762 }
3763 finally {
3764 FinderCacheUtil.clearCache(DLFileEntryTypeModelImpl.MAPPING_TABLE_DLFILEENTRYTYPES_DDMSTRUCTURES_NAME);
3765 }
3766 }
3767
3768
3775 public void addDDMStructure(long pk,
3776 com.liferay.portlet.dynamicdatamapping.model.DDMStructure ddmStructure)
3777 throws SystemException {
3778 try {
3779 addDDMStructure.add(pk, ddmStructure.getPrimaryKey());
3780 }
3781 catch (Exception e) {
3782 throw processException(e);
3783 }
3784 finally {
3785 FinderCacheUtil.clearCache(DLFileEntryTypeModelImpl.MAPPING_TABLE_DLFILEENTRYTYPES_DDMSTRUCTURES_NAME);
3786 }
3787 }
3788
3789
3796 public void addDDMStructures(long pk, long[] ddmStructurePKs)
3797 throws SystemException {
3798 try {
3799 for (long ddmStructurePK : ddmStructurePKs) {
3800 addDDMStructure.add(pk, ddmStructurePK);
3801 }
3802 }
3803 catch (Exception e) {
3804 throw processException(e);
3805 }
3806 finally {
3807 FinderCacheUtil.clearCache(DLFileEntryTypeModelImpl.MAPPING_TABLE_DLFILEENTRYTYPES_DDMSTRUCTURES_NAME);
3808 }
3809 }
3810
3811
3818 public void addDDMStructures(long pk,
3819 List<com.liferay.portlet.dynamicdatamapping.model.DDMStructure> ddmStructures)
3820 throws SystemException {
3821 try {
3822 for (com.liferay.portlet.dynamicdatamapping.model.DDMStructure ddmStructure : ddmStructures) {
3823 addDDMStructure.add(pk, ddmStructure.getPrimaryKey());
3824 }
3825 }
3826 catch (Exception e) {
3827 throw processException(e);
3828 }
3829 finally {
3830 FinderCacheUtil.clearCache(DLFileEntryTypeModelImpl.MAPPING_TABLE_DLFILEENTRYTYPES_DDMSTRUCTURES_NAME);
3831 }
3832 }
3833
3834
3840 public void clearDDMStructures(long pk) throws SystemException {
3841 try {
3842 clearDDMStructures.clear(pk);
3843 }
3844 catch (Exception e) {
3845 throw processException(e);
3846 }
3847 finally {
3848 FinderCacheUtil.clearCache(DLFileEntryTypeModelImpl.MAPPING_TABLE_DLFILEENTRYTYPES_DDMSTRUCTURES_NAME);
3849 }
3850 }
3851
3852
3859 public void removeDDMStructure(long pk, long ddmStructurePK)
3860 throws SystemException {
3861 try {
3862 removeDDMStructure.remove(pk, ddmStructurePK);
3863 }
3864 catch (Exception e) {
3865 throw processException(e);
3866 }
3867 finally {
3868 FinderCacheUtil.clearCache(DLFileEntryTypeModelImpl.MAPPING_TABLE_DLFILEENTRYTYPES_DDMSTRUCTURES_NAME);
3869 }
3870 }
3871
3872
3879 public void removeDDMStructure(long pk,
3880 com.liferay.portlet.dynamicdatamapping.model.DDMStructure ddmStructure)
3881 throws SystemException {
3882 try {
3883 removeDDMStructure.remove(pk, ddmStructure.getPrimaryKey());
3884 }
3885 catch (Exception e) {
3886 throw processException(e);
3887 }
3888 finally {
3889 FinderCacheUtil.clearCache(DLFileEntryTypeModelImpl.MAPPING_TABLE_DLFILEENTRYTYPES_DDMSTRUCTURES_NAME);
3890 }
3891 }
3892
3893
3900 public void removeDDMStructures(long pk, long[] ddmStructurePKs)
3901 throws SystemException {
3902 try {
3903 for (long ddmStructurePK : ddmStructurePKs) {
3904 removeDDMStructure.remove(pk, ddmStructurePK);
3905 }
3906 }
3907 catch (Exception e) {
3908 throw processException(e);
3909 }
3910 finally {
3911 FinderCacheUtil.clearCache(DLFileEntryTypeModelImpl.MAPPING_TABLE_DLFILEENTRYTYPES_DDMSTRUCTURES_NAME);
3912 }
3913 }
3914
3915
3922 public void removeDDMStructures(long pk,
3923 List<com.liferay.portlet.dynamicdatamapping.model.DDMStructure> ddmStructures)
3924 throws SystemException {
3925 try {
3926 for (com.liferay.portlet.dynamicdatamapping.model.DDMStructure ddmStructure : ddmStructures) {
3927 removeDDMStructure.remove(pk, ddmStructure.getPrimaryKey());
3928 }
3929 }
3930 catch (Exception e) {
3931 throw processException(e);
3932 }
3933 finally {
3934 FinderCacheUtil.clearCache(DLFileEntryTypeModelImpl.MAPPING_TABLE_DLFILEENTRYTYPES_DDMSTRUCTURES_NAME);
3935 }
3936 }
3937
3938
3945 public void setDDMStructures(long pk, long[] ddmStructurePKs)
3946 throws SystemException {
3947 try {
3948 Set<Long> ddmStructurePKSet = SetUtil.fromArray(ddmStructurePKs);
3949
3950 List<com.liferay.portlet.dynamicdatamapping.model.DDMStructure> ddmStructures =
3951 getDDMStructures(pk);
3952
3953 for (com.liferay.portlet.dynamicdatamapping.model.DDMStructure ddmStructure : ddmStructures) {
3954 if (!ddmStructurePKSet.remove(ddmStructure.getPrimaryKey())) {
3955 removeDDMStructure.remove(pk, ddmStructure.getPrimaryKey());
3956 }
3957 }
3958
3959 for (Long ddmStructurePK : ddmStructurePKSet) {
3960 addDDMStructure.add(pk, ddmStructurePK);
3961 }
3962 }
3963 catch (Exception e) {
3964 throw processException(e);
3965 }
3966 finally {
3967 FinderCacheUtil.clearCache(DLFileEntryTypeModelImpl.MAPPING_TABLE_DLFILEENTRYTYPES_DDMSTRUCTURES_NAME);
3968 }
3969 }
3970
3971
3978 public void setDDMStructures(long pk,
3979 List<com.liferay.portlet.dynamicdatamapping.model.DDMStructure> ddmStructures)
3980 throws SystemException {
3981 try {
3982 long[] ddmStructurePKs = new long[ddmStructures.size()];
3983
3984 for (int i = 0; i < ddmStructures.size(); i++) {
3985 com.liferay.portlet.dynamicdatamapping.model.DDMStructure ddmStructure =
3986 ddmStructures.get(i);
3987
3988 ddmStructurePKs[i] = ddmStructure.getPrimaryKey();
3989 }
3990
3991 setDDMStructures(pk, ddmStructurePKs);
3992 }
3993 catch (Exception e) {
3994 throw processException(e);
3995 }
3996 finally {
3997 FinderCacheUtil.clearCache(DLFileEntryTypeModelImpl.MAPPING_TABLE_DLFILEENTRYTYPES_DDMSTRUCTURES_NAME);
3998 }
3999 }
4000
4001
4004 public void afterPropertiesSet() {
4005 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
4006 com.liferay.portal.util.PropsUtil.get(
4007 "value.object.listener.com.liferay.portlet.documentlibrary.model.DLFileEntryType")));
4008
4009 if (listenerClassNames.length > 0) {
4010 try {
4011 List<ModelListener<DLFileEntryType>> listenersList = new ArrayList<ModelListener<DLFileEntryType>>();
4012
4013 for (String listenerClassName : listenerClassNames) {
4014 Class<?> clazz = getClass();
4015
4016 listenersList.add((ModelListener<DLFileEntryType>)InstanceFactory.newInstance(
4017 clazz.getClassLoader(), listenerClassName));
4018 }
4019
4020 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
4021 }
4022 catch (Exception e) {
4023 _log.error(e);
4024 }
4025 }
4026
4027 containsDLFolder = new ContainsDLFolder();
4028
4029 addDLFolder = new AddDLFolder();
4030 clearDLFolders = new ClearDLFolders();
4031 removeDLFolder = new RemoveDLFolder();
4032
4033 containsDDMStructure = new ContainsDDMStructure();
4034
4035 addDDMStructure = new AddDDMStructure();
4036 clearDDMStructures = new ClearDDMStructures();
4037 removeDDMStructure = new RemoveDDMStructure();
4038 }
4039
4040 public void destroy() {
4041 EntityCacheUtil.removeCache(DLFileEntryTypeImpl.class.getName());
4042 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
4043 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
4044 }
4045
4046 @BeanReference(type = DLContentPersistence.class)
4047 protected DLContentPersistence dlContentPersistence;
4048 @BeanReference(type = DLFileEntryPersistence.class)
4049 protected DLFileEntryPersistence dlFileEntryPersistence;
4050 @BeanReference(type = DLFileEntryMetadataPersistence.class)
4051 protected DLFileEntryMetadataPersistence dlFileEntryMetadataPersistence;
4052 @BeanReference(type = DLFileEntryTypePersistence.class)
4053 protected DLFileEntryTypePersistence dlFileEntryTypePersistence;
4054 @BeanReference(type = DLFileRankPersistence.class)
4055 protected DLFileRankPersistence dlFileRankPersistence;
4056 @BeanReference(type = DLFileShortcutPersistence.class)
4057 protected DLFileShortcutPersistence dlFileShortcutPersistence;
4058 @BeanReference(type = DLFileVersionPersistence.class)
4059 protected DLFileVersionPersistence dlFileVersionPersistence;
4060 @BeanReference(type = DLFolderPersistence.class)
4061 protected DLFolderPersistence dlFolderPersistence;
4062 @BeanReference(type = DLSyncPersistence.class)
4063 protected DLSyncPersistence dlSyncPersistence;
4064 @BeanReference(type = ResourcePersistence.class)
4065 protected ResourcePersistence resourcePersistence;
4066 @BeanReference(type = UserPersistence.class)
4067 protected UserPersistence userPersistence;
4068 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
4069 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
4070 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
4071 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
4072 @BeanReference(type = DDMStructurePersistence.class)
4073 protected DDMStructurePersistence ddmStructurePersistence;
4074 protected ContainsDLFolder containsDLFolder;
4075 protected AddDLFolder addDLFolder;
4076 protected ClearDLFolders clearDLFolders;
4077 protected RemoveDLFolder removeDLFolder;
4078 protected ContainsDDMStructure containsDDMStructure;
4079 protected AddDDMStructure addDDMStructure;
4080 protected ClearDDMStructures clearDDMStructures;
4081 protected RemoveDDMStructure removeDDMStructure;
4082
4083 protected class ContainsDLFolder {
4084 protected ContainsDLFolder() {
4085 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
4086 _SQL_CONTAINSDLFOLDER,
4087 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
4088 RowMapper.COUNT);
4089 }
4090
4091 protected boolean contains(long fileEntryTypeId, long folderId) {
4092 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
4093 new Long(fileEntryTypeId), new Long(folderId)
4094 });
4095
4096 if (results.size() > 0) {
4097 Integer count = results.get(0);
4098
4099 if (count.intValue() > 0) {
4100 return true;
4101 }
4102 }
4103
4104 return false;
4105 }
4106
4107 private MappingSqlQuery<Integer> _mappingSqlQuery;
4108 }
4109
4110 protected class AddDLFolder {
4111 protected AddDLFolder() {
4112 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
4113 "INSERT INTO DLFileEntryTypes_DLFolders (fileEntryTypeId, folderId) VALUES (?, ?)",
4114 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
4115 }
4116
4117 protected void add(long fileEntryTypeId, long folderId)
4118 throws SystemException {
4119 if (!containsDLFolder.contains(fileEntryTypeId, folderId)) {
4120 ModelListener<com.liferay.portlet.documentlibrary.model.DLFolder>[] dlFolderListeners =
4121 dlFolderPersistence.getListeners();
4122
4123 for (ModelListener<DLFileEntryType> listener : listeners) {
4124 listener.onBeforeAddAssociation(fileEntryTypeId,
4125 com.liferay.portlet.documentlibrary.model.DLFolder.class.getName(),
4126 folderId);
4127 }
4128
4129 for (ModelListener<com.liferay.portlet.documentlibrary.model.DLFolder> listener : dlFolderListeners) {
4130 listener.onBeforeAddAssociation(folderId,
4131 DLFileEntryType.class.getName(), fileEntryTypeId);
4132 }
4133
4134 _sqlUpdate.update(new Object[] {
4135 new Long(fileEntryTypeId), new Long(folderId)
4136 });
4137
4138 for (ModelListener<DLFileEntryType> listener : listeners) {
4139 listener.onAfterAddAssociation(fileEntryTypeId,
4140 com.liferay.portlet.documentlibrary.model.DLFolder.class.getName(),
4141 folderId);
4142 }
4143
4144 for (ModelListener<com.liferay.portlet.documentlibrary.model.DLFolder> listener : dlFolderListeners) {
4145 listener.onAfterAddAssociation(folderId,
4146 DLFileEntryType.class.getName(), fileEntryTypeId);
4147 }
4148 }
4149 }
4150
4151 private SqlUpdate _sqlUpdate;
4152 }
4153
4154 protected class ClearDLFolders {
4155 protected ClearDLFolders() {
4156 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
4157 "DELETE FROM DLFileEntryTypes_DLFolders WHERE fileEntryTypeId = ?",
4158 new int[] { java.sql.Types.BIGINT });
4159 }
4160
4161 protected void clear(long fileEntryTypeId) throws SystemException {
4162 ModelListener<com.liferay.portlet.documentlibrary.model.DLFolder>[] dlFolderListeners =
4163 dlFolderPersistence.getListeners();
4164
4165 List<com.liferay.portlet.documentlibrary.model.DLFolder> dlFolders = null;
4166
4167 if ((listeners.length > 0) || (dlFolderListeners.length > 0)) {
4168 dlFolders = getDLFolders(fileEntryTypeId);
4169
4170 for (com.liferay.portlet.documentlibrary.model.DLFolder dlFolder : dlFolders) {
4171 for (ModelListener<DLFileEntryType> listener : listeners) {
4172 listener.onBeforeRemoveAssociation(fileEntryTypeId,
4173 com.liferay.portlet.documentlibrary.model.DLFolder.class.getName(),
4174 dlFolder.getPrimaryKey());
4175 }
4176
4177 for (ModelListener<com.liferay.portlet.documentlibrary.model.DLFolder> listener : dlFolderListeners) {
4178 listener.onBeforeRemoveAssociation(dlFolder.getPrimaryKey(),
4179 DLFileEntryType.class.getName(), fileEntryTypeId);
4180 }
4181 }
4182 }
4183
4184 _sqlUpdate.update(new Object[] { new Long(fileEntryTypeId) });
4185
4186 if ((listeners.length > 0) || (dlFolderListeners.length > 0)) {
4187 for (com.liferay.portlet.documentlibrary.model.DLFolder dlFolder : dlFolders) {
4188 for (ModelListener<DLFileEntryType> listener : listeners) {
4189 listener.onAfterRemoveAssociation(fileEntryTypeId,
4190 com.liferay.portlet.documentlibrary.model.DLFolder.class.getName(),
4191 dlFolder.getPrimaryKey());
4192 }
4193
4194 for (ModelListener<com.liferay.portlet.documentlibrary.model.DLFolder> listener : dlFolderListeners) {
4195 listener.onAfterRemoveAssociation(dlFolder.getPrimaryKey(),
4196 DLFileEntryType.class.getName(), fileEntryTypeId);
4197 }
4198 }
4199 }
4200 }
4201
4202 private SqlUpdate _sqlUpdate;
4203 }
4204
4205 protected class RemoveDLFolder {
4206 protected RemoveDLFolder() {
4207 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
4208 "DELETE FROM DLFileEntryTypes_DLFolders WHERE fileEntryTypeId = ? AND folderId = ?",
4209 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
4210 }
4211
4212 protected void remove(long fileEntryTypeId, long folderId)
4213 throws SystemException {
4214 if (containsDLFolder.contains(fileEntryTypeId, folderId)) {
4215 ModelListener<com.liferay.portlet.documentlibrary.model.DLFolder>[] dlFolderListeners =
4216 dlFolderPersistence.getListeners();
4217
4218 for (ModelListener<DLFileEntryType> listener : listeners) {
4219 listener.onBeforeRemoveAssociation(fileEntryTypeId,
4220 com.liferay.portlet.documentlibrary.model.DLFolder.class.getName(),
4221 folderId);
4222 }
4223
4224 for (ModelListener<com.liferay.portlet.documentlibrary.model.DLFolder> listener : dlFolderListeners) {
4225 listener.onBeforeRemoveAssociation(folderId,
4226 DLFileEntryType.class.getName(), fileEntryTypeId);
4227 }
4228
4229 _sqlUpdate.update(new Object[] {
4230 new Long(fileEntryTypeId), new Long(folderId)
4231 });
4232
4233 for (ModelListener<DLFileEntryType> listener : listeners) {
4234 listener.onAfterRemoveAssociation(fileEntryTypeId,
4235 com.liferay.portlet.documentlibrary.model.DLFolder.class.getName(),
4236 folderId);
4237 }
4238
4239 for (ModelListener<com.liferay.portlet.documentlibrary.model.DLFolder> listener : dlFolderListeners) {
4240 listener.onAfterRemoveAssociation(folderId,
4241 DLFileEntryType.class.getName(), fileEntryTypeId);
4242 }
4243 }
4244 }
4245
4246 private SqlUpdate _sqlUpdate;
4247 }
4248
4249 protected class ContainsDDMStructure {
4250 protected ContainsDDMStructure() {
4251 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
4252 _SQL_CONTAINSDDMSTRUCTURE,
4253 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
4254 RowMapper.COUNT);
4255 }
4256
4257 protected boolean contains(long fileEntryTypeId, long structureId) {
4258 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
4259 new Long(fileEntryTypeId), new Long(structureId)
4260 });
4261
4262 if (results.size() > 0) {
4263 Integer count = results.get(0);
4264
4265 if (count.intValue() > 0) {
4266 return true;
4267 }
4268 }
4269
4270 return false;
4271 }
4272
4273 private MappingSqlQuery<Integer> _mappingSqlQuery;
4274 }
4275
4276 protected class AddDDMStructure {
4277 protected AddDDMStructure() {
4278 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
4279 "INSERT INTO DLFileEntryTypes_DDMStructures (fileEntryTypeId, structureId) VALUES (?, ?)",
4280 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
4281 }
4282
4283 protected void add(long fileEntryTypeId, long structureId)
4284 throws SystemException {
4285 if (!containsDDMStructure.contains(fileEntryTypeId, structureId)) {
4286 ModelListener<com.liferay.portlet.dynamicdatamapping.model.DDMStructure>[] ddmStructureListeners =
4287 ddmStructurePersistence.getListeners();
4288
4289 for (ModelListener<DLFileEntryType> listener : listeners) {
4290 listener.onBeforeAddAssociation(fileEntryTypeId,
4291 com.liferay.portlet.dynamicdatamapping.model.DDMStructure.class.getName(),
4292 structureId);
4293 }
4294
4295 for (ModelListener<com.liferay.portlet.dynamicdatamapping.model.DDMStructure> listener : ddmStructureListeners) {
4296 listener.onBeforeAddAssociation(structureId,
4297 DLFileEntryType.class.getName(), fileEntryTypeId);
4298 }
4299
4300 _sqlUpdate.update(new Object[] {
4301 new Long(fileEntryTypeId), new Long(structureId)
4302 });
4303
4304 for (ModelListener<DLFileEntryType> listener : listeners) {
4305 listener.onAfterAddAssociation(fileEntryTypeId,
4306 com.liferay.portlet.dynamicdatamapping.model.DDMStructure.class.getName(),
4307 structureId);
4308 }
4309
4310 for (ModelListener<com.liferay.portlet.dynamicdatamapping.model.DDMStructure> listener : ddmStructureListeners) {
4311 listener.onAfterAddAssociation(structureId,
4312 DLFileEntryType.class.getName(), fileEntryTypeId);
4313 }
4314 }
4315 }
4316
4317 private SqlUpdate _sqlUpdate;
4318 }
4319
4320 protected class ClearDDMStructures {
4321 protected ClearDDMStructures() {
4322 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
4323 "DELETE FROM DLFileEntryTypes_DDMStructures WHERE fileEntryTypeId = ?",
4324 new int[] { java.sql.Types.BIGINT });
4325 }
4326
4327 protected void clear(long fileEntryTypeId) throws SystemException {
4328 ModelListener<com.liferay.portlet.dynamicdatamapping.model.DDMStructure>[] ddmStructureListeners =
4329 ddmStructurePersistence.getListeners();
4330
4331 List<com.liferay.portlet.dynamicdatamapping.model.DDMStructure> ddmStructures =
4332 null;
4333
4334 if ((listeners.length > 0) || (ddmStructureListeners.length > 0)) {
4335 ddmStructures = getDDMStructures(fileEntryTypeId);
4336
4337 for (com.liferay.portlet.dynamicdatamapping.model.DDMStructure ddmStructure : ddmStructures) {
4338 for (ModelListener<DLFileEntryType> listener : listeners) {
4339 listener.onBeforeRemoveAssociation(fileEntryTypeId,
4340 com.liferay.portlet.dynamicdatamapping.model.DDMStructure.class.getName(),
4341 ddmStructure.getPrimaryKey());
4342 }
4343
4344 for (ModelListener<com.liferay.portlet.dynamicdatamapping.model.DDMStructure> listener : ddmStructureListeners) {
4345 listener.onBeforeRemoveAssociation(ddmStructure.getPrimaryKey(),
4346 DLFileEntryType.class.getName(), fileEntryTypeId);
4347 }
4348 }
4349 }
4350
4351 _sqlUpdate.update(new Object[] { new Long(fileEntryTypeId) });
4352
4353 if ((listeners.length > 0) || (ddmStructureListeners.length > 0)) {
4354 for (com.liferay.portlet.dynamicdatamapping.model.DDMStructure ddmStructure : ddmStructures) {
4355 for (ModelListener<DLFileEntryType> listener : listeners) {
4356 listener.onAfterRemoveAssociation(fileEntryTypeId,
4357 com.liferay.portlet.dynamicdatamapping.model.DDMStructure.class.getName(),
4358 ddmStructure.getPrimaryKey());
4359 }
4360
4361 for (ModelListener<com.liferay.portlet.dynamicdatamapping.model.DDMStructure> listener : ddmStructureListeners) {
4362 listener.onAfterRemoveAssociation(ddmStructure.getPrimaryKey(),
4363 DLFileEntryType.class.getName(), fileEntryTypeId);
4364 }
4365 }
4366 }
4367 }
4368
4369 private SqlUpdate _sqlUpdate;
4370 }
4371
4372 protected class RemoveDDMStructure {
4373 protected RemoveDDMStructure() {
4374 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
4375 "DELETE FROM DLFileEntryTypes_DDMStructures WHERE fileEntryTypeId = ? AND structureId = ?",
4376 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
4377 }
4378
4379 protected void remove(long fileEntryTypeId, long structureId)
4380 throws SystemException {
4381 if (containsDDMStructure.contains(fileEntryTypeId, structureId)) {
4382 ModelListener<com.liferay.portlet.dynamicdatamapping.model.DDMStructure>[] ddmStructureListeners =
4383 ddmStructurePersistence.getListeners();
4384
4385 for (ModelListener<DLFileEntryType> listener : listeners) {
4386 listener.onBeforeRemoveAssociation(fileEntryTypeId,
4387 com.liferay.portlet.dynamicdatamapping.model.DDMStructure.class.getName(),
4388 structureId);
4389 }
4390
4391 for (ModelListener<com.liferay.portlet.dynamicdatamapping.model.DDMStructure> listener : ddmStructureListeners) {
4392 listener.onBeforeRemoveAssociation(structureId,
4393 DLFileEntryType.class.getName(), fileEntryTypeId);
4394 }
4395
4396 _sqlUpdate.update(new Object[] {
4397 new Long(fileEntryTypeId), new Long(structureId)
4398 });
4399
4400 for (ModelListener<DLFileEntryType> listener : listeners) {
4401 listener.onAfterRemoveAssociation(fileEntryTypeId,
4402 com.liferay.portlet.dynamicdatamapping.model.DDMStructure.class.getName(),
4403 structureId);
4404 }
4405
4406 for (ModelListener<com.liferay.portlet.dynamicdatamapping.model.DDMStructure> listener : ddmStructureListeners) {
4407 listener.onAfterRemoveAssociation(structureId,
4408 DLFileEntryType.class.getName(), fileEntryTypeId);
4409 }
4410 }
4411 }
4412
4413 private SqlUpdate _sqlUpdate;
4414 }
4415
4416 private static final String _SQL_SELECT_DLFILEENTRYTYPE = "SELECT dlFileEntryType FROM DLFileEntryType dlFileEntryType";
4417 private static final String _SQL_SELECT_DLFILEENTRYTYPE_WHERE = "SELECT dlFileEntryType FROM DLFileEntryType dlFileEntryType WHERE ";
4418 private static final String _SQL_COUNT_DLFILEENTRYTYPE = "SELECT COUNT(dlFileEntryType) FROM DLFileEntryType dlFileEntryType";
4419 private static final String _SQL_COUNT_DLFILEENTRYTYPE_WHERE = "SELECT COUNT(dlFileEntryType) FROM DLFileEntryType dlFileEntryType WHERE ";
4420 private static final String _SQL_GETDLFOLDERS = "SELECT {DLFolder.*} FROM DLFolder INNER JOIN DLFileEntryTypes_DLFolders ON (DLFileEntryTypes_DLFolders.folderId = DLFolder.folderId) WHERE (DLFileEntryTypes_DLFolders.fileEntryTypeId = ?)";
4421 private static final String _SQL_GETDLFOLDERSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM DLFileEntryTypes_DLFolders WHERE fileEntryTypeId = ?";
4422 private static final String _SQL_CONTAINSDLFOLDER = "SELECT COUNT(*) AS COUNT_VALUE FROM DLFileEntryTypes_DLFolders WHERE fileEntryTypeId = ? AND folderId = ?";
4423 private static final String _SQL_GETDDMSTRUCTURES = "SELECT {DDMStructure.*} FROM DDMStructure INNER JOIN DLFileEntryTypes_DDMStructures ON (DLFileEntryTypes_DDMStructures.structureId = DDMStructure.structureId) WHERE (DLFileEntryTypes_DDMStructures.fileEntryTypeId = ?)";
4424 private static final String _SQL_GETDDMSTRUCTURESSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM DLFileEntryTypes_DDMStructures WHERE fileEntryTypeId = ?";
4425 private static final String _SQL_CONTAINSDDMSTRUCTURE = "SELECT COUNT(*) AS COUNT_VALUE FROM DLFileEntryTypes_DDMStructures WHERE fileEntryTypeId = ? AND structureId = ?";
4426 private static final String _FINDER_COLUMN_UUID_UUID_1 = "dlFileEntryType.uuid IS NULL";
4427 private static final String _FINDER_COLUMN_UUID_UUID_2 = "dlFileEntryType.uuid = ?";
4428 private static final String _FINDER_COLUMN_UUID_UUID_3 = "(dlFileEntryType.uuid IS NULL OR dlFileEntryType.uuid = ?)";
4429 private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "dlFileEntryType.uuid IS NULL AND ";
4430 private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "dlFileEntryType.uuid = ? AND ";
4431 private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(dlFileEntryType.uuid IS NULL OR dlFileEntryType.uuid = ?) AND ";
4432 private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "dlFileEntryType.groupId = ?";
4433 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "dlFileEntryType.groupId = ?";
4434 private static final String _FINDER_COLUMN_GROUPID_GROUPID_5 = "(" +
4435 _removeConjunction(_FINDER_COLUMN_GROUPID_GROUPID_2) + ")";
4436 private static final String _FINDER_COLUMN_G_N_GROUPID_2 = "dlFileEntryType.groupId = ? AND ";
4437 private static final String _FINDER_COLUMN_G_N_NAME_1 = "dlFileEntryType.name IS NULL";
4438 private static final String _FINDER_COLUMN_G_N_NAME_2 = "dlFileEntryType.name = ?";
4439 private static final String _FINDER_COLUMN_G_N_NAME_3 = "(dlFileEntryType.name IS NULL OR dlFileEntryType.name = ?)";
4440
4441 private static String _removeConjunction(String sql) {
4442 int pos = sql.indexOf(" AND ");
4443
4444 if (pos != -1) {
4445 sql = sql.substring(0, pos);
4446 }
4447
4448 return sql;
4449 }
4450
4451 private static final String _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN = "dlFileEntryType.fileEntryTypeId";
4452 private static final String _FILTER_SQL_SELECT_DLFILEENTRYTYPE_WHERE = "SELECT DISTINCT {dlFileEntryType.*} FROM DLFileEntryType dlFileEntryType WHERE ";
4453 private static final String _FILTER_SQL_SELECT_DLFILEENTRYTYPE_NO_INLINE_DISTINCT_WHERE_1 =
4454 "SELECT {DLFileEntryType.*} FROM (SELECT DISTINCT dlFileEntryType.fileEntryTypeId FROM DLFileEntryType dlFileEntryType WHERE ";
4455 private static final String _FILTER_SQL_SELECT_DLFILEENTRYTYPE_NO_INLINE_DISTINCT_WHERE_2 =
4456 ") TEMP_TABLE INNER JOIN DLFileEntryType ON TEMP_TABLE.fileEntryTypeId = DLFileEntryType.fileEntryTypeId";
4457 private static final String _FILTER_SQL_COUNT_DLFILEENTRYTYPE_WHERE = "SELECT COUNT(DISTINCT dlFileEntryType.fileEntryTypeId) AS COUNT_VALUE FROM DLFileEntryType dlFileEntryType WHERE ";
4458 private static final String _FILTER_ENTITY_ALIAS = "dlFileEntryType";
4459 private static final String _FILTER_ENTITY_TABLE = "DLFileEntryType";
4460 private static final String _ORDER_BY_ENTITY_ALIAS = "dlFileEntryType.";
4461 private static final String _ORDER_BY_ENTITY_TABLE = "DLFileEntryType.";
4462 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No DLFileEntryType exists with the primary key ";
4463 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No DLFileEntryType exists with the key {";
4464 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
4465 private static Log _log = LogFactoryUtil.getLog(DLFileEntryTypePersistenceImpl.class);
4466 private static DLFileEntryType _nullDLFileEntryType = new DLFileEntryTypeImpl() {
4467 @Override
4468 public Object clone() {
4469 return this;
4470 }
4471
4472 @Override
4473 public CacheModel<DLFileEntryType> toCacheModel() {
4474 return _nullDLFileEntryTypeCacheModel;
4475 }
4476 };
4477
4478 private static CacheModel<DLFileEntryType> _nullDLFileEntryTypeCacheModel = new CacheModel<DLFileEntryType>() {
4479 public DLFileEntryType toEntityModel() {
4480 return _nullDLFileEntryType;
4481 }
4482 };
4483 }