1
14
15 package com.liferay.portlet.imagegallery.service.persistence;
16
17 import com.liferay.portal.NoSuchModelException;
18 import com.liferay.portal.kernel.annotation.BeanReference;
19 import com.liferay.portal.kernel.cache.CacheRegistry;
20 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
21 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
22 import com.liferay.portal.kernel.dao.orm.FinderPath;
23 import com.liferay.portal.kernel.dao.orm.Query;
24 import com.liferay.portal.kernel.dao.orm.QueryPos;
25 import com.liferay.portal.kernel.dao.orm.QueryUtil;
26 import com.liferay.portal.kernel.dao.orm.Session;
27 import com.liferay.portal.kernel.exception.SystemException;
28 import com.liferay.portal.kernel.log.Log;
29 import com.liferay.portal.kernel.log.LogFactoryUtil;
30 import com.liferay.portal.kernel.util.GetterUtil;
31 import com.liferay.portal.kernel.util.OrderByComparator;
32 import com.liferay.portal.kernel.util.StringBundler;
33 import com.liferay.portal.kernel.util.StringPool;
34 import com.liferay.portal.kernel.util.StringUtil;
35 import com.liferay.portal.kernel.util.Validator;
36 import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
37 import com.liferay.portal.model.ModelListener;
38 import com.liferay.portal.service.persistence.BatchSessionUtil;
39 import com.liferay.portal.service.persistence.GroupPersistence;
40 import com.liferay.portal.service.persistence.ImagePersistence;
41 import com.liferay.portal.service.persistence.LayoutPersistence;
42 import com.liferay.portal.service.persistence.ResourcePersistence;
43 import com.liferay.portal.service.persistence.UserPersistence;
44 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
45
46 import com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence;
47 import com.liferay.portlet.imagegallery.NoSuchFolderException;
48 import com.liferay.portlet.imagegallery.model.IGFolder;
49 import com.liferay.portlet.imagegallery.model.impl.IGFolderImpl;
50 import com.liferay.portlet.imagegallery.model.impl.IGFolderModelImpl;
51
52 import java.io.Serializable;
53
54 import java.util.ArrayList;
55 import java.util.Collections;
56 import java.util.List;
57
58
71 public class IGFolderPersistenceImpl extends BasePersistenceImpl<IGFolder>
72 implements IGFolderPersistence {
73 public static final String FINDER_CLASS_NAME_ENTITY = IGFolderImpl.class.getName();
74 public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
75 ".List";
76 public static final FinderPath FINDER_PATH_FIND_BY_UUID = new FinderPath(IGFolderModelImpl.ENTITY_CACHE_ENABLED,
77 IGFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
78 "findByUuid", new String[] { String.class.getName() });
79 public static final FinderPath FINDER_PATH_FIND_BY_OBC_UUID = new FinderPath(IGFolderModelImpl.ENTITY_CACHE_ENABLED,
80 IGFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
81 "findByUuid",
82 new String[] {
83 String.class.getName(),
84
85 "java.lang.Integer", "java.lang.Integer",
86 "com.liferay.portal.kernel.util.OrderByComparator"
87 });
88 public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(IGFolderModelImpl.ENTITY_CACHE_ENABLED,
89 IGFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
90 "countByUuid", new String[] { String.class.getName() });
91 public static final FinderPath FINDER_PATH_FETCH_BY_UUID_G = new FinderPath(IGFolderModelImpl.ENTITY_CACHE_ENABLED,
92 IGFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
93 "fetchByUUID_G",
94 new String[] { String.class.getName(), Long.class.getName() });
95 public static final FinderPath FINDER_PATH_COUNT_BY_UUID_G = new FinderPath(IGFolderModelImpl.ENTITY_CACHE_ENABLED,
96 IGFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
97 "countByUUID_G",
98 new String[] { String.class.getName(), Long.class.getName() });
99 public static final FinderPath FINDER_PATH_FIND_BY_GROUPID = new FinderPath(IGFolderModelImpl.ENTITY_CACHE_ENABLED,
100 IGFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
101 "findByGroupId", new String[] { Long.class.getName() });
102 public static final FinderPath FINDER_PATH_FIND_BY_OBC_GROUPID = new FinderPath(IGFolderModelImpl.ENTITY_CACHE_ENABLED,
103 IGFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
104 "findByGroupId",
105 new String[] {
106 Long.class.getName(),
107
108 "java.lang.Integer", "java.lang.Integer",
109 "com.liferay.portal.kernel.util.OrderByComparator"
110 });
111 public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(IGFolderModelImpl.ENTITY_CACHE_ENABLED,
112 IGFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
113 "countByGroupId", new String[] { Long.class.getName() });
114 public static final FinderPath FINDER_PATH_FIND_BY_COMPANYID = new FinderPath(IGFolderModelImpl.ENTITY_CACHE_ENABLED,
115 IGFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
116 "findByCompanyId", new String[] { Long.class.getName() });
117 public static final FinderPath FINDER_PATH_FIND_BY_OBC_COMPANYID = new FinderPath(IGFolderModelImpl.ENTITY_CACHE_ENABLED,
118 IGFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
119 "findByCompanyId",
120 new String[] {
121 Long.class.getName(),
122
123 "java.lang.Integer", "java.lang.Integer",
124 "com.liferay.portal.kernel.util.OrderByComparator"
125 });
126 public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(IGFolderModelImpl.ENTITY_CACHE_ENABLED,
127 IGFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
128 "countByCompanyId", new String[] { Long.class.getName() });
129 public static final FinderPath FINDER_PATH_FIND_BY_G_P = new FinderPath(IGFolderModelImpl.ENTITY_CACHE_ENABLED,
130 IGFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
131 "findByG_P",
132 new String[] { Long.class.getName(), Long.class.getName() });
133 public static final FinderPath FINDER_PATH_FIND_BY_OBC_G_P = new FinderPath(IGFolderModelImpl.ENTITY_CACHE_ENABLED,
134 IGFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
135 "findByG_P",
136 new String[] {
137 Long.class.getName(), Long.class.getName(),
138
139 "java.lang.Integer", "java.lang.Integer",
140 "com.liferay.portal.kernel.util.OrderByComparator"
141 });
142 public static final FinderPath FINDER_PATH_COUNT_BY_G_P = new FinderPath(IGFolderModelImpl.ENTITY_CACHE_ENABLED,
143 IGFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
144 "countByG_P",
145 new String[] { Long.class.getName(), Long.class.getName() });
146 public static final FinderPath FINDER_PATH_FETCH_BY_G_P_N = new FinderPath(IGFolderModelImpl.ENTITY_CACHE_ENABLED,
147 IGFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
148 "fetchByG_P_N",
149 new String[] {
150 Long.class.getName(), Long.class.getName(),
151 String.class.getName()
152 });
153 public static final FinderPath FINDER_PATH_COUNT_BY_G_P_N = new FinderPath(IGFolderModelImpl.ENTITY_CACHE_ENABLED,
154 IGFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
155 "countByG_P_N",
156 new String[] {
157 Long.class.getName(), Long.class.getName(),
158 String.class.getName()
159 });
160 public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(IGFolderModelImpl.ENTITY_CACHE_ENABLED,
161 IGFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
162 "findAll", new String[0]);
163 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(IGFolderModelImpl.ENTITY_CACHE_ENABLED,
164 IGFolderModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
165 "countAll", new String[0]);
166
167 public void cacheResult(IGFolder igFolder) {
168 EntityCacheUtil.putResult(IGFolderModelImpl.ENTITY_CACHE_ENABLED,
169 IGFolderImpl.class, igFolder.getPrimaryKey(), igFolder);
170
171 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
172 new Object[] { igFolder.getUuid(), new Long(igFolder.getGroupId()) },
173 igFolder);
174
175 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_P_N,
176 new Object[] {
177 new Long(igFolder.getGroupId()),
178 new Long(igFolder.getParentFolderId()),
179
180 igFolder.getName()
181 }, igFolder);
182 }
183
184 public void cacheResult(List<IGFolder> igFolders) {
185 for (IGFolder igFolder : igFolders) {
186 if (EntityCacheUtil.getResult(
187 IGFolderModelImpl.ENTITY_CACHE_ENABLED,
188 IGFolderImpl.class, igFolder.getPrimaryKey(), this) == null) {
189 cacheResult(igFolder);
190 }
191 }
192 }
193
194 public void clearCache() {
195 CacheRegistry.clear(IGFolderImpl.class.getName());
196 EntityCacheUtil.clearCache(IGFolderImpl.class.getName());
197 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
198 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
199 }
200
201 public IGFolder create(long folderId) {
202 IGFolder igFolder = new IGFolderImpl();
203
204 igFolder.setNew(true);
205 igFolder.setPrimaryKey(folderId);
206
207 String uuid = PortalUUIDUtil.generate();
208
209 igFolder.setUuid(uuid);
210
211 return igFolder;
212 }
213
214 public IGFolder remove(Serializable primaryKey)
215 throws NoSuchModelException, SystemException {
216 return remove(((Long)primaryKey).longValue());
217 }
218
219 public IGFolder remove(long folderId)
220 throws NoSuchFolderException, SystemException {
221 Session session = null;
222
223 try {
224 session = openSession();
225
226 IGFolder igFolder = (IGFolder)session.get(IGFolderImpl.class,
227 new Long(folderId));
228
229 if (igFolder == null) {
230 if (_log.isWarnEnabled()) {
231 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + folderId);
232 }
233
234 throw new NoSuchFolderException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
235 folderId);
236 }
237
238 return remove(igFolder);
239 }
240 catch (NoSuchFolderException nsee) {
241 throw nsee;
242 }
243 catch (Exception e) {
244 throw processException(e);
245 }
246 finally {
247 closeSession(session);
248 }
249 }
250
251 public IGFolder remove(IGFolder igFolder) throws SystemException {
252 for (ModelListener<IGFolder> listener : listeners) {
253 listener.onBeforeRemove(igFolder);
254 }
255
256 igFolder = removeImpl(igFolder);
257
258 for (ModelListener<IGFolder> listener : listeners) {
259 listener.onAfterRemove(igFolder);
260 }
261
262 return igFolder;
263 }
264
265 protected IGFolder removeImpl(IGFolder igFolder) throws SystemException {
266 igFolder = toUnwrappedModel(igFolder);
267
268 Session session = null;
269
270 try {
271 session = openSession();
272
273 if (igFolder.isCachedModel() || BatchSessionUtil.isEnabled()) {
274 Object staleObject = session.get(IGFolderImpl.class,
275 igFolder.getPrimaryKeyObj());
276
277 if (staleObject != null) {
278 session.evict(staleObject);
279 }
280 }
281
282 session.delete(igFolder);
283
284 session.flush();
285 }
286 catch (Exception e) {
287 throw processException(e);
288 }
289 finally {
290 closeSession(session);
291 }
292
293 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
294
295 IGFolderModelImpl igFolderModelImpl = (IGFolderModelImpl)igFolder;
296
297 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
298 new Object[] {
299 igFolderModelImpl.getOriginalUuid(),
300 new Long(igFolderModelImpl.getOriginalGroupId())
301 });
302
303 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_P_N,
304 new Object[] {
305 new Long(igFolderModelImpl.getOriginalGroupId()),
306 new Long(igFolderModelImpl.getOriginalParentFolderId()),
307
308 igFolderModelImpl.getOriginalName()
309 });
310
311 EntityCacheUtil.removeResult(IGFolderModelImpl.ENTITY_CACHE_ENABLED,
312 IGFolderImpl.class, igFolder.getPrimaryKey());
313
314 return igFolder;
315 }
316
317 public IGFolder updateImpl(
318 com.liferay.portlet.imagegallery.model.IGFolder igFolder, boolean merge)
319 throws SystemException {
320 igFolder = toUnwrappedModel(igFolder);
321
322 boolean isNew = igFolder.isNew();
323
324 IGFolderModelImpl igFolderModelImpl = (IGFolderModelImpl)igFolder;
325
326 if (Validator.isNull(igFolder.getUuid())) {
327 String uuid = PortalUUIDUtil.generate();
328
329 igFolder.setUuid(uuid);
330 }
331
332 Session session = null;
333
334 try {
335 session = openSession();
336
337 BatchSessionUtil.update(session, igFolder, merge);
338
339 igFolder.setNew(false);
340 }
341 catch (Exception e) {
342 throw processException(e);
343 }
344 finally {
345 closeSession(session);
346 }
347
348 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
349
350 EntityCacheUtil.putResult(IGFolderModelImpl.ENTITY_CACHE_ENABLED,
351 IGFolderImpl.class, igFolder.getPrimaryKey(), igFolder);
352
353 if (!isNew &&
354 (!Validator.equals(igFolder.getUuid(),
355 igFolderModelImpl.getOriginalUuid()) ||
356 (igFolder.getGroupId() != igFolderModelImpl.getOriginalGroupId()))) {
357 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
358 new Object[] {
359 igFolderModelImpl.getOriginalUuid(),
360 new Long(igFolderModelImpl.getOriginalGroupId())
361 });
362 }
363
364 if (isNew ||
365 (!Validator.equals(igFolder.getUuid(),
366 igFolderModelImpl.getOriginalUuid()) ||
367 (igFolder.getGroupId() != igFolderModelImpl.getOriginalGroupId()))) {
368 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
369 new Object[] { igFolder.getUuid(), new Long(
370 igFolder.getGroupId()) }, igFolder);
371 }
372
373 if (!isNew &&
374 ((igFolder.getGroupId() != igFolderModelImpl.getOriginalGroupId()) ||
375 (igFolder.getParentFolderId() != igFolderModelImpl.getOriginalParentFolderId()) ||
376 !Validator.equals(igFolder.getName(),
377 igFolderModelImpl.getOriginalName()))) {
378 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_P_N,
379 new Object[] {
380 new Long(igFolderModelImpl.getOriginalGroupId()),
381 new Long(igFolderModelImpl.getOriginalParentFolderId()),
382
383 igFolderModelImpl.getOriginalName()
384 });
385 }
386
387 if (isNew ||
388 ((igFolder.getGroupId() != igFolderModelImpl.getOriginalGroupId()) ||
389 (igFolder.getParentFolderId() != igFolderModelImpl.getOriginalParentFolderId()) ||
390 !Validator.equals(igFolder.getName(),
391 igFolderModelImpl.getOriginalName()))) {
392 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_P_N,
393 new Object[] {
394 new Long(igFolder.getGroupId()),
395 new Long(igFolder.getParentFolderId()),
396
397 igFolder.getName()
398 }, igFolder);
399 }
400
401 return igFolder;
402 }
403
404 protected IGFolder toUnwrappedModel(IGFolder igFolder) {
405 if (igFolder instanceof IGFolderImpl) {
406 return igFolder;
407 }
408
409 IGFolderImpl igFolderImpl = new IGFolderImpl();
410
411 igFolderImpl.setNew(igFolder.isNew());
412 igFolderImpl.setPrimaryKey(igFolder.getPrimaryKey());
413
414 igFolderImpl.setUuid(igFolder.getUuid());
415 igFolderImpl.setFolderId(igFolder.getFolderId());
416 igFolderImpl.setGroupId(igFolder.getGroupId());
417 igFolderImpl.setCompanyId(igFolder.getCompanyId());
418 igFolderImpl.setUserId(igFolder.getUserId());
419 igFolderImpl.setCreateDate(igFolder.getCreateDate());
420 igFolderImpl.setModifiedDate(igFolder.getModifiedDate());
421 igFolderImpl.setParentFolderId(igFolder.getParentFolderId());
422 igFolderImpl.setName(igFolder.getName());
423 igFolderImpl.setDescription(igFolder.getDescription());
424
425 return igFolderImpl;
426 }
427
428 public IGFolder findByPrimaryKey(Serializable primaryKey)
429 throws NoSuchModelException, SystemException {
430 return findByPrimaryKey(((Long)primaryKey).longValue());
431 }
432
433 public IGFolder findByPrimaryKey(long folderId)
434 throws NoSuchFolderException, SystemException {
435 IGFolder igFolder = fetchByPrimaryKey(folderId);
436
437 if (igFolder == null) {
438 if (_log.isWarnEnabled()) {
439 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + folderId);
440 }
441
442 throw new NoSuchFolderException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
443 folderId);
444 }
445
446 return igFolder;
447 }
448
449 public IGFolder fetchByPrimaryKey(Serializable primaryKey)
450 throws SystemException {
451 return fetchByPrimaryKey(((Long)primaryKey).longValue());
452 }
453
454 public IGFolder fetchByPrimaryKey(long folderId) throws SystemException {
455 IGFolder igFolder = (IGFolder)EntityCacheUtil.getResult(IGFolderModelImpl.ENTITY_CACHE_ENABLED,
456 IGFolderImpl.class, folderId, this);
457
458 if (igFolder == null) {
459 Session session = null;
460
461 try {
462 session = openSession();
463
464 igFolder = (IGFolder)session.get(IGFolderImpl.class,
465 new Long(folderId));
466 }
467 catch (Exception e) {
468 throw processException(e);
469 }
470 finally {
471 if (igFolder != null) {
472 cacheResult(igFolder);
473 }
474
475 closeSession(session);
476 }
477 }
478
479 return igFolder;
480 }
481
482 public List<IGFolder> findByUuid(String uuid) throws SystemException {
483 Object[] finderArgs = new Object[] { uuid };
484
485 List<IGFolder> list = (List<IGFolder>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_UUID,
486 finderArgs, this);
487
488 if (list == null) {
489 Session session = null;
490
491 try {
492 session = openSession();
493
494 StringBundler query = new StringBundler(3);
495
496 query.append(_SQL_SELECT_IGFOLDER_WHERE);
497
498 if (uuid == null) {
499 query.append(_FINDER_COLUMN_UUID_UUID_1);
500 }
501 else {
502 if (uuid.equals(StringPool.BLANK)) {
503 query.append(_FINDER_COLUMN_UUID_UUID_3);
504 }
505 else {
506 query.append(_FINDER_COLUMN_UUID_UUID_2);
507 }
508 }
509
510 query.append(IGFolderModelImpl.ORDER_BY_JPQL);
511
512 String sql = query.toString();
513
514 Query q = session.createQuery(sql);
515
516 QueryPos qPos = QueryPos.getInstance(q);
517
518 if (uuid != null) {
519 qPos.add(uuid);
520 }
521
522 list = q.list();
523 }
524 catch (Exception e) {
525 throw processException(e);
526 }
527 finally {
528 if (list == null) {
529 list = new ArrayList<IGFolder>();
530 }
531
532 cacheResult(list);
533
534 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_UUID, finderArgs,
535 list);
536
537 closeSession(session);
538 }
539 }
540
541 return list;
542 }
543
544 public List<IGFolder> findByUuid(String uuid, int start, int end)
545 throws SystemException {
546 return findByUuid(uuid, start, end, null);
547 }
548
549 public List<IGFolder> findByUuid(String uuid, int start, int end,
550 OrderByComparator orderByComparator) throws SystemException {
551 Object[] finderArgs = new Object[] {
552 uuid,
553
554 String.valueOf(start), String.valueOf(end),
555 String.valueOf(orderByComparator)
556 };
557
558 List<IGFolder> list = (List<IGFolder>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_UUID,
559 finderArgs, this);
560
561 if (list == null) {
562 Session session = null;
563
564 try {
565 session = openSession();
566
567 StringBundler query = null;
568
569 if (orderByComparator != null) {
570 query = new StringBundler(3 +
571 (orderByComparator.getOrderByFields().length * 3));
572 }
573 else {
574 query = new StringBundler(3);
575 }
576
577 query.append(_SQL_SELECT_IGFOLDER_WHERE);
578
579 if (uuid == null) {
580 query.append(_FINDER_COLUMN_UUID_UUID_1);
581 }
582 else {
583 if (uuid.equals(StringPool.BLANK)) {
584 query.append(_FINDER_COLUMN_UUID_UUID_3);
585 }
586 else {
587 query.append(_FINDER_COLUMN_UUID_UUID_2);
588 }
589 }
590
591 if (orderByComparator != null) {
592 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
593 orderByComparator);
594 }
595
596 else {
597 query.append(IGFolderModelImpl.ORDER_BY_JPQL);
598 }
599
600 String sql = query.toString();
601
602 Query q = session.createQuery(sql);
603
604 QueryPos qPos = QueryPos.getInstance(q);
605
606 if (uuid != null) {
607 qPos.add(uuid);
608 }
609
610 list = (List<IGFolder>)QueryUtil.list(q, getDialect(), start,
611 end);
612 }
613 catch (Exception e) {
614 throw processException(e);
615 }
616 finally {
617 if (list == null) {
618 list = new ArrayList<IGFolder>();
619 }
620
621 cacheResult(list);
622
623 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_UUID,
624 finderArgs, list);
625
626 closeSession(session);
627 }
628 }
629
630 return list;
631 }
632
633 public IGFolder findByUuid_First(String uuid,
634 OrderByComparator orderByComparator)
635 throws NoSuchFolderException, SystemException {
636 List<IGFolder> list = findByUuid(uuid, 0, 1, orderByComparator);
637
638 if (list.isEmpty()) {
639 StringBundler msg = new StringBundler(4);
640
641 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
642
643 msg.append("uuid=");
644 msg.append(uuid);
645
646 msg.append(StringPool.CLOSE_CURLY_BRACE);
647
648 throw new NoSuchFolderException(msg.toString());
649 }
650 else {
651 return list.get(0);
652 }
653 }
654
655 public IGFolder findByUuid_Last(String uuid,
656 OrderByComparator orderByComparator)
657 throws NoSuchFolderException, SystemException {
658 int count = countByUuid(uuid);
659
660 List<IGFolder> list = findByUuid(uuid, count - 1, count,
661 orderByComparator);
662
663 if (list.isEmpty()) {
664 StringBundler msg = new StringBundler(4);
665
666 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
667
668 msg.append("uuid=");
669 msg.append(uuid);
670
671 msg.append(StringPool.CLOSE_CURLY_BRACE);
672
673 throw new NoSuchFolderException(msg.toString());
674 }
675 else {
676 return list.get(0);
677 }
678 }
679
680 public IGFolder[] findByUuid_PrevAndNext(long folderId, String uuid,
681 OrderByComparator orderByComparator)
682 throws NoSuchFolderException, SystemException {
683 IGFolder igFolder = findByPrimaryKey(folderId);
684
685 int count = countByUuid(uuid);
686
687 Session session = null;
688
689 try {
690 session = openSession();
691
692 StringBundler query = null;
693
694 if (orderByComparator != null) {
695 query = new StringBundler(3 +
696 (orderByComparator.getOrderByFields().length * 3));
697 }
698 else {
699 query = new StringBundler(3);
700 }
701
702 query.append(_SQL_SELECT_IGFOLDER_WHERE);
703
704 if (uuid == null) {
705 query.append(_FINDER_COLUMN_UUID_UUID_1);
706 }
707 else {
708 if (uuid.equals(StringPool.BLANK)) {
709 query.append(_FINDER_COLUMN_UUID_UUID_3);
710 }
711 else {
712 query.append(_FINDER_COLUMN_UUID_UUID_2);
713 }
714 }
715
716 if (orderByComparator != null) {
717 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
718 orderByComparator);
719 }
720
721 else {
722 query.append(IGFolderModelImpl.ORDER_BY_JPQL);
723 }
724
725 String sql = query.toString();
726
727 Query q = session.createQuery(sql);
728
729 QueryPos qPos = QueryPos.getInstance(q);
730
731 if (uuid != null) {
732 qPos.add(uuid);
733 }
734
735 Object[] objArray = QueryUtil.getPrevAndNext(q, count,
736 orderByComparator, igFolder);
737
738 IGFolder[] array = new IGFolderImpl[3];
739
740 array[0] = (IGFolder)objArray[0];
741 array[1] = (IGFolder)objArray[1];
742 array[2] = (IGFolder)objArray[2];
743
744 return array;
745 }
746 catch (Exception e) {
747 throw processException(e);
748 }
749 finally {
750 closeSession(session);
751 }
752 }
753
754 public IGFolder findByUUID_G(String uuid, long groupId)
755 throws NoSuchFolderException, SystemException {
756 IGFolder igFolder = fetchByUUID_G(uuid, groupId);
757
758 if (igFolder == null) {
759 StringBundler msg = new StringBundler(6);
760
761 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
762
763 msg.append("uuid=");
764 msg.append(uuid);
765
766 msg.append(", groupId=");
767 msg.append(groupId);
768
769 msg.append(StringPool.CLOSE_CURLY_BRACE);
770
771 if (_log.isWarnEnabled()) {
772 _log.warn(msg.toString());
773 }
774
775 throw new NoSuchFolderException(msg.toString());
776 }
777
778 return igFolder;
779 }
780
781 public IGFolder fetchByUUID_G(String uuid, long groupId)
782 throws SystemException {
783 return fetchByUUID_G(uuid, groupId, true);
784 }
785
786 public IGFolder fetchByUUID_G(String uuid, long groupId,
787 boolean retrieveFromCache) throws SystemException {
788 Object[] finderArgs = new Object[] { uuid, new Long(groupId) };
789
790 Object result = null;
791
792 if (retrieveFromCache) {
793 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
794 finderArgs, this);
795 }
796
797 if (result == null) {
798 Session session = null;
799
800 try {
801 session = openSession();
802
803 StringBundler query = new StringBundler(4);
804
805 query.append(_SQL_SELECT_IGFOLDER_WHERE);
806
807 if (uuid == null) {
808 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
809 }
810 else {
811 if (uuid.equals(StringPool.BLANK)) {
812 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
813 }
814 else {
815 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
816 }
817 }
818
819 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
820
821 query.append(IGFolderModelImpl.ORDER_BY_JPQL);
822
823 String sql = query.toString();
824
825 Query q = session.createQuery(sql);
826
827 QueryPos qPos = QueryPos.getInstance(q);
828
829 if (uuid != null) {
830 qPos.add(uuid);
831 }
832
833 qPos.add(groupId);
834
835 List<IGFolder> list = q.list();
836
837 result = list;
838
839 IGFolder igFolder = null;
840
841 if (list.isEmpty()) {
842 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
843 finderArgs, list);
844 }
845 else {
846 igFolder = list.get(0);
847
848 cacheResult(igFolder);
849
850 if ((igFolder.getUuid() == null) ||
851 !igFolder.getUuid().equals(uuid) ||
852 (igFolder.getGroupId() != groupId)) {
853 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
854 finderArgs, igFolder);
855 }
856 }
857
858 return igFolder;
859 }
860 catch (Exception e) {
861 throw processException(e);
862 }
863 finally {
864 if (result == null) {
865 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
866 finderArgs, new ArrayList<IGFolder>());
867 }
868
869 closeSession(session);
870 }
871 }
872 else {
873 if (result instanceof List<?>) {
874 return null;
875 }
876 else {
877 return (IGFolder)result;
878 }
879 }
880 }
881
882 public List<IGFolder> findByGroupId(long groupId) throws SystemException {
883 Object[] finderArgs = new Object[] { new Long(groupId) };
884
885 List<IGFolder> list = (List<IGFolder>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
886 finderArgs, this);
887
888 if (list == null) {
889 Session session = null;
890
891 try {
892 session = openSession();
893
894 StringBundler query = new StringBundler(3);
895
896 query.append(_SQL_SELECT_IGFOLDER_WHERE);
897
898 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
899
900 query.append(IGFolderModelImpl.ORDER_BY_JPQL);
901
902 String sql = query.toString();
903
904 Query q = session.createQuery(sql);
905
906 QueryPos qPos = QueryPos.getInstance(q);
907
908 qPos.add(groupId);
909
910 list = q.list();
911 }
912 catch (Exception e) {
913 throw processException(e);
914 }
915 finally {
916 if (list == null) {
917 list = new ArrayList<IGFolder>();
918 }
919
920 cacheResult(list);
921
922 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
923 finderArgs, list);
924
925 closeSession(session);
926 }
927 }
928
929 return list;
930 }
931
932 public List<IGFolder> findByGroupId(long groupId, int start, int end)
933 throws SystemException {
934 return findByGroupId(groupId, start, end, null);
935 }
936
937 public List<IGFolder> findByGroupId(long groupId, int start, int end,
938 OrderByComparator orderByComparator) throws SystemException {
939 Object[] finderArgs = new Object[] {
940 new Long(groupId),
941
942 String.valueOf(start), String.valueOf(end),
943 String.valueOf(orderByComparator)
944 };
945
946 List<IGFolder> list = (List<IGFolder>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_GROUPID,
947 finderArgs, this);
948
949 if (list == null) {
950 Session session = null;
951
952 try {
953 session = openSession();
954
955 StringBundler query = null;
956
957 if (orderByComparator != null) {
958 query = new StringBundler(3 +
959 (orderByComparator.getOrderByFields().length * 3));
960 }
961 else {
962 query = new StringBundler(3);
963 }
964
965 query.append(_SQL_SELECT_IGFOLDER_WHERE);
966
967 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
968
969 if (orderByComparator != null) {
970 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
971 orderByComparator);
972 }
973
974 else {
975 query.append(IGFolderModelImpl.ORDER_BY_JPQL);
976 }
977
978 String sql = query.toString();
979
980 Query q = session.createQuery(sql);
981
982 QueryPos qPos = QueryPos.getInstance(q);
983
984 qPos.add(groupId);
985
986 list = (List<IGFolder>)QueryUtil.list(q, getDialect(), start,
987 end);
988 }
989 catch (Exception e) {
990 throw processException(e);
991 }
992 finally {
993 if (list == null) {
994 list = new ArrayList<IGFolder>();
995 }
996
997 cacheResult(list);
998
999 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_GROUPID,
1000 finderArgs, list);
1001
1002 closeSession(session);
1003 }
1004 }
1005
1006 return list;
1007 }
1008
1009 public IGFolder findByGroupId_First(long groupId,
1010 OrderByComparator orderByComparator)
1011 throws NoSuchFolderException, SystemException {
1012 List<IGFolder> list = findByGroupId(groupId, 0, 1, orderByComparator);
1013
1014 if (list.isEmpty()) {
1015 StringBundler msg = new StringBundler(4);
1016
1017 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1018
1019 msg.append("groupId=");
1020 msg.append(groupId);
1021
1022 msg.append(StringPool.CLOSE_CURLY_BRACE);
1023
1024 throw new NoSuchFolderException(msg.toString());
1025 }
1026 else {
1027 return list.get(0);
1028 }
1029 }
1030
1031 public IGFolder findByGroupId_Last(long groupId,
1032 OrderByComparator orderByComparator)
1033 throws NoSuchFolderException, SystemException {
1034 int count = countByGroupId(groupId);
1035
1036 List<IGFolder> list = findByGroupId(groupId, count - 1, count,
1037 orderByComparator);
1038
1039 if (list.isEmpty()) {
1040 StringBundler msg = new StringBundler(4);
1041
1042 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1043
1044 msg.append("groupId=");
1045 msg.append(groupId);
1046
1047 msg.append(StringPool.CLOSE_CURLY_BRACE);
1048
1049 throw new NoSuchFolderException(msg.toString());
1050 }
1051 else {
1052 return list.get(0);
1053 }
1054 }
1055
1056 public IGFolder[] findByGroupId_PrevAndNext(long folderId, long groupId,
1057 OrderByComparator orderByComparator)
1058 throws NoSuchFolderException, SystemException {
1059 IGFolder igFolder = findByPrimaryKey(folderId);
1060
1061 int count = countByGroupId(groupId);
1062
1063 Session session = null;
1064
1065 try {
1066 session = openSession();
1067
1068 StringBundler query = null;
1069
1070 if (orderByComparator != null) {
1071 query = new StringBundler(3 +
1072 (orderByComparator.getOrderByFields().length * 3));
1073 }
1074 else {
1075 query = new StringBundler(3);
1076 }
1077
1078 query.append(_SQL_SELECT_IGFOLDER_WHERE);
1079
1080 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1081
1082 if (orderByComparator != null) {
1083 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1084 orderByComparator);
1085 }
1086
1087 else {
1088 query.append(IGFolderModelImpl.ORDER_BY_JPQL);
1089 }
1090
1091 String sql = query.toString();
1092
1093 Query q = session.createQuery(sql);
1094
1095 QueryPos qPos = QueryPos.getInstance(q);
1096
1097 qPos.add(groupId);
1098
1099 Object[] objArray = QueryUtil.getPrevAndNext(q, count,
1100 orderByComparator, igFolder);
1101
1102 IGFolder[] array = new IGFolderImpl[3];
1103
1104 array[0] = (IGFolder)objArray[0];
1105 array[1] = (IGFolder)objArray[1];
1106 array[2] = (IGFolder)objArray[2];
1107
1108 return array;
1109 }
1110 catch (Exception e) {
1111 throw processException(e);
1112 }
1113 finally {
1114 closeSession(session);
1115 }
1116 }
1117
1118 public List<IGFolder> findByCompanyId(long companyId)
1119 throws SystemException {
1120 Object[] finderArgs = new Object[] { new Long(companyId) };
1121
1122 List<IGFolder> list = (List<IGFolder>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_COMPANYID,
1123 finderArgs, this);
1124
1125 if (list == null) {
1126 Session session = null;
1127
1128 try {
1129 session = openSession();
1130
1131 StringBundler query = new StringBundler(3);
1132
1133 query.append(_SQL_SELECT_IGFOLDER_WHERE);
1134
1135 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1136
1137 query.append(IGFolderModelImpl.ORDER_BY_JPQL);
1138
1139 String sql = query.toString();
1140
1141 Query q = session.createQuery(sql);
1142
1143 QueryPos qPos = QueryPos.getInstance(q);
1144
1145 qPos.add(companyId);
1146
1147 list = q.list();
1148 }
1149 catch (Exception e) {
1150 throw processException(e);
1151 }
1152 finally {
1153 if (list == null) {
1154 list = new ArrayList<IGFolder>();
1155 }
1156
1157 cacheResult(list);
1158
1159 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_COMPANYID,
1160 finderArgs, list);
1161
1162 closeSession(session);
1163 }
1164 }
1165
1166 return list;
1167 }
1168
1169 public List<IGFolder> findByCompanyId(long companyId, int start, int end)
1170 throws SystemException {
1171 return findByCompanyId(companyId, start, end, null);
1172 }
1173
1174 public List<IGFolder> findByCompanyId(long companyId, int start, int end,
1175 OrderByComparator orderByComparator) throws SystemException {
1176 Object[] finderArgs = new Object[] {
1177 new Long(companyId),
1178
1179 String.valueOf(start), String.valueOf(end),
1180 String.valueOf(orderByComparator)
1181 };
1182
1183 List<IGFolder> list = (List<IGFolder>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_COMPANYID,
1184 finderArgs, this);
1185
1186 if (list == null) {
1187 Session session = null;
1188
1189 try {
1190 session = openSession();
1191
1192 StringBundler query = null;
1193
1194 if (orderByComparator != null) {
1195 query = new StringBundler(3 +
1196 (orderByComparator.getOrderByFields().length * 3));
1197 }
1198 else {
1199 query = new StringBundler(3);
1200 }
1201
1202 query.append(_SQL_SELECT_IGFOLDER_WHERE);
1203
1204 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1205
1206 if (orderByComparator != null) {
1207 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1208 orderByComparator);
1209 }
1210
1211 else {
1212 query.append(IGFolderModelImpl.ORDER_BY_JPQL);
1213 }
1214
1215 String sql = query.toString();
1216
1217 Query q = session.createQuery(sql);
1218
1219 QueryPos qPos = QueryPos.getInstance(q);
1220
1221 qPos.add(companyId);
1222
1223 list = (List<IGFolder>)QueryUtil.list(q, getDialect(), start,
1224 end);
1225 }
1226 catch (Exception e) {
1227 throw processException(e);
1228 }
1229 finally {
1230 if (list == null) {
1231 list = new ArrayList<IGFolder>();
1232 }
1233
1234 cacheResult(list);
1235
1236 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_COMPANYID,
1237 finderArgs, list);
1238
1239 closeSession(session);
1240 }
1241 }
1242
1243 return list;
1244 }
1245
1246 public IGFolder findByCompanyId_First(long companyId,
1247 OrderByComparator orderByComparator)
1248 throws NoSuchFolderException, SystemException {
1249 List<IGFolder> list = findByCompanyId(companyId, 0, 1, orderByComparator);
1250
1251 if (list.isEmpty()) {
1252 StringBundler msg = new StringBundler(4);
1253
1254 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1255
1256 msg.append("companyId=");
1257 msg.append(companyId);
1258
1259 msg.append(StringPool.CLOSE_CURLY_BRACE);
1260
1261 throw new NoSuchFolderException(msg.toString());
1262 }
1263 else {
1264 return list.get(0);
1265 }
1266 }
1267
1268 public IGFolder findByCompanyId_Last(long companyId,
1269 OrderByComparator orderByComparator)
1270 throws NoSuchFolderException, SystemException {
1271 int count = countByCompanyId(companyId);
1272
1273 List<IGFolder> list = findByCompanyId(companyId, count - 1, count,
1274 orderByComparator);
1275
1276 if (list.isEmpty()) {
1277 StringBundler msg = new StringBundler(4);
1278
1279 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1280
1281 msg.append("companyId=");
1282 msg.append(companyId);
1283
1284 msg.append(StringPool.CLOSE_CURLY_BRACE);
1285
1286 throw new NoSuchFolderException(msg.toString());
1287 }
1288 else {
1289 return list.get(0);
1290 }
1291 }
1292
1293 public IGFolder[] findByCompanyId_PrevAndNext(long folderId,
1294 long companyId, OrderByComparator orderByComparator)
1295 throws NoSuchFolderException, SystemException {
1296 IGFolder igFolder = findByPrimaryKey(folderId);
1297
1298 int count = countByCompanyId(companyId);
1299
1300 Session session = null;
1301
1302 try {
1303 session = openSession();
1304
1305 StringBundler query = null;
1306
1307 if (orderByComparator != null) {
1308 query = new StringBundler(3 +
1309 (orderByComparator.getOrderByFields().length * 3));
1310 }
1311 else {
1312 query = new StringBundler(3);
1313 }
1314
1315 query.append(_SQL_SELECT_IGFOLDER_WHERE);
1316
1317 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1318
1319 if (orderByComparator != null) {
1320 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1321 orderByComparator);
1322 }
1323
1324 else {
1325 query.append(IGFolderModelImpl.ORDER_BY_JPQL);
1326 }
1327
1328 String sql = query.toString();
1329
1330 Query q = session.createQuery(sql);
1331
1332 QueryPos qPos = QueryPos.getInstance(q);
1333
1334 qPos.add(companyId);
1335
1336 Object[] objArray = QueryUtil.getPrevAndNext(q, count,
1337 orderByComparator, igFolder);
1338
1339 IGFolder[] array = new IGFolderImpl[3];
1340
1341 array[0] = (IGFolder)objArray[0];
1342 array[1] = (IGFolder)objArray[1];
1343 array[2] = (IGFolder)objArray[2];
1344
1345 return array;
1346 }
1347 catch (Exception e) {
1348 throw processException(e);
1349 }
1350 finally {
1351 closeSession(session);
1352 }
1353 }
1354
1355 public List<IGFolder> findByG_P(long groupId, long parentFolderId)
1356 throws SystemException {
1357 Object[] finderArgs = new Object[] {
1358 new Long(groupId), new Long(parentFolderId)
1359 };
1360
1361 List<IGFolder> list = (List<IGFolder>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_P,
1362 finderArgs, this);
1363
1364 if (list == null) {
1365 Session session = null;
1366
1367 try {
1368 session = openSession();
1369
1370 StringBundler query = new StringBundler(4);
1371
1372 query.append(_SQL_SELECT_IGFOLDER_WHERE);
1373
1374 query.append(_FINDER_COLUMN_G_P_GROUPID_2);
1375
1376 query.append(_FINDER_COLUMN_G_P_PARENTFOLDERID_2);
1377
1378 query.append(IGFolderModelImpl.ORDER_BY_JPQL);
1379
1380 String sql = query.toString();
1381
1382 Query q = session.createQuery(sql);
1383
1384 QueryPos qPos = QueryPos.getInstance(q);
1385
1386 qPos.add(groupId);
1387
1388 qPos.add(parentFolderId);
1389
1390 list = q.list();
1391 }
1392 catch (Exception e) {
1393 throw processException(e);
1394 }
1395 finally {
1396 if (list == null) {
1397 list = new ArrayList<IGFolder>();
1398 }
1399
1400 cacheResult(list);
1401
1402 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_P, finderArgs,
1403 list);
1404
1405 closeSession(session);
1406 }
1407 }
1408
1409 return list;
1410 }
1411
1412 public List<IGFolder> findByG_P(long groupId, long parentFolderId,
1413 int start, int end) throws SystemException {
1414 return findByG_P(groupId, parentFolderId, start, end, null);
1415 }
1416
1417 public List<IGFolder> findByG_P(long groupId, long parentFolderId,
1418 int start, int end, OrderByComparator orderByComparator)
1419 throws SystemException {
1420 Object[] finderArgs = new Object[] {
1421 new Long(groupId), new Long(parentFolderId),
1422
1423 String.valueOf(start), String.valueOf(end),
1424 String.valueOf(orderByComparator)
1425 };
1426
1427 List<IGFolder> list = (List<IGFolder>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_G_P,
1428 finderArgs, this);
1429
1430 if (list == null) {
1431 Session session = null;
1432
1433 try {
1434 session = openSession();
1435
1436 StringBundler query = null;
1437
1438 if (orderByComparator != null) {
1439 query = new StringBundler(4 +
1440 (orderByComparator.getOrderByFields().length * 3));
1441 }
1442 else {
1443 query = new StringBundler(4);
1444 }
1445
1446 query.append(_SQL_SELECT_IGFOLDER_WHERE);
1447
1448 query.append(_FINDER_COLUMN_G_P_GROUPID_2);
1449
1450 query.append(_FINDER_COLUMN_G_P_PARENTFOLDERID_2);
1451
1452 if (orderByComparator != null) {
1453 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1454 orderByComparator);
1455 }
1456
1457 else {
1458 query.append(IGFolderModelImpl.ORDER_BY_JPQL);
1459 }
1460
1461 String sql = query.toString();
1462
1463 Query q = session.createQuery(sql);
1464
1465 QueryPos qPos = QueryPos.getInstance(q);
1466
1467 qPos.add(groupId);
1468
1469 qPos.add(parentFolderId);
1470
1471 list = (List<IGFolder>)QueryUtil.list(q, getDialect(), start,
1472 end);
1473 }
1474 catch (Exception e) {
1475 throw processException(e);
1476 }
1477 finally {
1478 if (list == null) {
1479 list = new ArrayList<IGFolder>();
1480 }
1481
1482 cacheResult(list);
1483
1484 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_G_P,
1485 finderArgs, list);
1486
1487 closeSession(session);
1488 }
1489 }
1490
1491 return list;
1492 }
1493
1494 public IGFolder findByG_P_First(long groupId, long parentFolderId,
1495 OrderByComparator orderByComparator)
1496 throws NoSuchFolderException, SystemException {
1497 List<IGFolder> list = findByG_P(groupId, parentFolderId, 0, 1,
1498 orderByComparator);
1499
1500 if (list.isEmpty()) {
1501 StringBundler msg = new StringBundler(6);
1502
1503 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1504
1505 msg.append("groupId=");
1506 msg.append(groupId);
1507
1508 msg.append(", parentFolderId=");
1509 msg.append(parentFolderId);
1510
1511 msg.append(StringPool.CLOSE_CURLY_BRACE);
1512
1513 throw new NoSuchFolderException(msg.toString());
1514 }
1515 else {
1516 return list.get(0);
1517 }
1518 }
1519
1520 public IGFolder findByG_P_Last(long groupId, long parentFolderId,
1521 OrderByComparator orderByComparator)
1522 throws NoSuchFolderException, SystemException {
1523 int count = countByG_P(groupId, parentFolderId);
1524
1525 List<IGFolder> list = findByG_P(groupId, parentFolderId, count - 1,
1526 count, orderByComparator);
1527
1528 if (list.isEmpty()) {
1529 StringBundler msg = new StringBundler(6);
1530
1531 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1532
1533 msg.append("groupId=");
1534 msg.append(groupId);
1535
1536 msg.append(", parentFolderId=");
1537 msg.append(parentFolderId);
1538
1539 msg.append(StringPool.CLOSE_CURLY_BRACE);
1540
1541 throw new NoSuchFolderException(msg.toString());
1542 }
1543 else {
1544 return list.get(0);
1545 }
1546 }
1547
1548 public IGFolder[] findByG_P_PrevAndNext(long folderId, long groupId,
1549 long parentFolderId, OrderByComparator orderByComparator)
1550 throws NoSuchFolderException, SystemException {
1551 IGFolder igFolder = findByPrimaryKey(folderId);
1552
1553 int count = countByG_P(groupId, parentFolderId);
1554
1555 Session session = null;
1556
1557 try {
1558 session = openSession();
1559
1560 StringBundler query = null;
1561
1562 if (orderByComparator != null) {
1563 query = new StringBundler(4 +
1564 (orderByComparator.getOrderByFields().length * 3));
1565 }
1566 else {
1567 query = new StringBundler(4);
1568 }
1569
1570 query.append(_SQL_SELECT_IGFOLDER_WHERE);
1571
1572 query.append(_FINDER_COLUMN_G_P_GROUPID_2);
1573
1574 query.append(_FINDER_COLUMN_G_P_PARENTFOLDERID_2);
1575
1576 if (orderByComparator != null) {
1577 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1578 orderByComparator);
1579 }
1580
1581 else {
1582 query.append(IGFolderModelImpl.ORDER_BY_JPQL);
1583 }
1584
1585 String sql = query.toString();
1586
1587 Query q = session.createQuery(sql);
1588
1589 QueryPos qPos = QueryPos.getInstance(q);
1590
1591 qPos.add(groupId);
1592
1593 qPos.add(parentFolderId);
1594
1595 Object[] objArray = QueryUtil.getPrevAndNext(q, count,
1596 orderByComparator, igFolder);
1597
1598 IGFolder[] array = new IGFolderImpl[3];
1599
1600 array[0] = (IGFolder)objArray[0];
1601 array[1] = (IGFolder)objArray[1];
1602 array[2] = (IGFolder)objArray[2];
1603
1604 return array;
1605 }
1606 catch (Exception e) {
1607 throw processException(e);
1608 }
1609 finally {
1610 closeSession(session);
1611 }
1612 }
1613
1614 public IGFolder findByG_P_N(long groupId, long parentFolderId, String name)
1615 throws NoSuchFolderException, SystemException {
1616 IGFolder igFolder = fetchByG_P_N(groupId, parentFolderId, name);
1617
1618 if (igFolder == null) {
1619 StringBundler msg = new StringBundler(8);
1620
1621 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1622
1623 msg.append("groupId=");
1624 msg.append(groupId);
1625
1626 msg.append(", parentFolderId=");
1627 msg.append(parentFolderId);
1628
1629 msg.append(", name=");
1630 msg.append(name);
1631
1632 msg.append(StringPool.CLOSE_CURLY_BRACE);
1633
1634 if (_log.isWarnEnabled()) {
1635 _log.warn(msg.toString());
1636 }
1637
1638 throw new NoSuchFolderException(msg.toString());
1639 }
1640
1641 return igFolder;
1642 }
1643
1644 public IGFolder fetchByG_P_N(long groupId, long parentFolderId, String name)
1645 throws SystemException {
1646 return fetchByG_P_N(groupId, parentFolderId, name, true);
1647 }
1648
1649 public IGFolder fetchByG_P_N(long groupId, long parentFolderId,
1650 String name, boolean retrieveFromCache) throws SystemException {
1651 Object[] finderArgs = new Object[] {
1652 new Long(groupId), new Long(parentFolderId),
1653
1654 name
1655 };
1656
1657 Object result = null;
1658
1659 if (retrieveFromCache) {
1660 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_P_N,
1661 finderArgs, this);
1662 }
1663
1664 if (result == null) {
1665 Session session = null;
1666
1667 try {
1668 session = openSession();
1669
1670 StringBundler query = new StringBundler(5);
1671
1672 query.append(_SQL_SELECT_IGFOLDER_WHERE);
1673
1674 query.append(_FINDER_COLUMN_G_P_N_GROUPID_2);
1675
1676 query.append(_FINDER_COLUMN_G_P_N_PARENTFOLDERID_2);
1677
1678 if (name == null) {
1679 query.append(_FINDER_COLUMN_G_P_N_NAME_1);
1680 }
1681 else {
1682 if (name.equals(StringPool.BLANK)) {
1683 query.append(_FINDER_COLUMN_G_P_N_NAME_3);
1684 }
1685 else {
1686 query.append(_FINDER_COLUMN_G_P_N_NAME_2);
1687 }
1688 }
1689
1690 query.append(IGFolderModelImpl.ORDER_BY_JPQL);
1691
1692 String sql = query.toString();
1693
1694 Query q = session.createQuery(sql);
1695
1696 QueryPos qPos = QueryPos.getInstance(q);
1697
1698 qPos.add(groupId);
1699
1700 qPos.add(parentFolderId);
1701
1702 if (name != null) {
1703 qPos.add(name);
1704 }
1705
1706 List<IGFolder> list = q.list();
1707
1708 result = list;
1709
1710 IGFolder igFolder = null;
1711
1712 if (list.isEmpty()) {
1713 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_P_N,
1714 finderArgs, list);
1715 }
1716 else {
1717 igFolder = list.get(0);
1718
1719 cacheResult(igFolder);
1720
1721 if ((igFolder.getGroupId() != groupId) ||
1722 (igFolder.getParentFolderId() != parentFolderId) ||
1723 (igFolder.getName() == null) ||
1724 !igFolder.getName().equals(name)) {
1725 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_P_N,
1726 finderArgs, igFolder);
1727 }
1728 }
1729
1730 return igFolder;
1731 }
1732 catch (Exception e) {
1733 throw processException(e);
1734 }
1735 finally {
1736 if (result == null) {
1737 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_P_N,
1738 finderArgs, new ArrayList<IGFolder>());
1739 }
1740
1741 closeSession(session);
1742 }
1743 }
1744 else {
1745 if (result instanceof List<?>) {
1746 return null;
1747 }
1748 else {
1749 return (IGFolder)result;
1750 }
1751 }
1752 }
1753
1754 public List<IGFolder> findAll() throws SystemException {
1755 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1756 }
1757
1758 public List<IGFolder> findAll(int start, int end) throws SystemException {
1759 return findAll(start, end, null);
1760 }
1761
1762 public List<IGFolder> findAll(int start, int end,
1763 OrderByComparator orderByComparator) throws SystemException {
1764 Object[] finderArgs = new Object[] {
1765 String.valueOf(start), String.valueOf(end),
1766 String.valueOf(orderByComparator)
1767 };
1768
1769 List<IGFolder> list = (List<IGFolder>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
1770 finderArgs, this);
1771
1772 if (list == null) {
1773 Session session = null;
1774
1775 try {
1776 session = openSession();
1777
1778 StringBundler query = null;
1779 String sql = null;
1780
1781 if (orderByComparator != null) {
1782 query = new StringBundler(2 +
1783 (orderByComparator.getOrderByFields().length * 3));
1784
1785 query.append(_SQL_SELECT_IGFOLDER);
1786
1787 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1788 orderByComparator);
1789
1790 sql = query.toString();
1791 }
1792
1793 else {
1794 sql = _SQL_SELECT_IGFOLDER.concat(IGFolderModelImpl.ORDER_BY_JPQL);
1795 }
1796
1797 Query q = session.createQuery(sql);
1798
1799 if (orderByComparator == null) {
1800 list = (List<IGFolder>)QueryUtil.list(q, getDialect(),
1801 start, end, false);
1802
1803 Collections.sort(list);
1804 }
1805 else {
1806 list = (List<IGFolder>)QueryUtil.list(q, getDialect(),
1807 start, end);
1808 }
1809 }
1810 catch (Exception e) {
1811 throw processException(e);
1812 }
1813 finally {
1814 if (list == null) {
1815 list = new ArrayList<IGFolder>();
1816 }
1817
1818 cacheResult(list);
1819
1820 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
1821
1822 closeSession(session);
1823 }
1824 }
1825
1826 return list;
1827 }
1828
1829 public void removeByUuid(String uuid) throws SystemException {
1830 for (IGFolder igFolder : findByUuid(uuid)) {
1831 remove(igFolder);
1832 }
1833 }
1834
1835 public void removeByUUID_G(String uuid, long groupId)
1836 throws NoSuchFolderException, SystemException {
1837 IGFolder igFolder = findByUUID_G(uuid, groupId);
1838
1839 remove(igFolder);
1840 }
1841
1842 public void removeByGroupId(long groupId) throws SystemException {
1843 for (IGFolder igFolder : findByGroupId(groupId)) {
1844 remove(igFolder);
1845 }
1846 }
1847
1848 public void removeByCompanyId(long companyId) throws SystemException {
1849 for (IGFolder igFolder : findByCompanyId(companyId)) {
1850 remove(igFolder);
1851 }
1852 }
1853
1854 public void removeByG_P(long groupId, long parentFolderId)
1855 throws SystemException {
1856 for (IGFolder igFolder : findByG_P(groupId, parentFolderId)) {
1857 remove(igFolder);
1858 }
1859 }
1860
1861 public void removeByG_P_N(long groupId, long parentFolderId, String name)
1862 throws NoSuchFolderException, SystemException {
1863 IGFolder igFolder = findByG_P_N(groupId, parentFolderId, name);
1864
1865 remove(igFolder);
1866 }
1867
1868 public void removeAll() throws SystemException {
1869 for (IGFolder igFolder : findAll()) {
1870 remove(igFolder);
1871 }
1872 }
1873
1874 public int countByUuid(String uuid) throws SystemException {
1875 Object[] finderArgs = new Object[] { uuid };
1876
1877 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
1878 finderArgs, this);
1879
1880 if (count == null) {
1881 Session session = null;
1882
1883 try {
1884 session = openSession();
1885
1886 StringBundler query = new StringBundler(2);
1887
1888 query.append(_SQL_COUNT_IGFOLDER_WHERE);
1889
1890 if (uuid == null) {
1891 query.append(_FINDER_COLUMN_UUID_UUID_1);
1892 }
1893 else {
1894 if (uuid.equals(StringPool.BLANK)) {
1895 query.append(_FINDER_COLUMN_UUID_UUID_3);
1896 }
1897 else {
1898 query.append(_FINDER_COLUMN_UUID_UUID_2);
1899 }
1900 }
1901
1902 String sql = query.toString();
1903
1904 Query q = session.createQuery(sql);
1905
1906 QueryPos qPos = QueryPos.getInstance(q);
1907
1908 if (uuid != null) {
1909 qPos.add(uuid);
1910 }
1911
1912 count = (Long)q.uniqueResult();
1913 }
1914 catch (Exception e) {
1915 throw processException(e);
1916 }
1917 finally {
1918 if (count == null) {
1919 count = Long.valueOf(0);
1920 }
1921
1922 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
1923 finderArgs, count);
1924
1925 closeSession(session);
1926 }
1927 }
1928
1929 return count.intValue();
1930 }
1931
1932 public int countByUUID_G(String uuid, long groupId)
1933 throws SystemException {
1934 Object[] finderArgs = new Object[] { uuid, new Long(groupId) };
1935
1936 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
1937 finderArgs, this);
1938
1939 if (count == null) {
1940 Session session = null;
1941
1942 try {
1943 session = openSession();
1944
1945 StringBundler query = new StringBundler(3);
1946
1947 query.append(_SQL_COUNT_IGFOLDER_WHERE);
1948
1949 if (uuid == null) {
1950 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
1951 }
1952 else {
1953 if (uuid.equals(StringPool.BLANK)) {
1954 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
1955 }
1956 else {
1957 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
1958 }
1959 }
1960
1961 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
1962
1963 String sql = query.toString();
1964
1965 Query q = session.createQuery(sql);
1966
1967 QueryPos qPos = QueryPos.getInstance(q);
1968
1969 if (uuid != null) {
1970 qPos.add(uuid);
1971 }
1972
1973 qPos.add(groupId);
1974
1975 count = (Long)q.uniqueResult();
1976 }
1977 catch (Exception e) {
1978 throw processException(e);
1979 }
1980 finally {
1981 if (count == null) {
1982 count = Long.valueOf(0);
1983 }
1984
1985 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
1986 finderArgs, count);
1987
1988 closeSession(session);
1989 }
1990 }
1991
1992 return count.intValue();
1993 }
1994
1995 public int countByGroupId(long groupId) throws SystemException {
1996 Object[] finderArgs = new Object[] { new Long(groupId) };
1997
1998 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
1999 finderArgs, this);
2000
2001 if (count == null) {
2002 Session session = null;
2003
2004 try {
2005 session = openSession();
2006
2007 StringBundler query = new StringBundler(2);
2008
2009 query.append(_SQL_COUNT_IGFOLDER_WHERE);
2010
2011 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2012
2013 String sql = query.toString();
2014
2015 Query q = session.createQuery(sql);
2016
2017 QueryPos qPos = QueryPos.getInstance(q);
2018
2019 qPos.add(groupId);
2020
2021 count = (Long)q.uniqueResult();
2022 }
2023 catch (Exception e) {
2024 throw processException(e);
2025 }
2026 finally {
2027 if (count == null) {
2028 count = Long.valueOf(0);
2029 }
2030
2031 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
2032 finderArgs, count);
2033
2034 closeSession(session);
2035 }
2036 }
2037
2038 return count.intValue();
2039 }
2040
2041 public int countByCompanyId(long companyId) throws SystemException {
2042 Object[] finderArgs = new Object[] { new Long(companyId) };
2043
2044 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
2045 finderArgs, this);
2046
2047 if (count == null) {
2048 Session session = null;
2049
2050 try {
2051 session = openSession();
2052
2053 StringBundler query = new StringBundler(2);
2054
2055 query.append(_SQL_COUNT_IGFOLDER_WHERE);
2056
2057 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
2058
2059 String sql = query.toString();
2060
2061 Query q = session.createQuery(sql);
2062
2063 QueryPos qPos = QueryPos.getInstance(q);
2064
2065 qPos.add(companyId);
2066
2067 count = (Long)q.uniqueResult();
2068 }
2069 catch (Exception e) {
2070 throw processException(e);
2071 }
2072 finally {
2073 if (count == null) {
2074 count = Long.valueOf(0);
2075 }
2076
2077 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
2078 finderArgs, count);
2079
2080 closeSession(session);
2081 }
2082 }
2083
2084 return count.intValue();
2085 }
2086
2087 public int countByG_P(long groupId, long parentFolderId)
2088 throws SystemException {
2089 Object[] finderArgs = new Object[] {
2090 new Long(groupId), new Long(parentFolderId)
2091 };
2092
2093 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_P,
2094 finderArgs, this);
2095
2096 if (count == null) {
2097 Session session = null;
2098
2099 try {
2100 session = openSession();
2101
2102 StringBundler query = new StringBundler(3);
2103
2104 query.append(_SQL_COUNT_IGFOLDER_WHERE);
2105
2106 query.append(_FINDER_COLUMN_G_P_GROUPID_2);
2107
2108 query.append(_FINDER_COLUMN_G_P_PARENTFOLDERID_2);
2109
2110 String sql = query.toString();
2111
2112 Query q = session.createQuery(sql);
2113
2114 QueryPos qPos = QueryPos.getInstance(q);
2115
2116 qPos.add(groupId);
2117
2118 qPos.add(parentFolderId);
2119
2120 count = (Long)q.uniqueResult();
2121 }
2122 catch (Exception e) {
2123 throw processException(e);
2124 }
2125 finally {
2126 if (count == null) {
2127 count = Long.valueOf(0);
2128 }
2129
2130 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_P, finderArgs,
2131 count);
2132
2133 closeSession(session);
2134 }
2135 }
2136
2137 return count.intValue();
2138 }
2139
2140 public int countByG_P_N(long groupId, long parentFolderId, String name)
2141 throws SystemException {
2142 Object[] finderArgs = new Object[] {
2143 new Long(groupId), new Long(parentFolderId),
2144
2145 name
2146 };
2147
2148 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_P_N,
2149 finderArgs, this);
2150
2151 if (count == null) {
2152 Session session = null;
2153
2154 try {
2155 session = openSession();
2156
2157 StringBundler query = new StringBundler(4);
2158
2159 query.append(_SQL_COUNT_IGFOLDER_WHERE);
2160
2161 query.append(_FINDER_COLUMN_G_P_N_GROUPID_2);
2162
2163 query.append(_FINDER_COLUMN_G_P_N_PARENTFOLDERID_2);
2164
2165 if (name == null) {
2166 query.append(_FINDER_COLUMN_G_P_N_NAME_1);
2167 }
2168 else {
2169 if (name.equals(StringPool.BLANK)) {
2170 query.append(_FINDER_COLUMN_G_P_N_NAME_3);
2171 }
2172 else {
2173 query.append(_FINDER_COLUMN_G_P_N_NAME_2);
2174 }
2175 }
2176
2177 String sql = query.toString();
2178
2179 Query q = session.createQuery(sql);
2180
2181 QueryPos qPos = QueryPos.getInstance(q);
2182
2183 qPos.add(groupId);
2184
2185 qPos.add(parentFolderId);
2186
2187 if (name != null) {
2188 qPos.add(name);
2189 }
2190
2191 count = (Long)q.uniqueResult();
2192 }
2193 catch (Exception e) {
2194 throw processException(e);
2195 }
2196 finally {
2197 if (count == null) {
2198 count = Long.valueOf(0);
2199 }
2200
2201 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_P_N,
2202 finderArgs, count);
2203
2204 closeSession(session);
2205 }
2206 }
2207
2208 return count.intValue();
2209 }
2210
2211 public int countAll() throws SystemException {
2212 Object[] finderArgs = new Object[0];
2213
2214 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2215 finderArgs, this);
2216
2217 if (count == null) {
2218 Session session = null;
2219
2220 try {
2221 session = openSession();
2222
2223 Query q = session.createQuery(_SQL_COUNT_IGFOLDER);
2224
2225 count = (Long)q.uniqueResult();
2226 }
2227 catch (Exception e) {
2228 throw processException(e);
2229 }
2230 finally {
2231 if (count == null) {
2232 count = Long.valueOf(0);
2233 }
2234
2235 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
2236 count);
2237
2238 closeSession(session);
2239 }
2240 }
2241
2242 return count.intValue();
2243 }
2244
2245 public void afterPropertiesSet() {
2246 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2247 com.liferay.portal.util.PropsUtil.get(
2248 "value.object.listener.com.liferay.portlet.imagegallery.model.IGFolder")));
2249
2250 if (listenerClassNames.length > 0) {
2251 try {
2252 List<ModelListener<IGFolder>> listenersList = new ArrayList<ModelListener<IGFolder>>();
2253
2254 for (String listenerClassName : listenerClassNames) {
2255 listenersList.add((ModelListener<IGFolder>)Class.forName(
2256 listenerClassName).newInstance());
2257 }
2258
2259 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2260 }
2261 catch (Exception e) {
2262 _log.error(e);
2263 }
2264 }
2265 }
2266
2267 @BeanReference(type = IGFolderPersistence.class)
2268 protected IGFolderPersistence igFolderPersistence;
2269 @BeanReference(type = IGImagePersistence.class)
2270 protected IGImagePersistence igImagePersistence;
2271 @BeanReference(type = GroupPersistence.class)
2272 protected GroupPersistence groupPersistence;
2273 @BeanReference(type = ImagePersistence.class)
2274 protected ImagePersistence imagePersistence;
2275 @BeanReference(type = LayoutPersistence.class)
2276 protected LayoutPersistence layoutPersistence;
2277 @BeanReference(type = ResourcePersistence.class)
2278 protected ResourcePersistence resourcePersistence;
2279 @BeanReference(type = UserPersistence.class)
2280 protected UserPersistence userPersistence;
2281 @BeanReference(type = ExpandoValuePersistence.class)
2282 protected ExpandoValuePersistence expandoValuePersistence;
2283 private static final String _SQL_SELECT_IGFOLDER = "SELECT igFolder FROM IGFolder igFolder";
2284 private static final String _SQL_SELECT_IGFOLDER_WHERE = "SELECT igFolder FROM IGFolder igFolder WHERE ";
2285 private static final String _SQL_COUNT_IGFOLDER = "SELECT COUNT(igFolder) FROM IGFolder igFolder";
2286 private static final String _SQL_COUNT_IGFOLDER_WHERE = "SELECT COUNT(igFolder) FROM IGFolder igFolder WHERE ";
2287 private static final String _FINDER_COLUMN_UUID_UUID_1 = "igFolder.uuid IS NULL";
2288 private static final String _FINDER_COLUMN_UUID_UUID_2 = "igFolder.uuid = ?";
2289 private static final String _FINDER_COLUMN_UUID_UUID_3 = "(igFolder.uuid IS NULL OR igFolder.uuid = ?)";
2290 private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "igFolder.uuid IS NULL AND ";
2291 private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "igFolder.uuid = ? AND ";
2292 private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(igFolder.uuid IS NULL OR igFolder.uuid = ?) AND ";
2293 private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "igFolder.groupId = ?";
2294 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "igFolder.groupId = ?";
2295 private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "igFolder.companyId = ?";
2296 private static final String _FINDER_COLUMN_G_P_GROUPID_2 = "igFolder.groupId = ? AND ";
2297 private static final String _FINDER_COLUMN_G_P_PARENTFOLDERID_2 = "igFolder.parentFolderId = ?";
2298 private static final String _FINDER_COLUMN_G_P_N_GROUPID_2 = "igFolder.groupId = ? AND ";
2299 private static final String _FINDER_COLUMN_G_P_N_PARENTFOLDERID_2 = "igFolder.parentFolderId = ? AND ";
2300 private static final String _FINDER_COLUMN_G_P_N_NAME_1 = "igFolder.name IS NULL";
2301 private static final String _FINDER_COLUMN_G_P_N_NAME_2 = "igFolder.name = ?";
2302 private static final String _FINDER_COLUMN_G_P_N_NAME_3 = "(igFolder.name IS NULL OR igFolder.name = ?)";
2303 private static final String _ORDER_BY_ENTITY_ALIAS = "igFolder.";
2304 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No IGFolder exists with the primary key ";
2305 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No IGFolder exists with the key {";
2306 private static Log _log = LogFactoryUtil.getLog(IGFolderPersistenceImpl.class);
2307}