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