001
014
015 package com.liferay.portlet.exportimport.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.Session;
028 import com.liferay.portal.kernel.log.Log;
029 import com.liferay.portal.kernel.log.LogFactoryUtil;
030 import com.liferay.portal.kernel.util.OrderByComparator;
031 import com.liferay.portal.kernel.util.SetUtil;
032 import com.liferay.portal.kernel.util.StringBundler;
033 import com.liferay.portal.kernel.util.StringPool;
034 import com.liferay.portal.model.CacheModel;
035 import com.liferay.portal.model.MVCCModel;
036 import com.liferay.portal.service.ServiceContext;
037 import com.liferay.portal.service.ServiceContextThreadLocal;
038 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
039
040 import com.liferay.portlet.exportimport.NoSuchConfigurationException;
041 import com.liferay.portlet.exportimport.model.ExportImportConfiguration;
042 import com.liferay.portlet.exportimport.model.impl.ExportImportConfigurationImpl;
043 import com.liferay.portlet.exportimport.model.impl.ExportImportConfigurationModelImpl;
044 import com.liferay.portlet.exportimport.service.persistence.ExportImportConfigurationPersistence;
045
046 import java.io.Serializable;
047
048 import java.util.Collections;
049 import java.util.Date;
050 import java.util.HashMap;
051 import java.util.HashSet;
052 import java.util.Iterator;
053 import java.util.List;
054 import java.util.Map;
055 import java.util.Set;
056
057
069 @ProviderType
070 public class ExportImportConfigurationPersistenceImpl
071 extends BasePersistenceImpl<ExportImportConfiguration>
072 implements ExportImportConfigurationPersistence {
073
078 public static final String FINDER_CLASS_NAME_ENTITY = ExportImportConfigurationImpl.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(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
084 ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
085 ExportImportConfigurationImpl.class,
086 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
087 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
088 ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
089 ExportImportConfigurationImpl.class,
090 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
091 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
092 ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
093 Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll",
094 new String[0]);
095 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID = new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
096 ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
097 ExportImportConfigurationImpl.class,
098 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByGroupId",
099 new String[] {
100 Long.class.getName(),
101
102 Integer.class.getName(), Integer.class.getName(),
103 OrderByComparator.class.getName()
104 });
105 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID =
106 new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
107 ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
108 ExportImportConfigurationImpl.class,
109 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByGroupId",
110 new String[] { Long.class.getName() },
111 ExportImportConfigurationModelImpl.GROUPID_COLUMN_BITMASK |
112 ExportImportConfigurationModelImpl.CREATEDATE_COLUMN_BITMASK);
113 public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
114 ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
115 Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
116 "countByGroupId", new String[] { Long.class.getName() });
117
118
124 @Override
125 public List<ExportImportConfiguration> findByGroupId(long groupId) {
126 return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
127 }
128
129
141 @Override
142 public List<ExportImportConfiguration> findByGroupId(long groupId,
143 int start, int end) {
144 return findByGroupId(groupId, start, end, null);
145 }
146
147
160 @Override
161 public List<ExportImportConfiguration> findByGroupId(long groupId,
162 int start, int end,
163 OrderByComparator<ExportImportConfiguration> orderByComparator) {
164 return findByGroupId(groupId, start, end, orderByComparator, true);
165 }
166
167
181 @Override
182 public List<ExportImportConfiguration> findByGroupId(long groupId,
183 int start, int end,
184 OrderByComparator<ExportImportConfiguration> orderByComparator,
185 boolean retrieveFromCache) {
186 boolean pagination = true;
187 FinderPath finderPath = null;
188 Object[] finderArgs = null;
189
190 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
191 (orderByComparator == null)) {
192 pagination = false;
193 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID;
194 finderArgs = new Object[] { groupId };
195 }
196 else {
197 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID;
198 finderArgs = new Object[] { groupId, start, end, orderByComparator };
199 }
200
201 List<ExportImportConfiguration> list = null;
202
203 if (retrieveFromCache) {
204 list = (List<ExportImportConfiguration>)finderCache.getResult(finderPath,
205 finderArgs, this);
206
207 if ((list != null) && !list.isEmpty()) {
208 for (ExportImportConfiguration exportImportConfiguration : list) {
209 if ((groupId != exportImportConfiguration.getGroupId())) {
210 list = null;
211
212 break;
213 }
214 }
215 }
216 }
217
218 if (list == null) {
219 StringBundler query = null;
220
221 if (orderByComparator != null) {
222 query = new StringBundler(3 +
223 (orderByComparator.getOrderByFields().length * 3));
224 }
225 else {
226 query = new StringBundler(3);
227 }
228
229 query.append(_SQL_SELECT_EXPORTIMPORTCONFIGURATION_WHERE);
230
231 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
232
233 if (orderByComparator != null) {
234 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
235 orderByComparator);
236 }
237 else
238 if (pagination) {
239 query.append(ExportImportConfigurationModelImpl.ORDER_BY_JPQL);
240 }
241
242 String sql = query.toString();
243
244 Session session = null;
245
246 try {
247 session = openSession();
248
249 Query q = session.createQuery(sql);
250
251 QueryPos qPos = QueryPos.getInstance(q);
252
253 qPos.add(groupId);
254
255 if (!pagination) {
256 list = (List<ExportImportConfiguration>)QueryUtil.list(q,
257 getDialect(), start, end, false);
258
259 Collections.sort(list);
260
261 list = Collections.unmodifiableList(list);
262 }
263 else {
264 list = (List<ExportImportConfiguration>)QueryUtil.list(q,
265 getDialect(), start, end);
266 }
267
268 cacheResult(list);
269
270 finderCache.putResult(finderPath, finderArgs, list);
271 }
272 catch (Exception e) {
273 finderCache.removeResult(finderPath, finderArgs);
274
275 throw processException(e);
276 }
277 finally {
278 closeSession(session);
279 }
280 }
281
282 return list;
283 }
284
285
293 @Override
294 public ExportImportConfiguration findByGroupId_First(long groupId,
295 OrderByComparator<ExportImportConfiguration> orderByComparator)
296 throws NoSuchConfigurationException {
297 ExportImportConfiguration exportImportConfiguration = fetchByGroupId_First(groupId,
298 orderByComparator);
299
300 if (exportImportConfiguration != null) {
301 return exportImportConfiguration;
302 }
303
304 StringBundler msg = new StringBundler(4);
305
306 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
307
308 msg.append("groupId=");
309 msg.append(groupId);
310
311 msg.append(StringPool.CLOSE_CURLY_BRACE);
312
313 throw new NoSuchConfigurationException(msg.toString());
314 }
315
316
323 @Override
324 public ExportImportConfiguration fetchByGroupId_First(long groupId,
325 OrderByComparator<ExportImportConfiguration> orderByComparator) {
326 List<ExportImportConfiguration> list = findByGroupId(groupId, 0, 1,
327 orderByComparator);
328
329 if (!list.isEmpty()) {
330 return list.get(0);
331 }
332
333 return null;
334 }
335
336
344 @Override
345 public ExportImportConfiguration findByGroupId_Last(long groupId,
346 OrderByComparator<ExportImportConfiguration> orderByComparator)
347 throws NoSuchConfigurationException {
348 ExportImportConfiguration exportImportConfiguration = fetchByGroupId_Last(groupId,
349 orderByComparator);
350
351 if (exportImportConfiguration != null) {
352 return exportImportConfiguration;
353 }
354
355 StringBundler msg = new StringBundler(4);
356
357 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
358
359 msg.append("groupId=");
360 msg.append(groupId);
361
362 msg.append(StringPool.CLOSE_CURLY_BRACE);
363
364 throw new NoSuchConfigurationException(msg.toString());
365 }
366
367
374 @Override
375 public ExportImportConfiguration fetchByGroupId_Last(long groupId,
376 OrderByComparator<ExportImportConfiguration> orderByComparator) {
377 int count = countByGroupId(groupId);
378
379 if (count == 0) {
380 return null;
381 }
382
383 List<ExportImportConfiguration> list = findByGroupId(groupId,
384 count - 1, count, orderByComparator);
385
386 if (!list.isEmpty()) {
387 return list.get(0);
388 }
389
390 return null;
391 }
392
393
402 @Override
403 public ExportImportConfiguration[] findByGroupId_PrevAndNext(
404 long exportImportConfigurationId, long groupId,
405 OrderByComparator<ExportImportConfiguration> orderByComparator)
406 throws NoSuchConfigurationException {
407 ExportImportConfiguration exportImportConfiguration = findByPrimaryKey(exportImportConfigurationId);
408
409 Session session = null;
410
411 try {
412 session = openSession();
413
414 ExportImportConfiguration[] array = new ExportImportConfigurationImpl[3];
415
416 array[0] = getByGroupId_PrevAndNext(session,
417 exportImportConfiguration, groupId, orderByComparator, true);
418
419 array[1] = exportImportConfiguration;
420
421 array[2] = getByGroupId_PrevAndNext(session,
422 exportImportConfiguration, groupId, orderByComparator, false);
423
424 return array;
425 }
426 catch (Exception e) {
427 throw processException(e);
428 }
429 finally {
430 closeSession(session);
431 }
432 }
433
434 protected ExportImportConfiguration getByGroupId_PrevAndNext(
435 Session session, ExportImportConfiguration exportImportConfiguration,
436 long groupId,
437 OrderByComparator<ExportImportConfiguration> orderByComparator,
438 boolean previous) {
439 StringBundler query = null;
440
441 if (orderByComparator != null) {
442 query = new StringBundler(6 +
443 (orderByComparator.getOrderByFields().length * 6));
444 }
445 else {
446 query = new StringBundler(3);
447 }
448
449 query.append(_SQL_SELECT_EXPORTIMPORTCONFIGURATION_WHERE);
450
451 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
452
453 if (orderByComparator != null) {
454 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
455
456 if (orderByConditionFields.length > 0) {
457 query.append(WHERE_AND);
458 }
459
460 for (int i = 0; i < orderByConditionFields.length; i++) {
461 query.append(_ORDER_BY_ENTITY_ALIAS);
462 query.append(orderByConditionFields[i]);
463
464 if ((i + 1) < orderByConditionFields.length) {
465 if (orderByComparator.isAscending() ^ previous) {
466 query.append(WHERE_GREATER_THAN_HAS_NEXT);
467 }
468 else {
469 query.append(WHERE_LESSER_THAN_HAS_NEXT);
470 }
471 }
472 else {
473 if (orderByComparator.isAscending() ^ previous) {
474 query.append(WHERE_GREATER_THAN);
475 }
476 else {
477 query.append(WHERE_LESSER_THAN);
478 }
479 }
480 }
481
482 query.append(ORDER_BY_CLAUSE);
483
484 String[] orderByFields = orderByComparator.getOrderByFields();
485
486 for (int i = 0; i < orderByFields.length; i++) {
487 query.append(_ORDER_BY_ENTITY_ALIAS);
488 query.append(orderByFields[i]);
489
490 if ((i + 1) < orderByFields.length) {
491 if (orderByComparator.isAscending() ^ previous) {
492 query.append(ORDER_BY_ASC_HAS_NEXT);
493 }
494 else {
495 query.append(ORDER_BY_DESC_HAS_NEXT);
496 }
497 }
498 else {
499 if (orderByComparator.isAscending() ^ previous) {
500 query.append(ORDER_BY_ASC);
501 }
502 else {
503 query.append(ORDER_BY_DESC);
504 }
505 }
506 }
507 }
508 else {
509 query.append(ExportImportConfigurationModelImpl.ORDER_BY_JPQL);
510 }
511
512 String sql = query.toString();
513
514 Query q = session.createQuery(sql);
515
516 q.setFirstResult(0);
517 q.setMaxResults(2);
518
519 QueryPos qPos = QueryPos.getInstance(q);
520
521 qPos.add(groupId);
522
523 if (orderByComparator != null) {
524 Object[] values = orderByComparator.getOrderByConditionValues(exportImportConfiguration);
525
526 for (Object value : values) {
527 qPos.add(value);
528 }
529 }
530
531 List<ExportImportConfiguration> list = q.list();
532
533 if (list.size() == 2) {
534 return list.get(1);
535 }
536 else {
537 return null;
538 }
539 }
540
541
546 @Override
547 public void removeByGroupId(long groupId) {
548 for (ExportImportConfiguration exportImportConfiguration : findByGroupId(
549 groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
550 remove(exportImportConfiguration);
551 }
552 }
553
554
560 @Override
561 public int countByGroupId(long groupId) {
562 FinderPath finderPath = FINDER_PATH_COUNT_BY_GROUPID;
563
564 Object[] finderArgs = new Object[] { groupId };
565
566 Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
567
568 if (count == null) {
569 StringBundler query = new StringBundler(2);
570
571 query.append(_SQL_COUNT_EXPORTIMPORTCONFIGURATION_WHERE);
572
573 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
574
575 String sql = query.toString();
576
577 Session session = null;
578
579 try {
580 session = openSession();
581
582 Query q = session.createQuery(sql);
583
584 QueryPos qPos = QueryPos.getInstance(q);
585
586 qPos.add(groupId);
587
588 count = (Long)q.uniqueResult();
589
590 finderCache.putResult(finderPath, finderArgs, count);
591 }
592 catch (Exception e) {
593 finderCache.removeResult(finderPath, finderArgs);
594
595 throw processException(e);
596 }
597 finally {
598 closeSession(session);
599 }
600 }
601
602 return count.intValue();
603 }
604
605 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "exportImportConfiguration.groupId = ?";
606 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID =
607 new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
608 ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
609 ExportImportConfigurationImpl.class,
610 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByCompanyId",
611 new String[] {
612 Long.class.getName(),
613
614 Integer.class.getName(), Integer.class.getName(),
615 OrderByComparator.class.getName()
616 });
617 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID =
618 new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
619 ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
620 ExportImportConfigurationImpl.class,
621 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByCompanyId",
622 new String[] { Long.class.getName() },
623 ExportImportConfigurationModelImpl.COMPANYID_COLUMN_BITMASK |
624 ExportImportConfigurationModelImpl.CREATEDATE_COLUMN_BITMASK);
625 public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
626 ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
627 Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
628 "countByCompanyId", new String[] { Long.class.getName() });
629
630
636 @Override
637 public List<ExportImportConfiguration> findByCompanyId(long companyId) {
638 return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
639 null);
640 }
641
642
654 @Override
655 public List<ExportImportConfiguration> findByCompanyId(long companyId,
656 int start, int end) {
657 return findByCompanyId(companyId, start, end, null);
658 }
659
660
673 @Override
674 public List<ExportImportConfiguration> findByCompanyId(long companyId,
675 int start, int end,
676 OrderByComparator<ExportImportConfiguration> orderByComparator) {
677 return findByCompanyId(companyId, start, end, orderByComparator, true);
678 }
679
680
694 @Override
695 public List<ExportImportConfiguration> findByCompanyId(long companyId,
696 int start, int end,
697 OrderByComparator<ExportImportConfiguration> orderByComparator,
698 boolean retrieveFromCache) {
699 boolean pagination = true;
700 FinderPath finderPath = null;
701 Object[] finderArgs = null;
702
703 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
704 (orderByComparator == null)) {
705 pagination = false;
706 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID;
707 finderArgs = new Object[] { companyId };
708 }
709 else {
710 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID;
711 finderArgs = new Object[] { companyId, start, end, orderByComparator };
712 }
713
714 List<ExportImportConfiguration> list = null;
715
716 if (retrieveFromCache) {
717 list = (List<ExportImportConfiguration>)finderCache.getResult(finderPath,
718 finderArgs, this);
719
720 if ((list != null) && !list.isEmpty()) {
721 for (ExportImportConfiguration exportImportConfiguration : list) {
722 if ((companyId != exportImportConfiguration.getCompanyId())) {
723 list = null;
724
725 break;
726 }
727 }
728 }
729 }
730
731 if (list == null) {
732 StringBundler query = null;
733
734 if (orderByComparator != null) {
735 query = new StringBundler(3 +
736 (orderByComparator.getOrderByFields().length * 3));
737 }
738 else {
739 query = new StringBundler(3);
740 }
741
742 query.append(_SQL_SELECT_EXPORTIMPORTCONFIGURATION_WHERE);
743
744 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
745
746 if (orderByComparator != null) {
747 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
748 orderByComparator);
749 }
750 else
751 if (pagination) {
752 query.append(ExportImportConfigurationModelImpl.ORDER_BY_JPQL);
753 }
754
755 String sql = query.toString();
756
757 Session session = null;
758
759 try {
760 session = openSession();
761
762 Query q = session.createQuery(sql);
763
764 QueryPos qPos = QueryPos.getInstance(q);
765
766 qPos.add(companyId);
767
768 if (!pagination) {
769 list = (List<ExportImportConfiguration>)QueryUtil.list(q,
770 getDialect(), start, end, false);
771
772 Collections.sort(list);
773
774 list = Collections.unmodifiableList(list);
775 }
776 else {
777 list = (List<ExportImportConfiguration>)QueryUtil.list(q,
778 getDialect(), start, end);
779 }
780
781 cacheResult(list);
782
783 finderCache.putResult(finderPath, finderArgs, list);
784 }
785 catch (Exception e) {
786 finderCache.removeResult(finderPath, finderArgs);
787
788 throw processException(e);
789 }
790 finally {
791 closeSession(session);
792 }
793 }
794
795 return list;
796 }
797
798
806 @Override
807 public ExportImportConfiguration findByCompanyId_First(long companyId,
808 OrderByComparator<ExportImportConfiguration> orderByComparator)
809 throws NoSuchConfigurationException {
810 ExportImportConfiguration exportImportConfiguration = fetchByCompanyId_First(companyId,
811 orderByComparator);
812
813 if (exportImportConfiguration != null) {
814 return exportImportConfiguration;
815 }
816
817 StringBundler msg = new StringBundler(4);
818
819 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
820
821 msg.append("companyId=");
822 msg.append(companyId);
823
824 msg.append(StringPool.CLOSE_CURLY_BRACE);
825
826 throw new NoSuchConfigurationException(msg.toString());
827 }
828
829
836 @Override
837 public ExportImportConfiguration fetchByCompanyId_First(long companyId,
838 OrderByComparator<ExportImportConfiguration> orderByComparator) {
839 List<ExportImportConfiguration> list = findByCompanyId(companyId, 0, 1,
840 orderByComparator);
841
842 if (!list.isEmpty()) {
843 return list.get(0);
844 }
845
846 return null;
847 }
848
849
857 @Override
858 public ExportImportConfiguration findByCompanyId_Last(long companyId,
859 OrderByComparator<ExportImportConfiguration> orderByComparator)
860 throws NoSuchConfigurationException {
861 ExportImportConfiguration exportImportConfiguration = fetchByCompanyId_Last(companyId,
862 orderByComparator);
863
864 if (exportImportConfiguration != null) {
865 return exportImportConfiguration;
866 }
867
868 StringBundler msg = new StringBundler(4);
869
870 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
871
872 msg.append("companyId=");
873 msg.append(companyId);
874
875 msg.append(StringPool.CLOSE_CURLY_BRACE);
876
877 throw new NoSuchConfigurationException(msg.toString());
878 }
879
880
887 @Override
888 public ExportImportConfiguration fetchByCompanyId_Last(long companyId,
889 OrderByComparator<ExportImportConfiguration> orderByComparator) {
890 int count = countByCompanyId(companyId);
891
892 if (count == 0) {
893 return null;
894 }
895
896 List<ExportImportConfiguration> list = findByCompanyId(companyId,
897 count - 1, count, orderByComparator);
898
899 if (!list.isEmpty()) {
900 return list.get(0);
901 }
902
903 return null;
904 }
905
906
915 @Override
916 public ExportImportConfiguration[] findByCompanyId_PrevAndNext(
917 long exportImportConfigurationId, long companyId,
918 OrderByComparator<ExportImportConfiguration> orderByComparator)
919 throws NoSuchConfigurationException {
920 ExportImportConfiguration exportImportConfiguration = findByPrimaryKey(exportImportConfigurationId);
921
922 Session session = null;
923
924 try {
925 session = openSession();
926
927 ExportImportConfiguration[] array = new ExportImportConfigurationImpl[3];
928
929 array[0] = getByCompanyId_PrevAndNext(session,
930 exportImportConfiguration, companyId, orderByComparator,
931 true);
932
933 array[1] = exportImportConfiguration;
934
935 array[2] = getByCompanyId_PrevAndNext(session,
936 exportImportConfiguration, companyId, orderByComparator,
937 false);
938
939 return array;
940 }
941 catch (Exception e) {
942 throw processException(e);
943 }
944 finally {
945 closeSession(session);
946 }
947 }
948
949 protected ExportImportConfiguration getByCompanyId_PrevAndNext(
950 Session session, ExportImportConfiguration exportImportConfiguration,
951 long companyId,
952 OrderByComparator<ExportImportConfiguration> orderByComparator,
953 boolean previous) {
954 StringBundler query = null;
955
956 if (orderByComparator != null) {
957 query = new StringBundler(6 +
958 (orderByComparator.getOrderByFields().length * 6));
959 }
960 else {
961 query = new StringBundler(3);
962 }
963
964 query.append(_SQL_SELECT_EXPORTIMPORTCONFIGURATION_WHERE);
965
966 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
967
968 if (orderByComparator != null) {
969 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
970
971 if (orderByConditionFields.length > 0) {
972 query.append(WHERE_AND);
973 }
974
975 for (int i = 0; i < orderByConditionFields.length; i++) {
976 query.append(_ORDER_BY_ENTITY_ALIAS);
977 query.append(orderByConditionFields[i]);
978
979 if ((i + 1) < orderByConditionFields.length) {
980 if (orderByComparator.isAscending() ^ previous) {
981 query.append(WHERE_GREATER_THAN_HAS_NEXT);
982 }
983 else {
984 query.append(WHERE_LESSER_THAN_HAS_NEXT);
985 }
986 }
987 else {
988 if (orderByComparator.isAscending() ^ previous) {
989 query.append(WHERE_GREATER_THAN);
990 }
991 else {
992 query.append(WHERE_LESSER_THAN);
993 }
994 }
995 }
996
997 query.append(ORDER_BY_CLAUSE);
998
999 String[] orderByFields = orderByComparator.getOrderByFields();
1000
1001 for (int i = 0; i < orderByFields.length; i++) {
1002 query.append(_ORDER_BY_ENTITY_ALIAS);
1003 query.append(orderByFields[i]);
1004
1005 if ((i + 1) < orderByFields.length) {
1006 if (orderByComparator.isAscending() ^ previous) {
1007 query.append(ORDER_BY_ASC_HAS_NEXT);
1008 }
1009 else {
1010 query.append(ORDER_BY_DESC_HAS_NEXT);
1011 }
1012 }
1013 else {
1014 if (orderByComparator.isAscending() ^ previous) {
1015 query.append(ORDER_BY_ASC);
1016 }
1017 else {
1018 query.append(ORDER_BY_DESC);
1019 }
1020 }
1021 }
1022 }
1023 else {
1024 query.append(ExportImportConfigurationModelImpl.ORDER_BY_JPQL);
1025 }
1026
1027 String sql = query.toString();
1028
1029 Query q = session.createQuery(sql);
1030
1031 q.setFirstResult(0);
1032 q.setMaxResults(2);
1033
1034 QueryPos qPos = QueryPos.getInstance(q);
1035
1036 qPos.add(companyId);
1037
1038 if (orderByComparator != null) {
1039 Object[] values = orderByComparator.getOrderByConditionValues(exportImportConfiguration);
1040
1041 for (Object value : values) {
1042 qPos.add(value);
1043 }
1044 }
1045
1046 List<ExportImportConfiguration> list = q.list();
1047
1048 if (list.size() == 2) {
1049 return list.get(1);
1050 }
1051 else {
1052 return null;
1053 }
1054 }
1055
1056
1061 @Override
1062 public void removeByCompanyId(long companyId) {
1063 for (ExportImportConfiguration exportImportConfiguration : findByCompanyId(
1064 companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
1065 remove(exportImportConfiguration);
1066 }
1067 }
1068
1069
1075 @Override
1076 public int countByCompanyId(long companyId) {
1077 FinderPath finderPath = FINDER_PATH_COUNT_BY_COMPANYID;
1078
1079 Object[] finderArgs = new Object[] { companyId };
1080
1081 Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
1082
1083 if (count == null) {
1084 StringBundler query = new StringBundler(2);
1085
1086 query.append(_SQL_COUNT_EXPORTIMPORTCONFIGURATION_WHERE);
1087
1088 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1089
1090 String sql = query.toString();
1091
1092 Session session = null;
1093
1094 try {
1095 session = openSession();
1096
1097 Query q = session.createQuery(sql);
1098
1099 QueryPos qPos = QueryPos.getInstance(q);
1100
1101 qPos.add(companyId);
1102
1103 count = (Long)q.uniqueResult();
1104
1105 finderCache.putResult(finderPath, finderArgs, count);
1106 }
1107 catch (Exception e) {
1108 finderCache.removeResult(finderPath, finderArgs);
1109
1110 throw processException(e);
1111 }
1112 finally {
1113 closeSession(session);
1114 }
1115 }
1116
1117 return count.intValue();
1118 }
1119
1120 private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "exportImportConfiguration.companyId = ?";
1121 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_T = new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
1122 ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
1123 ExportImportConfigurationImpl.class,
1124 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_T",
1125 new String[] {
1126 Long.class.getName(), Integer.class.getName(),
1127
1128 Integer.class.getName(), Integer.class.getName(),
1129 OrderByComparator.class.getName()
1130 });
1131 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_T = new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
1132 ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
1133 ExportImportConfigurationImpl.class,
1134 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_T",
1135 new String[] { Long.class.getName(), Integer.class.getName() },
1136 ExportImportConfigurationModelImpl.GROUPID_COLUMN_BITMASK |
1137 ExportImportConfigurationModelImpl.TYPE_COLUMN_BITMASK |
1138 ExportImportConfigurationModelImpl.CREATEDATE_COLUMN_BITMASK);
1139 public static final FinderPath FINDER_PATH_COUNT_BY_G_T = new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
1140 ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
1141 Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
1142 "countByG_T",
1143 new String[] { Long.class.getName(), Integer.class.getName() });
1144
1145
1152 @Override
1153 public List<ExportImportConfiguration> findByG_T(long groupId, int type) {
1154 return findByG_T(groupId, type, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1155 null);
1156 }
1157
1158
1171 @Override
1172 public List<ExportImportConfiguration> findByG_T(long groupId, int type,
1173 int start, int end) {
1174 return findByG_T(groupId, type, start, end, null);
1175 }
1176
1177
1191 @Override
1192 public List<ExportImportConfiguration> findByG_T(long groupId, int type,
1193 int start, int end,
1194 OrderByComparator<ExportImportConfiguration> orderByComparator) {
1195 return findByG_T(groupId, type, start, end, orderByComparator, true);
1196 }
1197
1198
1213 @Override
1214 public List<ExportImportConfiguration> findByG_T(long groupId, int type,
1215 int start, int end,
1216 OrderByComparator<ExportImportConfiguration> orderByComparator,
1217 boolean retrieveFromCache) {
1218 boolean pagination = true;
1219 FinderPath finderPath = null;
1220 Object[] finderArgs = null;
1221
1222 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1223 (orderByComparator == null)) {
1224 pagination = false;
1225 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_T;
1226 finderArgs = new Object[] { groupId, type };
1227 }
1228 else {
1229 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_T;
1230 finderArgs = new Object[] {
1231 groupId, type,
1232
1233 start, end, orderByComparator
1234 };
1235 }
1236
1237 List<ExportImportConfiguration> list = null;
1238
1239 if (retrieveFromCache) {
1240 list = (List<ExportImportConfiguration>)finderCache.getResult(finderPath,
1241 finderArgs, this);
1242
1243 if ((list != null) && !list.isEmpty()) {
1244 for (ExportImportConfiguration exportImportConfiguration : list) {
1245 if ((groupId != exportImportConfiguration.getGroupId()) ||
1246 (type != exportImportConfiguration.getType())) {
1247 list = null;
1248
1249 break;
1250 }
1251 }
1252 }
1253 }
1254
1255 if (list == null) {
1256 StringBundler query = null;
1257
1258 if (orderByComparator != null) {
1259 query = new StringBundler(4 +
1260 (orderByComparator.getOrderByFields().length * 3));
1261 }
1262 else {
1263 query = new StringBundler(4);
1264 }
1265
1266 query.append(_SQL_SELECT_EXPORTIMPORTCONFIGURATION_WHERE);
1267
1268 query.append(_FINDER_COLUMN_G_T_GROUPID_2);
1269
1270 query.append(_FINDER_COLUMN_G_T_TYPE_2);
1271
1272 if (orderByComparator != null) {
1273 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1274 orderByComparator);
1275 }
1276 else
1277 if (pagination) {
1278 query.append(ExportImportConfigurationModelImpl.ORDER_BY_JPQL);
1279 }
1280
1281 String sql = query.toString();
1282
1283 Session session = null;
1284
1285 try {
1286 session = openSession();
1287
1288 Query q = session.createQuery(sql);
1289
1290 QueryPos qPos = QueryPos.getInstance(q);
1291
1292 qPos.add(groupId);
1293
1294 qPos.add(type);
1295
1296 if (!pagination) {
1297 list = (List<ExportImportConfiguration>)QueryUtil.list(q,
1298 getDialect(), start, end, false);
1299
1300 Collections.sort(list);
1301
1302 list = Collections.unmodifiableList(list);
1303 }
1304 else {
1305 list = (List<ExportImportConfiguration>)QueryUtil.list(q,
1306 getDialect(), start, end);
1307 }
1308
1309 cacheResult(list);
1310
1311 finderCache.putResult(finderPath, finderArgs, list);
1312 }
1313 catch (Exception e) {
1314 finderCache.removeResult(finderPath, finderArgs);
1315
1316 throw processException(e);
1317 }
1318 finally {
1319 closeSession(session);
1320 }
1321 }
1322
1323 return list;
1324 }
1325
1326
1335 @Override
1336 public ExportImportConfiguration findByG_T_First(long groupId, int type,
1337 OrderByComparator<ExportImportConfiguration> orderByComparator)
1338 throws NoSuchConfigurationException {
1339 ExportImportConfiguration exportImportConfiguration = fetchByG_T_First(groupId,
1340 type, orderByComparator);
1341
1342 if (exportImportConfiguration != null) {
1343 return exportImportConfiguration;
1344 }
1345
1346 StringBundler msg = new StringBundler(6);
1347
1348 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1349
1350 msg.append("groupId=");
1351 msg.append(groupId);
1352
1353 msg.append(", type=");
1354 msg.append(type);
1355
1356 msg.append(StringPool.CLOSE_CURLY_BRACE);
1357
1358 throw new NoSuchConfigurationException(msg.toString());
1359 }
1360
1361
1369 @Override
1370 public ExportImportConfiguration fetchByG_T_First(long groupId, int type,
1371 OrderByComparator<ExportImportConfiguration> orderByComparator) {
1372 List<ExportImportConfiguration> list = findByG_T(groupId, type, 0, 1,
1373 orderByComparator);
1374
1375 if (!list.isEmpty()) {
1376 return list.get(0);
1377 }
1378
1379 return null;
1380 }
1381
1382
1391 @Override
1392 public ExportImportConfiguration findByG_T_Last(long groupId, int type,
1393 OrderByComparator<ExportImportConfiguration> orderByComparator)
1394 throws NoSuchConfigurationException {
1395 ExportImportConfiguration exportImportConfiguration = fetchByG_T_Last(groupId,
1396 type, orderByComparator);
1397
1398 if (exportImportConfiguration != null) {
1399 return exportImportConfiguration;
1400 }
1401
1402 StringBundler msg = new StringBundler(6);
1403
1404 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1405
1406 msg.append("groupId=");
1407 msg.append(groupId);
1408
1409 msg.append(", type=");
1410 msg.append(type);
1411
1412 msg.append(StringPool.CLOSE_CURLY_BRACE);
1413
1414 throw new NoSuchConfigurationException(msg.toString());
1415 }
1416
1417
1425 @Override
1426 public ExportImportConfiguration fetchByG_T_Last(long groupId, int type,
1427 OrderByComparator<ExportImportConfiguration> orderByComparator) {
1428 int count = countByG_T(groupId, type);
1429
1430 if (count == 0) {
1431 return null;
1432 }
1433
1434 List<ExportImportConfiguration> list = findByG_T(groupId, type,
1435 count - 1, count, orderByComparator);
1436
1437 if (!list.isEmpty()) {
1438 return list.get(0);
1439 }
1440
1441 return null;
1442 }
1443
1444
1454 @Override
1455 public ExportImportConfiguration[] findByG_T_PrevAndNext(
1456 long exportImportConfigurationId, long groupId, int type,
1457 OrderByComparator<ExportImportConfiguration> orderByComparator)
1458 throws NoSuchConfigurationException {
1459 ExportImportConfiguration exportImportConfiguration = findByPrimaryKey(exportImportConfigurationId);
1460
1461 Session session = null;
1462
1463 try {
1464 session = openSession();
1465
1466 ExportImportConfiguration[] array = new ExportImportConfigurationImpl[3];
1467
1468 array[0] = getByG_T_PrevAndNext(session, exportImportConfiguration,
1469 groupId, type, orderByComparator, true);
1470
1471 array[1] = exportImportConfiguration;
1472
1473 array[2] = getByG_T_PrevAndNext(session, exportImportConfiguration,
1474 groupId, type, orderByComparator, false);
1475
1476 return array;
1477 }
1478 catch (Exception e) {
1479 throw processException(e);
1480 }
1481 finally {
1482 closeSession(session);
1483 }
1484 }
1485
1486 protected ExportImportConfiguration getByG_T_PrevAndNext(Session session,
1487 ExportImportConfiguration exportImportConfiguration, long groupId,
1488 int type,
1489 OrderByComparator<ExportImportConfiguration> orderByComparator,
1490 boolean previous) {
1491 StringBundler query = null;
1492
1493 if (orderByComparator != null) {
1494 query = new StringBundler(6 +
1495 (orderByComparator.getOrderByFields().length * 6));
1496 }
1497 else {
1498 query = new StringBundler(3);
1499 }
1500
1501 query.append(_SQL_SELECT_EXPORTIMPORTCONFIGURATION_WHERE);
1502
1503 query.append(_FINDER_COLUMN_G_T_GROUPID_2);
1504
1505 query.append(_FINDER_COLUMN_G_T_TYPE_2);
1506
1507 if (orderByComparator != null) {
1508 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1509
1510 if (orderByConditionFields.length > 0) {
1511 query.append(WHERE_AND);
1512 }
1513
1514 for (int i = 0; i < orderByConditionFields.length; i++) {
1515 query.append(_ORDER_BY_ENTITY_ALIAS);
1516 query.append(orderByConditionFields[i]);
1517
1518 if ((i + 1) < orderByConditionFields.length) {
1519 if (orderByComparator.isAscending() ^ previous) {
1520 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1521 }
1522 else {
1523 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1524 }
1525 }
1526 else {
1527 if (orderByComparator.isAscending() ^ previous) {
1528 query.append(WHERE_GREATER_THAN);
1529 }
1530 else {
1531 query.append(WHERE_LESSER_THAN);
1532 }
1533 }
1534 }
1535
1536 query.append(ORDER_BY_CLAUSE);
1537
1538 String[] orderByFields = orderByComparator.getOrderByFields();
1539
1540 for (int i = 0; i < orderByFields.length; i++) {
1541 query.append(_ORDER_BY_ENTITY_ALIAS);
1542 query.append(orderByFields[i]);
1543
1544 if ((i + 1) < orderByFields.length) {
1545 if (orderByComparator.isAscending() ^ previous) {
1546 query.append(ORDER_BY_ASC_HAS_NEXT);
1547 }
1548 else {
1549 query.append(ORDER_BY_DESC_HAS_NEXT);
1550 }
1551 }
1552 else {
1553 if (orderByComparator.isAscending() ^ previous) {
1554 query.append(ORDER_BY_ASC);
1555 }
1556 else {
1557 query.append(ORDER_BY_DESC);
1558 }
1559 }
1560 }
1561 }
1562 else {
1563 query.append(ExportImportConfigurationModelImpl.ORDER_BY_JPQL);
1564 }
1565
1566 String sql = query.toString();
1567
1568 Query q = session.createQuery(sql);
1569
1570 q.setFirstResult(0);
1571 q.setMaxResults(2);
1572
1573 QueryPos qPos = QueryPos.getInstance(q);
1574
1575 qPos.add(groupId);
1576
1577 qPos.add(type);
1578
1579 if (orderByComparator != null) {
1580 Object[] values = orderByComparator.getOrderByConditionValues(exportImportConfiguration);
1581
1582 for (Object value : values) {
1583 qPos.add(value);
1584 }
1585 }
1586
1587 List<ExportImportConfiguration> list = q.list();
1588
1589 if (list.size() == 2) {
1590 return list.get(1);
1591 }
1592 else {
1593 return null;
1594 }
1595 }
1596
1597
1603 @Override
1604 public void removeByG_T(long groupId, int type) {
1605 for (ExportImportConfiguration exportImportConfiguration : findByG_T(
1606 groupId, type, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
1607 remove(exportImportConfiguration);
1608 }
1609 }
1610
1611
1618 @Override
1619 public int countByG_T(long groupId, int type) {
1620 FinderPath finderPath = FINDER_PATH_COUNT_BY_G_T;
1621
1622 Object[] finderArgs = new Object[] { groupId, type };
1623
1624 Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
1625
1626 if (count == null) {
1627 StringBundler query = new StringBundler(3);
1628
1629 query.append(_SQL_COUNT_EXPORTIMPORTCONFIGURATION_WHERE);
1630
1631 query.append(_FINDER_COLUMN_G_T_GROUPID_2);
1632
1633 query.append(_FINDER_COLUMN_G_T_TYPE_2);
1634
1635 String sql = query.toString();
1636
1637 Session session = null;
1638
1639 try {
1640 session = openSession();
1641
1642 Query q = session.createQuery(sql);
1643
1644 QueryPos qPos = QueryPos.getInstance(q);
1645
1646 qPos.add(groupId);
1647
1648 qPos.add(type);
1649
1650 count = (Long)q.uniqueResult();
1651
1652 finderCache.putResult(finderPath, finderArgs, count);
1653 }
1654 catch (Exception e) {
1655 finderCache.removeResult(finderPath, finderArgs);
1656
1657 throw processException(e);
1658 }
1659 finally {
1660 closeSession(session);
1661 }
1662 }
1663
1664 return count.intValue();
1665 }
1666
1667 private static final String _FINDER_COLUMN_G_T_GROUPID_2 = "exportImportConfiguration.groupId = ? AND ";
1668 private static final String _FINDER_COLUMN_G_T_TYPE_2 = "exportImportConfiguration.type = ?";
1669 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_S = new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
1670 ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
1671 ExportImportConfigurationImpl.class,
1672 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_S",
1673 new String[] {
1674 Long.class.getName(), Integer.class.getName(),
1675
1676 Integer.class.getName(), Integer.class.getName(),
1677 OrderByComparator.class.getName()
1678 });
1679 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S = new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
1680 ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
1681 ExportImportConfigurationImpl.class,
1682 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_S",
1683 new String[] { Long.class.getName(), Integer.class.getName() },
1684 ExportImportConfigurationModelImpl.GROUPID_COLUMN_BITMASK |
1685 ExportImportConfigurationModelImpl.STATUS_COLUMN_BITMASK |
1686 ExportImportConfigurationModelImpl.CREATEDATE_COLUMN_BITMASK);
1687 public static final FinderPath FINDER_PATH_COUNT_BY_G_S = new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
1688 ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
1689 Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
1690 "countByG_S",
1691 new String[] { Long.class.getName(), Integer.class.getName() });
1692
1693
1700 @Override
1701 public List<ExportImportConfiguration> findByG_S(long groupId, int status) {
1702 return findByG_S(groupId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1703 null);
1704 }
1705
1706
1719 @Override
1720 public List<ExportImportConfiguration> findByG_S(long groupId, int status,
1721 int start, int end) {
1722 return findByG_S(groupId, status, start, end, null);
1723 }
1724
1725
1739 @Override
1740 public List<ExportImportConfiguration> findByG_S(long groupId, int status,
1741 int start, int end,
1742 OrderByComparator<ExportImportConfiguration> orderByComparator) {
1743 return findByG_S(groupId, status, start, end, orderByComparator, true);
1744 }
1745
1746
1761 @Override
1762 public List<ExportImportConfiguration> findByG_S(long groupId, int status,
1763 int start, int end,
1764 OrderByComparator<ExportImportConfiguration> orderByComparator,
1765 boolean retrieveFromCache) {
1766 boolean pagination = true;
1767 FinderPath finderPath = null;
1768 Object[] finderArgs = null;
1769
1770 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1771 (orderByComparator == null)) {
1772 pagination = false;
1773 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S;
1774 finderArgs = new Object[] { groupId, status };
1775 }
1776 else {
1777 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_S;
1778 finderArgs = new Object[] {
1779 groupId, status,
1780
1781 start, end, orderByComparator
1782 };
1783 }
1784
1785 List<ExportImportConfiguration> list = null;
1786
1787 if (retrieveFromCache) {
1788 list = (List<ExportImportConfiguration>)finderCache.getResult(finderPath,
1789 finderArgs, this);
1790
1791 if ((list != null) && !list.isEmpty()) {
1792 for (ExportImportConfiguration exportImportConfiguration : list) {
1793 if ((groupId != exportImportConfiguration.getGroupId()) ||
1794 (status != exportImportConfiguration.getStatus())) {
1795 list = null;
1796
1797 break;
1798 }
1799 }
1800 }
1801 }
1802
1803 if (list == null) {
1804 StringBundler query = null;
1805
1806 if (orderByComparator != null) {
1807 query = new StringBundler(4 +
1808 (orderByComparator.getOrderByFields().length * 3));
1809 }
1810 else {
1811 query = new StringBundler(4);
1812 }
1813
1814 query.append(_SQL_SELECT_EXPORTIMPORTCONFIGURATION_WHERE);
1815
1816 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
1817
1818 query.append(_FINDER_COLUMN_G_S_STATUS_2);
1819
1820 if (orderByComparator != null) {
1821 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1822 orderByComparator);
1823 }
1824 else
1825 if (pagination) {
1826 query.append(ExportImportConfigurationModelImpl.ORDER_BY_JPQL);
1827 }
1828
1829 String sql = query.toString();
1830
1831 Session session = null;
1832
1833 try {
1834 session = openSession();
1835
1836 Query q = session.createQuery(sql);
1837
1838 QueryPos qPos = QueryPos.getInstance(q);
1839
1840 qPos.add(groupId);
1841
1842 qPos.add(status);
1843
1844 if (!pagination) {
1845 list = (List<ExportImportConfiguration>)QueryUtil.list(q,
1846 getDialect(), start, end, false);
1847
1848 Collections.sort(list);
1849
1850 list = Collections.unmodifiableList(list);
1851 }
1852 else {
1853 list = (List<ExportImportConfiguration>)QueryUtil.list(q,
1854 getDialect(), start, end);
1855 }
1856
1857 cacheResult(list);
1858
1859 finderCache.putResult(finderPath, finderArgs, list);
1860 }
1861 catch (Exception e) {
1862 finderCache.removeResult(finderPath, finderArgs);
1863
1864 throw processException(e);
1865 }
1866 finally {
1867 closeSession(session);
1868 }
1869 }
1870
1871 return list;
1872 }
1873
1874
1883 @Override
1884 public ExportImportConfiguration findByG_S_First(long groupId, int status,
1885 OrderByComparator<ExportImportConfiguration> orderByComparator)
1886 throws NoSuchConfigurationException {
1887 ExportImportConfiguration exportImportConfiguration = fetchByG_S_First(groupId,
1888 status, orderByComparator);
1889
1890 if (exportImportConfiguration != null) {
1891 return exportImportConfiguration;
1892 }
1893
1894 StringBundler msg = new StringBundler(6);
1895
1896 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1897
1898 msg.append("groupId=");
1899 msg.append(groupId);
1900
1901 msg.append(", status=");
1902 msg.append(status);
1903
1904 msg.append(StringPool.CLOSE_CURLY_BRACE);
1905
1906 throw new NoSuchConfigurationException(msg.toString());
1907 }
1908
1909
1917 @Override
1918 public ExportImportConfiguration fetchByG_S_First(long groupId, int status,
1919 OrderByComparator<ExportImportConfiguration> orderByComparator) {
1920 List<ExportImportConfiguration> list = findByG_S(groupId, status, 0, 1,
1921 orderByComparator);
1922
1923 if (!list.isEmpty()) {
1924 return list.get(0);
1925 }
1926
1927 return null;
1928 }
1929
1930
1939 @Override
1940 public ExportImportConfiguration findByG_S_Last(long groupId, int status,
1941 OrderByComparator<ExportImportConfiguration> orderByComparator)
1942 throws NoSuchConfigurationException {
1943 ExportImportConfiguration exportImportConfiguration = fetchByG_S_Last(groupId,
1944 status, orderByComparator);
1945
1946 if (exportImportConfiguration != null) {
1947 return exportImportConfiguration;
1948 }
1949
1950 StringBundler msg = new StringBundler(6);
1951
1952 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1953
1954 msg.append("groupId=");
1955 msg.append(groupId);
1956
1957 msg.append(", status=");
1958 msg.append(status);
1959
1960 msg.append(StringPool.CLOSE_CURLY_BRACE);
1961
1962 throw new NoSuchConfigurationException(msg.toString());
1963 }
1964
1965
1973 @Override
1974 public ExportImportConfiguration fetchByG_S_Last(long groupId, int status,
1975 OrderByComparator<ExportImportConfiguration> orderByComparator) {
1976 int count = countByG_S(groupId, status);
1977
1978 if (count == 0) {
1979 return null;
1980 }
1981
1982 List<ExportImportConfiguration> list = findByG_S(groupId, status,
1983 count - 1, count, orderByComparator);
1984
1985 if (!list.isEmpty()) {
1986 return list.get(0);
1987 }
1988
1989 return null;
1990 }
1991
1992
2002 @Override
2003 public ExportImportConfiguration[] findByG_S_PrevAndNext(
2004 long exportImportConfigurationId, long groupId, int status,
2005 OrderByComparator<ExportImportConfiguration> orderByComparator)
2006 throws NoSuchConfigurationException {
2007 ExportImportConfiguration exportImportConfiguration = findByPrimaryKey(exportImportConfigurationId);
2008
2009 Session session = null;
2010
2011 try {
2012 session = openSession();
2013
2014 ExportImportConfiguration[] array = new ExportImportConfigurationImpl[3];
2015
2016 array[0] = getByG_S_PrevAndNext(session, exportImportConfiguration,
2017 groupId, status, orderByComparator, true);
2018
2019 array[1] = exportImportConfiguration;
2020
2021 array[2] = getByG_S_PrevAndNext(session, exportImportConfiguration,
2022 groupId, status, orderByComparator, false);
2023
2024 return array;
2025 }
2026 catch (Exception e) {
2027 throw processException(e);
2028 }
2029 finally {
2030 closeSession(session);
2031 }
2032 }
2033
2034 protected ExportImportConfiguration getByG_S_PrevAndNext(Session session,
2035 ExportImportConfiguration exportImportConfiguration, long groupId,
2036 int status,
2037 OrderByComparator<ExportImportConfiguration> orderByComparator,
2038 boolean previous) {
2039 StringBundler query = null;
2040
2041 if (orderByComparator != null) {
2042 query = new StringBundler(6 +
2043 (orderByComparator.getOrderByFields().length * 6));
2044 }
2045 else {
2046 query = new StringBundler(3);
2047 }
2048
2049 query.append(_SQL_SELECT_EXPORTIMPORTCONFIGURATION_WHERE);
2050
2051 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
2052
2053 query.append(_FINDER_COLUMN_G_S_STATUS_2);
2054
2055 if (orderByComparator != null) {
2056 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2057
2058 if (orderByConditionFields.length > 0) {
2059 query.append(WHERE_AND);
2060 }
2061
2062 for (int i = 0; i < orderByConditionFields.length; i++) {
2063 query.append(_ORDER_BY_ENTITY_ALIAS);
2064 query.append(orderByConditionFields[i]);
2065
2066 if ((i + 1) < orderByConditionFields.length) {
2067 if (orderByComparator.isAscending() ^ previous) {
2068 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2069 }
2070 else {
2071 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2072 }
2073 }
2074 else {
2075 if (orderByComparator.isAscending() ^ previous) {
2076 query.append(WHERE_GREATER_THAN);
2077 }
2078 else {
2079 query.append(WHERE_LESSER_THAN);
2080 }
2081 }
2082 }
2083
2084 query.append(ORDER_BY_CLAUSE);
2085
2086 String[] orderByFields = orderByComparator.getOrderByFields();
2087
2088 for (int i = 0; i < orderByFields.length; i++) {
2089 query.append(_ORDER_BY_ENTITY_ALIAS);
2090 query.append(orderByFields[i]);
2091
2092 if ((i + 1) < orderByFields.length) {
2093 if (orderByComparator.isAscending() ^ previous) {
2094 query.append(ORDER_BY_ASC_HAS_NEXT);
2095 }
2096 else {
2097 query.append(ORDER_BY_DESC_HAS_NEXT);
2098 }
2099 }
2100 else {
2101 if (orderByComparator.isAscending() ^ previous) {
2102 query.append(ORDER_BY_ASC);
2103 }
2104 else {
2105 query.append(ORDER_BY_DESC);
2106 }
2107 }
2108 }
2109 }
2110 else {
2111 query.append(ExportImportConfigurationModelImpl.ORDER_BY_JPQL);
2112 }
2113
2114 String sql = query.toString();
2115
2116 Query q = session.createQuery(sql);
2117
2118 q.setFirstResult(0);
2119 q.setMaxResults(2);
2120
2121 QueryPos qPos = QueryPos.getInstance(q);
2122
2123 qPos.add(groupId);
2124
2125 qPos.add(status);
2126
2127 if (orderByComparator != null) {
2128 Object[] values = orderByComparator.getOrderByConditionValues(exportImportConfiguration);
2129
2130 for (Object value : values) {
2131 qPos.add(value);
2132 }
2133 }
2134
2135 List<ExportImportConfiguration> list = q.list();
2136
2137 if (list.size() == 2) {
2138 return list.get(1);
2139 }
2140 else {
2141 return null;
2142 }
2143 }
2144
2145
2151 @Override
2152 public void removeByG_S(long groupId, int status) {
2153 for (ExportImportConfiguration exportImportConfiguration : findByG_S(
2154 groupId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
2155 remove(exportImportConfiguration);
2156 }
2157 }
2158
2159
2166 @Override
2167 public int countByG_S(long groupId, int status) {
2168 FinderPath finderPath = FINDER_PATH_COUNT_BY_G_S;
2169
2170 Object[] finderArgs = new Object[] { groupId, status };
2171
2172 Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
2173
2174 if (count == null) {
2175 StringBundler query = new StringBundler(3);
2176
2177 query.append(_SQL_COUNT_EXPORTIMPORTCONFIGURATION_WHERE);
2178
2179 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
2180
2181 query.append(_FINDER_COLUMN_G_S_STATUS_2);
2182
2183 String sql = query.toString();
2184
2185 Session session = null;
2186
2187 try {
2188 session = openSession();
2189
2190 Query q = session.createQuery(sql);
2191
2192 QueryPos qPos = QueryPos.getInstance(q);
2193
2194 qPos.add(groupId);
2195
2196 qPos.add(status);
2197
2198 count = (Long)q.uniqueResult();
2199
2200 finderCache.putResult(finderPath, finderArgs, count);
2201 }
2202 catch (Exception e) {
2203 finderCache.removeResult(finderPath, finderArgs);
2204
2205 throw processException(e);
2206 }
2207 finally {
2208 closeSession(session);
2209 }
2210 }
2211
2212 return count.intValue();
2213 }
2214
2215 private static final String _FINDER_COLUMN_G_S_GROUPID_2 = "exportImportConfiguration.groupId = ? AND ";
2216 private static final String _FINDER_COLUMN_G_S_STATUS_2 = "exportImportConfiguration.status = ?";
2217 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_T_S = new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
2218 ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
2219 ExportImportConfigurationImpl.class,
2220 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_T_S",
2221 new String[] {
2222 Long.class.getName(), Integer.class.getName(),
2223 Integer.class.getName(),
2224
2225 Integer.class.getName(), Integer.class.getName(),
2226 OrderByComparator.class.getName()
2227 });
2228 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_T_S = new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
2229 ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
2230 ExportImportConfigurationImpl.class,
2231 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_T_S",
2232 new String[] {
2233 Long.class.getName(), Integer.class.getName(),
2234 Integer.class.getName()
2235 },
2236 ExportImportConfigurationModelImpl.GROUPID_COLUMN_BITMASK |
2237 ExportImportConfigurationModelImpl.TYPE_COLUMN_BITMASK |
2238 ExportImportConfigurationModelImpl.STATUS_COLUMN_BITMASK |
2239 ExportImportConfigurationModelImpl.CREATEDATE_COLUMN_BITMASK);
2240 public static final FinderPath FINDER_PATH_COUNT_BY_G_T_S = new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
2241 ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
2242 Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
2243 "countByG_T_S",
2244 new String[] {
2245 Long.class.getName(), Integer.class.getName(),
2246 Integer.class.getName()
2247 });
2248
2249
2257 @Override
2258 public List<ExportImportConfiguration> findByG_T_S(long groupId, int type,
2259 int status) {
2260 return findByG_T_S(groupId, type, status, QueryUtil.ALL_POS,
2261 QueryUtil.ALL_POS, null);
2262 }
2263
2264
2278 @Override
2279 public List<ExportImportConfiguration> findByG_T_S(long groupId, int type,
2280 int status, int start, int end) {
2281 return findByG_T_S(groupId, type, status, start, end, null);
2282 }
2283
2284
2299 @Override
2300 public List<ExportImportConfiguration> findByG_T_S(long groupId, int type,
2301 int status, int start, int end,
2302 OrderByComparator<ExportImportConfiguration> orderByComparator) {
2303 return findByG_T_S(groupId, type, status, start, end,
2304 orderByComparator, true);
2305 }
2306
2307
2323 @Override
2324 public List<ExportImportConfiguration> findByG_T_S(long groupId, int type,
2325 int status, int start, int end,
2326 OrderByComparator<ExportImportConfiguration> orderByComparator,
2327 boolean retrieveFromCache) {
2328 boolean pagination = true;
2329 FinderPath finderPath = null;
2330 Object[] finderArgs = null;
2331
2332 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2333 (orderByComparator == null)) {
2334 pagination = false;
2335 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_T_S;
2336 finderArgs = new Object[] { groupId, type, status };
2337 }
2338 else {
2339 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_T_S;
2340 finderArgs = new Object[] {
2341 groupId, type, status,
2342
2343 start, end, orderByComparator
2344 };
2345 }
2346
2347 List<ExportImportConfiguration> list = null;
2348
2349 if (retrieveFromCache) {
2350 list = (List<ExportImportConfiguration>)finderCache.getResult(finderPath,
2351 finderArgs, this);
2352
2353 if ((list != null) && !list.isEmpty()) {
2354 for (ExportImportConfiguration exportImportConfiguration : list) {
2355 if ((groupId != exportImportConfiguration.getGroupId()) ||
2356 (type != exportImportConfiguration.getType()) ||
2357 (status != exportImportConfiguration.getStatus())) {
2358 list = null;
2359
2360 break;
2361 }
2362 }
2363 }
2364 }
2365
2366 if (list == null) {
2367 StringBundler query = null;
2368
2369 if (orderByComparator != null) {
2370 query = new StringBundler(5 +
2371 (orderByComparator.getOrderByFields().length * 3));
2372 }
2373 else {
2374 query = new StringBundler(5);
2375 }
2376
2377 query.append(_SQL_SELECT_EXPORTIMPORTCONFIGURATION_WHERE);
2378
2379 query.append(_FINDER_COLUMN_G_T_S_GROUPID_2);
2380
2381 query.append(_FINDER_COLUMN_G_T_S_TYPE_2);
2382
2383 query.append(_FINDER_COLUMN_G_T_S_STATUS_2);
2384
2385 if (orderByComparator != null) {
2386 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2387 orderByComparator);
2388 }
2389 else
2390 if (pagination) {
2391 query.append(ExportImportConfigurationModelImpl.ORDER_BY_JPQL);
2392 }
2393
2394 String sql = query.toString();
2395
2396 Session session = null;
2397
2398 try {
2399 session = openSession();
2400
2401 Query q = session.createQuery(sql);
2402
2403 QueryPos qPos = QueryPos.getInstance(q);
2404
2405 qPos.add(groupId);
2406
2407 qPos.add(type);
2408
2409 qPos.add(status);
2410
2411 if (!pagination) {
2412 list = (List<ExportImportConfiguration>)QueryUtil.list(q,
2413 getDialect(), start, end, false);
2414
2415 Collections.sort(list);
2416
2417 list = Collections.unmodifiableList(list);
2418 }
2419 else {
2420 list = (List<ExportImportConfiguration>)QueryUtil.list(q,
2421 getDialect(), start, end);
2422 }
2423
2424 cacheResult(list);
2425
2426 finderCache.putResult(finderPath, finderArgs, list);
2427 }
2428 catch (Exception e) {
2429 finderCache.removeResult(finderPath, finderArgs);
2430
2431 throw processException(e);
2432 }
2433 finally {
2434 closeSession(session);
2435 }
2436 }
2437
2438 return list;
2439 }
2440
2441
2451 @Override
2452 public ExportImportConfiguration findByG_T_S_First(long groupId, int type,
2453 int status,
2454 OrderByComparator<ExportImportConfiguration> orderByComparator)
2455 throws NoSuchConfigurationException {
2456 ExportImportConfiguration exportImportConfiguration = fetchByG_T_S_First(groupId,
2457 type, status, orderByComparator);
2458
2459 if (exportImportConfiguration != null) {
2460 return exportImportConfiguration;
2461 }
2462
2463 StringBundler msg = new StringBundler(8);
2464
2465 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2466
2467 msg.append("groupId=");
2468 msg.append(groupId);
2469
2470 msg.append(", type=");
2471 msg.append(type);
2472
2473 msg.append(", status=");
2474 msg.append(status);
2475
2476 msg.append(StringPool.CLOSE_CURLY_BRACE);
2477
2478 throw new NoSuchConfigurationException(msg.toString());
2479 }
2480
2481
2490 @Override
2491 public ExportImportConfiguration fetchByG_T_S_First(long groupId, int type,
2492 int status,
2493 OrderByComparator<ExportImportConfiguration> orderByComparator) {
2494 List<ExportImportConfiguration> list = findByG_T_S(groupId, type,
2495 status, 0, 1, orderByComparator);
2496
2497 if (!list.isEmpty()) {
2498 return list.get(0);
2499 }
2500
2501 return null;
2502 }
2503
2504
2514 @Override
2515 public ExportImportConfiguration findByG_T_S_Last(long groupId, int type,
2516 int status,
2517 OrderByComparator<ExportImportConfiguration> orderByComparator)
2518 throws NoSuchConfigurationException {
2519 ExportImportConfiguration exportImportConfiguration = fetchByG_T_S_Last(groupId,
2520 type, status, orderByComparator);
2521
2522 if (exportImportConfiguration != null) {
2523 return exportImportConfiguration;
2524 }
2525
2526 StringBundler msg = new StringBundler(8);
2527
2528 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2529
2530 msg.append("groupId=");
2531 msg.append(groupId);
2532
2533 msg.append(", type=");
2534 msg.append(type);
2535
2536 msg.append(", status=");
2537 msg.append(status);
2538
2539 msg.append(StringPool.CLOSE_CURLY_BRACE);
2540
2541 throw new NoSuchConfigurationException(msg.toString());
2542 }
2543
2544
2553 @Override
2554 public ExportImportConfiguration fetchByG_T_S_Last(long groupId, int type,
2555 int status,
2556 OrderByComparator<ExportImportConfiguration> orderByComparator) {
2557 int count = countByG_T_S(groupId, type, status);
2558
2559 if (count == 0) {
2560 return null;
2561 }
2562
2563 List<ExportImportConfiguration> list = findByG_T_S(groupId, type,
2564 status, count - 1, count, orderByComparator);
2565
2566 if (!list.isEmpty()) {
2567 return list.get(0);
2568 }
2569
2570 return null;
2571 }
2572
2573
2584 @Override
2585 public ExportImportConfiguration[] findByG_T_S_PrevAndNext(
2586 long exportImportConfigurationId, long groupId, int type, int status,
2587 OrderByComparator<ExportImportConfiguration> orderByComparator)
2588 throws NoSuchConfigurationException {
2589 ExportImportConfiguration exportImportConfiguration = findByPrimaryKey(exportImportConfigurationId);
2590
2591 Session session = null;
2592
2593 try {
2594 session = openSession();
2595
2596 ExportImportConfiguration[] array = new ExportImportConfigurationImpl[3];
2597
2598 array[0] = getByG_T_S_PrevAndNext(session,
2599 exportImportConfiguration, groupId, type, status,
2600 orderByComparator, true);
2601
2602 array[1] = exportImportConfiguration;
2603
2604 array[2] = getByG_T_S_PrevAndNext(session,
2605 exportImportConfiguration, groupId, type, status,
2606 orderByComparator, false);
2607
2608 return array;
2609 }
2610 catch (Exception e) {
2611 throw processException(e);
2612 }
2613 finally {
2614 closeSession(session);
2615 }
2616 }
2617
2618 protected ExportImportConfiguration getByG_T_S_PrevAndNext(
2619 Session session, ExportImportConfiguration exportImportConfiguration,
2620 long groupId, int type, int status,
2621 OrderByComparator<ExportImportConfiguration> orderByComparator,
2622 boolean previous) {
2623 StringBundler query = null;
2624
2625 if (orderByComparator != null) {
2626 query = new StringBundler(6 +
2627 (orderByComparator.getOrderByFields().length * 6));
2628 }
2629 else {
2630 query = new StringBundler(3);
2631 }
2632
2633 query.append(_SQL_SELECT_EXPORTIMPORTCONFIGURATION_WHERE);
2634
2635 query.append(_FINDER_COLUMN_G_T_S_GROUPID_2);
2636
2637 query.append(_FINDER_COLUMN_G_T_S_TYPE_2);
2638
2639 query.append(_FINDER_COLUMN_G_T_S_STATUS_2);
2640
2641 if (orderByComparator != null) {
2642 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2643
2644 if (orderByConditionFields.length > 0) {
2645 query.append(WHERE_AND);
2646 }
2647
2648 for (int i = 0; i < orderByConditionFields.length; i++) {
2649 query.append(_ORDER_BY_ENTITY_ALIAS);
2650 query.append(orderByConditionFields[i]);
2651
2652 if ((i + 1) < orderByConditionFields.length) {
2653 if (orderByComparator.isAscending() ^ previous) {
2654 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2655 }
2656 else {
2657 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2658 }
2659 }
2660 else {
2661 if (orderByComparator.isAscending() ^ previous) {
2662 query.append(WHERE_GREATER_THAN);
2663 }
2664 else {
2665 query.append(WHERE_LESSER_THAN);
2666 }
2667 }
2668 }
2669
2670 query.append(ORDER_BY_CLAUSE);
2671
2672 String[] orderByFields = orderByComparator.getOrderByFields();
2673
2674 for (int i = 0; i < orderByFields.length; i++) {
2675 query.append(_ORDER_BY_ENTITY_ALIAS);
2676 query.append(orderByFields[i]);
2677
2678 if ((i + 1) < orderByFields.length) {
2679 if (orderByComparator.isAscending() ^ previous) {
2680 query.append(ORDER_BY_ASC_HAS_NEXT);
2681 }
2682 else {
2683 query.append(ORDER_BY_DESC_HAS_NEXT);
2684 }
2685 }
2686 else {
2687 if (orderByComparator.isAscending() ^ previous) {
2688 query.append(ORDER_BY_ASC);
2689 }
2690 else {
2691 query.append(ORDER_BY_DESC);
2692 }
2693 }
2694 }
2695 }
2696 else {
2697 query.append(ExportImportConfigurationModelImpl.ORDER_BY_JPQL);
2698 }
2699
2700 String sql = query.toString();
2701
2702 Query q = session.createQuery(sql);
2703
2704 q.setFirstResult(0);
2705 q.setMaxResults(2);
2706
2707 QueryPos qPos = QueryPos.getInstance(q);
2708
2709 qPos.add(groupId);
2710
2711 qPos.add(type);
2712
2713 qPos.add(status);
2714
2715 if (orderByComparator != null) {
2716 Object[] values = orderByComparator.getOrderByConditionValues(exportImportConfiguration);
2717
2718 for (Object value : values) {
2719 qPos.add(value);
2720 }
2721 }
2722
2723 List<ExportImportConfiguration> list = q.list();
2724
2725 if (list.size() == 2) {
2726 return list.get(1);
2727 }
2728 else {
2729 return null;
2730 }
2731 }
2732
2733
2740 @Override
2741 public void removeByG_T_S(long groupId, int type, int status) {
2742 for (ExportImportConfiguration exportImportConfiguration : findByG_T_S(
2743 groupId, type, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
2744 null)) {
2745 remove(exportImportConfiguration);
2746 }
2747 }
2748
2749
2757 @Override
2758 public int countByG_T_S(long groupId, int type, int status) {
2759 FinderPath finderPath = FINDER_PATH_COUNT_BY_G_T_S;
2760
2761 Object[] finderArgs = new Object[] { groupId, type, status };
2762
2763 Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
2764
2765 if (count == null) {
2766 StringBundler query = new StringBundler(4);
2767
2768 query.append(_SQL_COUNT_EXPORTIMPORTCONFIGURATION_WHERE);
2769
2770 query.append(_FINDER_COLUMN_G_T_S_GROUPID_2);
2771
2772 query.append(_FINDER_COLUMN_G_T_S_TYPE_2);
2773
2774 query.append(_FINDER_COLUMN_G_T_S_STATUS_2);
2775
2776 String sql = query.toString();
2777
2778 Session session = null;
2779
2780 try {
2781 session = openSession();
2782
2783 Query q = session.createQuery(sql);
2784
2785 QueryPos qPos = QueryPos.getInstance(q);
2786
2787 qPos.add(groupId);
2788
2789 qPos.add(type);
2790
2791 qPos.add(status);
2792
2793 count = (Long)q.uniqueResult();
2794
2795 finderCache.putResult(finderPath, finderArgs, count);
2796 }
2797 catch (Exception e) {
2798 finderCache.removeResult(finderPath, finderArgs);
2799
2800 throw processException(e);
2801 }
2802 finally {
2803 closeSession(session);
2804 }
2805 }
2806
2807 return count.intValue();
2808 }
2809
2810 private static final String _FINDER_COLUMN_G_T_S_GROUPID_2 = "exportImportConfiguration.groupId = ? AND ";
2811 private static final String _FINDER_COLUMN_G_T_S_TYPE_2 = "exportImportConfiguration.type = ? AND ";
2812 private static final String _FINDER_COLUMN_G_T_S_STATUS_2 = "exportImportConfiguration.status = ?";
2813
2814 public ExportImportConfigurationPersistenceImpl() {
2815 setModelClass(ExportImportConfiguration.class);
2816 }
2817
2818
2823 @Override
2824 public void cacheResult(ExportImportConfiguration exportImportConfiguration) {
2825 entityCache.putResult(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
2826 ExportImportConfigurationImpl.class,
2827 exportImportConfiguration.getPrimaryKey(), exportImportConfiguration);
2828
2829 exportImportConfiguration.resetOriginalValues();
2830 }
2831
2832
2837 @Override
2838 public void cacheResult(
2839 List<ExportImportConfiguration> exportImportConfigurations) {
2840 for (ExportImportConfiguration exportImportConfiguration : exportImportConfigurations) {
2841 if (entityCache.getResult(
2842 ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
2843 ExportImportConfigurationImpl.class,
2844 exportImportConfiguration.getPrimaryKey()) == null) {
2845 cacheResult(exportImportConfiguration);
2846 }
2847 else {
2848 exportImportConfiguration.resetOriginalValues();
2849 }
2850 }
2851 }
2852
2853
2860 @Override
2861 public void clearCache() {
2862 entityCache.clearCache(ExportImportConfigurationImpl.class);
2863
2864 finderCache.clearCache(FINDER_CLASS_NAME_ENTITY);
2865 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
2866 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2867 }
2868
2869
2876 @Override
2877 public void clearCache(ExportImportConfiguration exportImportConfiguration) {
2878 entityCache.removeResult(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
2879 ExportImportConfigurationImpl.class,
2880 exportImportConfiguration.getPrimaryKey());
2881
2882 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
2883 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2884 }
2885
2886 @Override
2887 public void clearCache(
2888 List<ExportImportConfiguration> exportImportConfigurations) {
2889 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
2890 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2891
2892 for (ExportImportConfiguration exportImportConfiguration : exportImportConfigurations) {
2893 entityCache.removeResult(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
2894 ExportImportConfigurationImpl.class,
2895 exportImportConfiguration.getPrimaryKey());
2896 }
2897 }
2898
2899
2905 @Override
2906 public ExportImportConfiguration create(long exportImportConfigurationId) {
2907 ExportImportConfiguration exportImportConfiguration = new ExportImportConfigurationImpl();
2908
2909 exportImportConfiguration.setNew(true);
2910 exportImportConfiguration.setPrimaryKey(exportImportConfigurationId);
2911
2912 return exportImportConfiguration;
2913 }
2914
2915
2922 @Override
2923 public ExportImportConfiguration remove(long exportImportConfigurationId)
2924 throws NoSuchConfigurationException {
2925 return remove((Serializable)exportImportConfigurationId);
2926 }
2927
2928
2935 @Override
2936 public ExportImportConfiguration remove(Serializable primaryKey)
2937 throws NoSuchConfigurationException {
2938 Session session = null;
2939
2940 try {
2941 session = openSession();
2942
2943 ExportImportConfiguration exportImportConfiguration = (ExportImportConfiguration)session.get(ExportImportConfigurationImpl.class,
2944 primaryKey);
2945
2946 if (exportImportConfiguration == null) {
2947 if (_log.isWarnEnabled()) {
2948 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
2949 }
2950
2951 throw new NoSuchConfigurationException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
2952 primaryKey);
2953 }
2954
2955 return remove(exportImportConfiguration);
2956 }
2957 catch (NoSuchConfigurationException nsee) {
2958 throw nsee;
2959 }
2960 catch (Exception e) {
2961 throw processException(e);
2962 }
2963 finally {
2964 closeSession(session);
2965 }
2966 }
2967
2968 @Override
2969 protected ExportImportConfiguration removeImpl(
2970 ExportImportConfiguration exportImportConfiguration) {
2971 exportImportConfiguration = toUnwrappedModel(exportImportConfiguration);
2972
2973 Session session = null;
2974
2975 try {
2976 session = openSession();
2977
2978 if (!session.contains(exportImportConfiguration)) {
2979 exportImportConfiguration = (ExportImportConfiguration)session.get(ExportImportConfigurationImpl.class,
2980 exportImportConfiguration.getPrimaryKeyObj());
2981 }
2982
2983 if (exportImportConfiguration != null) {
2984 session.delete(exportImportConfiguration);
2985 }
2986 }
2987 catch (Exception e) {
2988 throw processException(e);
2989 }
2990 finally {
2991 closeSession(session);
2992 }
2993
2994 if (exportImportConfiguration != null) {
2995 clearCache(exportImportConfiguration);
2996 }
2997
2998 return exportImportConfiguration;
2999 }
3000
3001 @Override
3002 public ExportImportConfiguration updateImpl(
3003 ExportImportConfiguration exportImportConfiguration) {
3004 exportImportConfiguration = toUnwrappedModel(exportImportConfiguration);
3005
3006 boolean isNew = exportImportConfiguration.isNew();
3007
3008 ExportImportConfigurationModelImpl exportImportConfigurationModelImpl = (ExportImportConfigurationModelImpl)exportImportConfiguration;
3009
3010 ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
3011
3012 Date now = new Date();
3013
3014 if (isNew && (exportImportConfiguration.getCreateDate() == null)) {
3015 if (serviceContext == null) {
3016 exportImportConfiguration.setCreateDate(now);
3017 }
3018 else {
3019 exportImportConfiguration.setCreateDate(serviceContext.getCreateDate(
3020 now));
3021 }
3022 }
3023
3024 if (!exportImportConfigurationModelImpl.hasSetModifiedDate()) {
3025 if (serviceContext == null) {
3026 exportImportConfiguration.setModifiedDate(now);
3027 }
3028 else {
3029 exportImportConfiguration.setModifiedDate(serviceContext.getModifiedDate(
3030 now));
3031 }
3032 }
3033
3034 Session session = null;
3035
3036 try {
3037 session = openSession();
3038
3039 if (exportImportConfiguration.isNew()) {
3040 session.save(exportImportConfiguration);
3041
3042 exportImportConfiguration.setNew(false);
3043 }
3044 else {
3045 exportImportConfiguration = (ExportImportConfiguration)session.merge(exportImportConfiguration);
3046 }
3047 }
3048 catch (Exception e) {
3049 throw processException(e);
3050 }
3051 finally {
3052 closeSession(session);
3053 }
3054
3055 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
3056
3057 if (isNew ||
3058 !ExportImportConfigurationModelImpl.COLUMN_BITMASK_ENABLED) {
3059 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
3060 }
3061
3062 else {
3063 if ((exportImportConfigurationModelImpl.getColumnBitmask() &
3064 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID.getColumnBitmask()) != 0) {
3065 Object[] args = new Object[] {
3066 exportImportConfigurationModelImpl.getOriginalGroupId()
3067 };
3068
3069 finderCache.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
3070 finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
3071 args);
3072
3073 args = new Object[] {
3074 exportImportConfigurationModelImpl.getGroupId()
3075 };
3076
3077 finderCache.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
3078 finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
3079 args);
3080 }
3081
3082 if ((exportImportConfigurationModelImpl.getColumnBitmask() &
3083 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID.getColumnBitmask()) != 0) {
3084 Object[] args = new Object[] {
3085 exportImportConfigurationModelImpl.getOriginalCompanyId()
3086 };
3087
3088 finderCache.removeResult(FINDER_PATH_COUNT_BY_COMPANYID, args);
3089 finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
3090 args);
3091
3092 args = new Object[] {
3093 exportImportConfigurationModelImpl.getCompanyId()
3094 };
3095
3096 finderCache.removeResult(FINDER_PATH_COUNT_BY_COMPANYID, args);
3097 finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
3098 args);
3099 }
3100
3101 if ((exportImportConfigurationModelImpl.getColumnBitmask() &
3102 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_T.getColumnBitmask()) != 0) {
3103 Object[] args = new Object[] {
3104 exportImportConfigurationModelImpl.getOriginalGroupId(),
3105 exportImportConfigurationModelImpl.getOriginalType()
3106 };
3107
3108 finderCache.removeResult(FINDER_PATH_COUNT_BY_G_T, args);
3109 finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_T,
3110 args);
3111
3112 args = new Object[] {
3113 exportImportConfigurationModelImpl.getGroupId(),
3114 exportImportConfigurationModelImpl.getType()
3115 };
3116
3117 finderCache.removeResult(FINDER_PATH_COUNT_BY_G_T, args);
3118 finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_T,
3119 args);
3120 }
3121
3122 if ((exportImportConfigurationModelImpl.getColumnBitmask() &
3123 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S.getColumnBitmask()) != 0) {
3124 Object[] args = new Object[] {
3125 exportImportConfigurationModelImpl.getOriginalGroupId(),
3126 exportImportConfigurationModelImpl.getOriginalStatus()
3127 };
3128
3129 finderCache.removeResult(FINDER_PATH_COUNT_BY_G_S, args);
3130 finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S,
3131 args);
3132
3133 args = new Object[] {
3134 exportImportConfigurationModelImpl.getGroupId(),
3135 exportImportConfigurationModelImpl.getStatus()
3136 };
3137
3138 finderCache.removeResult(FINDER_PATH_COUNT_BY_G_S, args);
3139 finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S,
3140 args);
3141 }
3142
3143 if ((exportImportConfigurationModelImpl.getColumnBitmask() &
3144 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_T_S.getColumnBitmask()) != 0) {
3145 Object[] args = new Object[] {
3146 exportImportConfigurationModelImpl.getOriginalGroupId(),
3147 exportImportConfigurationModelImpl.getOriginalType(),
3148 exportImportConfigurationModelImpl.getOriginalStatus()
3149 };
3150
3151 finderCache.removeResult(FINDER_PATH_COUNT_BY_G_T_S, args);
3152 finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_T_S,
3153 args);
3154
3155 args = new Object[] {
3156 exportImportConfigurationModelImpl.getGroupId(),
3157 exportImportConfigurationModelImpl.getType(),
3158 exportImportConfigurationModelImpl.getStatus()
3159 };
3160
3161 finderCache.removeResult(FINDER_PATH_COUNT_BY_G_T_S, args);
3162 finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_T_S,
3163 args);
3164 }
3165 }
3166
3167 entityCache.putResult(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
3168 ExportImportConfigurationImpl.class,
3169 exportImportConfiguration.getPrimaryKey(),
3170 exportImportConfiguration, false);
3171
3172 exportImportConfiguration.resetOriginalValues();
3173
3174 return exportImportConfiguration;
3175 }
3176
3177 protected ExportImportConfiguration toUnwrappedModel(
3178 ExportImportConfiguration exportImportConfiguration) {
3179 if (exportImportConfiguration instanceof ExportImportConfigurationImpl) {
3180 return exportImportConfiguration;
3181 }
3182
3183 ExportImportConfigurationImpl exportImportConfigurationImpl = new ExportImportConfigurationImpl();
3184
3185 exportImportConfigurationImpl.setNew(exportImportConfiguration.isNew());
3186 exportImportConfigurationImpl.setPrimaryKey(exportImportConfiguration.getPrimaryKey());
3187
3188 exportImportConfigurationImpl.setMvccVersion(exportImportConfiguration.getMvccVersion());
3189 exportImportConfigurationImpl.setExportImportConfigurationId(exportImportConfiguration.getExportImportConfigurationId());
3190 exportImportConfigurationImpl.setGroupId(exportImportConfiguration.getGroupId());
3191 exportImportConfigurationImpl.setCompanyId(exportImportConfiguration.getCompanyId());
3192 exportImportConfigurationImpl.setUserId(exportImportConfiguration.getUserId());
3193 exportImportConfigurationImpl.setUserName(exportImportConfiguration.getUserName());
3194 exportImportConfigurationImpl.setCreateDate(exportImportConfiguration.getCreateDate());
3195 exportImportConfigurationImpl.setModifiedDate(exportImportConfiguration.getModifiedDate());
3196 exportImportConfigurationImpl.setName(exportImportConfiguration.getName());
3197 exportImportConfigurationImpl.setDescription(exportImportConfiguration.getDescription());
3198 exportImportConfigurationImpl.setType(exportImportConfiguration.getType());
3199 exportImportConfigurationImpl.setSettings(exportImportConfiguration.getSettings());
3200 exportImportConfigurationImpl.setStatus(exportImportConfiguration.getStatus());
3201 exportImportConfigurationImpl.setStatusByUserId(exportImportConfiguration.getStatusByUserId());
3202 exportImportConfigurationImpl.setStatusByUserName(exportImportConfiguration.getStatusByUserName());
3203 exportImportConfigurationImpl.setStatusDate(exportImportConfiguration.getStatusDate());
3204
3205 return exportImportConfigurationImpl;
3206 }
3207
3208
3215 @Override
3216 public ExportImportConfiguration findByPrimaryKey(Serializable primaryKey)
3217 throws NoSuchConfigurationException {
3218 ExportImportConfiguration exportImportConfiguration = fetchByPrimaryKey(primaryKey);
3219
3220 if (exportImportConfiguration == null) {
3221 if (_log.isWarnEnabled()) {
3222 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
3223 }
3224
3225 throw new NoSuchConfigurationException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
3226 primaryKey);
3227 }
3228
3229 return exportImportConfiguration;
3230 }
3231
3232
3239 @Override
3240 public ExportImportConfiguration findByPrimaryKey(
3241 long exportImportConfigurationId) throws NoSuchConfigurationException {
3242 return findByPrimaryKey((Serializable)exportImportConfigurationId);
3243 }
3244
3245
3251 @Override
3252 public ExportImportConfiguration fetchByPrimaryKey(Serializable primaryKey) {
3253 ExportImportConfiguration exportImportConfiguration = (ExportImportConfiguration)entityCache.getResult(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
3254 ExportImportConfigurationImpl.class, primaryKey);
3255
3256 if (exportImportConfiguration == _nullExportImportConfiguration) {
3257 return null;
3258 }
3259
3260 if (exportImportConfiguration == null) {
3261 Session session = null;
3262
3263 try {
3264 session = openSession();
3265
3266 exportImportConfiguration = (ExportImportConfiguration)session.get(ExportImportConfigurationImpl.class,
3267 primaryKey);
3268
3269 if (exportImportConfiguration != null) {
3270 cacheResult(exportImportConfiguration);
3271 }
3272 else {
3273 entityCache.putResult(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
3274 ExportImportConfigurationImpl.class, primaryKey,
3275 _nullExportImportConfiguration);
3276 }
3277 }
3278 catch (Exception e) {
3279 entityCache.removeResult(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
3280 ExportImportConfigurationImpl.class, primaryKey);
3281
3282 throw processException(e);
3283 }
3284 finally {
3285 closeSession(session);
3286 }
3287 }
3288
3289 return exportImportConfiguration;
3290 }
3291
3292
3298 @Override
3299 public ExportImportConfiguration fetchByPrimaryKey(
3300 long exportImportConfigurationId) {
3301 return fetchByPrimaryKey((Serializable)exportImportConfigurationId);
3302 }
3303
3304 @Override
3305 public Map<Serializable, ExportImportConfiguration> fetchByPrimaryKeys(
3306 Set<Serializable> primaryKeys) {
3307 if (primaryKeys.isEmpty()) {
3308 return Collections.emptyMap();
3309 }
3310
3311 Map<Serializable, ExportImportConfiguration> map = new HashMap<Serializable, ExportImportConfiguration>();
3312
3313 if (primaryKeys.size() == 1) {
3314 Iterator<Serializable> iterator = primaryKeys.iterator();
3315
3316 Serializable primaryKey = iterator.next();
3317
3318 ExportImportConfiguration exportImportConfiguration = fetchByPrimaryKey(primaryKey);
3319
3320 if (exportImportConfiguration != null) {
3321 map.put(primaryKey, exportImportConfiguration);
3322 }
3323
3324 return map;
3325 }
3326
3327 Set<Serializable> uncachedPrimaryKeys = null;
3328
3329 for (Serializable primaryKey : primaryKeys) {
3330 ExportImportConfiguration exportImportConfiguration = (ExportImportConfiguration)entityCache.getResult(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
3331 ExportImportConfigurationImpl.class, primaryKey);
3332
3333 if (exportImportConfiguration == null) {
3334 if (uncachedPrimaryKeys == null) {
3335 uncachedPrimaryKeys = new HashSet<Serializable>();
3336 }
3337
3338 uncachedPrimaryKeys.add(primaryKey);
3339 }
3340 else {
3341 map.put(primaryKey, exportImportConfiguration);
3342 }
3343 }
3344
3345 if (uncachedPrimaryKeys == null) {
3346 return map;
3347 }
3348
3349 StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) +
3350 1);
3351
3352 query.append(_SQL_SELECT_EXPORTIMPORTCONFIGURATION_WHERE_PKS_IN);
3353
3354 for (Serializable primaryKey : uncachedPrimaryKeys) {
3355 query.append(String.valueOf(primaryKey));
3356
3357 query.append(StringPool.COMMA);
3358 }
3359
3360 query.setIndex(query.index() - 1);
3361
3362 query.append(StringPool.CLOSE_PARENTHESIS);
3363
3364 String sql = query.toString();
3365
3366 Session session = null;
3367
3368 try {
3369 session = openSession();
3370
3371 Query q = session.createQuery(sql);
3372
3373 for (ExportImportConfiguration exportImportConfiguration : (List<ExportImportConfiguration>)q.list()) {
3374 map.put(exportImportConfiguration.getPrimaryKeyObj(),
3375 exportImportConfiguration);
3376
3377 cacheResult(exportImportConfiguration);
3378
3379 uncachedPrimaryKeys.remove(exportImportConfiguration.getPrimaryKeyObj());
3380 }
3381
3382 for (Serializable primaryKey : uncachedPrimaryKeys) {
3383 entityCache.putResult(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
3384 ExportImportConfigurationImpl.class, primaryKey,
3385 _nullExportImportConfiguration);
3386 }
3387 }
3388 catch (Exception e) {
3389 throw processException(e);
3390 }
3391 finally {
3392 closeSession(session);
3393 }
3394
3395 return map;
3396 }
3397
3398
3403 @Override
3404 public List<ExportImportConfiguration> findAll() {
3405 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
3406 }
3407
3408
3419 @Override
3420 public List<ExportImportConfiguration> findAll(int start, int end) {
3421 return findAll(start, end, null);
3422 }
3423
3424
3436 @Override
3437 public List<ExportImportConfiguration> findAll(int start, int end,
3438 OrderByComparator<ExportImportConfiguration> orderByComparator) {
3439 return findAll(start, end, orderByComparator, true);
3440 }
3441
3442
3455 @Override
3456 public List<ExportImportConfiguration> findAll(int start, int end,
3457 OrderByComparator<ExportImportConfiguration> orderByComparator,
3458 boolean retrieveFromCache) {
3459 boolean pagination = true;
3460 FinderPath finderPath = null;
3461 Object[] finderArgs = null;
3462
3463 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
3464 (orderByComparator == null)) {
3465 pagination = false;
3466 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
3467 finderArgs = FINDER_ARGS_EMPTY;
3468 }
3469 else {
3470 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
3471 finderArgs = new Object[] { start, end, orderByComparator };
3472 }
3473
3474 List<ExportImportConfiguration> list = null;
3475
3476 if (retrieveFromCache) {
3477 list = (List<ExportImportConfiguration>)finderCache.getResult(finderPath,
3478 finderArgs, this);
3479 }
3480
3481 if (list == null) {
3482 StringBundler query = null;
3483 String sql = null;
3484
3485 if (orderByComparator != null) {
3486 query = new StringBundler(2 +
3487 (orderByComparator.getOrderByFields().length * 3));
3488
3489 query.append(_SQL_SELECT_EXPORTIMPORTCONFIGURATION);
3490
3491 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3492 orderByComparator);
3493
3494 sql = query.toString();
3495 }
3496 else {
3497 sql = _SQL_SELECT_EXPORTIMPORTCONFIGURATION;
3498
3499 if (pagination) {
3500 sql = sql.concat(ExportImportConfigurationModelImpl.ORDER_BY_JPQL);
3501 }
3502 }
3503
3504 Session session = null;
3505
3506 try {
3507 session = openSession();
3508
3509 Query q = session.createQuery(sql);
3510
3511 if (!pagination) {
3512 list = (List<ExportImportConfiguration>)QueryUtil.list(q,
3513 getDialect(), start, end, false);
3514
3515 Collections.sort(list);
3516
3517 list = Collections.unmodifiableList(list);
3518 }
3519 else {
3520 list = (List<ExportImportConfiguration>)QueryUtil.list(q,
3521 getDialect(), start, end);
3522 }
3523
3524 cacheResult(list);
3525
3526 finderCache.putResult(finderPath, finderArgs, list);
3527 }
3528 catch (Exception e) {
3529 finderCache.removeResult(finderPath, finderArgs);
3530
3531 throw processException(e);
3532 }
3533 finally {
3534 closeSession(session);
3535 }
3536 }
3537
3538 return list;
3539 }
3540
3541
3545 @Override
3546 public void removeAll() {
3547 for (ExportImportConfiguration exportImportConfiguration : findAll()) {
3548 remove(exportImportConfiguration);
3549 }
3550 }
3551
3552
3557 @Override
3558 public int countAll() {
3559 Long count = (Long)finderCache.getResult(FINDER_PATH_COUNT_ALL,
3560 FINDER_ARGS_EMPTY, this);
3561
3562 if (count == null) {
3563 Session session = null;
3564
3565 try {
3566 session = openSession();
3567
3568 Query q = session.createQuery(_SQL_COUNT_EXPORTIMPORTCONFIGURATION);
3569
3570 count = (Long)q.uniqueResult();
3571
3572 finderCache.putResult(FINDER_PATH_COUNT_ALL, FINDER_ARGS_EMPTY,
3573 count);
3574 }
3575 catch (Exception e) {
3576 finderCache.removeResult(FINDER_PATH_COUNT_ALL,
3577 FINDER_ARGS_EMPTY);
3578
3579 throw processException(e);
3580 }
3581 finally {
3582 closeSession(session);
3583 }
3584 }
3585
3586 return count.intValue();
3587 }
3588
3589 @Override
3590 public Set<String> getBadColumnNames() {
3591 return _badColumnNames;
3592 }
3593
3594 @Override
3595 protected Map<String, Integer> getTableColumnsMap() {
3596 return ExportImportConfigurationModelImpl.TABLE_COLUMNS_MAP;
3597 }
3598
3599
3602 public void afterPropertiesSet() {
3603 }
3604
3605 public void destroy() {
3606 entityCache.removeCache(ExportImportConfigurationImpl.class.getName());
3607 finderCache.removeCache(FINDER_CLASS_NAME_ENTITY);
3608 finderCache.removeCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
3609 finderCache.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
3610 }
3611
3612 protected EntityCache entityCache = EntityCacheUtil.getEntityCache();
3613 protected FinderCache finderCache = FinderCacheUtil.getFinderCache();
3614 private static final String _SQL_SELECT_EXPORTIMPORTCONFIGURATION = "SELECT exportImportConfiguration FROM ExportImportConfiguration exportImportConfiguration";
3615 private static final String _SQL_SELECT_EXPORTIMPORTCONFIGURATION_WHERE_PKS_IN =
3616 "SELECT exportImportConfiguration FROM ExportImportConfiguration exportImportConfiguration WHERE exportImportConfigurationId IN (";
3617 private static final String _SQL_SELECT_EXPORTIMPORTCONFIGURATION_WHERE = "SELECT exportImportConfiguration FROM ExportImportConfiguration exportImportConfiguration WHERE ";
3618 private static final String _SQL_COUNT_EXPORTIMPORTCONFIGURATION = "SELECT COUNT(exportImportConfiguration) FROM ExportImportConfiguration exportImportConfiguration";
3619 private static final String _SQL_COUNT_EXPORTIMPORTCONFIGURATION_WHERE = "SELECT COUNT(exportImportConfiguration) FROM ExportImportConfiguration exportImportConfiguration WHERE ";
3620 private static final String _ORDER_BY_ENTITY_ALIAS = "exportImportConfiguration.";
3621 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No ExportImportConfiguration exists with the primary key ";
3622 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No ExportImportConfiguration exists with the key {";
3623 private static final Log _log = LogFactoryUtil.getLog(ExportImportConfigurationPersistenceImpl.class);
3624 private static final Set<String> _badColumnNames = SetUtil.fromArray(new String[] {
3625 "type", "settings"
3626 });
3627 private static final ExportImportConfiguration _nullExportImportConfiguration =
3628 new ExportImportConfigurationImpl() {
3629 @Override
3630 public Object clone() {
3631 return this;
3632 }
3633
3634 @Override
3635 public CacheModel<ExportImportConfiguration> toCacheModel() {
3636 return _nullExportImportConfigurationCacheModel;
3637 }
3638 };
3639
3640 private static final CacheModel<ExportImportConfiguration> _nullExportImportConfigurationCacheModel =
3641 new NullCacheModel();
3642
3643 private static class NullCacheModel implements CacheModel<ExportImportConfiguration>,
3644 MVCCModel {
3645 @Override
3646 public long getMvccVersion() {
3647 return -1;
3648 }
3649
3650 @Override
3651 public void setMvccVersion(long mvccVersion) {
3652 }
3653
3654 @Override
3655 public ExportImportConfiguration toEntityModel() {
3656 return _nullExportImportConfiguration;
3657 }
3658 }
3659 }