001
014
015 package com.liferay.portlet.expando.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.SQLQuery;
027 import com.liferay.portal.kernel.dao.orm.Session;
028 import com.liferay.portal.kernel.log.Log;
029 import com.liferay.portal.kernel.log.LogFactoryUtil;
030 import com.liferay.portal.kernel.util.ArrayUtil;
031 import com.liferay.portal.kernel.util.OrderByComparator;
032 import com.liferay.portal.kernel.util.SetUtil;
033 import com.liferay.portal.kernel.util.StringBundler;
034 import com.liferay.portal.kernel.util.StringPool;
035 import com.liferay.portal.kernel.util.StringUtil;
036 import com.liferay.portal.kernel.util.Validator;
037 import com.liferay.portal.model.CacheModel;
038 import com.liferay.portal.security.permission.InlineSQLHelperUtil;
039 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
040
041 import com.liferay.portlet.expando.NoSuchColumnException;
042 import com.liferay.portlet.expando.model.ExpandoColumn;
043 import com.liferay.portlet.expando.model.impl.ExpandoColumnImpl;
044 import com.liferay.portlet.expando.model.impl.ExpandoColumnModelImpl;
045 import com.liferay.portlet.expando.service.persistence.ExpandoColumnPersistence;
046
047 import java.io.Serializable;
048
049 import java.util.ArrayList;
050 import java.util.Collections;
051 import java.util.HashMap;
052 import java.util.HashSet;
053 import java.util.Iterator;
054 import java.util.List;
055 import java.util.Map;
056 import java.util.Set;
057
058
070 @ProviderType
071 public class ExpandoColumnPersistenceImpl extends BasePersistenceImpl<ExpandoColumn>
072 implements ExpandoColumnPersistence {
073
078 public static final String FINDER_CLASS_NAME_ENTITY = ExpandoColumnImpl.class.getName();
079 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
080 ".List1";
081 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
082 ".List2";
083 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
084 ExpandoColumnModelImpl.FINDER_CACHE_ENABLED,
085 ExpandoColumnImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
086 "findAll", new String[0]);
087 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
088 ExpandoColumnModelImpl.FINDER_CACHE_ENABLED,
089 ExpandoColumnImpl.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
090 "findAll", new String[0]);
091 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
092 ExpandoColumnModelImpl.FINDER_CACHE_ENABLED, Long.class,
093 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
094 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_TABLEID = new FinderPath(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
095 ExpandoColumnModelImpl.FINDER_CACHE_ENABLED,
096 ExpandoColumnImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
097 "findByTableId",
098 new String[] {
099 Long.class.getName(),
100
101 Integer.class.getName(), Integer.class.getName(),
102 OrderByComparator.class.getName()
103 });
104 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TABLEID =
105 new FinderPath(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
106 ExpandoColumnModelImpl.FINDER_CACHE_ENABLED,
107 ExpandoColumnImpl.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
108 "findByTableId", new String[] { Long.class.getName() },
109 ExpandoColumnModelImpl.TABLEID_COLUMN_BITMASK |
110 ExpandoColumnModelImpl.NAME_COLUMN_BITMASK);
111 public static final FinderPath FINDER_PATH_COUNT_BY_TABLEID = new FinderPath(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
112 ExpandoColumnModelImpl.FINDER_CACHE_ENABLED, Long.class,
113 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByTableId",
114 new String[] { Long.class.getName() });
115
116
122 @Override
123 public List<ExpandoColumn> findByTableId(long tableId) {
124 return findByTableId(tableId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
125 }
126
127
139 @Override
140 public List<ExpandoColumn> findByTableId(long tableId, int start, int end) {
141 return findByTableId(tableId, start, end, null);
142 }
143
144
157 @Override
158 public List<ExpandoColumn> findByTableId(long tableId, int start, int end,
159 OrderByComparator<ExpandoColumn> orderByComparator) {
160 boolean pagination = true;
161 FinderPath finderPath = null;
162 Object[] finderArgs = null;
163
164 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
165 (orderByComparator == null)) {
166 pagination = false;
167 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TABLEID;
168 finderArgs = new Object[] { tableId };
169 }
170 else {
171 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_TABLEID;
172 finderArgs = new Object[] { tableId, start, end, orderByComparator };
173 }
174
175 List<ExpandoColumn> list = (List<ExpandoColumn>)FinderCacheUtil.getResult(finderPath,
176 finderArgs, this);
177
178 if ((list != null) && !list.isEmpty()) {
179 for (ExpandoColumn expandoColumn : list) {
180 if ((tableId != expandoColumn.getTableId())) {
181 list = null;
182
183 break;
184 }
185 }
186 }
187
188 if (list == null) {
189 StringBundler query = null;
190
191 if (orderByComparator != null) {
192 query = new StringBundler(3 +
193 (orderByComparator.getOrderByFields().length * 3));
194 }
195 else {
196 query = new StringBundler(3);
197 }
198
199 query.append(_SQL_SELECT_EXPANDOCOLUMN_WHERE);
200
201 query.append(_FINDER_COLUMN_TABLEID_TABLEID_2);
202
203 if (orderByComparator != null) {
204 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
205 orderByComparator);
206 }
207 else
208 if (pagination) {
209 query.append(ExpandoColumnModelImpl.ORDER_BY_JPQL);
210 }
211
212 String sql = query.toString();
213
214 Session session = null;
215
216 try {
217 session = openSession();
218
219 Query q = session.createQuery(sql);
220
221 QueryPos qPos = QueryPos.getInstance(q);
222
223 qPos.add(tableId);
224
225 if (!pagination) {
226 list = (List<ExpandoColumn>)QueryUtil.list(q, getDialect(),
227 start, end, false);
228
229 Collections.sort(list);
230
231 list = Collections.unmodifiableList(list);
232 }
233 else {
234 list = (List<ExpandoColumn>)QueryUtil.list(q, getDialect(),
235 start, end);
236 }
237
238 cacheResult(list);
239
240 FinderCacheUtil.putResult(finderPath, finderArgs, list);
241 }
242 catch (Exception e) {
243 FinderCacheUtil.removeResult(finderPath, finderArgs);
244
245 throw processException(e);
246 }
247 finally {
248 closeSession(session);
249 }
250 }
251
252 return list;
253 }
254
255
263 @Override
264 public ExpandoColumn findByTableId_First(long tableId,
265 OrderByComparator<ExpandoColumn> orderByComparator)
266 throws NoSuchColumnException {
267 ExpandoColumn expandoColumn = fetchByTableId_First(tableId,
268 orderByComparator);
269
270 if (expandoColumn != null) {
271 return expandoColumn;
272 }
273
274 StringBundler msg = new StringBundler(4);
275
276 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
277
278 msg.append("tableId=");
279 msg.append(tableId);
280
281 msg.append(StringPool.CLOSE_CURLY_BRACE);
282
283 throw new NoSuchColumnException(msg.toString());
284 }
285
286
293 @Override
294 public ExpandoColumn fetchByTableId_First(long tableId,
295 OrderByComparator<ExpandoColumn> orderByComparator) {
296 List<ExpandoColumn> list = findByTableId(tableId, 0, 1,
297 orderByComparator);
298
299 if (!list.isEmpty()) {
300 return list.get(0);
301 }
302
303 return null;
304 }
305
306
314 @Override
315 public ExpandoColumn findByTableId_Last(long tableId,
316 OrderByComparator<ExpandoColumn> orderByComparator)
317 throws NoSuchColumnException {
318 ExpandoColumn expandoColumn = fetchByTableId_Last(tableId,
319 orderByComparator);
320
321 if (expandoColumn != null) {
322 return expandoColumn;
323 }
324
325 StringBundler msg = new StringBundler(4);
326
327 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
328
329 msg.append("tableId=");
330 msg.append(tableId);
331
332 msg.append(StringPool.CLOSE_CURLY_BRACE);
333
334 throw new NoSuchColumnException(msg.toString());
335 }
336
337
344 @Override
345 public ExpandoColumn fetchByTableId_Last(long tableId,
346 OrderByComparator<ExpandoColumn> orderByComparator) {
347 int count = countByTableId(tableId);
348
349 if (count == 0) {
350 return null;
351 }
352
353 List<ExpandoColumn> list = findByTableId(tableId, count - 1, count,
354 orderByComparator);
355
356 if (!list.isEmpty()) {
357 return list.get(0);
358 }
359
360 return null;
361 }
362
363
372 @Override
373 public ExpandoColumn[] findByTableId_PrevAndNext(long columnId,
374 long tableId, OrderByComparator<ExpandoColumn> orderByComparator)
375 throws NoSuchColumnException {
376 ExpandoColumn expandoColumn = findByPrimaryKey(columnId);
377
378 Session session = null;
379
380 try {
381 session = openSession();
382
383 ExpandoColumn[] array = new ExpandoColumnImpl[3];
384
385 array[0] = getByTableId_PrevAndNext(session, expandoColumn,
386 tableId, orderByComparator, true);
387
388 array[1] = expandoColumn;
389
390 array[2] = getByTableId_PrevAndNext(session, expandoColumn,
391 tableId, orderByComparator, false);
392
393 return array;
394 }
395 catch (Exception e) {
396 throw processException(e);
397 }
398 finally {
399 closeSession(session);
400 }
401 }
402
403 protected ExpandoColumn getByTableId_PrevAndNext(Session session,
404 ExpandoColumn expandoColumn, long tableId,
405 OrderByComparator<ExpandoColumn> orderByComparator, boolean previous) {
406 StringBundler query = null;
407
408 if (orderByComparator != null) {
409 query = new StringBundler(6 +
410 (orderByComparator.getOrderByFields().length * 6));
411 }
412 else {
413 query = new StringBundler(3);
414 }
415
416 query.append(_SQL_SELECT_EXPANDOCOLUMN_WHERE);
417
418 query.append(_FINDER_COLUMN_TABLEID_TABLEID_2);
419
420 if (orderByComparator != null) {
421 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
422
423 if (orderByConditionFields.length > 0) {
424 query.append(WHERE_AND);
425 }
426
427 for (int i = 0; i < orderByConditionFields.length; i++) {
428 query.append(_ORDER_BY_ENTITY_ALIAS);
429 query.append(orderByConditionFields[i]);
430
431 if ((i + 1) < orderByConditionFields.length) {
432 if (orderByComparator.isAscending() ^ previous) {
433 query.append(WHERE_GREATER_THAN_HAS_NEXT);
434 }
435 else {
436 query.append(WHERE_LESSER_THAN_HAS_NEXT);
437 }
438 }
439 else {
440 if (orderByComparator.isAscending() ^ previous) {
441 query.append(WHERE_GREATER_THAN);
442 }
443 else {
444 query.append(WHERE_LESSER_THAN);
445 }
446 }
447 }
448
449 query.append(ORDER_BY_CLAUSE);
450
451 String[] orderByFields = orderByComparator.getOrderByFields();
452
453 for (int i = 0; i < orderByFields.length; i++) {
454 query.append(_ORDER_BY_ENTITY_ALIAS);
455 query.append(orderByFields[i]);
456
457 if ((i + 1) < orderByFields.length) {
458 if (orderByComparator.isAscending() ^ previous) {
459 query.append(ORDER_BY_ASC_HAS_NEXT);
460 }
461 else {
462 query.append(ORDER_BY_DESC_HAS_NEXT);
463 }
464 }
465 else {
466 if (orderByComparator.isAscending() ^ previous) {
467 query.append(ORDER_BY_ASC);
468 }
469 else {
470 query.append(ORDER_BY_DESC);
471 }
472 }
473 }
474 }
475 else {
476 query.append(ExpandoColumnModelImpl.ORDER_BY_JPQL);
477 }
478
479 String sql = query.toString();
480
481 Query q = session.createQuery(sql);
482
483 q.setFirstResult(0);
484 q.setMaxResults(2);
485
486 QueryPos qPos = QueryPos.getInstance(q);
487
488 qPos.add(tableId);
489
490 if (orderByComparator != null) {
491 Object[] values = orderByComparator.getOrderByConditionValues(expandoColumn);
492
493 for (Object value : values) {
494 qPos.add(value);
495 }
496 }
497
498 List<ExpandoColumn> list = q.list();
499
500 if (list.size() == 2) {
501 return list.get(1);
502 }
503 else {
504 return null;
505 }
506 }
507
508
514 @Override
515 public List<ExpandoColumn> filterFindByTableId(long tableId) {
516 return filterFindByTableId(tableId, QueryUtil.ALL_POS,
517 QueryUtil.ALL_POS, null);
518 }
519
520
532 @Override
533 public List<ExpandoColumn> filterFindByTableId(long tableId, int start,
534 int end) {
535 return filterFindByTableId(tableId, start, end, null);
536 }
537
538
551 @Override
552 public List<ExpandoColumn> filterFindByTableId(long tableId, int start,
553 int end, OrderByComparator<ExpandoColumn> orderByComparator) {
554 if (!InlineSQLHelperUtil.isEnabled()) {
555 return findByTableId(tableId, start, end, orderByComparator);
556 }
557
558 StringBundler query = null;
559
560 if (orderByComparator != null) {
561 query = new StringBundler(3 +
562 (orderByComparator.getOrderByFields().length * 3));
563 }
564 else {
565 query = new StringBundler(3);
566 }
567
568 if (getDB().isSupportsInlineDistinct()) {
569 query.append(_FILTER_SQL_SELECT_EXPANDOCOLUMN_WHERE);
570 }
571 else {
572 query.append(_FILTER_SQL_SELECT_EXPANDOCOLUMN_NO_INLINE_DISTINCT_WHERE_1);
573 }
574
575 query.append(_FINDER_COLUMN_TABLEID_TABLEID_2);
576
577 if (!getDB().isSupportsInlineDistinct()) {
578 query.append(_FILTER_SQL_SELECT_EXPANDOCOLUMN_NO_INLINE_DISTINCT_WHERE_2);
579 }
580
581 if (orderByComparator != null) {
582 if (getDB().isSupportsInlineDistinct()) {
583 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
584 orderByComparator, true);
585 }
586 else {
587 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
588 orderByComparator, true);
589 }
590 }
591 else {
592 if (getDB().isSupportsInlineDistinct()) {
593 query.append(ExpandoColumnModelImpl.ORDER_BY_JPQL);
594 }
595 else {
596 query.append(ExpandoColumnModelImpl.ORDER_BY_SQL);
597 }
598 }
599
600 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
601 ExpandoColumn.class.getName(),
602 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
603
604 Session session = null;
605
606 try {
607 session = openSession();
608
609 SQLQuery q = session.createSynchronizedSQLQuery(sql);
610
611 if (getDB().isSupportsInlineDistinct()) {
612 q.addEntity(_FILTER_ENTITY_ALIAS, ExpandoColumnImpl.class);
613 }
614 else {
615 q.addEntity(_FILTER_ENTITY_TABLE, ExpandoColumnImpl.class);
616 }
617
618 QueryPos qPos = QueryPos.getInstance(q);
619
620 qPos.add(tableId);
621
622 return (List<ExpandoColumn>)QueryUtil.list(q, getDialect(), start,
623 end);
624 }
625 catch (Exception e) {
626 throw processException(e);
627 }
628 finally {
629 closeSession(session);
630 }
631 }
632
633
642 @Override
643 public ExpandoColumn[] filterFindByTableId_PrevAndNext(long columnId,
644 long tableId, OrderByComparator<ExpandoColumn> orderByComparator)
645 throws NoSuchColumnException {
646 if (!InlineSQLHelperUtil.isEnabled()) {
647 return findByTableId_PrevAndNext(columnId, tableId,
648 orderByComparator);
649 }
650
651 ExpandoColumn expandoColumn = findByPrimaryKey(columnId);
652
653 Session session = null;
654
655 try {
656 session = openSession();
657
658 ExpandoColumn[] array = new ExpandoColumnImpl[3];
659
660 array[0] = filterGetByTableId_PrevAndNext(session, expandoColumn,
661 tableId, orderByComparator, true);
662
663 array[1] = expandoColumn;
664
665 array[2] = filterGetByTableId_PrevAndNext(session, expandoColumn,
666 tableId, orderByComparator, false);
667
668 return array;
669 }
670 catch (Exception e) {
671 throw processException(e);
672 }
673 finally {
674 closeSession(session);
675 }
676 }
677
678 protected ExpandoColumn filterGetByTableId_PrevAndNext(Session session,
679 ExpandoColumn expandoColumn, long tableId,
680 OrderByComparator<ExpandoColumn> orderByComparator, boolean previous) {
681 StringBundler query = null;
682
683 if (orderByComparator != null) {
684 query = new StringBundler(6 +
685 (orderByComparator.getOrderByFields().length * 6));
686 }
687 else {
688 query = new StringBundler(3);
689 }
690
691 if (getDB().isSupportsInlineDistinct()) {
692 query.append(_FILTER_SQL_SELECT_EXPANDOCOLUMN_WHERE);
693 }
694 else {
695 query.append(_FILTER_SQL_SELECT_EXPANDOCOLUMN_NO_INLINE_DISTINCT_WHERE_1);
696 }
697
698 query.append(_FINDER_COLUMN_TABLEID_TABLEID_2);
699
700 if (!getDB().isSupportsInlineDistinct()) {
701 query.append(_FILTER_SQL_SELECT_EXPANDOCOLUMN_NO_INLINE_DISTINCT_WHERE_2);
702 }
703
704 if (orderByComparator != null) {
705 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
706
707 if (orderByConditionFields.length > 0) {
708 query.append(WHERE_AND);
709 }
710
711 for (int i = 0; i < orderByConditionFields.length; i++) {
712 if (getDB().isSupportsInlineDistinct()) {
713 query.append(_ORDER_BY_ENTITY_ALIAS);
714 }
715 else {
716 query.append(_ORDER_BY_ENTITY_TABLE);
717 }
718
719 query.append(orderByConditionFields[i]);
720
721 if ((i + 1) < orderByConditionFields.length) {
722 if (orderByComparator.isAscending() ^ previous) {
723 query.append(WHERE_GREATER_THAN_HAS_NEXT);
724 }
725 else {
726 query.append(WHERE_LESSER_THAN_HAS_NEXT);
727 }
728 }
729 else {
730 if (orderByComparator.isAscending() ^ previous) {
731 query.append(WHERE_GREATER_THAN);
732 }
733 else {
734 query.append(WHERE_LESSER_THAN);
735 }
736 }
737 }
738
739 query.append(ORDER_BY_CLAUSE);
740
741 String[] orderByFields = orderByComparator.getOrderByFields();
742
743 for (int i = 0; i < orderByFields.length; i++) {
744 if (getDB().isSupportsInlineDistinct()) {
745 query.append(_ORDER_BY_ENTITY_ALIAS);
746 }
747 else {
748 query.append(_ORDER_BY_ENTITY_TABLE);
749 }
750
751 query.append(orderByFields[i]);
752
753 if ((i + 1) < orderByFields.length) {
754 if (orderByComparator.isAscending() ^ previous) {
755 query.append(ORDER_BY_ASC_HAS_NEXT);
756 }
757 else {
758 query.append(ORDER_BY_DESC_HAS_NEXT);
759 }
760 }
761 else {
762 if (orderByComparator.isAscending() ^ previous) {
763 query.append(ORDER_BY_ASC);
764 }
765 else {
766 query.append(ORDER_BY_DESC);
767 }
768 }
769 }
770 }
771 else {
772 if (getDB().isSupportsInlineDistinct()) {
773 query.append(ExpandoColumnModelImpl.ORDER_BY_JPQL);
774 }
775 else {
776 query.append(ExpandoColumnModelImpl.ORDER_BY_SQL);
777 }
778 }
779
780 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
781 ExpandoColumn.class.getName(),
782 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
783
784 SQLQuery q = session.createSynchronizedSQLQuery(sql);
785
786 q.setFirstResult(0);
787 q.setMaxResults(2);
788
789 if (getDB().isSupportsInlineDistinct()) {
790 q.addEntity(_FILTER_ENTITY_ALIAS, ExpandoColumnImpl.class);
791 }
792 else {
793 q.addEntity(_FILTER_ENTITY_TABLE, ExpandoColumnImpl.class);
794 }
795
796 QueryPos qPos = QueryPos.getInstance(q);
797
798 qPos.add(tableId);
799
800 if (orderByComparator != null) {
801 Object[] values = orderByComparator.getOrderByConditionValues(expandoColumn);
802
803 for (Object value : values) {
804 qPos.add(value);
805 }
806 }
807
808 List<ExpandoColumn> list = q.list();
809
810 if (list.size() == 2) {
811 return list.get(1);
812 }
813 else {
814 return null;
815 }
816 }
817
818
823 @Override
824 public void removeByTableId(long tableId) {
825 for (ExpandoColumn expandoColumn : findByTableId(tableId,
826 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
827 remove(expandoColumn);
828 }
829 }
830
831
837 @Override
838 public int countByTableId(long tableId) {
839 FinderPath finderPath = FINDER_PATH_COUNT_BY_TABLEID;
840
841 Object[] finderArgs = new Object[] { tableId };
842
843 Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
844 this);
845
846 if (count == null) {
847 StringBundler query = new StringBundler(2);
848
849 query.append(_SQL_COUNT_EXPANDOCOLUMN_WHERE);
850
851 query.append(_FINDER_COLUMN_TABLEID_TABLEID_2);
852
853 String sql = query.toString();
854
855 Session session = null;
856
857 try {
858 session = openSession();
859
860 Query q = session.createQuery(sql);
861
862 QueryPos qPos = QueryPos.getInstance(q);
863
864 qPos.add(tableId);
865
866 count = (Long)q.uniqueResult();
867
868 FinderCacheUtil.putResult(finderPath, finderArgs, count);
869 }
870 catch (Exception e) {
871 FinderCacheUtil.removeResult(finderPath, finderArgs);
872
873 throw processException(e);
874 }
875 finally {
876 closeSession(session);
877 }
878 }
879
880 return count.intValue();
881 }
882
883
889 @Override
890 public int filterCountByTableId(long tableId) {
891 if (!InlineSQLHelperUtil.isEnabled()) {
892 return countByTableId(tableId);
893 }
894
895 StringBundler query = new StringBundler(2);
896
897 query.append(_FILTER_SQL_COUNT_EXPANDOCOLUMN_WHERE);
898
899 query.append(_FINDER_COLUMN_TABLEID_TABLEID_2);
900
901 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
902 ExpandoColumn.class.getName(),
903 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
904
905 Session session = null;
906
907 try {
908 session = openSession();
909
910 SQLQuery q = session.createSynchronizedSQLQuery(sql);
911
912 q.addScalar(COUNT_COLUMN_NAME,
913 com.liferay.portal.kernel.dao.orm.Type.LONG);
914
915 QueryPos qPos = QueryPos.getInstance(q);
916
917 qPos.add(tableId);
918
919 Long count = (Long)q.uniqueResult();
920
921 return count.intValue();
922 }
923 catch (Exception e) {
924 throw processException(e);
925 }
926 finally {
927 closeSession(session);
928 }
929 }
930
931 private static final String _FINDER_COLUMN_TABLEID_TABLEID_2 = "expandoColumn.tableId = ?";
932 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_T_N = new FinderPath(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
933 ExpandoColumnModelImpl.FINDER_CACHE_ENABLED,
934 ExpandoColumnImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
935 "findByT_N",
936 new String[] {
937 Long.class.getName(), String.class.getName(),
938
939 Integer.class.getName(), Integer.class.getName(),
940 OrderByComparator.class.getName()
941 });
942 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_T_N = new FinderPath(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
943 ExpandoColumnModelImpl.FINDER_CACHE_ENABLED,
944 ExpandoColumnImpl.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
945 "findByT_N",
946 new String[] { Long.class.getName(), String.class.getName() },
947 ExpandoColumnModelImpl.TABLEID_COLUMN_BITMASK |
948 ExpandoColumnModelImpl.NAME_COLUMN_BITMASK);
949 public static final FinderPath FINDER_PATH_FETCH_BY_T_N = new FinderPath(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
950 ExpandoColumnModelImpl.FINDER_CACHE_ENABLED,
951 ExpandoColumnImpl.class, FINDER_CLASS_NAME_ENTITY, "fetchByT_N",
952 new String[] { Long.class.getName(), String.class.getName() },
953 ExpandoColumnModelImpl.TABLEID_COLUMN_BITMASK |
954 ExpandoColumnModelImpl.NAME_COLUMN_BITMASK);
955 public static final FinderPath FINDER_PATH_COUNT_BY_T_N = new FinderPath(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
956 ExpandoColumnModelImpl.FINDER_CACHE_ENABLED, Long.class,
957 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByT_N",
958 new String[] { Long.class.getName(), String.class.getName() });
959 public static final FinderPath FINDER_PATH_WITH_PAGINATION_COUNT_BY_T_N = new FinderPath(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
960 ExpandoColumnModelImpl.FINDER_CACHE_ENABLED, Long.class,
961 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByT_N",
962 new String[] { Long.class.getName(), String.class.getName() });
963
964
975 @Override
976 public List<ExpandoColumn> findByT_N(long tableId, String[] names) {
977 return findByT_N(tableId, names, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
978 null);
979 }
980
981
994 @Override
995 public List<ExpandoColumn> findByT_N(long tableId, String[] names,
996 int start, int end) {
997 return findByT_N(tableId, names, start, end, null);
998 }
999
1000
1014 @Override
1015 public List<ExpandoColumn> findByT_N(long tableId, String[] names,
1016 int start, int end, OrderByComparator<ExpandoColumn> orderByComparator) {
1017 if (names == null) {
1018 names = new String[0];
1019 }
1020 else {
1021 names = ArrayUtil.distinct(names, NULL_SAFE_STRING_COMPARATOR);
1022 }
1023
1024 if (names.length == 1) {
1025 ExpandoColumn expandoColumn = fetchByT_N(tableId, names[0]);
1026
1027 if (expandoColumn == null) {
1028 return Collections.emptyList();
1029 }
1030 else {
1031 List<ExpandoColumn> list = new ArrayList<ExpandoColumn>(1);
1032
1033 list.add(expandoColumn);
1034
1035 return list;
1036 }
1037 }
1038
1039 boolean pagination = true;
1040 Object[] finderArgs = null;
1041
1042 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1043 (orderByComparator == null)) {
1044 pagination = false;
1045 finderArgs = new Object[] { tableId, StringUtil.merge(names) };
1046 }
1047 else {
1048 finderArgs = new Object[] {
1049 tableId, StringUtil.merge(names),
1050
1051 start, end, orderByComparator
1052 };
1053 }
1054
1055 List<ExpandoColumn> list = (List<ExpandoColumn>)FinderCacheUtil.getResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_T_N,
1056 finderArgs, this);
1057
1058 if ((list != null) && !list.isEmpty()) {
1059 for (ExpandoColumn expandoColumn : list) {
1060 if ((tableId != expandoColumn.getTableId()) ||
1061 !ArrayUtil.contains(names, expandoColumn.getName())) {
1062 list = null;
1063
1064 break;
1065 }
1066 }
1067 }
1068
1069 if (list == null) {
1070 StringBundler query = new StringBundler();
1071
1072 query.append(_SQL_SELECT_EXPANDOCOLUMN_WHERE);
1073
1074 query.append(_FINDER_COLUMN_T_N_TABLEID_2);
1075
1076 if (names.length > 0) {
1077 query.append(StringPool.OPEN_PARENTHESIS);
1078
1079 for (int i = 0; i < names.length; i++) {
1080 String name = names[i];
1081
1082 if (name == null) {
1083 query.append(_FINDER_COLUMN_T_N_NAME_1);
1084 }
1085 else if (name.equals(StringPool.BLANK)) {
1086 query.append(_FINDER_COLUMN_T_N_NAME_3);
1087 }
1088 else {
1089 query.append(_FINDER_COLUMN_T_N_NAME_2);
1090 }
1091
1092 if ((i + 1) < names.length) {
1093 query.append(WHERE_OR);
1094 }
1095 }
1096
1097 query.append(StringPool.CLOSE_PARENTHESIS);
1098 }
1099
1100 query.setStringAt(removeConjunction(query.stringAt(query.index() -
1101 1)), query.index() - 1);
1102
1103 if (orderByComparator != null) {
1104 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1105 orderByComparator);
1106 }
1107 else
1108 if (pagination) {
1109 query.append(ExpandoColumnModelImpl.ORDER_BY_JPQL);
1110 }
1111
1112 String sql = query.toString();
1113
1114 Session session = null;
1115
1116 try {
1117 session = openSession();
1118
1119 Query q = session.createQuery(sql);
1120
1121 QueryPos qPos = QueryPos.getInstance(q);
1122
1123 qPos.add(tableId);
1124
1125 for (String name : names) {
1126 if ((name != null) && !name.isEmpty()) {
1127 qPos.add(name);
1128 }
1129 }
1130
1131 if (!pagination) {
1132 list = (List<ExpandoColumn>)QueryUtil.list(q, getDialect(),
1133 start, end, false);
1134
1135 Collections.sort(list);
1136
1137 list = Collections.unmodifiableList(list);
1138 }
1139 else {
1140 list = (List<ExpandoColumn>)QueryUtil.list(q, getDialect(),
1141 start, end);
1142 }
1143
1144 cacheResult(list);
1145
1146 FinderCacheUtil.putResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_T_N,
1147 finderArgs, list);
1148 }
1149 catch (Exception e) {
1150 FinderCacheUtil.removeResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_T_N,
1151 finderArgs);
1152
1153 throw processException(e);
1154 }
1155 finally {
1156 closeSession(session);
1157 }
1158 }
1159
1160 return list;
1161 }
1162
1163
1171 @Override
1172 public ExpandoColumn findByT_N(long tableId, String name)
1173 throws NoSuchColumnException {
1174 ExpandoColumn expandoColumn = fetchByT_N(tableId, name);
1175
1176 if (expandoColumn == null) {
1177 StringBundler msg = new StringBundler(6);
1178
1179 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1180
1181 msg.append("tableId=");
1182 msg.append(tableId);
1183
1184 msg.append(", name=");
1185 msg.append(name);
1186
1187 msg.append(StringPool.CLOSE_CURLY_BRACE);
1188
1189 if (_log.isWarnEnabled()) {
1190 _log.warn(msg.toString());
1191 }
1192
1193 throw new NoSuchColumnException(msg.toString());
1194 }
1195
1196 return expandoColumn;
1197 }
1198
1199
1206 @Override
1207 public ExpandoColumn fetchByT_N(long tableId, String name) {
1208 return fetchByT_N(tableId, name, true);
1209 }
1210
1211
1219 @Override
1220 public ExpandoColumn fetchByT_N(long tableId, String name,
1221 boolean retrieveFromCache) {
1222 Object[] finderArgs = new Object[] { tableId, name };
1223
1224 Object result = null;
1225
1226 if (retrieveFromCache) {
1227 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_T_N,
1228 finderArgs, this);
1229 }
1230
1231 if (result instanceof ExpandoColumn) {
1232 ExpandoColumn expandoColumn = (ExpandoColumn)result;
1233
1234 if ((tableId != expandoColumn.getTableId()) ||
1235 !Validator.equals(name, expandoColumn.getName())) {
1236 result = null;
1237 }
1238 }
1239
1240 if (result == null) {
1241 StringBundler query = new StringBundler(4);
1242
1243 query.append(_SQL_SELECT_EXPANDOCOLUMN_WHERE);
1244
1245 query.append(_FINDER_COLUMN_T_N_TABLEID_2);
1246
1247 boolean bindName = false;
1248
1249 if (name == null) {
1250 query.append(_FINDER_COLUMN_T_N_NAME_1);
1251 }
1252 else if (name.equals(StringPool.BLANK)) {
1253 query.append(_FINDER_COLUMN_T_N_NAME_3);
1254 }
1255 else {
1256 bindName = true;
1257
1258 query.append(_FINDER_COLUMN_T_N_NAME_2);
1259 }
1260
1261 String sql = query.toString();
1262
1263 Session session = null;
1264
1265 try {
1266 session = openSession();
1267
1268 Query q = session.createQuery(sql);
1269
1270 QueryPos qPos = QueryPos.getInstance(q);
1271
1272 qPos.add(tableId);
1273
1274 if (bindName) {
1275 qPos.add(name);
1276 }
1277
1278 List<ExpandoColumn> list = q.list();
1279
1280 if (list.isEmpty()) {
1281 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_T_N,
1282 finderArgs, list);
1283 }
1284 else {
1285 ExpandoColumn expandoColumn = list.get(0);
1286
1287 result = expandoColumn;
1288
1289 cacheResult(expandoColumn);
1290
1291 if ((expandoColumn.getTableId() != tableId) ||
1292 (expandoColumn.getName() == null) ||
1293 !expandoColumn.getName().equals(name)) {
1294 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_T_N,
1295 finderArgs, expandoColumn);
1296 }
1297 }
1298 }
1299 catch (Exception e) {
1300 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_T_N,
1301 finderArgs);
1302
1303 throw processException(e);
1304 }
1305 finally {
1306 closeSession(session);
1307 }
1308 }
1309
1310 if (result instanceof List<?>) {
1311 return null;
1312 }
1313 else {
1314 return (ExpandoColumn)result;
1315 }
1316 }
1317
1318
1325 @Override
1326 public ExpandoColumn removeByT_N(long tableId, String name)
1327 throws NoSuchColumnException {
1328 ExpandoColumn expandoColumn = findByT_N(tableId, name);
1329
1330 return remove(expandoColumn);
1331 }
1332
1333
1340 @Override
1341 public int countByT_N(long tableId, String name) {
1342 FinderPath finderPath = FINDER_PATH_COUNT_BY_T_N;
1343
1344 Object[] finderArgs = new Object[] { tableId, name };
1345
1346 Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
1347 this);
1348
1349 if (count == null) {
1350 StringBundler query = new StringBundler(3);
1351
1352 query.append(_SQL_COUNT_EXPANDOCOLUMN_WHERE);
1353
1354 query.append(_FINDER_COLUMN_T_N_TABLEID_2);
1355
1356 boolean bindName = false;
1357
1358 if (name == null) {
1359 query.append(_FINDER_COLUMN_T_N_NAME_1);
1360 }
1361 else if (name.equals(StringPool.BLANK)) {
1362 query.append(_FINDER_COLUMN_T_N_NAME_3);
1363 }
1364 else {
1365 bindName = true;
1366
1367 query.append(_FINDER_COLUMN_T_N_NAME_2);
1368 }
1369
1370 String sql = query.toString();
1371
1372 Session session = null;
1373
1374 try {
1375 session = openSession();
1376
1377 Query q = session.createQuery(sql);
1378
1379 QueryPos qPos = QueryPos.getInstance(q);
1380
1381 qPos.add(tableId);
1382
1383 if (bindName) {
1384 qPos.add(name);
1385 }
1386
1387 count = (Long)q.uniqueResult();
1388
1389 FinderCacheUtil.putResult(finderPath, finderArgs, count);
1390 }
1391 catch (Exception e) {
1392 FinderCacheUtil.removeResult(finderPath, finderArgs);
1393
1394 throw processException(e);
1395 }
1396 finally {
1397 closeSession(session);
1398 }
1399 }
1400
1401 return count.intValue();
1402 }
1403
1404
1411 @Override
1412 public int countByT_N(long tableId, String[] names) {
1413 if (names == null) {
1414 names = new String[0];
1415 }
1416 else {
1417 names = ArrayUtil.distinct(names, NULL_SAFE_STRING_COMPARATOR);
1418 }
1419
1420 Object[] finderArgs = new Object[] { tableId, StringUtil.merge(names) };
1421
1422 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_T_N,
1423 finderArgs, this);
1424
1425 if (count == null) {
1426 StringBundler query = new StringBundler();
1427
1428 query.append(_SQL_COUNT_EXPANDOCOLUMN_WHERE);
1429
1430 query.append(_FINDER_COLUMN_T_N_TABLEID_2);
1431
1432 if (names.length > 0) {
1433 query.append(StringPool.OPEN_PARENTHESIS);
1434
1435 for (int i = 0; i < names.length; i++) {
1436 String name = names[i];
1437
1438 if (name == null) {
1439 query.append(_FINDER_COLUMN_T_N_NAME_1);
1440 }
1441 else if (name.equals(StringPool.BLANK)) {
1442 query.append(_FINDER_COLUMN_T_N_NAME_3);
1443 }
1444 else {
1445 query.append(_FINDER_COLUMN_T_N_NAME_2);
1446 }
1447
1448 if ((i + 1) < names.length) {
1449 query.append(WHERE_OR);
1450 }
1451 }
1452
1453 query.append(StringPool.CLOSE_PARENTHESIS);
1454 }
1455
1456 query.setStringAt(removeConjunction(query.stringAt(query.index() -
1457 1)), query.index() - 1);
1458
1459 String sql = query.toString();
1460
1461 Session session = null;
1462
1463 try {
1464 session = openSession();
1465
1466 Query q = session.createQuery(sql);
1467
1468 QueryPos qPos = QueryPos.getInstance(q);
1469
1470 qPos.add(tableId);
1471
1472 for (String name : names) {
1473 if ((name != null) && !name.isEmpty()) {
1474 qPos.add(name);
1475 }
1476 }
1477
1478 count = (Long)q.uniqueResult();
1479
1480 FinderCacheUtil.putResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_T_N,
1481 finderArgs, count);
1482 }
1483 catch (Exception e) {
1484 FinderCacheUtil.removeResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_T_N,
1485 finderArgs);
1486
1487 throw processException(e);
1488 }
1489 finally {
1490 closeSession(session);
1491 }
1492 }
1493
1494 return count.intValue();
1495 }
1496
1497
1504 @Override
1505 public int filterCountByT_N(long tableId, String name) {
1506 if (!InlineSQLHelperUtil.isEnabled()) {
1507 return countByT_N(tableId, name);
1508 }
1509
1510 StringBundler query = new StringBundler(3);
1511
1512 query.append(_FILTER_SQL_COUNT_EXPANDOCOLUMN_WHERE);
1513
1514 query.append(_FINDER_COLUMN_T_N_TABLEID_2);
1515
1516 boolean bindName = false;
1517
1518 if (name == null) {
1519 query.append(_FINDER_COLUMN_T_N_NAME_1);
1520 }
1521 else if (name.equals(StringPool.BLANK)) {
1522 query.append(_FINDER_COLUMN_T_N_NAME_3);
1523 }
1524 else {
1525 bindName = true;
1526
1527 query.append(_FINDER_COLUMN_T_N_NAME_2);
1528 }
1529
1530 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1531 ExpandoColumn.class.getName(),
1532 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
1533
1534 Session session = null;
1535
1536 try {
1537 session = openSession();
1538
1539 SQLQuery q = session.createSynchronizedSQLQuery(sql);
1540
1541 q.addScalar(COUNT_COLUMN_NAME,
1542 com.liferay.portal.kernel.dao.orm.Type.LONG);
1543
1544 QueryPos qPos = QueryPos.getInstance(q);
1545
1546 qPos.add(tableId);
1547
1548 if (bindName) {
1549 qPos.add(name);
1550 }
1551
1552 Long count = (Long)q.uniqueResult();
1553
1554 return count.intValue();
1555 }
1556 catch (Exception e) {
1557 throw processException(e);
1558 }
1559 finally {
1560 closeSession(session);
1561 }
1562 }
1563
1564
1571 @Override
1572 public int filterCountByT_N(long tableId, String[] names) {
1573 if (!InlineSQLHelperUtil.isEnabled()) {
1574 return countByT_N(tableId, names);
1575 }
1576
1577 if (names == null) {
1578 names = new String[0];
1579 }
1580 else {
1581 names = ArrayUtil.distinct(names, NULL_SAFE_STRING_COMPARATOR);
1582 }
1583
1584 StringBundler query = new StringBundler();
1585
1586 query.append(_FILTER_SQL_COUNT_EXPANDOCOLUMN_WHERE);
1587
1588 query.append(_FINDER_COLUMN_T_N_TABLEID_2);
1589
1590 if (names.length > 0) {
1591 query.append(StringPool.OPEN_PARENTHESIS);
1592
1593 for (int i = 0; i < names.length; i++) {
1594 String name = names[i];
1595
1596 if (name == null) {
1597 query.append(_FINDER_COLUMN_T_N_NAME_1);
1598 }
1599 else if (name.equals(StringPool.BLANK)) {
1600 query.append(_FINDER_COLUMN_T_N_NAME_3);
1601 }
1602 else {
1603 query.append(_FINDER_COLUMN_T_N_NAME_2);
1604 }
1605
1606 if ((i + 1) < names.length) {
1607 query.append(WHERE_OR);
1608 }
1609 }
1610
1611 query.append(StringPool.CLOSE_PARENTHESIS);
1612 }
1613
1614 query.setStringAt(removeConjunction(query.stringAt(query.index() - 1)),
1615 query.index() - 1);
1616
1617 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1618 ExpandoColumn.class.getName(),
1619 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
1620
1621 Session session = null;
1622
1623 try {
1624 session = openSession();
1625
1626 SQLQuery q = session.createSynchronizedSQLQuery(sql);
1627
1628 q.addScalar(COUNT_COLUMN_NAME,
1629 com.liferay.portal.kernel.dao.orm.Type.LONG);
1630
1631 QueryPos qPos = QueryPos.getInstance(q);
1632
1633 qPos.add(tableId);
1634
1635 for (String name : names) {
1636 if ((name != null) && !name.isEmpty()) {
1637 qPos.add(name);
1638 }
1639 }
1640
1641 Long count = (Long)q.uniqueResult();
1642
1643 return count.intValue();
1644 }
1645 catch (Exception e) {
1646 throw processException(e);
1647 }
1648 finally {
1649 closeSession(session);
1650 }
1651 }
1652
1653 private static final String _FINDER_COLUMN_T_N_TABLEID_2 = "expandoColumn.tableId = ? AND ";
1654 private static final String _FINDER_COLUMN_T_N_NAME_1 = "expandoColumn.name IS NULL";
1655 private static final String _FINDER_COLUMN_T_N_NAME_2 = "expandoColumn.name = ?";
1656 private static final String _FINDER_COLUMN_T_N_NAME_3 = "(expandoColumn.name IS NULL OR expandoColumn.name = '')";
1657
1658 public ExpandoColumnPersistenceImpl() {
1659 setModelClass(ExpandoColumn.class);
1660 }
1661
1662
1667 @Override
1668 public void cacheResult(ExpandoColumn expandoColumn) {
1669 EntityCacheUtil.putResult(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
1670 ExpandoColumnImpl.class, expandoColumn.getPrimaryKey(),
1671 expandoColumn);
1672
1673 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_T_N,
1674 new Object[] { expandoColumn.getTableId(), expandoColumn.getName() },
1675 expandoColumn);
1676
1677 expandoColumn.resetOriginalValues();
1678 }
1679
1680
1685 @Override
1686 public void cacheResult(List<ExpandoColumn> expandoColumns) {
1687 for (ExpandoColumn expandoColumn : expandoColumns) {
1688 if (EntityCacheUtil.getResult(
1689 ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
1690 ExpandoColumnImpl.class, expandoColumn.getPrimaryKey()) == null) {
1691 cacheResult(expandoColumn);
1692 }
1693 else {
1694 expandoColumn.resetOriginalValues();
1695 }
1696 }
1697 }
1698
1699
1706 @Override
1707 public void clearCache() {
1708 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
1709 CacheRegistryUtil.clear(ExpandoColumnImpl.class.getName());
1710 }
1711
1712 EntityCacheUtil.clearCache(ExpandoColumnImpl.class);
1713
1714 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
1715 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1716 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1717 }
1718
1719
1726 @Override
1727 public void clearCache(ExpandoColumn expandoColumn) {
1728 EntityCacheUtil.removeResult(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
1729 ExpandoColumnImpl.class, expandoColumn.getPrimaryKey());
1730
1731 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1732 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1733
1734 clearUniqueFindersCache(expandoColumn);
1735 }
1736
1737 @Override
1738 public void clearCache(List<ExpandoColumn> expandoColumns) {
1739 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1740 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1741
1742 for (ExpandoColumn expandoColumn : expandoColumns) {
1743 EntityCacheUtil.removeResult(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
1744 ExpandoColumnImpl.class, expandoColumn.getPrimaryKey());
1745
1746 clearUniqueFindersCache(expandoColumn);
1747 }
1748 }
1749
1750 protected void cacheUniqueFindersCache(ExpandoColumn expandoColumn) {
1751 if (expandoColumn.isNew()) {
1752 Object[] args = new Object[] {
1753 expandoColumn.getTableId(), expandoColumn.getName()
1754 };
1755
1756 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_T_N, args,
1757 Long.valueOf(1));
1758 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_T_N, args,
1759 expandoColumn);
1760 }
1761 else {
1762 ExpandoColumnModelImpl expandoColumnModelImpl = (ExpandoColumnModelImpl)expandoColumn;
1763
1764 if ((expandoColumnModelImpl.getColumnBitmask() &
1765 FINDER_PATH_FETCH_BY_T_N.getColumnBitmask()) != 0) {
1766 Object[] args = new Object[] {
1767 expandoColumn.getTableId(), expandoColumn.getName()
1768 };
1769
1770 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_T_N, args,
1771 Long.valueOf(1));
1772 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_T_N, args,
1773 expandoColumn);
1774 }
1775 }
1776 }
1777
1778 protected void clearUniqueFindersCache(ExpandoColumn expandoColumn) {
1779 ExpandoColumnModelImpl expandoColumnModelImpl = (ExpandoColumnModelImpl)expandoColumn;
1780
1781 Object[] args = new Object[] {
1782 expandoColumn.getTableId(), expandoColumn.getName()
1783 };
1784
1785 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_T_N, args);
1786 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_T_N, args);
1787
1788 if ((expandoColumnModelImpl.getColumnBitmask() &
1789 FINDER_PATH_FETCH_BY_T_N.getColumnBitmask()) != 0) {
1790 args = new Object[] {
1791 expandoColumnModelImpl.getOriginalTableId(),
1792 expandoColumnModelImpl.getOriginalName()
1793 };
1794
1795 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_T_N, args);
1796 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_T_N, args);
1797 }
1798 }
1799
1800
1806 @Override
1807 public ExpandoColumn create(long columnId) {
1808 ExpandoColumn expandoColumn = new ExpandoColumnImpl();
1809
1810 expandoColumn.setNew(true);
1811 expandoColumn.setPrimaryKey(columnId);
1812
1813 return expandoColumn;
1814 }
1815
1816
1823 @Override
1824 public ExpandoColumn remove(long columnId) throws NoSuchColumnException {
1825 return remove((Serializable)columnId);
1826 }
1827
1828
1835 @Override
1836 public ExpandoColumn remove(Serializable primaryKey)
1837 throws NoSuchColumnException {
1838 Session session = null;
1839
1840 try {
1841 session = openSession();
1842
1843 ExpandoColumn expandoColumn = (ExpandoColumn)session.get(ExpandoColumnImpl.class,
1844 primaryKey);
1845
1846 if (expandoColumn == null) {
1847 if (_log.isWarnEnabled()) {
1848 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
1849 }
1850
1851 throw new NoSuchColumnException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
1852 primaryKey);
1853 }
1854
1855 return remove(expandoColumn);
1856 }
1857 catch (NoSuchColumnException nsee) {
1858 throw nsee;
1859 }
1860 catch (Exception e) {
1861 throw processException(e);
1862 }
1863 finally {
1864 closeSession(session);
1865 }
1866 }
1867
1868 @Override
1869 protected ExpandoColumn removeImpl(ExpandoColumn expandoColumn) {
1870 expandoColumn = toUnwrappedModel(expandoColumn);
1871
1872 Session session = null;
1873
1874 try {
1875 session = openSession();
1876
1877 if (!session.contains(expandoColumn)) {
1878 expandoColumn = (ExpandoColumn)session.get(ExpandoColumnImpl.class,
1879 expandoColumn.getPrimaryKeyObj());
1880 }
1881
1882 if (expandoColumn != null) {
1883 session.delete(expandoColumn);
1884 }
1885 }
1886 catch (Exception e) {
1887 throw processException(e);
1888 }
1889 finally {
1890 closeSession(session);
1891 }
1892
1893 if (expandoColumn != null) {
1894 clearCache(expandoColumn);
1895 }
1896
1897 return expandoColumn;
1898 }
1899
1900 @Override
1901 public ExpandoColumn updateImpl(
1902 com.liferay.portlet.expando.model.ExpandoColumn expandoColumn) {
1903 expandoColumn = toUnwrappedModel(expandoColumn);
1904
1905 boolean isNew = expandoColumn.isNew();
1906
1907 ExpandoColumnModelImpl expandoColumnModelImpl = (ExpandoColumnModelImpl)expandoColumn;
1908
1909 Session session = null;
1910
1911 try {
1912 session = openSession();
1913
1914 if (expandoColumn.isNew()) {
1915 session.save(expandoColumn);
1916
1917 expandoColumn.setNew(false);
1918 }
1919 else {
1920 session.merge(expandoColumn);
1921 }
1922 }
1923 catch (Exception e) {
1924 throw processException(e);
1925 }
1926 finally {
1927 closeSession(session);
1928 }
1929
1930 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1931
1932 if (isNew || !ExpandoColumnModelImpl.COLUMN_BITMASK_ENABLED) {
1933 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1934 }
1935
1936 else {
1937 if ((expandoColumnModelImpl.getColumnBitmask() &
1938 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TABLEID.getColumnBitmask()) != 0) {
1939 Object[] args = new Object[] {
1940 expandoColumnModelImpl.getOriginalTableId()
1941 };
1942
1943 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_TABLEID, args);
1944 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TABLEID,
1945 args);
1946
1947 args = new Object[] { expandoColumnModelImpl.getTableId() };
1948
1949 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_TABLEID, args);
1950 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TABLEID,
1951 args);
1952 }
1953
1954 if ((expandoColumnModelImpl.getColumnBitmask() &
1955 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_T_N.getColumnBitmask()) != 0) {
1956 Object[] args = new Object[] {
1957 expandoColumnModelImpl.getOriginalTableId(),
1958 expandoColumnModelImpl.getOriginalName()
1959 };
1960
1961 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_T_N, args);
1962 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_T_N,
1963 args);
1964
1965 args = new Object[] {
1966 expandoColumnModelImpl.getTableId(),
1967 expandoColumnModelImpl.getName()
1968 };
1969
1970 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_T_N, args);
1971 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_T_N,
1972 args);
1973 }
1974 }
1975
1976 EntityCacheUtil.putResult(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
1977 ExpandoColumnImpl.class, expandoColumn.getPrimaryKey(),
1978 expandoColumn, false);
1979
1980 clearUniqueFindersCache(expandoColumn);
1981 cacheUniqueFindersCache(expandoColumn);
1982
1983 expandoColumn.resetOriginalValues();
1984
1985 return expandoColumn;
1986 }
1987
1988 protected ExpandoColumn toUnwrappedModel(ExpandoColumn expandoColumn) {
1989 if (expandoColumn instanceof ExpandoColumnImpl) {
1990 return expandoColumn;
1991 }
1992
1993 ExpandoColumnImpl expandoColumnImpl = new ExpandoColumnImpl();
1994
1995 expandoColumnImpl.setNew(expandoColumn.isNew());
1996 expandoColumnImpl.setPrimaryKey(expandoColumn.getPrimaryKey());
1997
1998 expandoColumnImpl.setColumnId(expandoColumn.getColumnId());
1999 expandoColumnImpl.setCompanyId(expandoColumn.getCompanyId());
2000 expandoColumnImpl.setTableId(expandoColumn.getTableId());
2001 expandoColumnImpl.setName(expandoColumn.getName());
2002 expandoColumnImpl.setType(expandoColumn.getType());
2003 expandoColumnImpl.setDefaultData(expandoColumn.getDefaultData());
2004 expandoColumnImpl.setTypeSettings(expandoColumn.getTypeSettings());
2005
2006 return expandoColumnImpl;
2007 }
2008
2009
2016 @Override
2017 public ExpandoColumn findByPrimaryKey(Serializable primaryKey)
2018 throws NoSuchColumnException {
2019 ExpandoColumn expandoColumn = fetchByPrimaryKey(primaryKey);
2020
2021 if (expandoColumn == null) {
2022 if (_log.isWarnEnabled()) {
2023 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
2024 }
2025
2026 throw new NoSuchColumnException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
2027 primaryKey);
2028 }
2029
2030 return expandoColumn;
2031 }
2032
2033
2040 @Override
2041 public ExpandoColumn findByPrimaryKey(long columnId)
2042 throws NoSuchColumnException {
2043 return findByPrimaryKey((Serializable)columnId);
2044 }
2045
2046
2052 @Override
2053 public ExpandoColumn fetchByPrimaryKey(Serializable primaryKey) {
2054 ExpandoColumn expandoColumn = (ExpandoColumn)EntityCacheUtil.getResult(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
2055 ExpandoColumnImpl.class, primaryKey);
2056
2057 if (expandoColumn == _nullExpandoColumn) {
2058 return null;
2059 }
2060
2061 if (expandoColumn == null) {
2062 Session session = null;
2063
2064 try {
2065 session = openSession();
2066
2067 expandoColumn = (ExpandoColumn)session.get(ExpandoColumnImpl.class,
2068 primaryKey);
2069
2070 if (expandoColumn != null) {
2071 cacheResult(expandoColumn);
2072 }
2073 else {
2074 EntityCacheUtil.putResult(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
2075 ExpandoColumnImpl.class, primaryKey, _nullExpandoColumn);
2076 }
2077 }
2078 catch (Exception e) {
2079 EntityCacheUtil.removeResult(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
2080 ExpandoColumnImpl.class, primaryKey);
2081
2082 throw processException(e);
2083 }
2084 finally {
2085 closeSession(session);
2086 }
2087 }
2088
2089 return expandoColumn;
2090 }
2091
2092
2098 @Override
2099 public ExpandoColumn fetchByPrimaryKey(long columnId) {
2100 return fetchByPrimaryKey((Serializable)columnId);
2101 }
2102
2103 @Override
2104 public Map<Serializable, ExpandoColumn> fetchByPrimaryKeys(
2105 Set<Serializable> primaryKeys) {
2106 if (primaryKeys.isEmpty()) {
2107 return Collections.emptyMap();
2108 }
2109
2110 Map<Serializable, ExpandoColumn> map = new HashMap<Serializable, ExpandoColumn>();
2111
2112 if (primaryKeys.size() == 1) {
2113 Iterator<Serializable> iterator = primaryKeys.iterator();
2114
2115 Serializable primaryKey = iterator.next();
2116
2117 ExpandoColumn expandoColumn = fetchByPrimaryKey(primaryKey);
2118
2119 if (expandoColumn != null) {
2120 map.put(primaryKey, expandoColumn);
2121 }
2122
2123 return map;
2124 }
2125
2126 Set<Serializable> uncachedPrimaryKeys = null;
2127
2128 for (Serializable primaryKey : primaryKeys) {
2129 ExpandoColumn expandoColumn = (ExpandoColumn)EntityCacheUtil.getResult(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
2130 ExpandoColumnImpl.class, primaryKey);
2131
2132 if (expandoColumn == null) {
2133 if (uncachedPrimaryKeys == null) {
2134 uncachedPrimaryKeys = new HashSet<Serializable>();
2135 }
2136
2137 uncachedPrimaryKeys.add(primaryKey);
2138 }
2139 else {
2140 map.put(primaryKey, expandoColumn);
2141 }
2142 }
2143
2144 if (uncachedPrimaryKeys == null) {
2145 return map;
2146 }
2147
2148 StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) +
2149 1);
2150
2151 query.append(_SQL_SELECT_EXPANDOCOLUMN_WHERE_PKS_IN);
2152
2153 for (Serializable primaryKey : uncachedPrimaryKeys) {
2154 query.append(String.valueOf(primaryKey));
2155
2156 query.append(StringPool.COMMA);
2157 }
2158
2159 query.setIndex(query.index() - 1);
2160
2161 query.append(StringPool.CLOSE_PARENTHESIS);
2162
2163 String sql = query.toString();
2164
2165 Session session = null;
2166
2167 try {
2168 session = openSession();
2169
2170 Query q = session.createQuery(sql);
2171
2172 for (ExpandoColumn expandoColumn : (List<ExpandoColumn>)q.list()) {
2173 map.put(expandoColumn.getPrimaryKeyObj(), expandoColumn);
2174
2175 cacheResult(expandoColumn);
2176
2177 uncachedPrimaryKeys.remove(expandoColumn.getPrimaryKeyObj());
2178 }
2179
2180 for (Serializable primaryKey : uncachedPrimaryKeys) {
2181 EntityCacheUtil.putResult(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
2182 ExpandoColumnImpl.class, primaryKey, _nullExpandoColumn);
2183 }
2184 }
2185 catch (Exception e) {
2186 throw processException(e);
2187 }
2188 finally {
2189 closeSession(session);
2190 }
2191
2192 return map;
2193 }
2194
2195
2200 @Override
2201 public List<ExpandoColumn> findAll() {
2202 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2203 }
2204
2205
2216 @Override
2217 public List<ExpandoColumn> findAll(int start, int end) {
2218 return findAll(start, end, null);
2219 }
2220
2221
2233 @Override
2234 public List<ExpandoColumn> findAll(int start, int end,
2235 OrderByComparator<ExpandoColumn> orderByComparator) {
2236 boolean pagination = true;
2237 FinderPath finderPath = null;
2238 Object[] finderArgs = null;
2239
2240 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2241 (orderByComparator == null)) {
2242 pagination = false;
2243 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
2244 finderArgs = FINDER_ARGS_EMPTY;
2245 }
2246 else {
2247 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
2248 finderArgs = new Object[] { start, end, orderByComparator };
2249 }
2250
2251 List<ExpandoColumn> list = (List<ExpandoColumn>)FinderCacheUtil.getResult(finderPath,
2252 finderArgs, this);
2253
2254 if (list == null) {
2255 StringBundler query = null;
2256 String sql = null;
2257
2258 if (orderByComparator != null) {
2259 query = new StringBundler(2 +
2260 (orderByComparator.getOrderByFields().length * 3));
2261
2262 query.append(_SQL_SELECT_EXPANDOCOLUMN);
2263
2264 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2265 orderByComparator);
2266
2267 sql = query.toString();
2268 }
2269 else {
2270 sql = _SQL_SELECT_EXPANDOCOLUMN;
2271
2272 if (pagination) {
2273 sql = sql.concat(ExpandoColumnModelImpl.ORDER_BY_JPQL);
2274 }
2275 }
2276
2277 Session session = null;
2278
2279 try {
2280 session = openSession();
2281
2282 Query q = session.createQuery(sql);
2283
2284 if (!pagination) {
2285 list = (List<ExpandoColumn>)QueryUtil.list(q, getDialect(),
2286 start, end, false);
2287
2288 Collections.sort(list);
2289
2290 list = Collections.unmodifiableList(list);
2291 }
2292 else {
2293 list = (List<ExpandoColumn>)QueryUtil.list(q, getDialect(),
2294 start, end);
2295 }
2296
2297 cacheResult(list);
2298
2299 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2300 }
2301 catch (Exception e) {
2302 FinderCacheUtil.removeResult(finderPath, finderArgs);
2303
2304 throw processException(e);
2305 }
2306 finally {
2307 closeSession(session);
2308 }
2309 }
2310
2311 return list;
2312 }
2313
2314
2318 @Override
2319 public void removeAll() {
2320 for (ExpandoColumn expandoColumn : findAll()) {
2321 remove(expandoColumn);
2322 }
2323 }
2324
2325
2330 @Override
2331 public int countAll() {
2332 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2333 FINDER_ARGS_EMPTY, this);
2334
2335 if (count == null) {
2336 Session session = null;
2337
2338 try {
2339 session = openSession();
2340
2341 Query q = session.createQuery(_SQL_COUNT_EXPANDOCOLUMN);
2342
2343 count = (Long)q.uniqueResult();
2344
2345 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
2346 FINDER_ARGS_EMPTY, count);
2347 }
2348 catch (Exception e) {
2349 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_ALL,
2350 FINDER_ARGS_EMPTY);
2351
2352 throw processException(e);
2353 }
2354 finally {
2355 closeSession(session);
2356 }
2357 }
2358
2359 return count.intValue();
2360 }
2361
2362 @Override
2363 protected Set<String> getBadColumnNames() {
2364 return _badColumnNames;
2365 }
2366
2367
2370 public void afterPropertiesSet() {
2371 }
2372
2373 public void destroy() {
2374 EntityCacheUtil.removeCache(ExpandoColumnImpl.class.getName());
2375 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
2376 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
2377 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2378 }
2379
2380 private static final String _SQL_SELECT_EXPANDOCOLUMN = "SELECT expandoColumn FROM ExpandoColumn expandoColumn";
2381 private static final String _SQL_SELECT_EXPANDOCOLUMN_WHERE_PKS_IN = "SELECT expandoColumn FROM ExpandoColumn expandoColumn WHERE columnId IN (";
2382 private static final String _SQL_SELECT_EXPANDOCOLUMN_WHERE = "SELECT expandoColumn FROM ExpandoColumn expandoColumn WHERE ";
2383 private static final String _SQL_COUNT_EXPANDOCOLUMN = "SELECT COUNT(expandoColumn) FROM ExpandoColumn expandoColumn";
2384 private static final String _SQL_COUNT_EXPANDOCOLUMN_WHERE = "SELECT COUNT(expandoColumn) FROM ExpandoColumn expandoColumn WHERE ";
2385 private static final String _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN = "expandoColumn.columnId";
2386 private static final String _FILTER_SQL_SELECT_EXPANDOCOLUMN_WHERE = "SELECT DISTINCT {expandoColumn.*} FROM ExpandoColumn expandoColumn WHERE ";
2387 private static final String _FILTER_SQL_SELECT_EXPANDOCOLUMN_NO_INLINE_DISTINCT_WHERE_1 =
2388 "SELECT {ExpandoColumn.*} FROM (SELECT DISTINCT expandoColumn.columnId FROM ExpandoColumn expandoColumn WHERE ";
2389 private static final String _FILTER_SQL_SELECT_EXPANDOCOLUMN_NO_INLINE_DISTINCT_WHERE_2 =
2390 ") TEMP_TABLE INNER JOIN ExpandoColumn ON TEMP_TABLE.columnId = ExpandoColumn.columnId";
2391 private static final String _FILTER_SQL_COUNT_EXPANDOCOLUMN_WHERE = "SELECT COUNT(DISTINCT expandoColumn.columnId) AS COUNT_VALUE FROM ExpandoColumn expandoColumn WHERE ";
2392 private static final String _FILTER_ENTITY_ALIAS = "expandoColumn";
2393 private static final String _FILTER_ENTITY_TABLE = "ExpandoColumn";
2394 private static final String _ORDER_BY_ENTITY_ALIAS = "expandoColumn.";
2395 private static final String _ORDER_BY_ENTITY_TABLE = "ExpandoColumn.";
2396 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No ExpandoColumn exists with the primary key ";
2397 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No ExpandoColumn exists with the key {";
2398 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
2399 private static final Log _log = LogFactoryUtil.getLog(ExpandoColumnPersistenceImpl.class);
2400 private static final Set<String> _badColumnNames = SetUtil.fromArray(new String[] {
2401 "type"
2402 });
2403 private static final ExpandoColumn _nullExpandoColumn = new ExpandoColumnImpl() {
2404 @Override
2405 public Object clone() {
2406 return this;
2407 }
2408
2409 @Override
2410 public CacheModel<ExpandoColumn> toCacheModel() {
2411 return _nullExpandoColumnCacheModel;
2412 }
2413 };
2414
2415 private static final CacheModel<ExpandoColumn> _nullExpandoColumnCacheModel = new CacheModel<ExpandoColumn>() {
2416 @Override
2417 public ExpandoColumn toEntityModel() {
2418 return _nullExpandoColumn;
2419 }
2420 };
2421 }