001
014
015 package com.liferay.portlet.wiki.service.persistence.impl;
016
017 import aQute.bnd.annotation.ProviderType;
018
019 import com.liferay.portal.kernel.cache.CacheRegistryUtil;
020 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
021 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
022 import com.liferay.portal.kernel.dao.orm.FinderPath;
023 import com.liferay.portal.kernel.dao.orm.Query;
024 import com.liferay.portal.kernel.dao.orm.QueryPos;
025 import com.liferay.portal.kernel.dao.orm.QueryUtil;
026 import com.liferay.portal.kernel.dao.orm.Session;
027 import com.liferay.portal.kernel.log.Log;
028 import com.liferay.portal.kernel.log.LogFactoryUtil;
029 import com.liferay.portal.kernel.util.OrderByComparator;
030 import com.liferay.portal.kernel.util.SetUtil;
031 import com.liferay.portal.kernel.util.StringBundler;
032 import com.liferay.portal.kernel.util.StringPool;
033 import com.liferay.portal.kernel.util.Validator;
034 import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
035 import com.liferay.portal.model.CacheModel;
036 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
037
038 import com.liferay.portlet.wiki.NoSuchPageResourceException;
039 import com.liferay.portlet.wiki.model.WikiPageResource;
040 import com.liferay.portlet.wiki.model.impl.WikiPageResourceImpl;
041 import com.liferay.portlet.wiki.model.impl.WikiPageResourceModelImpl;
042 import com.liferay.portlet.wiki.service.persistence.WikiPageResourcePersistence;
043
044 import java.io.Serializable;
045
046 import java.util.Collections;
047 import java.util.HashMap;
048 import java.util.HashSet;
049 import java.util.Iterator;
050 import java.util.List;
051 import java.util.Map;
052 import java.util.Set;
053
054
066 @ProviderType
067 public class WikiPageResourcePersistenceImpl extends BasePersistenceImpl<WikiPageResource>
068 implements WikiPageResourcePersistence {
069
074 public static final String FINDER_CLASS_NAME_ENTITY = WikiPageResourceImpl.class.getName();
075 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
076 ".List1";
077 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
078 ".List2";
079 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(WikiPageResourceModelImpl.ENTITY_CACHE_ENABLED,
080 WikiPageResourceModelImpl.FINDER_CACHE_ENABLED,
081 WikiPageResourceImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
082 "findAll", new String[0]);
083 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(WikiPageResourceModelImpl.ENTITY_CACHE_ENABLED,
084 WikiPageResourceModelImpl.FINDER_CACHE_ENABLED,
085 WikiPageResourceImpl.class,
086 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
087 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(WikiPageResourceModelImpl.ENTITY_CACHE_ENABLED,
088 WikiPageResourceModelImpl.FINDER_CACHE_ENABLED, Long.class,
089 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
090 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID = new FinderPath(WikiPageResourceModelImpl.ENTITY_CACHE_ENABLED,
091 WikiPageResourceModelImpl.FINDER_CACHE_ENABLED,
092 WikiPageResourceImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
093 "findByUuid",
094 new String[] {
095 String.class.getName(),
096
097 Integer.class.getName(), Integer.class.getName(),
098 OrderByComparator.class.getName()
099 });
100 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID = new FinderPath(WikiPageResourceModelImpl.ENTITY_CACHE_ENABLED,
101 WikiPageResourceModelImpl.FINDER_CACHE_ENABLED,
102 WikiPageResourceImpl.class,
103 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUuid",
104 new String[] { String.class.getName() },
105 WikiPageResourceModelImpl.UUID_COLUMN_BITMASK);
106 public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(WikiPageResourceModelImpl.ENTITY_CACHE_ENABLED,
107 WikiPageResourceModelImpl.FINDER_CACHE_ENABLED, Long.class,
108 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUuid",
109 new String[] { String.class.getName() });
110
111
117 @Override
118 public List<WikiPageResource> findByUuid(String uuid) {
119 return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
120 }
121
122
134 @Override
135 public List<WikiPageResource> findByUuid(String uuid, int start, int end) {
136 return findByUuid(uuid, start, end, null);
137 }
138
139
152 @Override
153 public List<WikiPageResource> findByUuid(String uuid, int start, int end,
154 OrderByComparator<WikiPageResource> orderByComparator) {
155 boolean pagination = true;
156 FinderPath finderPath = null;
157 Object[] finderArgs = null;
158
159 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
160 (orderByComparator == null)) {
161 pagination = false;
162 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID;
163 finderArgs = new Object[] { uuid };
164 }
165 else {
166 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID;
167 finderArgs = new Object[] { uuid, start, end, orderByComparator };
168 }
169
170 List<WikiPageResource> list = (List<WikiPageResource>)FinderCacheUtil.getResult(finderPath,
171 finderArgs, this);
172
173 if ((list != null) && !list.isEmpty()) {
174 for (WikiPageResource wikiPageResource : list) {
175 if (!Validator.equals(uuid, wikiPageResource.getUuid())) {
176 list = null;
177
178 break;
179 }
180 }
181 }
182
183 if (list == null) {
184 StringBundler query = null;
185
186 if (orderByComparator != null) {
187 query = new StringBundler(3 +
188 (orderByComparator.getOrderByFields().length * 3));
189 }
190 else {
191 query = new StringBundler(3);
192 }
193
194 query.append(_SQL_SELECT_WIKIPAGERESOURCE_WHERE);
195
196 boolean bindUuid = false;
197
198 if (uuid == null) {
199 query.append(_FINDER_COLUMN_UUID_UUID_1);
200 }
201 else if (uuid.equals(StringPool.BLANK)) {
202 query.append(_FINDER_COLUMN_UUID_UUID_3);
203 }
204 else {
205 bindUuid = true;
206
207 query.append(_FINDER_COLUMN_UUID_UUID_2);
208 }
209
210 if (orderByComparator != null) {
211 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
212 orderByComparator);
213 }
214 else
215 if (pagination) {
216 query.append(WikiPageResourceModelImpl.ORDER_BY_JPQL);
217 }
218
219 String sql = query.toString();
220
221 Session session = null;
222
223 try {
224 session = openSession();
225
226 Query q = session.createQuery(sql);
227
228 QueryPos qPos = QueryPos.getInstance(q);
229
230 if (bindUuid) {
231 qPos.add(uuid);
232 }
233
234 if (!pagination) {
235 list = (List<WikiPageResource>)QueryUtil.list(q,
236 getDialect(), start, end, false);
237
238 Collections.sort(list);
239
240 list = Collections.unmodifiableList(list);
241 }
242 else {
243 list = (List<WikiPageResource>)QueryUtil.list(q,
244 getDialect(), start, end);
245 }
246
247 cacheResult(list);
248
249 FinderCacheUtil.putResult(finderPath, finderArgs, list);
250 }
251 catch (Exception e) {
252 FinderCacheUtil.removeResult(finderPath, finderArgs);
253
254 throw processException(e);
255 }
256 finally {
257 closeSession(session);
258 }
259 }
260
261 return list;
262 }
263
264
272 @Override
273 public WikiPageResource findByUuid_First(String uuid,
274 OrderByComparator<WikiPageResource> orderByComparator)
275 throws NoSuchPageResourceException {
276 WikiPageResource wikiPageResource = fetchByUuid_First(uuid,
277 orderByComparator);
278
279 if (wikiPageResource != null) {
280 return wikiPageResource;
281 }
282
283 StringBundler msg = new StringBundler(4);
284
285 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
286
287 msg.append("uuid=");
288 msg.append(uuid);
289
290 msg.append(StringPool.CLOSE_CURLY_BRACE);
291
292 throw new NoSuchPageResourceException(msg.toString());
293 }
294
295
302 @Override
303 public WikiPageResource fetchByUuid_First(String uuid,
304 OrderByComparator<WikiPageResource> orderByComparator) {
305 List<WikiPageResource> list = findByUuid(uuid, 0, 1, orderByComparator);
306
307 if (!list.isEmpty()) {
308 return list.get(0);
309 }
310
311 return null;
312 }
313
314
322 @Override
323 public WikiPageResource findByUuid_Last(String uuid,
324 OrderByComparator<WikiPageResource> orderByComparator)
325 throws NoSuchPageResourceException {
326 WikiPageResource wikiPageResource = fetchByUuid_Last(uuid,
327 orderByComparator);
328
329 if (wikiPageResource != null) {
330 return wikiPageResource;
331 }
332
333 StringBundler msg = new StringBundler(4);
334
335 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
336
337 msg.append("uuid=");
338 msg.append(uuid);
339
340 msg.append(StringPool.CLOSE_CURLY_BRACE);
341
342 throw new NoSuchPageResourceException(msg.toString());
343 }
344
345
352 @Override
353 public WikiPageResource fetchByUuid_Last(String uuid,
354 OrderByComparator<WikiPageResource> orderByComparator) {
355 int count = countByUuid(uuid);
356
357 if (count == 0) {
358 return null;
359 }
360
361 List<WikiPageResource> list = findByUuid(uuid, count - 1, count,
362 orderByComparator);
363
364 if (!list.isEmpty()) {
365 return list.get(0);
366 }
367
368 return null;
369 }
370
371
380 @Override
381 public WikiPageResource[] findByUuid_PrevAndNext(long resourcePrimKey,
382 String uuid, OrderByComparator<WikiPageResource> orderByComparator)
383 throws NoSuchPageResourceException {
384 WikiPageResource wikiPageResource = findByPrimaryKey(resourcePrimKey);
385
386 Session session = null;
387
388 try {
389 session = openSession();
390
391 WikiPageResource[] array = new WikiPageResourceImpl[3];
392
393 array[0] = getByUuid_PrevAndNext(session, wikiPageResource, uuid,
394 orderByComparator, true);
395
396 array[1] = wikiPageResource;
397
398 array[2] = getByUuid_PrevAndNext(session, wikiPageResource, uuid,
399 orderByComparator, false);
400
401 return array;
402 }
403 catch (Exception e) {
404 throw processException(e);
405 }
406 finally {
407 closeSession(session);
408 }
409 }
410
411 protected WikiPageResource getByUuid_PrevAndNext(Session session,
412 WikiPageResource wikiPageResource, String uuid,
413 OrderByComparator<WikiPageResource> orderByComparator, boolean previous) {
414 StringBundler query = null;
415
416 if (orderByComparator != null) {
417 query = new StringBundler(6 +
418 (orderByComparator.getOrderByFields().length * 6));
419 }
420 else {
421 query = new StringBundler(3);
422 }
423
424 query.append(_SQL_SELECT_WIKIPAGERESOURCE_WHERE);
425
426 boolean bindUuid = false;
427
428 if (uuid == null) {
429 query.append(_FINDER_COLUMN_UUID_UUID_1);
430 }
431 else if (uuid.equals(StringPool.BLANK)) {
432 query.append(_FINDER_COLUMN_UUID_UUID_3);
433 }
434 else {
435 bindUuid = true;
436
437 query.append(_FINDER_COLUMN_UUID_UUID_2);
438 }
439
440 if (orderByComparator != null) {
441 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
442
443 if (orderByConditionFields.length > 0) {
444 query.append(WHERE_AND);
445 }
446
447 for (int i = 0; i < orderByConditionFields.length; i++) {
448 query.append(_ORDER_BY_ENTITY_ALIAS);
449 query.append(orderByConditionFields[i]);
450
451 if ((i + 1) < orderByConditionFields.length) {
452 if (orderByComparator.isAscending() ^ previous) {
453 query.append(WHERE_GREATER_THAN_HAS_NEXT);
454 }
455 else {
456 query.append(WHERE_LESSER_THAN_HAS_NEXT);
457 }
458 }
459 else {
460 if (orderByComparator.isAscending() ^ previous) {
461 query.append(WHERE_GREATER_THAN);
462 }
463 else {
464 query.append(WHERE_LESSER_THAN);
465 }
466 }
467 }
468
469 query.append(ORDER_BY_CLAUSE);
470
471 String[] orderByFields = orderByComparator.getOrderByFields();
472
473 for (int i = 0; i < orderByFields.length; i++) {
474 query.append(_ORDER_BY_ENTITY_ALIAS);
475 query.append(orderByFields[i]);
476
477 if ((i + 1) < orderByFields.length) {
478 if (orderByComparator.isAscending() ^ previous) {
479 query.append(ORDER_BY_ASC_HAS_NEXT);
480 }
481 else {
482 query.append(ORDER_BY_DESC_HAS_NEXT);
483 }
484 }
485 else {
486 if (orderByComparator.isAscending() ^ previous) {
487 query.append(ORDER_BY_ASC);
488 }
489 else {
490 query.append(ORDER_BY_DESC);
491 }
492 }
493 }
494 }
495 else {
496 query.append(WikiPageResourceModelImpl.ORDER_BY_JPQL);
497 }
498
499 String sql = query.toString();
500
501 Query q = session.createQuery(sql);
502
503 q.setFirstResult(0);
504 q.setMaxResults(2);
505
506 QueryPos qPos = QueryPos.getInstance(q);
507
508 if (bindUuid) {
509 qPos.add(uuid);
510 }
511
512 if (orderByComparator != null) {
513 Object[] values = orderByComparator.getOrderByConditionValues(wikiPageResource);
514
515 for (Object value : values) {
516 qPos.add(value);
517 }
518 }
519
520 List<WikiPageResource> list = q.list();
521
522 if (list.size() == 2) {
523 return list.get(1);
524 }
525 else {
526 return null;
527 }
528 }
529
530
535 @Override
536 public void removeByUuid(String uuid) {
537 for (WikiPageResource wikiPageResource : findByUuid(uuid,
538 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
539 remove(wikiPageResource);
540 }
541 }
542
543
549 @Override
550 public int countByUuid(String uuid) {
551 FinderPath finderPath = FINDER_PATH_COUNT_BY_UUID;
552
553 Object[] finderArgs = new Object[] { uuid };
554
555 Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
556 this);
557
558 if (count == null) {
559 StringBundler query = new StringBundler(2);
560
561 query.append(_SQL_COUNT_WIKIPAGERESOURCE_WHERE);
562
563 boolean bindUuid = false;
564
565 if (uuid == null) {
566 query.append(_FINDER_COLUMN_UUID_UUID_1);
567 }
568 else if (uuid.equals(StringPool.BLANK)) {
569 query.append(_FINDER_COLUMN_UUID_UUID_3);
570 }
571 else {
572 bindUuid = true;
573
574 query.append(_FINDER_COLUMN_UUID_UUID_2);
575 }
576
577 String sql = query.toString();
578
579 Session session = null;
580
581 try {
582 session = openSession();
583
584 Query q = session.createQuery(sql);
585
586 QueryPos qPos = QueryPos.getInstance(q);
587
588 if (bindUuid) {
589 qPos.add(uuid);
590 }
591
592 count = (Long)q.uniqueResult();
593
594 FinderCacheUtil.putResult(finderPath, finderArgs, count);
595 }
596 catch (Exception e) {
597 FinderCacheUtil.removeResult(finderPath, finderArgs);
598
599 throw processException(e);
600 }
601 finally {
602 closeSession(session);
603 }
604 }
605
606 return count.intValue();
607 }
608
609 private static final String _FINDER_COLUMN_UUID_UUID_1 = "wikiPageResource.uuid IS NULL";
610 private static final String _FINDER_COLUMN_UUID_UUID_2 = "wikiPageResource.uuid = ?";
611 private static final String _FINDER_COLUMN_UUID_UUID_3 = "(wikiPageResource.uuid IS NULL OR wikiPageResource.uuid = '')";
612 public static final FinderPath FINDER_PATH_FETCH_BY_N_T = new FinderPath(WikiPageResourceModelImpl.ENTITY_CACHE_ENABLED,
613 WikiPageResourceModelImpl.FINDER_CACHE_ENABLED,
614 WikiPageResourceImpl.class, FINDER_CLASS_NAME_ENTITY, "fetchByN_T",
615 new String[] { Long.class.getName(), String.class.getName() },
616 WikiPageResourceModelImpl.NODEID_COLUMN_BITMASK |
617 WikiPageResourceModelImpl.TITLE_COLUMN_BITMASK);
618 public static final FinderPath FINDER_PATH_COUNT_BY_N_T = new FinderPath(WikiPageResourceModelImpl.ENTITY_CACHE_ENABLED,
619 WikiPageResourceModelImpl.FINDER_CACHE_ENABLED, Long.class,
620 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByN_T",
621 new String[] { Long.class.getName(), String.class.getName() });
622
623
631 @Override
632 public WikiPageResource findByN_T(long nodeId, String title)
633 throws NoSuchPageResourceException {
634 WikiPageResource wikiPageResource = fetchByN_T(nodeId, title);
635
636 if (wikiPageResource == null) {
637 StringBundler msg = new StringBundler(6);
638
639 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
640
641 msg.append("nodeId=");
642 msg.append(nodeId);
643
644 msg.append(", title=");
645 msg.append(title);
646
647 msg.append(StringPool.CLOSE_CURLY_BRACE);
648
649 if (_log.isWarnEnabled()) {
650 _log.warn(msg.toString());
651 }
652
653 throw new NoSuchPageResourceException(msg.toString());
654 }
655
656 return wikiPageResource;
657 }
658
659
666 @Override
667 public WikiPageResource fetchByN_T(long nodeId, String title) {
668 return fetchByN_T(nodeId, title, true);
669 }
670
671
679 @Override
680 public WikiPageResource fetchByN_T(long nodeId, String title,
681 boolean retrieveFromCache) {
682 Object[] finderArgs = new Object[] { nodeId, title };
683
684 Object result = null;
685
686 if (retrieveFromCache) {
687 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_N_T,
688 finderArgs, this);
689 }
690
691 if (result instanceof WikiPageResource) {
692 WikiPageResource wikiPageResource = (WikiPageResource)result;
693
694 if ((nodeId != wikiPageResource.getNodeId()) ||
695 !Validator.equals(title, wikiPageResource.getTitle())) {
696 result = null;
697 }
698 }
699
700 if (result == null) {
701 StringBundler query = new StringBundler(4);
702
703 query.append(_SQL_SELECT_WIKIPAGERESOURCE_WHERE);
704
705 query.append(_FINDER_COLUMN_N_T_NODEID_2);
706
707 boolean bindTitle = false;
708
709 if (title == null) {
710 query.append(_FINDER_COLUMN_N_T_TITLE_1);
711 }
712 else if (title.equals(StringPool.BLANK)) {
713 query.append(_FINDER_COLUMN_N_T_TITLE_3);
714 }
715 else {
716 bindTitle = true;
717
718 query.append(_FINDER_COLUMN_N_T_TITLE_2);
719 }
720
721 String sql = query.toString();
722
723 Session session = null;
724
725 try {
726 session = openSession();
727
728 Query q = session.createQuery(sql);
729
730 QueryPos qPos = QueryPos.getInstance(q);
731
732 qPos.add(nodeId);
733
734 if (bindTitle) {
735 qPos.add(title);
736 }
737
738 List<WikiPageResource> list = q.list();
739
740 if (list.isEmpty()) {
741 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_N_T,
742 finderArgs, list);
743 }
744 else {
745 WikiPageResource wikiPageResource = list.get(0);
746
747 result = wikiPageResource;
748
749 cacheResult(wikiPageResource);
750
751 if ((wikiPageResource.getNodeId() != nodeId) ||
752 (wikiPageResource.getTitle() == null) ||
753 !wikiPageResource.getTitle().equals(title)) {
754 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_N_T,
755 finderArgs, wikiPageResource);
756 }
757 }
758 }
759 catch (Exception e) {
760 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_N_T,
761 finderArgs);
762
763 throw processException(e);
764 }
765 finally {
766 closeSession(session);
767 }
768 }
769
770 if (result instanceof List<?>) {
771 return null;
772 }
773 else {
774 return (WikiPageResource)result;
775 }
776 }
777
778
785 @Override
786 public WikiPageResource removeByN_T(long nodeId, String title)
787 throws NoSuchPageResourceException {
788 WikiPageResource wikiPageResource = findByN_T(nodeId, title);
789
790 return remove(wikiPageResource);
791 }
792
793
800 @Override
801 public int countByN_T(long nodeId, String title) {
802 FinderPath finderPath = FINDER_PATH_COUNT_BY_N_T;
803
804 Object[] finderArgs = new Object[] { nodeId, title };
805
806 Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
807 this);
808
809 if (count == null) {
810 StringBundler query = new StringBundler(3);
811
812 query.append(_SQL_COUNT_WIKIPAGERESOURCE_WHERE);
813
814 query.append(_FINDER_COLUMN_N_T_NODEID_2);
815
816 boolean bindTitle = false;
817
818 if (title == null) {
819 query.append(_FINDER_COLUMN_N_T_TITLE_1);
820 }
821 else if (title.equals(StringPool.BLANK)) {
822 query.append(_FINDER_COLUMN_N_T_TITLE_3);
823 }
824 else {
825 bindTitle = true;
826
827 query.append(_FINDER_COLUMN_N_T_TITLE_2);
828 }
829
830 String sql = query.toString();
831
832 Session session = null;
833
834 try {
835 session = openSession();
836
837 Query q = session.createQuery(sql);
838
839 QueryPos qPos = QueryPos.getInstance(q);
840
841 qPos.add(nodeId);
842
843 if (bindTitle) {
844 qPos.add(title);
845 }
846
847 count = (Long)q.uniqueResult();
848
849 FinderCacheUtil.putResult(finderPath, finderArgs, count);
850 }
851 catch (Exception e) {
852 FinderCacheUtil.removeResult(finderPath, finderArgs);
853
854 throw processException(e);
855 }
856 finally {
857 closeSession(session);
858 }
859 }
860
861 return count.intValue();
862 }
863
864 private static final String _FINDER_COLUMN_N_T_NODEID_2 = "wikiPageResource.nodeId = ? AND ";
865 private static final String _FINDER_COLUMN_N_T_TITLE_1 = "wikiPageResource.title IS NULL";
866 private static final String _FINDER_COLUMN_N_T_TITLE_2 = "wikiPageResource.title = ?";
867 private static final String _FINDER_COLUMN_N_T_TITLE_3 = "(wikiPageResource.title IS NULL OR wikiPageResource.title = '')";
868
869 public WikiPageResourcePersistenceImpl() {
870 setModelClass(WikiPageResource.class);
871 }
872
873
878 @Override
879 public void cacheResult(WikiPageResource wikiPageResource) {
880 EntityCacheUtil.putResult(WikiPageResourceModelImpl.ENTITY_CACHE_ENABLED,
881 WikiPageResourceImpl.class, wikiPageResource.getPrimaryKey(),
882 wikiPageResource);
883
884 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_N_T,
885 new Object[] {
886 wikiPageResource.getNodeId(), wikiPageResource.getTitle()
887 }, wikiPageResource);
888
889 wikiPageResource.resetOriginalValues();
890 }
891
892
897 @Override
898 public void cacheResult(List<WikiPageResource> wikiPageResources) {
899 for (WikiPageResource wikiPageResource : wikiPageResources) {
900 if (EntityCacheUtil.getResult(
901 WikiPageResourceModelImpl.ENTITY_CACHE_ENABLED,
902 WikiPageResourceImpl.class,
903 wikiPageResource.getPrimaryKey()) == null) {
904 cacheResult(wikiPageResource);
905 }
906 else {
907 wikiPageResource.resetOriginalValues();
908 }
909 }
910 }
911
912
919 @Override
920 public void clearCache() {
921 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
922 CacheRegistryUtil.clear(WikiPageResourceImpl.class.getName());
923 }
924
925 EntityCacheUtil.clearCache(WikiPageResourceImpl.class);
926
927 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
928 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
929 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
930 }
931
932
939 @Override
940 public void clearCache(WikiPageResource wikiPageResource) {
941 EntityCacheUtil.removeResult(WikiPageResourceModelImpl.ENTITY_CACHE_ENABLED,
942 WikiPageResourceImpl.class, wikiPageResource.getPrimaryKey());
943
944 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
945 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
946
947 clearUniqueFindersCache(wikiPageResource);
948 }
949
950 @Override
951 public void clearCache(List<WikiPageResource> wikiPageResources) {
952 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
953 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
954
955 for (WikiPageResource wikiPageResource : wikiPageResources) {
956 EntityCacheUtil.removeResult(WikiPageResourceModelImpl.ENTITY_CACHE_ENABLED,
957 WikiPageResourceImpl.class, wikiPageResource.getPrimaryKey());
958
959 clearUniqueFindersCache(wikiPageResource);
960 }
961 }
962
963 protected void cacheUniqueFindersCache(WikiPageResource wikiPageResource) {
964 if (wikiPageResource.isNew()) {
965 Object[] args = new Object[] {
966 wikiPageResource.getNodeId(), wikiPageResource.getTitle()
967 };
968
969 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_N_T, args,
970 Long.valueOf(1));
971 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_N_T, args,
972 wikiPageResource);
973 }
974 else {
975 WikiPageResourceModelImpl wikiPageResourceModelImpl = (WikiPageResourceModelImpl)wikiPageResource;
976
977 if ((wikiPageResourceModelImpl.getColumnBitmask() &
978 FINDER_PATH_FETCH_BY_N_T.getColumnBitmask()) != 0) {
979 Object[] args = new Object[] {
980 wikiPageResource.getNodeId(),
981 wikiPageResource.getTitle()
982 };
983
984 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_N_T, args,
985 Long.valueOf(1));
986 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_N_T, args,
987 wikiPageResource);
988 }
989 }
990 }
991
992 protected void clearUniqueFindersCache(WikiPageResource wikiPageResource) {
993 WikiPageResourceModelImpl wikiPageResourceModelImpl = (WikiPageResourceModelImpl)wikiPageResource;
994
995 Object[] args = new Object[] {
996 wikiPageResource.getNodeId(), wikiPageResource.getTitle()
997 };
998
999 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_N_T, args);
1000 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_N_T, args);
1001
1002 if ((wikiPageResourceModelImpl.getColumnBitmask() &
1003 FINDER_PATH_FETCH_BY_N_T.getColumnBitmask()) != 0) {
1004 args = new Object[] {
1005 wikiPageResourceModelImpl.getOriginalNodeId(),
1006 wikiPageResourceModelImpl.getOriginalTitle()
1007 };
1008
1009 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_N_T, args);
1010 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_N_T, args);
1011 }
1012 }
1013
1014
1020 @Override
1021 public WikiPageResource create(long resourcePrimKey) {
1022 WikiPageResource wikiPageResource = new WikiPageResourceImpl();
1023
1024 wikiPageResource.setNew(true);
1025 wikiPageResource.setPrimaryKey(resourcePrimKey);
1026
1027 String uuid = PortalUUIDUtil.generate();
1028
1029 wikiPageResource.setUuid(uuid);
1030
1031 return wikiPageResource;
1032 }
1033
1034
1041 @Override
1042 public WikiPageResource remove(long resourcePrimKey)
1043 throws NoSuchPageResourceException {
1044 return remove((Serializable)resourcePrimKey);
1045 }
1046
1047
1054 @Override
1055 public WikiPageResource remove(Serializable primaryKey)
1056 throws NoSuchPageResourceException {
1057 Session session = null;
1058
1059 try {
1060 session = openSession();
1061
1062 WikiPageResource wikiPageResource = (WikiPageResource)session.get(WikiPageResourceImpl.class,
1063 primaryKey);
1064
1065 if (wikiPageResource == null) {
1066 if (_log.isWarnEnabled()) {
1067 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
1068 }
1069
1070 throw new NoSuchPageResourceException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
1071 primaryKey);
1072 }
1073
1074 return remove(wikiPageResource);
1075 }
1076 catch (NoSuchPageResourceException nsee) {
1077 throw nsee;
1078 }
1079 catch (Exception e) {
1080 throw processException(e);
1081 }
1082 finally {
1083 closeSession(session);
1084 }
1085 }
1086
1087 @Override
1088 protected WikiPageResource removeImpl(WikiPageResource wikiPageResource) {
1089 wikiPageResource = toUnwrappedModel(wikiPageResource);
1090
1091 Session session = null;
1092
1093 try {
1094 session = openSession();
1095
1096 if (!session.contains(wikiPageResource)) {
1097 wikiPageResource = (WikiPageResource)session.get(WikiPageResourceImpl.class,
1098 wikiPageResource.getPrimaryKeyObj());
1099 }
1100
1101 if (wikiPageResource != null) {
1102 session.delete(wikiPageResource);
1103 }
1104 }
1105 catch (Exception e) {
1106 throw processException(e);
1107 }
1108 finally {
1109 closeSession(session);
1110 }
1111
1112 if (wikiPageResource != null) {
1113 clearCache(wikiPageResource);
1114 }
1115
1116 return wikiPageResource;
1117 }
1118
1119 @Override
1120 public WikiPageResource updateImpl(
1121 com.liferay.portlet.wiki.model.WikiPageResource wikiPageResource) {
1122 wikiPageResource = toUnwrappedModel(wikiPageResource);
1123
1124 boolean isNew = wikiPageResource.isNew();
1125
1126 WikiPageResourceModelImpl wikiPageResourceModelImpl = (WikiPageResourceModelImpl)wikiPageResource;
1127
1128 if (Validator.isNull(wikiPageResource.getUuid())) {
1129 String uuid = PortalUUIDUtil.generate();
1130
1131 wikiPageResource.setUuid(uuid);
1132 }
1133
1134 Session session = null;
1135
1136 try {
1137 session = openSession();
1138
1139 if (wikiPageResource.isNew()) {
1140 session.save(wikiPageResource);
1141
1142 wikiPageResource.setNew(false);
1143 }
1144 else {
1145 session.merge(wikiPageResource);
1146 }
1147 }
1148 catch (Exception e) {
1149 throw processException(e);
1150 }
1151 finally {
1152 closeSession(session);
1153 }
1154
1155 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1156
1157 if (isNew || !WikiPageResourceModelImpl.COLUMN_BITMASK_ENABLED) {
1158 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1159 }
1160
1161 else {
1162 if ((wikiPageResourceModelImpl.getColumnBitmask() &
1163 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID.getColumnBitmask()) != 0) {
1164 Object[] args = new Object[] {
1165 wikiPageResourceModelImpl.getOriginalUuid()
1166 };
1167
1168 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
1169 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
1170 args);
1171
1172 args = new Object[] { wikiPageResourceModelImpl.getUuid() };
1173
1174 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
1175 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
1176 args);
1177 }
1178 }
1179
1180 EntityCacheUtil.putResult(WikiPageResourceModelImpl.ENTITY_CACHE_ENABLED,
1181 WikiPageResourceImpl.class, wikiPageResource.getPrimaryKey(),
1182 wikiPageResource, false);
1183
1184 clearUniqueFindersCache(wikiPageResource);
1185 cacheUniqueFindersCache(wikiPageResource);
1186
1187 wikiPageResource.resetOriginalValues();
1188
1189 return wikiPageResource;
1190 }
1191
1192 protected WikiPageResource toUnwrappedModel(
1193 WikiPageResource wikiPageResource) {
1194 if (wikiPageResource instanceof WikiPageResourceImpl) {
1195 return wikiPageResource;
1196 }
1197
1198 WikiPageResourceImpl wikiPageResourceImpl = new WikiPageResourceImpl();
1199
1200 wikiPageResourceImpl.setNew(wikiPageResource.isNew());
1201 wikiPageResourceImpl.setPrimaryKey(wikiPageResource.getPrimaryKey());
1202
1203 wikiPageResourceImpl.setUuid(wikiPageResource.getUuid());
1204 wikiPageResourceImpl.setResourcePrimKey(wikiPageResource.getResourcePrimKey());
1205 wikiPageResourceImpl.setNodeId(wikiPageResource.getNodeId());
1206 wikiPageResourceImpl.setTitle(wikiPageResource.getTitle());
1207
1208 return wikiPageResourceImpl;
1209 }
1210
1211
1218 @Override
1219 public WikiPageResource findByPrimaryKey(Serializable primaryKey)
1220 throws NoSuchPageResourceException {
1221 WikiPageResource wikiPageResource = fetchByPrimaryKey(primaryKey);
1222
1223 if (wikiPageResource == null) {
1224 if (_log.isWarnEnabled()) {
1225 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
1226 }
1227
1228 throw new NoSuchPageResourceException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
1229 primaryKey);
1230 }
1231
1232 return wikiPageResource;
1233 }
1234
1235
1242 @Override
1243 public WikiPageResource findByPrimaryKey(long resourcePrimKey)
1244 throws NoSuchPageResourceException {
1245 return findByPrimaryKey((Serializable)resourcePrimKey);
1246 }
1247
1248
1254 @Override
1255 public WikiPageResource fetchByPrimaryKey(Serializable primaryKey) {
1256 WikiPageResource wikiPageResource = (WikiPageResource)EntityCacheUtil.getResult(WikiPageResourceModelImpl.ENTITY_CACHE_ENABLED,
1257 WikiPageResourceImpl.class, primaryKey);
1258
1259 if (wikiPageResource == _nullWikiPageResource) {
1260 return null;
1261 }
1262
1263 if (wikiPageResource == null) {
1264 Session session = null;
1265
1266 try {
1267 session = openSession();
1268
1269 wikiPageResource = (WikiPageResource)session.get(WikiPageResourceImpl.class,
1270 primaryKey);
1271
1272 if (wikiPageResource != null) {
1273 cacheResult(wikiPageResource);
1274 }
1275 else {
1276 EntityCacheUtil.putResult(WikiPageResourceModelImpl.ENTITY_CACHE_ENABLED,
1277 WikiPageResourceImpl.class, primaryKey,
1278 _nullWikiPageResource);
1279 }
1280 }
1281 catch (Exception e) {
1282 EntityCacheUtil.removeResult(WikiPageResourceModelImpl.ENTITY_CACHE_ENABLED,
1283 WikiPageResourceImpl.class, primaryKey);
1284
1285 throw processException(e);
1286 }
1287 finally {
1288 closeSession(session);
1289 }
1290 }
1291
1292 return wikiPageResource;
1293 }
1294
1295
1301 @Override
1302 public WikiPageResource fetchByPrimaryKey(long resourcePrimKey) {
1303 return fetchByPrimaryKey((Serializable)resourcePrimKey);
1304 }
1305
1306 @Override
1307 public Map<Serializable, WikiPageResource> fetchByPrimaryKeys(
1308 Set<Serializable> primaryKeys) {
1309 if (primaryKeys.isEmpty()) {
1310 return Collections.emptyMap();
1311 }
1312
1313 Map<Serializable, WikiPageResource> map = new HashMap<Serializable, WikiPageResource>();
1314
1315 if (primaryKeys.size() == 1) {
1316 Iterator<Serializable> iterator = primaryKeys.iterator();
1317
1318 Serializable primaryKey = iterator.next();
1319
1320 WikiPageResource wikiPageResource = fetchByPrimaryKey(primaryKey);
1321
1322 if (wikiPageResource != null) {
1323 map.put(primaryKey, wikiPageResource);
1324 }
1325
1326 return map;
1327 }
1328
1329 Set<Serializable> uncachedPrimaryKeys = null;
1330
1331 for (Serializable primaryKey : primaryKeys) {
1332 WikiPageResource wikiPageResource = (WikiPageResource)EntityCacheUtil.getResult(WikiPageResourceModelImpl.ENTITY_CACHE_ENABLED,
1333 WikiPageResourceImpl.class, primaryKey);
1334
1335 if (wikiPageResource == null) {
1336 if (uncachedPrimaryKeys == null) {
1337 uncachedPrimaryKeys = new HashSet<Serializable>();
1338 }
1339
1340 uncachedPrimaryKeys.add(primaryKey);
1341 }
1342 else {
1343 map.put(primaryKey, wikiPageResource);
1344 }
1345 }
1346
1347 if (uncachedPrimaryKeys == null) {
1348 return map;
1349 }
1350
1351 StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) +
1352 1);
1353
1354 query.append(_SQL_SELECT_WIKIPAGERESOURCE_WHERE_PKS_IN);
1355
1356 for (Serializable primaryKey : uncachedPrimaryKeys) {
1357 query.append(String.valueOf(primaryKey));
1358
1359 query.append(StringPool.COMMA);
1360 }
1361
1362 query.setIndex(query.index() - 1);
1363
1364 query.append(StringPool.CLOSE_PARENTHESIS);
1365
1366 String sql = query.toString();
1367
1368 Session session = null;
1369
1370 try {
1371 session = openSession();
1372
1373 Query q = session.createQuery(sql);
1374
1375 for (WikiPageResource wikiPageResource : (List<WikiPageResource>)q.list()) {
1376 map.put(wikiPageResource.getPrimaryKeyObj(), wikiPageResource);
1377
1378 cacheResult(wikiPageResource);
1379
1380 uncachedPrimaryKeys.remove(wikiPageResource.getPrimaryKeyObj());
1381 }
1382
1383 for (Serializable primaryKey : uncachedPrimaryKeys) {
1384 EntityCacheUtil.putResult(WikiPageResourceModelImpl.ENTITY_CACHE_ENABLED,
1385 WikiPageResourceImpl.class, primaryKey,
1386 _nullWikiPageResource);
1387 }
1388 }
1389 catch (Exception e) {
1390 throw processException(e);
1391 }
1392 finally {
1393 closeSession(session);
1394 }
1395
1396 return map;
1397 }
1398
1399
1404 @Override
1405 public List<WikiPageResource> findAll() {
1406 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1407 }
1408
1409
1420 @Override
1421 public List<WikiPageResource> findAll(int start, int end) {
1422 return findAll(start, end, null);
1423 }
1424
1425
1437 @Override
1438 public List<WikiPageResource> findAll(int start, int end,
1439 OrderByComparator<WikiPageResource> orderByComparator) {
1440 boolean pagination = true;
1441 FinderPath finderPath = null;
1442 Object[] finderArgs = null;
1443
1444 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1445 (orderByComparator == null)) {
1446 pagination = false;
1447 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1448 finderArgs = FINDER_ARGS_EMPTY;
1449 }
1450 else {
1451 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1452 finderArgs = new Object[] { start, end, orderByComparator };
1453 }
1454
1455 List<WikiPageResource> list = (List<WikiPageResource>)FinderCacheUtil.getResult(finderPath,
1456 finderArgs, this);
1457
1458 if (list == null) {
1459 StringBundler query = null;
1460 String sql = null;
1461
1462 if (orderByComparator != null) {
1463 query = new StringBundler(2 +
1464 (orderByComparator.getOrderByFields().length * 3));
1465
1466 query.append(_SQL_SELECT_WIKIPAGERESOURCE);
1467
1468 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1469 orderByComparator);
1470
1471 sql = query.toString();
1472 }
1473 else {
1474 sql = _SQL_SELECT_WIKIPAGERESOURCE;
1475
1476 if (pagination) {
1477 sql = sql.concat(WikiPageResourceModelImpl.ORDER_BY_JPQL);
1478 }
1479 }
1480
1481 Session session = null;
1482
1483 try {
1484 session = openSession();
1485
1486 Query q = session.createQuery(sql);
1487
1488 if (!pagination) {
1489 list = (List<WikiPageResource>)QueryUtil.list(q,
1490 getDialect(), start, end, false);
1491
1492 Collections.sort(list);
1493
1494 list = Collections.unmodifiableList(list);
1495 }
1496 else {
1497 list = (List<WikiPageResource>)QueryUtil.list(q,
1498 getDialect(), start, end);
1499 }
1500
1501 cacheResult(list);
1502
1503 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1504 }
1505 catch (Exception e) {
1506 FinderCacheUtil.removeResult(finderPath, finderArgs);
1507
1508 throw processException(e);
1509 }
1510 finally {
1511 closeSession(session);
1512 }
1513 }
1514
1515 return list;
1516 }
1517
1518
1522 @Override
1523 public void removeAll() {
1524 for (WikiPageResource wikiPageResource : findAll()) {
1525 remove(wikiPageResource);
1526 }
1527 }
1528
1529
1534 @Override
1535 public int countAll() {
1536 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1537 FINDER_ARGS_EMPTY, this);
1538
1539 if (count == null) {
1540 Session session = null;
1541
1542 try {
1543 session = openSession();
1544
1545 Query q = session.createQuery(_SQL_COUNT_WIKIPAGERESOURCE);
1546
1547 count = (Long)q.uniqueResult();
1548
1549 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1550 FINDER_ARGS_EMPTY, count);
1551 }
1552 catch (Exception e) {
1553 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_ALL,
1554 FINDER_ARGS_EMPTY);
1555
1556 throw processException(e);
1557 }
1558 finally {
1559 closeSession(session);
1560 }
1561 }
1562
1563 return count.intValue();
1564 }
1565
1566 @Override
1567 protected Set<String> getBadColumnNames() {
1568 return _badColumnNames;
1569 }
1570
1571
1574 public void afterPropertiesSet() {
1575 }
1576
1577 public void destroy() {
1578 EntityCacheUtil.removeCache(WikiPageResourceImpl.class.getName());
1579 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1580 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1581 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1582 }
1583
1584 private static final String _SQL_SELECT_WIKIPAGERESOURCE = "SELECT wikiPageResource FROM WikiPageResource wikiPageResource";
1585 private static final String _SQL_SELECT_WIKIPAGERESOURCE_WHERE_PKS_IN = "SELECT wikiPageResource FROM WikiPageResource wikiPageResource WHERE resourcePrimKey IN (";
1586 private static final String _SQL_SELECT_WIKIPAGERESOURCE_WHERE = "SELECT wikiPageResource FROM WikiPageResource wikiPageResource WHERE ";
1587 private static final String _SQL_COUNT_WIKIPAGERESOURCE = "SELECT COUNT(wikiPageResource) FROM WikiPageResource wikiPageResource";
1588 private static final String _SQL_COUNT_WIKIPAGERESOURCE_WHERE = "SELECT COUNT(wikiPageResource) FROM WikiPageResource wikiPageResource WHERE ";
1589 private static final String _ORDER_BY_ENTITY_ALIAS = "wikiPageResource.";
1590 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No WikiPageResource exists with the primary key ";
1591 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No WikiPageResource exists with the key {";
1592 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
1593 private static final Log _log = LogFactoryUtil.getLog(WikiPageResourcePersistenceImpl.class);
1594 private static final Set<String> _badColumnNames = SetUtil.fromArray(new String[] {
1595 "uuid"
1596 });
1597 private static final WikiPageResource _nullWikiPageResource = new WikiPageResourceImpl() {
1598 @Override
1599 public Object clone() {
1600 return this;
1601 }
1602
1603 @Override
1604 public CacheModel<WikiPageResource> toCacheModel() {
1605 return _nullWikiPageResourceCacheModel;
1606 }
1607 };
1608
1609 private static final CacheModel<WikiPageResource> _nullWikiPageResourceCacheModel =
1610 new CacheModel<WikiPageResource>() {
1611 @Override
1612 public WikiPageResource toEntityModel() {
1613 return _nullWikiPageResource;
1614 }
1615 };
1616 }