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.dao.orm.EntityCache;
020 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
021 import com.liferay.portal.kernel.dao.orm.FinderCache;
022 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
023 import com.liferay.portal.kernel.dao.orm.FinderPath;
024 import com.liferay.portal.kernel.dao.orm.Query;
025 import com.liferay.portal.kernel.dao.orm.QueryPos;
026 import com.liferay.portal.kernel.dao.orm.QueryUtil;
027 import com.liferay.portal.kernel.dao.orm.SQLQuery;
028 import com.liferay.portal.kernel.dao.orm.Session;
029 import com.liferay.portal.kernel.log.Log;
030 import com.liferay.portal.kernel.log.LogFactoryUtil;
031 import com.liferay.portal.kernel.util.ArrayUtil;
032 import com.liferay.portal.kernel.util.OrderByComparator;
033 import com.liferay.portal.kernel.util.SetUtil;
034 import com.liferay.portal.kernel.util.StringBundler;
035 import com.liferay.portal.kernel.util.StringPool;
036 import com.liferay.portal.kernel.util.StringUtil;
037 import com.liferay.portal.kernel.util.Validator;
038 import com.liferay.portal.model.CacheModel;
039 import com.liferay.portal.security.permission.InlineSQLHelperUtil;
040 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
041
042 import com.liferay.portlet.expando.NoSuchColumnException;
043 import com.liferay.portlet.expando.model.ExpandoColumn;
044 import com.liferay.portlet.expando.model.impl.ExpandoColumnImpl;
045 import com.liferay.portlet.expando.model.impl.ExpandoColumnModelImpl;
046 import com.liferay.portlet.expando.service.persistence.ExpandoColumnPersistence;
047
048 import java.io.Serializable;
049
050 import java.util.ArrayList;
051 import java.util.Arrays;
052 import java.util.Collections;
053 import java.util.HashMap;
054 import java.util.HashSet;
055 import java.util.Iterator;
056 import java.util.List;
057 import java.util.Map;
058 import java.util.Set;
059
060
072 @ProviderType
073 public class ExpandoColumnPersistenceImpl extends BasePersistenceImpl<ExpandoColumn>
074 implements ExpandoColumnPersistence {
075
080 public static final String FINDER_CLASS_NAME_ENTITY = ExpandoColumnImpl.class.getName();
081 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
082 ".List1";
083 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
084 ".List2";
085 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
086 ExpandoColumnModelImpl.FINDER_CACHE_ENABLED,
087 ExpandoColumnImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
088 "findAll", new String[0]);
089 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
090 ExpandoColumnModelImpl.FINDER_CACHE_ENABLED,
091 ExpandoColumnImpl.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
092 "findAll", new String[0]);
093 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
094 ExpandoColumnModelImpl.FINDER_CACHE_ENABLED, Long.class,
095 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
096 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_TABLEID = new FinderPath(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
097 ExpandoColumnModelImpl.FINDER_CACHE_ENABLED,
098 ExpandoColumnImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
099 "findByTableId",
100 new String[] {
101 Long.class.getName(),
102
103 Integer.class.getName(), Integer.class.getName(),
104 OrderByComparator.class.getName()
105 });
106 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TABLEID =
107 new FinderPath(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
108 ExpandoColumnModelImpl.FINDER_CACHE_ENABLED,
109 ExpandoColumnImpl.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
110 "findByTableId", new String[] { Long.class.getName() },
111 ExpandoColumnModelImpl.TABLEID_COLUMN_BITMASK |
112 ExpandoColumnModelImpl.NAME_COLUMN_BITMASK);
113 public static final FinderPath FINDER_PATH_COUNT_BY_TABLEID = new FinderPath(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
114 ExpandoColumnModelImpl.FINDER_CACHE_ENABLED, Long.class,
115 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByTableId",
116 new String[] { Long.class.getName() });
117
118
124 @Override
125 public List<ExpandoColumn> findByTableId(long tableId) {
126 return findByTableId(tableId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
127 }
128
129
141 @Override
142 public List<ExpandoColumn> findByTableId(long tableId, int start, int end) {
143 return findByTableId(tableId, start, end, null);
144 }
145
146
159 @Override
160 public List<ExpandoColumn> findByTableId(long tableId, int start, int end,
161 OrderByComparator<ExpandoColumn> orderByComparator) {
162 return findByTableId(tableId, start, end, orderByComparator, true);
163 }
164
165
179 @Override
180 public List<ExpandoColumn> findByTableId(long tableId, int start, int end,
181 OrderByComparator<ExpandoColumn> orderByComparator,
182 boolean retrieveFromCache) {
183 boolean pagination = true;
184 FinderPath finderPath = null;
185 Object[] finderArgs = null;
186
187 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
188 (orderByComparator == null)) {
189 pagination = false;
190 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TABLEID;
191 finderArgs = new Object[] { tableId };
192 }
193 else {
194 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_TABLEID;
195 finderArgs = new Object[] { tableId, start, end, orderByComparator };
196 }
197
198 List<ExpandoColumn> list = null;
199
200 if (retrieveFromCache) {
201 list = (List<ExpandoColumn>)finderCache.getResult(finderPath,
202 finderArgs, this);
203
204 if ((list != null) && !list.isEmpty()) {
205 for (ExpandoColumn expandoColumn : list) {
206 if ((tableId != expandoColumn.getTableId())) {
207 list = null;
208
209 break;
210 }
211 }
212 }
213 }
214
215 if (list == null) {
216 StringBundler query = null;
217
218 if (orderByComparator != null) {
219 query = new StringBundler(3 +
220 (orderByComparator.getOrderByFields().length * 3));
221 }
222 else {
223 query = new StringBundler(3);
224 }
225
226 query.append(_SQL_SELECT_EXPANDOCOLUMN_WHERE);
227
228 query.append(_FINDER_COLUMN_TABLEID_TABLEID_2);
229
230 if (orderByComparator != null) {
231 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
232 orderByComparator);
233 }
234 else
235 if (pagination) {
236 query.append(ExpandoColumnModelImpl.ORDER_BY_JPQL);
237 }
238
239 String sql = query.toString();
240
241 Session session = null;
242
243 try {
244 session = openSession();
245
246 Query q = session.createQuery(sql);
247
248 QueryPos qPos = QueryPos.getInstance(q);
249
250 qPos.add(tableId);
251
252 if (!pagination) {
253 list = (List<ExpandoColumn>)QueryUtil.list(q, getDialect(),
254 start, end, false);
255
256 Collections.sort(list);
257
258 list = Collections.unmodifiableList(list);
259 }
260 else {
261 list = (List<ExpandoColumn>)QueryUtil.list(q, getDialect(),
262 start, end);
263 }
264
265 cacheResult(list);
266
267 finderCache.putResult(finderPath, finderArgs, list);
268 }
269 catch (Exception e) {
270 finderCache.removeResult(finderPath, finderArgs);
271
272 throw processException(e);
273 }
274 finally {
275 closeSession(session);
276 }
277 }
278
279 return list;
280 }
281
282
290 @Override
291 public ExpandoColumn findByTableId_First(long tableId,
292 OrderByComparator<ExpandoColumn> orderByComparator)
293 throws NoSuchColumnException {
294 ExpandoColumn expandoColumn = fetchByTableId_First(tableId,
295 orderByComparator);
296
297 if (expandoColumn != null) {
298 return expandoColumn;
299 }
300
301 StringBundler msg = new StringBundler(4);
302
303 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
304
305 msg.append("tableId=");
306 msg.append(tableId);
307
308 msg.append(StringPool.CLOSE_CURLY_BRACE);
309
310 throw new NoSuchColumnException(msg.toString());
311 }
312
313
320 @Override
321 public ExpandoColumn fetchByTableId_First(long tableId,
322 OrderByComparator<ExpandoColumn> orderByComparator) {
323 List<ExpandoColumn> list = findByTableId(tableId, 0, 1,
324 orderByComparator);
325
326 if (!list.isEmpty()) {
327 return list.get(0);
328 }
329
330 return null;
331 }
332
333
341 @Override
342 public ExpandoColumn findByTableId_Last(long tableId,
343 OrderByComparator<ExpandoColumn> orderByComparator)
344 throws NoSuchColumnException {
345 ExpandoColumn expandoColumn = fetchByTableId_Last(tableId,
346 orderByComparator);
347
348 if (expandoColumn != null) {
349 return expandoColumn;
350 }
351
352 StringBundler msg = new StringBundler(4);
353
354 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
355
356 msg.append("tableId=");
357 msg.append(tableId);
358
359 msg.append(StringPool.CLOSE_CURLY_BRACE);
360
361 throw new NoSuchColumnException(msg.toString());
362 }
363
364
371 @Override
372 public ExpandoColumn fetchByTableId_Last(long tableId,
373 OrderByComparator<ExpandoColumn> orderByComparator) {
374 int count = countByTableId(tableId);
375
376 if (count == 0) {
377 return null;
378 }
379
380 List<ExpandoColumn> list = findByTableId(tableId, count - 1, count,
381 orderByComparator);
382
383 if (!list.isEmpty()) {
384 return list.get(0);
385 }
386
387 return null;
388 }
389
390
399 @Override
400 public ExpandoColumn[] findByTableId_PrevAndNext(long columnId,
401 long tableId, OrderByComparator<ExpandoColumn> orderByComparator)
402 throws NoSuchColumnException {
403 ExpandoColumn expandoColumn = findByPrimaryKey(columnId);
404
405 Session session = null;
406
407 try {
408 session = openSession();
409
410 ExpandoColumn[] array = new ExpandoColumnImpl[3];
411
412 array[0] = getByTableId_PrevAndNext(session, expandoColumn,
413 tableId, orderByComparator, true);
414
415 array[1] = expandoColumn;
416
417 array[2] = getByTableId_PrevAndNext(session, expandoColumn,
418 tableId, orderByComparator, false);
419
420 return array;
421 }
422 catch (Exception e) {
423 throw processException(e);
424 }
425 finally {
426 closeSession(session);
427 }
428 }
429
430 protected ExpandoColumn getByTableId_PrevAndNext(Session session,
431 ExpandoColumn expandoColumn, long tableId,
432 OrderByComparator<ExpandoColumn> orderByComparator, boolean previous) {
433 StringBundler query = null;
434
435 if (orderByComparator != null) {
436 query = new StringBundler(6 +
437 (orderByComparator.getOrderByFields().length * 6));
438 }
439 else {
440 query = new StringBundler(3);
441 }
442
443 query.append(_SQL_SELECT_EXPANDOCOLUMN_WHERE);
444
445 query.append(_FINDER_COLUMN_TABLEID_TABLEID_2);
446
447 if (orderByComparator != null) {
448 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
449
450 if (orderByConditionFields.length > 0) {
451 query.append(WHERE_AND);
452 }
453
454 for (int i = 0; i < orderByConditionFields.length; i++) {
455 query.append(_ORDER_BY_ENTITY_ALIAS);
456 query.append(orderByConditionFields[i]);
457
458 if ((i + 1) < orderByConditionFields.length) {
459 if (orderByComparator.isAscending() ^ previous) {
460 query.append(WHERE_GREATER_THAN_HAS_NEXT);
461 }
462 else {
463 query.append(WHERE_LESSER_THAN_HAS_NEXT);
464 }
465 }
466 else {
467 if (orderByComparator.isAscending() ^ previous) {
468 query.append(WHERE_GREATER_THAN);
469 }
470 else {
471 query.append(WHERE_LESSER_THAN);
472 }
473 }
474 }
475
476 query.append(ORDER_BY_CLAUSE);
477
478 String[] orderByFields = orderByComparator.getOrderByFields();
479
480 for (int i = 0; i < orderByFields.length; i++) {
481 query.append(_ORDER_BY_ENTITY_ALIAS);
482 query.append(orderByFields[i]);
483
484 if ((i + 1) < orderByFields.length) {
485 if (orderByComparator.isAscending() ^ previous) {
486 query.append(ORDER_BY_ASC_HAS_NEXT);
487 }
488 else {
489 query.append(ORDER_BY_DESC_HAS_NEXT);
490 }
491 }
492 else {
493 if (orderByComparator.isAscending() ^ previous) {
494 query.append(ORDER_BY_ASC);
495 }
496 else {
497 query.append(ORDER_BY_DESC);
498 }
499 }
500 }
501 }
502 else {
503 query.append(ExpandoColumnModelImpl.ORDER_BY_JPQL);
504 }
505
506 String sql = query.toString();
507
508 Query q = session.createQuery(sql);
509
510 q.setFirstResult(0);
511 q.setMaxResults(2);
512
513 QueryPos qPos = QueryPos.getInstance(q);
514
515 qPos.add(tableId);
516
517 if (orderByComparator != null) {
518 Object[] values = orderByComparator.getOrderByConditionValues(expandoColumn);
519
520 for (Object value : values) {
521 qPos.add(value);
522 }
523 }
524
525 List<ExpandoColumn> list = q.list();
526
527 if (list.size() == 2) {
528 return list.get(1);
529 }
530 else {
531 return null;
532 }
533 }
534
535
541 @Override
542 public List<ExpandoColumn> filterFindByTableId(long tableId) {
543 return filterFindByTableId(tableId, QueryUtil.ALL_POS,
544 QueryUtil.ALL_POS, null);
545 }
546
547
559 @Override
560 public List<ExpandoColumn> filterFindByTableId(long tableId, int start,
561 int end) {
562 return filterFindByTableId(tableId, start, end, null);
563 }
564
565
578 @Override
579 public List<ExpandoColumn> filterFindByTableId(long tableId, int start,
580 int end, OrderByComparator<ExpandoColumn> orderByComparator) {
581 if (!InlineSQLHelperUtil.isEnabled()) {
582 return findByTableId(tableId, start, end, orderByComparator);
583 }
584
585 StringBundler query = null;
586
587 if (orderByComparator != null) {
588 query = new StringBundler(3 +
589 (orderByComparator.getOrderByFields().length * 3));
590 }
591 else {
592 query = new StringBundler(3);
593 }
594
595 if (getDB().isSupportsInlineDistinct()) {
596 query.append(_FILTER_SQL_SELECT_EXPANDOCOLUMN_WHERE);
597 }
598 else {
599 query.append(_FILTER_SQL_SELECT_EXPANDOCOLUMN_NO_INLINE_DISTINCT_WHERE_1);
600 }
601
602 query.append(_FINDER_COLUMN_TABLEID_TABLEID_2);
603
604 if (!getDB().isSupportsInlineDistinct()) {
605 query.append(_FILTER_SQL_SELECT_EXPANDOCOLUMN_NO_INLINE_DISTINCT_WHERE_2);
606 }
607
608 if (orderByComparator != null) {
609 if (getDB().isSupportsInlineDistinct()) {
610 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
611 orderByComparator, true);
612 }
613 else {
614 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
615 orderByComparator, true);
616 }
617 }
618 else {
619 if (getDB().isSupportsInlineDistinct()) {
620 query.append(ExpandoColumnModelImpl.ORDER_BY_JPQL);
621 }
622 else {
623 query.append(ExpandoColumnModelImpl.ORDER_BY_SQL);
624 }
625 }
626
627 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
628 ExpandoColumn.class.getName(),
629 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
630
631 Session session = null;
632
633 try {
634 session = openSession();
635
636 SQLQuery q = session.createSynchronizedSQLQuery(sql);
637
638 if (getDB().isSupportsInlineDistinct()) {
639 q.addEntity(_FILTER_ENTITY_ALIAS, ExpandoColumnImpl.class);
640 }
641 else {
642 q.addEntity(_FILTER_ENTITY_TABLE, ExpandoColumnImpl.class);
643 }
644
645 QueryPos qPos = QueryPos.getInstance(q);
646
647 qPos.add(tableId);
648
649 return (List<ExpandoColumn>)QueryUtil.list(q, getDialect(), start,
650 end);
651 }
652 catch (Exception e) {
653 throw processException(e);
654 }
655 finally {
656 closeSession(session);
657 }
658 }
659
660
669 @Override
670 public ExpandoColumn[] filterFindByTableId_PrevAndNext(long columnId,
671 long tableId, OrderByComparator<ExpandoColumn> orderByComparator)
672 throws NoSuchColumnException {
673 if (!InlineSQLHelperUtil.isEnabled()) {
674 return findByTableId_PrevAndNext(columnId, tableId,
675 orderByComparator);
676 }
677
678 ExpandoColumn expandoColumn = findByPrimaryKey(columnId);
679
680 Session session = null;
681
682 try {
683 session = openSession();
684
685 ExpandoColumn[] array = new ExpandoColumnImpl[3];
686
687 array[0] = filterGetByTableId_PrevAndNext(session, expandoColumn,
688 tableId, orderByComparator, true);
689
690 array[1] = expandoColumn;
691
692 array[2] = filterGetByTableId_PrevAndNext(session, expandoColumn,
693 tableId, orderByComparator, false);
694
695 return array;
696 }
697 catch (Exception e) {
698 throw processException(e);
699 }
700 finally {
701 closeSession(session);
702 }
703 }
704
705 protected ExpandoColumn filterGetByTableId_PrevAndNext(Session session,
706 ExpandoColumn expandoColumn, long tableId,
707 OrderByComparator<ExpandoColumn> orderByComparator, boolean previous) {
708 StringBundler query = null;
709
710 if (orderByComparator != null) {
711 query = new StringBundler(6 +
712 (orderByComparator.getOrderByFields().length * 6));
713 }
714 else {
715 query = new StringBundler(3);
716 }
717
718 if (getDB().isSupportsInlineDistinct()) {
719 query.append(_FILTER_SQL_SELECT_EXPANDOCOLUMN_WHERE);
720 }
721 else {
722 query.append(_FILTER_SQL_SELECT_EXPANDOCOLUMN_NO_INLINE_DISTINCT_WHERE_1);
723 }
724
725 query.append(_FINDER_COLUMN_TABLEID_TABLEID_2);
726
727 if (!getDB().isSupportsInlineDistinct()) {
728 query.append(_FILTER_SQL_SELECT_EXPANDOCOLUMN_NO_INLINE_DISTINCT_WHERE_2);
729 }
730
731 if (orderByComparator != null) {
732 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
733
734 if (orderByConditionFields.length > 0) {
735 query.append(WHERE_AND);
736 }
737
738 for (int i = 0; i < orderByConditionFields.length; i++) {
739 if (getDB().isSupportsInlineDistinct()) {
740 query.append(_ORDER_BY_ENTITY_ALIAS);
741 }
742 else {
743 query.append(_ORDER_BY_ENTITY_TABLE);
744 }
745
746 query.append(orderByConditionFields[i]);
747
748 if ((i + 1) < orderByConditionFields.length) {
749 if (orderByComparator.isAscending() ^ previous) {
750 query.append(WHERE_GREATER_THAN_HAS_NEXT);
751 }
752 else {
753 query.append(WHERE_LESSER_THAN_HAS_NEXT);
754 }
755 }
756 else {
757 if (orderByComparator.isAscending() ^ previous) {
758 query.append(WHERE_GREATER_THAN);
759 }
760 else {
761 query.append(WHERE_LESSER_THAN);
762 }
763 }
764 }
765
766 query.append(ORDER_BY_CLAUSE);
767
768 String[] orderByFields = orderByComparator.getOrderByFields();
769
770 for (int i = 0; i < orderByFields.length; i++) {
771 if (getDB().isSupportsInlineDistinct()) {
772 query.append(_ORDER_BY_ENTITY_ALIAS);
773 }
774 else {
775 query.append(_ORDER_BY_ENTITY_TABLE);
776 }
777
778 query.append(orderByFields[i]);
779
780 if ((i + 1) < orderByFields.length) {
781 if (orderByComparator.isAscending() ^ previous) {
782 query.append(ORDER_BY_ASC_HAS_NEXT);
783 }
784 else {
785 query.append(ORDER_BY_DESC_HAS_NEXT);
786 }
787 }
788 else {
789 if (orderByComparator.isAscending() ^ previous) {
790 query.append(ORDER_BY_ASC);
791 }
792 else {
793 query.append(ORDER_BY_DESC);
794 }
795 }
796 }
797 }
798 else {
799 if (getDB().isSupportsInlineDistinct()) {
800 query.append(ExpandoColumnModelImpl.ORDER_BY_JPQL);
801 }
802 else {
803 query.append(ExpandoColumnModelImpl.ORDER_BY_SQL);
804 }
805 }
806
807 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
808 ExpandoColumn.class.getName(),
809 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
810
811 SQLQuery q = session.createSynchronizedSQLQuery(sql);
812
813 q.setFirstResult(0);
814 q.setMaxResults(2);
815
816 if (getDB().isSupportsInlineDistinct()) {
817 q.addEntity(_FILTER_ENTITY_ALIAS, ExpandoColumnImpl.class);
818 }
819 else {
820 q.addEntity(_FILTER_ENTITY_TABLE, ExpandoColumnImpl.class);
821 }
822
823 QueryPos qPos = QueryPos.getInstance(q);
824
825 qPos.add(tableId);
826
827 if (orderByComparator != null) {
828 Object[] values = orderByComparator.getOrderByConditionValues(expandoColumn);
829
830 for (Object value : values) {
831 qPos.add(value);
832 }
833 }
834
835 List<ExpandoColumn> list = q.list();
836
837 if (list.size() == 2) {
838 return list.get(1);
839 }
840 else {
841 return null;
842 }
843 }
844
845
850 @Override
851 public void removeByTableId(long tableId) {
852 for (ExpandoColumn expandoColumn : findByTableId(tableId,
853 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
854 remove(expandoColumn);
855 }
856 }
857
858
864 @Override
865 public int countByTableId(long tableId) {
866 FinderPath finderPath = FINDER_PATH_COUNT_BY_TABLEID;
867
868 Object[] finderArgs = new Object[] { tableId };
869
870 Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
871
872 if (count == null) {
873 StringBundler query = new StringBundler(2);
874
875 query.append(_SQL_COUNT_EXPANDOCOLUMN_WHERE);
876
877 query.append(_FINDER_COLUMN_TABLEID_TABLEID_2);
878
879 String sql = query.toString();
880
881 Session session = null;
882
883 try {
884 session = openSession();
885
886 Query q = session.createQuery(sql);
887
888 QueryPos qPos = QueryPos.getInstance(q);
889
890 qPos.add(tableId);
891
892 count = (Long)q.uniqueResult();
893
894 finderCache.putResult(finderPath, finderArgs, count);
895 }
896 catch (Exception e) {
897 finderCache.removeResult(finderPath, finderArgs);
898
899 throw processException(e);
900 }
901 finally {
902 closeSession(session);
903 }
904 }
905
906 return count.intValue();
907 }
908
909
915 @Override
916 public int filterCountByTableId(long tableId) {
917 if (!InlineSQLHelperUtil.isEnabled()) {
918 return countByTableId(tableId);
919 }
920
921 StringBundler query = new StringBundler(2);
922
923 query.append(_FILTER_SQL_COUNT_EXPANDOCOLUMN_WHERE);
924
925 query.append(_FINDER_COLUMN_TABLEID_TABLEID_2);
926
927 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
928 ExpandoColumn.class.getName(),
929 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
930
931 Session session = null;
932
933 try {
934 session = openSession();
935
936 SQLQuery q = session.createSynchronizedSQLQuery(sql);
937
938 q.addScalar(COUNT_COLUMN_NAME,
939 com.liferay.portal.kernel.dao.orm.Type.LONG);
940
941 QueryPos qPos = QueryPos.getInstance(q);
942
943 qPos.add(tableId);
944
945 Long count = (Long)q.uniqueResult();
946
947 return count.intValue();
948 }
949 catch (Exception e) {
950 throw processException(e);
951 }
952 finally {
953 closeSession(session);
954 }
955 }
956
957 private static final String _FINDER_COLUMN_TABLEID_TABLEID_2 = "expandoColumn.tableId = ?";
958 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_T_N = new FinderPath(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
959 ExpandoColumnModelImpl.FINDER_CACHE_ENABLED,
960 ExpandoColumnImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
961 "findByT_N",
962 new String[] {
963 Long.class.getName(), String.class.getName(),
964
965 Integer.class.getName(), Integer.class.getName(),
966 OrderByComparator.class.getName()
967 });
968 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_T_N = new FinderPath(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
969 ExpandoColumnModelImpl.FINDER_CACHE_ENABLED,
970 ExpandoColumnImpl.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
971 "findByT_N",
972 new String[] { Long.class.getName(), String.class.getName() },
973 ExpandoColumnModelImpl.TABLEID_COLUMN_BITMASK |
974 ExpandoColumnModelImpl.NAME_COLUMN_BITMASK);
975 public static final FinderPath FINDER_PATH_FETCH_BY_T_N = new FinderPath(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
976 ExpandoColumnModelImpl.FINDER_CACHE_ENABLED,
977 ExpandoColumnImpl.class, FINDER_CLASS_NAME_ENTITY, "fetchByT_N",
978 new String[] { Long.class.getName(), String.class.getName() },
979 ExpandoColumnModelImpl.TABLEID_COLUMN_BITMASK |
980 ExpandoColumnModelImpl.NAME_COLUMN_BITMASK);
981 public static final FinderPath FINDER_PATH_COUNT_BY_T_N = new FinderPath(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
982 ExpandoColumnModelImpl.FINDER_CACHE_ENABLED, Long.class,
983 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByT_N",
984 new String[] { Long.class.getName(), String.class.getName() });
985 public static final FinderPath FINDER_PATH_WITH_PAGINATION_COUNT_BY_T_N = new FinderPath(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
986 ExpandoColumnModelImpl.FINDER_CACHE_ENABLED, Long.class,
987 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByT_N",
988 new String[] { Long.class.getName(), String.class.getName() });
989
990
1001 @Override
1002 public List<ExpandoColumn> findByT_N(long tableId, String[] names) {
1003 return findByT_N(tableId, names, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1004 null);
1005 }
1006
1007
1020 @Override
1021 public List<ExpandoColumn> findByT_N(long tableId, String[] names,
1022 int start, int end) {
1023 return findByT_N(tableId, names, start, end, null);
1024 }
1025
1026
1040 @Override
1041 public List<ExpandoColumn> findByT_N(long tableId, String[] names,
1042 int start, int end, OrderByComparator<ExpandoColumn> orderByComparator) {
1043 return findByT_N(tableId, names, start, end, orderByComparator, true);
1044 }
1045
1046
1061 @Override
1062 public List<ExpandoColumn> findByT_N(long tableId, String[] names,
1063 int start, int end, OrderByComparator<ExpandoColumn> orderByComparator,
1064 boolean retrieveFromCache) {
1065 if (names == null) {
1066 names = new String[0];
1067 }
1068 else if (names.length > 1) {
1069 names = ArrayUtil.distinct(names, NULL_SAFE_STRING_COMPARATOR);
1070
1071 Arrays.sort(names, NULL_SAFE_STRING_COMPARATOR);
1072 }
1073
1074 if (names.length == 1) {
1075 ExpandoColumn expandoColumn = fetchByT_N(tableId, names[0]);
1076
1077 if (expandoColumn == null) {
1078 return Collections.emptyList();
1079 }
1080 else {
1081 List<ExpandoColumn> list = new ArrayList<ExpandoColumn>(1);
1082
1083 list.add(expandoColumn);
1084
1085 return list;
1086 }
1087 }
1088
1089 boolean pagination = true;
1090 Object[] finderArgs = null;
1091
1092 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1093 (orderByComparator == null)) {
1094 pagination = false;
1095 finderArgs = new Object[] { tableId, StringUtil.merge(names) };
1096 }
1097 else {
1098 finderArgs = new Object[] {
1099 tableId, StringUtil.merge(names),
1100
1101 start, end, orderByComparator
1102 };
1103 }
1104
1105 List<ExpandoColumn> list = null;
1106
1107 if (retrieveFromCache) {
1108 list = (List<ExpandoColumn>)finderCache.getResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_T_N,
1109 finderArgs, this);
1110
1111 if ((list != null) && !list.isEmpty()) {
1112 for (ExpandoColumn expandoColumn : list) {
1113 if ((tableId != expandoColumn.getTableId()) ||
1114 !ArrayUtil.contains(names, expandoColumn.getName())) {
1115 list = null;
1116
1117 break;
1118 }
1119 }
1120 }
1121 }
1122
1123 if (list == null) {
1124 StringBundler query = new StringBundler();
1125
1126 query.append(_SQL_SELECT_EXPANDOCOLUMN_WHERE);
1127
1128 query.append(_FINDER_COLUMN_T_N_TABLEID_2);
1129
1130 if (names.length > 0) {
1131 query.append(StringPool.OPEN_PARENTHESIS);
1132
1133 for (int i = 0; i < names.length; i++) {
1134 String name = names[i];
1135
1136 if (name == null) {
1137 query.append(_FINDER_COLUMN_T_N_NAME_1);
1138 }
1139 else if (name.equals(StringPool.BLANK)) {
1140 query.append(_FINDER_COLUMN_T_N_NAME_3);
1141 }
1142 else {
1143 query.append(_FINDER_COLUMN_T_N_NAME_2);
1144 }
1145
1146 if ((i + 1) < names.length) {
1147 query.append(WHERE_OR);
1148 }
1149 }
1150
1151 query.append(StringPool.CLOSE_PARENTHESIS);
1152 }
1153
1154 query.setStringAt(removeConjunction(query.stringAt(query.index() -
1155 1)), query.index() - 1);
1156
1157 if (orderByComparator != null) {
1158 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1159 orderByComparator);
1160 }
1161 else
1162 if (pagination) {
1163 query.append(ExpandoColumnModelImpl.ORDER_BY_JPQL);
1164 }
1165
1166 String sql = query.toString();
1167
1168 Session session = null;
1169
1170 try {
1171 session = openSession();
1172
1173 Query q = session.createQuery(sql);
1174
1175 QueryPos qPos = QueryPos.getInstance(q);
1176
1177 qPos.add(tableId);
1178
1179 for (String name : names) {
1180 if ((name != null) && !name.isEmpty()) {
1181 qPos.add(name);
1182 }
1183 }
1184
1185 if (!pagination) {
1186 list = (List<ExpandoColumn>)QueryUtil.list(q, getDialect(),
1187 start, end, false);
1188
1189 Collections.sort(list);
1190
1191 list = Collections.unmodifiableList(list);
1192 }
1193 else {
1194 list = (List<ExpandoColumn>)QueryUtil.list(q, getDialect(),
1195 start, end);
1196 }
1197
1198 cacheResult(list);
1199
1200 finderCache.putResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_T_N,
1201 finderArgs, list);
1202 }
1203 catch (Exception e) {
1204 finderCache.removeResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_T_N,
1205 finderArgs);
1206
1207 throw processException(e);
1208 }
1209 finally {
1210 closeSession(session);
1211 }
1212 }
1213
1214 return list;
1215 }
1216
1217
1225 @Override
1226 public ExpandoColumn findByT_N(long tableId, String name)
1227 throws NoSuchColumnException {
1228 ExpandoColumn expandoColumn = fetchByT_N(tableId, name);
1229
1230 if (expandoColumn == null) {
1231 StringBundler msg = new StringBundler(6);
1232
1233 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1234
1235 msg.append("tableId=");
1236 msg.append(tableId);
1237
1238 msg.append(", name=");
1239 msg.append(name);
1240
1241 msg.append(StringPool.CLOSE_CURLY_BRACE);
1242
1243 if (_log.isWarnEnabled()) {
1244 _log.warn(msg.toString());
1245 }
1246
1247 throw new NoSuchColumnException(msg.toString());
1248 }
1249
1250 return expandoColumn;
1251 }
1252
1253
1260 @Override
1261 public ExpandoColumn fetchByT_N(long tableId, String name) {
1262 return fetchByT_N(tableId, name, true);
1263 }
1264
1265
1273 @Override
1274 public ExpandoColumn fetchByT_N(long tableId, String name,
1275 boolean retrieveFromCache) {
1276 Object[] finderArgs = new Object[] { tableId, name };
1277
1278 Object result = null;
1279
1280 if (retrieveFromCache) {
1281 result = finderCache.getResult(FINDER_PATH_FETCH_BY_T_N,
1282 finderArgs, this);
1283 }
1284
1285 if (result instanceof ExpandoColumn) {
1286 ExpandoColumn expandoColumn = (ExpandoColumn)result;
1287
1288 if ((tableId != expandoColumn.getTableId()) ||
1289 !Validator.equals(name, expandoColumn.getName())) {
1290 result = null;
1291 }
1292 }
1293
1294 if (result == null) {
1295 StringBundler query = new StringBundler(4);
1296
1297 query.append(_SQL_SELECT_EXPANDOCOLUMN_WHERE);
1298
1299 query.append(_FINDER_COLUMN_T_N_TABLEID_2);
1300
1301 boolean bindName = false;
1302
1303 if (name == null) {
1304 query.append(_FINDER_COLUMN_T_N_NAME_1);
1305 }
1306 else if (name.equals(StringPool.BLANK)) {
1307 query.append(_FINDER_COLUMN_T_N_NAME_3);
1308 }
1309 else {
1310 bindName = true;
1311
1312 query.append(_FINDER_COLUMN_T_N_NAME_2);
1313 }
1314
1315 String sql = query.toString();
1316
1317 Session session = null;
1318
1319 try {
1320 session = openSession();
1321
1322 Query q = session.createQuery(sql);
1323
1324 QueryPos qPos = QueryPos.getInstance(q);
1325
1326 qPos.add(tableId);
1327
1328 if (bindName) {
1329 qPos.add(name);
1330 }
1331
1332 List<ExpandoColumn> list = q.list();
1333
1334 if (list.isEmpty()) {
1335 finderCache.putResult(FINDER_PATH_FETCH_BY_T_N, finderArgs,
1336 list);
1337 }
1338 else {
1339 ExpandoColumn expandoColumn = list.get(0);
1340
1341 result = expandoColumn;
1342
1343 cacheResult(expandoColumn);
1344
1345 if ((expandoColumn.getTableId() != tableId) ||
1346 (expandoColumn.getName() == null) ||
1347 !expandoColumn.getName().equals(name)) {
1348 finderCache.putResult(FINDER_PATH_FETCH_BY_T_N,
1349 finderArgs, expandoColumn);
1350 }
1351 }
1352 }
1353 catch (Exception e) {
1354 finderCache.removeResult(FINDER_PATH_FETCH_BY_T_N, finderArgs);
1355
1356 throw processException(e);
1357 }
1358 finally {
1359 closeSession(session);
1360 }
1361 }
1362
1363 if (result instanceof List<?>) {
1364 return null;
1365 }
1366 else {
1367 return (ExpandoColumn)result;
1368 }
1369 }
1370
1371
1378 @Override
1379 public ExpandoColumn removeByT_N(long tableId, String name)
1380 throws NoSuchColumnException {
1381 ExpandoColumn expandoColumn = findByT_N(tableId, name);
1382
1383 return remove(expandoColumn);
1384 }
1385
1386
1393 @Override
1394 public int countByT_N(long tableId, String name) {
1395 FinderPath finderPath = FINDER_PATH_COUNT_BY_T_N;
1396
1397 Object[] finderArgs = new Object[] { tableId, name };
1398
1399 Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
1400
1401 if (count == null) {
1402 StringBundler query = new StringBundler(3);
1403
1404 query.append(_SQL_COUNT_EXPANDOCOLUMN_WHERE);
1405
1406 query.append(_FINDER_COLUMN_T_N_TABLEID_2);
1407
1408 boolean bindName = false;
1409
1410 if (name == null) {
1411 query.append(_FINDER_COLUMN_T_N_NAME_1);
1412 }
1413 else if (name.equals(StringPool.BLANK)) {
1414 query.append(_FINDER_COLUMN_T_N_NAME_3);
1415 }
1416 else {
1417 bindName = true;
1418
1419 query.append(_FINDER_COLUMN_T_N_NAME_2);
1420 }
1421
1422 String sql = query.toString();
1423
1424 Session session = null;
1425
1426 try {
1427 session = openSession();
1428
1429 Query q = session.createQuery(sql);
1430
1431 QueryPos qPos = QueryPos.getInstance(q);
1432
1433 qPos.add(tableId);
1434
1435 if (bindName) {
1436 qPos.add(name);
1437 }
1438
1439 count = (Long)q.uniqueResult();
1440
1441 finderCache.putResult(finderPath, finderArgs, count);
1442 }
1443 catch (Exception e) {
1444 finderCache.removeResult(finderPath, finderArgs);
1445
1446 throw processException(e);
1447 }
1448 finally {
1449 closeSession(session);
1450 }
1451 }
1452
1453 return count.intValue();
1454 }
1455
1456
1463 @Override
1464 public int countByT_N(long tableId, String[] names) {
1465 if (names == null) {
1466 names = new String[0];
1467 }
1468 else if (names.length > 1) {
1469 names = ArrayUtil.distinct(names, NULL_SAFE_STRING_COMPARATOR);
1470
1471 Arrays.sort(names, NULL_SAFE_STRING_COMPARATOR);
1472 }
1473
1474 Object[] finderArgs = new Object[] { tableId, StringUtil.merge(names) };
1475
1476 Long count = (Long)finderCache.getResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_T_N,
1477 finderArgs, this);
1478
1479 if (count == null) {
1480 StringBundler query = new StringBundler();
1481
1482 query.append(_SQL_COUNT_EXPANDOCOLUMN_WHERE);
1483
1484 query.append(_FINDER_COLUMN_T_N_TABLEID_2);
1485
1486 if (names.length > 0) {
1487 query.append(StringPool.OPEN_PARENTHESIS);
1488
1489 for (int i = 0; i < names.length; i++) {
1490 String name = names[i];
1491
1492 if (name == null) {
1493 query.append(_FINDER_COLUMN_T_N_NAME_1);
1494 }
1495 else if (name.equals(StringPool.BLANK)) {
1496 query.append(_FINDER_COLUMN_T_N_NAME_3);
1497 }
1498 else {
1499 query.append(_FINDER_COLUMN_T_N_NAME_2);
1500 }
1501
1502 if ((i + 1) < names.length) {
1503 query.append(WHERE_OR);
1504 }
1505 }
1506
1507 query.append(StringPool.CLOSE_PARENTHESIS);
1508 }
1509
1510 query.setStringAt(removeConjunction(query.stringAt(query.index() -
1511 1)), query.index() - 1);
1512
1513 String sql = query.toString();
1514
1515 Session session = null;
1516
1517 try {
1518 session = openSession();
1519
1520 Query q = session.createQuery(sql);
1521
1522 QueryPos qPos = QueryPos.getInstance(q);
1523
1524 qPos.add(tableId);
1525
1526 for (String name : names) {
1527 if ((name != null) && !name.isEmpty()) {
1528 qPos.add(name);
1529 }
1530 }
1531
1532 count = (Long)q.uniqueResult();
1533
1534 finderCache.putResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_T_N,
1535 finderArgs, count);
1536 }
1537 catch (Exception e) {
1538 finderCache.removeResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_T_N,
1539 finderArgs);
1540
1541 throw processException(e);
1542 }
1543 finally {
1544 closeSession(session);
1545 }
1546 }
1547
1548 return count.intValue();
1549 }
1550
1551
1558 @Override
1559 public int filterCountByT_N(long tableId, String name) {
1560 if (!InlineSQLHelperUtil.isEnabled()) {
1561 return countByT_N(tableId, name);
1562 }
1563
1564 StringBundler query = new StringBundler(3);
1565
1566 query.append(_FILTER_SQL_COUNT_EXPANDOCOLUMN_WHERE);
1567
1568 query.append(_FINDER_COLUMN_T_N_TABLEID_2);
1569
1570 boolean bindName = false;
1571
1572 if (name == null) {
1573 query.append(_FINDER_COLUMN_T_N_NAME_1);
1574 }
1575 else if (name.equals(StringPool.BLANK)) {
1576 query.append(_FINDER_COLUMN_T_N_NAME_3);
1577 }
1578 else {
1579 bindName = true;
1580
1581 query.append(_FINDER_COLUMN_T_N_NAME_2);
1582 }
1583
1584 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1585 ExpandoColumn.class.getName(),
1586 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
1587
1588 Session session = null;
1589
1590 try {
1591 session = openSession();
1592
1593 SQLQuery q = session.createSynchronizedSQLQuery(sql);
1594
1595 q.addScalar(COUNT_COLUMN_NAME,
1596 com.liferay.portal.kernel.dao.orm.Type.LONG);
1597
1598 QueryPos qPos = QueryPos.getInstance(q);
1599
1600 qPos.add(tableId);
1601
1602 if (bindName) {
1603 qPos.add(name);
1604 }
1605
1606 Long count = (Long)q.uniqueResult();
1607
1608 return count.intValue();
1609 }
1610 catch (Exception e) {
1611 throw processException(e);
1612 }
1613 finally {
1614 closeSession(session);
1615 }
1616 }
1617
1618
1625 @Override
1626 public int filterCountByT_N(long tableId, String[] names) {
1627 if (!InlineSQLHelperUtil.isEnabled()) {
1628 return countByT_N(tableId, names);
1629 }
1630
1631 if (names == null) {
1632 names = new String[0];
1633 }
1634 else if (names.length > 1) {
1635 names = ArrayUtil.distinct(names, NULL_SAFE_STRING_COMPARATOR);
1636
1637 Arrays.sort(names, NULL_SAFE_STRING_COMPARATOR);
1638 }
1639
1640 StringBundler query = new StringBundler();
1641
1642 query.append(_FILTER_SQL_COUNT_EXPANDOCOLUMN_WHERE);
1643
1644 query.append(_FINDER_COLUMN_T_N_TABLEID_2);
1645
1646 if (names.length > 0) {
1647 query.append(StringPool.OPEN_PARENTHESIS);
1648
1649 for (int i = 0; i < names.length; i++) {
1650 String name = names[i];
1651
1652 if (name == null) {
1653 query.append(_FINDER_COLUMN_T_N_NAME_1);
1654 }
1655 else if (name.equals(StringPool.BLANK)) {
1656 query.append(_FINDER_COLUMN_T_N_NAME_3);
1657 }
1658 else {
1659 query.append(_FINDER_COLUMN_T_N_NAME_2);
1660 }
1661
1662 if ((i + 1) < names.length) {
1663 query.append(WHERE_OR);
1664 }
1665 }
1666
1667 query.append(StringPool.CLOSE_PARENTHESIS);
1668 }
1669
1670 query.setStringAt(removeConjunction(query.stringAt(query.index() - 1)),
1671 query.index() - 1);
1672
1673 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1674 ExpandoColumn.class.getName(),
1675 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
1676
1677 Session session = null;
1678
1679 try {
1680 session = openSession();
1681
1682 SQLQuery q = session.createSynchronizedSQLQuery(sql);
1683
1684 q.addScalar(COUNT_COLUMN_NAME,
1685 com.liferay.portal.kernel.dao.orm.Type.LONG);
1686
1687 QueryPos qPos = QueryPos.getInstance(q);
1688
1689 qPos.add(tableId);
1690
1691 for (String name : names) {
1692 if ((name != null) && !name.isEmpty()) {
1693 qPos.add(name);
1694 }
1695 }
1696
1697 Long count = (Long)q.uniqueResult();
1698
1699 return count.intValue();
1700 }
1701 catch (Exception e) {
1702 throw processException(e);
1703 }
1704 finally {
1705 closeSession(session);
1706 }
1707 }
1708
1709 private static final String _FINDER_COLUMN_T_N_TABLEID_2 = "expandoColumn.tableId = ? AND ";
1710 private static final String _FINDER_COLUMN_T_N_NAME_1 = "expandoColumn.name IS NULL";
1711 private static final String _FINDER_COLUMN_T_N_NAME_2 = "expandoColumn.name = ?";
1712 private static final String _FINDER_COLUMN_T_N_NAME_3 = "(expandoColumn.name IS NULL OR expandoColumn.name = '')";
1713
1714 public ExpandoColumnPersistenceImpl() {
1715 setModelClass(ExpandoColumn.class);
1716 }
1717
1718
1723 @Override
1724 public void cacheResult(ExpandoColumn expandoColumn) {
1725 entityCache.putResult(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
1726 ExpandoColumnImpl.class, expandoColumn.getPrimaryKey(),
1727 expandoColumn);
1728
1729 finderCache.putResult(FINDER_PATH_FETCH_BY_T_N,
1730 new Object[] { expandoColumn.getTableId(), expandoColumn.getName() },
1731 expandoColumn);
1732
1733 expandoColumn.resetOriginalValues();
1734 }
1735
1736
1741 @Override
1742 public void cacheResult(List<ExpandoColumn> expandoColumns) {
1743 for (ExpandoColumn expandoColumn : expandoColumns) {
1744 if (entityCache.getResult(
1745 ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
1746 ExpandoColumnImpl.class, expandoColumn.getPrimaryKey()) == null) {
1747 cacheResult(expandoColumn);
1748 }
1749 else {
1750 expandoColumn.resetOriginalValues();
1751 }
1752 }
1753 }
1754
1755
1762 @Override
1763 public void clearCache() {
1764 entityCache.clearCache(ExpandoColumnImpl.class);
1765
1766 finderCache.clearCache(FINDER_CLASS_NAME_ENTITY);
1767 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1768 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1769 }
1770
1771
1778 @Override
1779 public void clearCache(ExpandoColumn expandoColumn) {
1780 entityCache.removeResult(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
1781 ExpandoColumnImpl.class, expandoColumn.getPrimaryKey());
1782
1783 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1784 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1785
1786 clearUniqueFindersCache((ExpandoColumnModelImpl)expandoColumn);
1787 }
1788
1789 @Override
1790 public void clearCache(List<ExpandoColumn> expandoColumns) {
1791 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1792 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1793
1794 for (ExpandoColumn expandoColumn : expandoColumns) {
1795 entityCache.removeResult(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
1796 ExpandoColumnImpl.class, expandoColumn.getPrimaryKey());
1797
1798 clearUniqueFindersCache((ExpandoColumnModelImpl)expandoColumn);
1799 }
1800 }
1801
1802 protected void cacheUniqueFindersCache(
1803 ExpandoColumnModelImpl expandoColumnModelImpl, boolean isNew) {
1804 if (isNew) {
1805 Object[] args = new Object[] {
1806 expandoColumnModelImpl.getTableId(),
1807 expandoColumnModelImpl.getName()
1808 };
1809
1810 finderCache.putResult(FINDER_PATH_COUNT_BY_T_N, args,
1811 Long.valueOf(1));
1812 finderCache.putResult(FINDER_PATH_FETCH_BY_T_N, args,
1813 expandoColumnModelImpl);
1814 }
1815 else {
1816 if ((expandoColumnModelImpl.getColumnBitmask() &
1817 FINDER_PATH_FETCH_BY_T_N.getColumnBitmask()) != 0) {
1818 Object[] args = new Object[] {
1819 expandoColumnModelImpl.getTableId(),
1820 expandoColumnModelImpl.getName()
1821 };
1822
1823 finderCache.putResult(FINDER_PATH_COUNT_BY_T_N, args,
1824 Long.valueOf(1));
1825 finderCache.putResult(FINDER_PATH_FETCH_BY_T_N, args,
1826 expandoColumnModelImpl);
1827 }
1828 }
1829 }
1830
1831 protected void clearUniqueFindersCache(
1832 ExpandoColumnModelImpl expandoColumnModelImpl) {
1833 Object[] args = new Object[] {
1834 expandoColumnModelImpl.getTableId(),
1835 expandoColumnModelImpl.getName()
1836 };
1837
1838 finderCache.removeResult(FINDER_PATH_COUNT_BY_T_N, args);
1839 finderCache.removeResult(FINDER_PATH_FETCH_BY_T_N, args);
1840
1841 if ((expandoColumnModelImpl.getColumnBitmask() &
1842 FINDER_PATH_FETCH_BY_T_N.getColumnBitmask()) != 0) {
1843 args = new Object[] {
1844 expandoColumnModelImpl.getOriginalTableId(),
1845 expandoColumnModelImpl.getOriginalName()
1846 };
1847
1848 finderCache.removeResult(FINDER_PATH_COUNT_BY_T_N, args);
1849 finderCache.removeResult(FINDER_PATH_FETCH_BY_T_N, args);
1850 }
1851 }
1852
1853
1859 @Override
1860 public ExpandoColumn create(long columnId) {
1861 ExpandoColumn expandoColumn = new ExpandoColumnImpl();
1862
1863 expandoColumn.setNew(true);
1864 expandoColumn.setPrimaryKey(columnId);
1865
1866 return expandoColumn;
1867 }
1868
1869
1876 @Override
1877 public ExpandoColumn remove(long columnId) throws NoSuchColumnException {
1878 return remove((Serializable)columnId);
1879 }
1880
1881
1888 @Override
1889 public ExpandoColumn remove(Serializable primaryKey)
1890 throws NoSuchColumnException {
1891 Session session = null;
1892
1893 try {
1894 session = openSession();
1895
1896 ExpandoColumn expandoColumn = (ExpandoColumn)session.get(ExpandoColumnImpl.class,
1897 primaryKey);
1898
1899 if (expandoColumn == null) {
1900 if (_log.isWarnEnabled()) {
1901 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
1902 }
1903
1904 throw new NoSuchColumnException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
1905 primaryKey);
1906 }
1907
1908 return remove(expandoColumn);
1909 }
1910 catch (NoSuchColumnException nsee) {
1911 throw nsee;
1912 }
1913 catch (Exception e) {
1914 throw processException(e);
1915 }
1916 finally {
1917 closeSession(session);
1918 }
1919 }
1920
1921 @Override
1922 protected ExpandoColumn removeImpl(ExpandoColumn expandoColumn) {
1923 expandoColumn = toUnwrappedModel(expandoColumn);
1924
1925 Session session = null;
1926
1927 try {
1928 session = openSession();
1929
1930 if (!session.contains(expandoColumn)) {
1931 expandoColumn = (ExpandoColumn)session.get(ExpandoColumnImpl.class,
1932 expandoColumn.getPrimaryKeyObj());
1933 }
1934
1935 if (expandoColumn != null) {
1936 session.delete(expandoColumn);
1937 }
1938 }
1939 catch (Exception e) {
1940 throw processException(e);
1941 }
1942 finally {
1943 closeSession(session);
1944 }
1945
1946 if (expandoColumn != null) {
1947 clearCache(expandoColumn);
1948 }
1949
1950 return expandoColumn;
1951 }
1952
1953 @Override
1954 public ExpandoColumn updateImpl(ExpandoColumn expandoColumn) {
1955 expandoColumn = toUnwrappedModel(expandoColumn);
1956
1957 boolean isNew = expandoColumn.isNew();
1958
1959 ExpandoColumnModelImpl expandoColumnModelImpl = (ExpandoColumnModelImpl)expandoColumn;
1960
1961 Session session = null;
1962
1963 try {
1964 session = openSession();
1965
1966 if (expandoColumn.isNew()) {
1967 session.save(expandoColumn);
1968
1969 expandoColumn.setNew(false);
1970 }
1971 else {
1972 expandoColumn = (ExpandoColumn)session.merge(expandoColumn);
1973 }
1974 }
1975 catch (Exception e) {
1976 throw processException(e);
1977 }
1978 finally {
1979 closeSession(session);
1980 }
1981
1982 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1983
1984 if (isNew || !ExpandoColumnModelImpl.COLUMN_BITMASK_ENABLED) {
1985 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1986 }
1987
1988 else {
1989 if ((expandoColumnModelImpl.getColumnBitmask() &
1990 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TABLEID.getColumnBitmask()) != 0) {
1991 Object[] args = new Object[] {
1992 expandoColumnModelImpl.getOriginalTableId()
1993 };
1994
1995 finderCache.removeResult(FINDER_PATH_COUNT_BY_TABLEID, args);
1996 finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TABLEID,
1997 args);
1998
1999 args = new Object[] { expandoColumnModelImpl.getTableId() };
2000
2001 finderCache.removeResult(FINDER_PATH_COUNT_BY_TABLEID, args);
2002 finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TABLEID,
2003 args);
2004 }
2005
2006 if ((expandoColumnModelImpl.getColumnBitmask() &
2007 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_T_N.getColumnBitmask()) != 0) {
2008 Object[] args = new Object[] {
2009 expandoColumnModelImpl.getOriginalTableId(),
2010 expandoColumnModelImpl.getOriginalName()
2011 };
2012
2013 finderCache.removeResult(FINDER_PATH_COUNT_BY_T_N, args);
2014 finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_T_N,
2015 args);
2016
2017 args = new Object[] {
2018 expandoColumnModelImpl.getTableId(),
2019 expandoColumnModelImpl.getName()
2020 };
2021
2022 finderCache.removeResult(FINDER_PATH_COUNT_BY_T_N, args);
2023 finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_T_N,
2024 args);
2025 }
2026 }
2027
2028 entityCache.putResult(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
2029 ExpandoColumnImpl.class, expandoColumn.getPrimaryKey(),
2030 expandoColumn, false);
2031
2032 clearUniqueFindersCache(expandoColumnModelImpl);
2033 cacheUniqueFindersCache(expandoColumnModelImpl, isNew);
2034
2035 expandoColumn.resetOriginalValues();
2036
2037 return expandoColumn;
2038 }
2039
2040 protected ExpandoColumn toUnwrappedModel(ExpandoColumn expandoColumn) {
2041 if (expandoColumn instanceof ExpandoColumnImpl) {
2042 return expandoColumn;
2043 }
2044
2045 ExpandoColumnImpl expandoColumnImpl = new ExpandoColumnImpl();
2046
2047 expandoColumnImpl.setNew(expandoColumn.isNew());
2048 expandoColumnImpl.setPrimaryKey(expandoColumn.getPrimaryKey());
2049
2050 expandoColumnImpl.setColumnId(expandoColumn.getColumnId());
2051 expandoColumnImpl.setCompanyId(expandoColumn.getCompanyId());
2052 expandoColumnImpl.setTableId(expandoColumn.getTableId());
2053 expandoColumnImpl.setName(expandoColumn.getName());
2054 expandoColumnImpl.setType(expandoColumn.getType());
2055 expandoColumnImpl.setDefaultData(expandoColumn.getDefaultData());
2056 expandoColumnImpl.setTypeSettings(expandoColumn.getTypeSettings());
2057
2058 return expandoColumnImpl;
2059 }
2060
2061
2068 @Override
2069 public ExpandoColumn findByPrimaryKey(Serializable primaryKey)
2070 throws NoSuchColumnException {
2071 ExpandoColumn expandoColumn = fetchByPrimaryKey(primaryKey);
2072
2073 if (expandoColumn == null) {
2074 if (_log.isWarnEnabled()) {
2075 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
2076 }
2077
2078 throw new NoSuchColumnException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
2079 primaryKey);
2080 }
2081
2082 return expandoColumn;
2083 }
2084
2085
2092 @Override
2093 public ExpandoColumn findByPrimaryKey(long columnId)
2094 throws NoSuchColumnException {
2095 return findByPrimaryKey((Serializable)columnId);
2096 }
2097
2098
2104 @Override
2105 public ExpandoColumn fetchByPrimaryKey(Serializable primaryKey) {
2106 ExpandoColumn expandoColumn = (ExpandoColumn)entityCache.getResult(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
2107 ExpandoColumnImpl.class, primaryKey);
2108
2109 if (expandoColumn == _nullExpandoColumn) {
2110 return null;
2111 }
2112
2113 if (expandoColumn == null) {
2114 Session session = null;
2115
2116 try {
2117 session = openSession();
2118
2119 expandoColumn = (ExpandoColumn)session.get(ExpandoColumnImpl.class,
2120 primaryKey);
2121
2122 if (expandoColumn != null) {
2123 cacheResult(expandoColumn);
2124 }
2125 else {
2126 entityCache.putResult(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
2127 ExpandoColumnImpl.class, primaryKey, _nullExpandoColumn);
2128 }
2129 }
2130 catch (Exception e) {
2131 entityCache.removeResult(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
2132 ExpandoColumnImpl.class, primaryKey);
2133
2134 throw processException(e);
2135 }
2136 finally {
2137 closeSession(session);
2138 }
2139 }
2140
2141 return expandoColumn;
2142 }
2143
2144
2150 @Override
2151 public ExpandoColumn fetchByPrimaryKey(long columnId) {
2152 return fetchByPrimaryKey((Serializable)columnId);
2153 }
2154
2155 @Override
2156 public Map<Serializable, ExpandoColumn> fetchByPrimaryKeys(
2157 Set<Serializable> primaryKeys) {
2158 if (primaryKeys.isEmpty()) {
2159 return Collections.emptyMap();
2160 }
2161
2162 Map<Serializable, ExpandoColumn> map = new HashMap<Serializable, ExpandoColumn>();
2163
2164 if (primaryKeys.size() == 1) {
2165 Iterator<Serializable> iterator = primaryKeys.iterator();
2166
2167 Serializable primaryKey = iterator.next();
2168
2169 ExpandoColumn expandoColumn = fetchByPrimaryKey(primaryKey);
2170
2171 if (expandoColumn != null) {
2172 map.put(primaryKey, expandoColumn);
2173 }
2174
2175 return map;
2176 }
2177
2178 Set<Serializable> uncachedPrimaryKeys = null;
2179
2180 for (Serializable primaryKey : primaryKeys) {
2181 ExpandoColumn expandoColumn = (ExpandoColumn)entityCache.getResult(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
2182 ExpandoColumnImpl.class, primaryKey);
2183
2184 if (expandoColumn == null) {
2185 if (uncachedPrimaryKeys == null) {
2186 uncachedPrimaryKeys = new HashSet<Serializable>();
2187 }
2188
2189 uncachedPrimaryKeys.add(primaryKey);
2190 }
2191 else {
2192 map.put(primaryKey, expandoColumn);
2193 }
2194 }
2195
2196 if (uncachedPrimaryKeys == null) {
2197 return map;
2198 }
2199
2200 StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) +
2201 1);
2202
2203 query.append(_SQL_SELECT_EXPANDOCOLUMN_WHERE_PKS_IN);
2204
2205 for (Serializable primaryKey : uncachedPrimaryKeys) {
2206 query.append(String.valueOf(primaryKey));
2207
2208 query.append(StringPool.COMMA);
2209 }
2210
2211 query.setIndex(query.index() - 1);
2212
2213 query.append(StringPool.CLOSE_PARENTHESIS);
2214
2215 String sql = query.toString();
2216
2217 Session session = null;
2218
2219 try {
2220 session = openSession();
2221
2222 Query q = session.createQuery(sql);
2223
2224 for (ExpandoColumn expandoColumn : (List<ExpandoColumn>)q.list()) {
2225 map.put(expandoColumn.getPrimaryKeyObj(), expandoColumn);
2226
2227 cacheResult(expandoColumn);
2228
2229 uncachedPrimaryKeys.remove(expandoColumn.getPrimaryKeyObj());
2230 }
2231
2232 for (Serializable primaryKey : uncachedPrimaryKeys) {
2233 entityCache.putResult(ExpandoColumnModelImpl.ENTITY_CACHE_ENABLED,
2234 ExpandoColumnImpl.class, primaryKey, _nullExpandoColumn);
2235 }
2236 }
2237 catch (Exception e) {
2238 throw processException(e);
2239 }
2240 finally {
2241 closeSession(session);
2242 }
2243
2244 return map;
2245 }
2246
2247
2252 @Override
2253 public List<ExpandoColumn> findAll() {
2254 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2255 }
2256
2257
2268 @Override
2269 public List<ExpandoColumn> findAll(int start, int end) {
2270 return findAll(start, end, null);
2271 }
2272
2273
2285 @Override
2286 public List<ExpandoColumn> findAll(int start, int end,
2287 OrderByComparator<ExpandoColumn> orderByComparator) {
2288 return findAll(start, end, orderByComparator, true);
2289 }
2290
2291
2304 @Override
2305 public List<ExpandoColumn> findAll(int start, int end,
2306 OrderByComparator<ExpandoColumn> orderByComparator,
2307 boolean retrieveFromCache) {
2308 boolean pagination = true;
2309 FinderPath finderPath = null;
2310 Object[] finderArgs = null;
2311
2312 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2313 (orderByComparator == null)) {
2314 pagination = false;
2315 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
2316 finderArgs = FINDER_ARGS_EMPTY;
2317 }
2318 else {
2319 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
2320 finderArgs = new Object[] { start, end, orderByComparator };
2321 }
2322
2323 List<ExpandoColumn> list = null;
2324
2325 if (retrieveFromCache) {
2326 list = (List<ExpandoColumn>)finderCache.getResult(finderPath,
2327 finderArgs, this);
2328 }
2329
2330 if (list == null) {
2331 StringBundler query = null;
2332 String sql = null;
2333
2334 if (orderByComparator != null) {
2335 query = new StringBundler(2 +
2336 (orderByComparator.getOrderByFields().length * 3));
2337
2338 query.append(_SQL_SELECT_EXPANDOCOLUMN);
2339
2340 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2341 orderByComparator);
2342
2343 sql = query.toString();
2344 }
2345 else {
2346 sql = _SQL_SELECT_EXPANDOCOLUMN;
2347
2348 if (pagination) {
2349 sql = sql.concat(ExpandoColumnModelImpl.ORDER_BY_JPQL);
2350 }
2351 }
2352
2353 Session session = null;
2354
2355 try {
2356 session = openSession();
2357
2358 Query q = session.createQuery(sql);
2359
2360 if (!pagination) {
2361 list = (List<ExpandoColumn>)QueryUtil.list(q, getDialect(),
2362 start, end, false);
2363
2364 Collections.sort(list);
2365
2366 list = Collections.unmodifiableList(list);
2367 }
2368 else {
2369 list = (List<ExpandoColumn>)QueryUtil.list(q, getDialect(),
2370 start, end);
2371 }
2372
2373 cacheResult(list);
2374
2375 finderCache.putResult(finderPath, finderArgs, list);
2376 }
2377 catch (Exception e) {
2378 finderCache.removeResult(finderPath, finderArgs);
2379
2380 throw processException(e);
2381 }
2382 finally {
2383 closeSession(session);
2384 }
2385 }
2386
2387 return list;
2388 }
2389
2390
2394 @Override
2395 public void removeAll() {
2396 for (ExpandoColumn expandoColumn : findAll()) {
2397 remove(expandoColumn);
2398 }
2399 }
2400
2401
2406 @Override
2407 public int countAll() {
2408 Long count = (Long)finderCache.getResult(FINDER_PATH_COUNT_ALL,
2409 FINDER_ARGS_EMPTY, this);
2410
2411 if (count == null) {
2412 Session session = null;
2413
2414 try {
2415 session = openSession();
2416
2417 Query q = session.createQuery(_SQL_COUNT_EXPANDOCOLUMN);
2418
2419 count = (Long)q.uniqueResult();
2420
2421 finderCache.putResult(FINDER_PATH_COUNT_ALL, FINDER_ARGS_EMPTY,
2422 count);
2423 }
2424 catch (Exception e) {
2425 finderCache.removeResult(FINDER_PATH_COUNT_ALL,
2426 FINDER_ARGS_EMPTY);
2427
2428 throw processException(e);
2429 }
2430 finally {
2431 closeSession(session);
2432 }
2433 }
2434
2435 return count.intValue();
2436 }
2437
2438 @Override
2439 public Set<String> getBadColumnNames() {
2440 return _badColumnNames;
2441 }
2442
2443 @Override
2444 protected Map<String, Integer> getTableColumnsMap() {
2445 return ExpandoColumnModelImpl.TABLE_COLUMNS_MAP;
2446 }
2447
2448
2451 public void afterPropertiesSet() {
2452 }
2453
2454 public void destroy() {
2455 entityCache.removeCache(ExpandoColumnImpl.class.getName());
2456 finderCache.removeCache(FINDER_CLASS_NAME_ENTITY);
2457 finderCache.removeCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
2458 finderCache.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2459 }
2460
2461 protected EntityCache entityCache = EntityCacheUtil.getEntityCache();
2462 protected FinderCache finderCache = FinderCacheUtil.getFinderCache();
2463 private static final String _SQL_SELECT_EXPANDOCOLUMN = "SELECT expandoColumn FROM ExpandoColumn expandoColumn";
2464 private static final String _SQL_SELECT_EXPANDOCOLUMN_WHERE_PKS_IN = "SELECT expandoColumn FROM ExpandoColumn expandoColumn WHERE columnId IN (";
2465 private static final String _SQL_SELECT_EXPANDOCOLUMN_WHERE = "SELECT expandoColumn FROM ExpandoColumn expandoColumn WHERE ";
2466 private static final String _SQL_COUNT_EXPANDOCOLUMN = "SELECT COUNT(expandoColumn) FROM ExpandoColumn expandoColumn";
2467 private static final String _SQL_COUNT_EXPANDOCOLUMN_WHERE = "SELECT COUNT(expandoColumn) FROM ExpandoColumn expandoColumn WHERE ";
2468 private static final String _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN = "expandoColumn.columnId";
2469 private static final String _FILTER_SQL_SELECT_EXPANDOCOLUMN_WHERE = "SELECT DISTINCT {expandoColumn.*} FROM ExpandoColumn expandoColumn WHERE ";
2470 private static final String _FILTER_SQL_SELECT_EXPANDOCOLUMN_NO_INLINE_DISTINCT_WHERE_1 =
2471 "SELECT {ExpandoColumn.*} FROM (SELECT DISTINCT expandoColumn.columnId FROM ExpandoColumn expandoColumn WHERE ";
2472 private static final String _FILTER_SQL_SELECT_EXPANDOCOLUMN_NO_INLINE_DISTINCT_WHERE_2 =
2473 ") TEMP_TABLE INNER JOIN ExpandoColumn ON TEMP_TABLE.columnId = ExpandoColumn.columnId";
2474 private static final String _FILTER_SQL_COUNT_EXPANDOCOLUMN_WHERE = "SELECT COUNT(DISTINCT expandoColumn.columnId) AS COUNT_VALUE FROM ExpandoColumn expandoColumn WHERE ";
2475 private static final String _FILTER_ENTITY_ALIAS = "expandoColumn";
2476 private static final String _FILTER_ENTITY_TABLE = "ExpandoColumn";
2477 private static final String _ORDER_BY_ENTITY_ALIAS = "expandoColumn.";
2478 private static final String _ORDER_BY_ENTITY_TABLE = "ExpandoColumn.";
2479 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No ExpandoColumn exists with the primary key ";
2480 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No ExpandoColumn exists with the key {";
2481 private static final Log _log = LogFactoryUtil.getLog(ExpandoColumnPersistenceImpl.class);
2482 private static final Set<String> _badColumnNames = SetUtil.fromArray(new String[] {
2483 "type"
2484 });
2485 private static final ExpandoColumn _nullExpandoColumn = new ExpandoColumnImpl() {
2486 @Override
2487 public Object clone() {
2488 return this;
2489 }
2490
2491 @Override
2492 public CacheModel<ExpandoColumn> toCacheModel() {
2493 return _nullExpandoColumnCacheModel;
2494 }
2495 };
2496
2497 private static final CacheModel<ExpandoColumn> _nullExpandoColumnCacheModel = new CacheModel<ExpandoColumn>() {
2498 @Override
2499 public ExpandoColumn toEntityModel() {
2500 return _nullExpandoColumn;
2501 }
2502 };
2503 }