001
014
015 package com.liferay.portlet.shopping.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.kernel.annotation.BeanReference;
019 import com.liferay.portal.kernel.cache.CacheRegistryUtil;
020 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
021 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
022 import com.liferay.portal.kernel.dao.orm.FinderPath;
023 import com.liferay.portal.kernel.dao.orm.Query;
024 import com.liferay.portal.kernel.dao.orm.QueryPos;
025 import com.liferay.portal.kernel.dao.orm.QueryUtil;
026 import com.liferay.portal.kernel.dao.orm.Session;
027 import com.liferay.portal.kernel.exception.SystemException;
028 import com.liferay.portal.kernel.log.Log;
029 import com.liferay.portal.kernel.log.LogFactoryUtil;
030 import com.liferay.portal.kernel.util.GetterUtil;
031 import com.liferay.portal.kernel.util.InstanceFactory;
032 import com.liferay.portal.kernel.util.OrderByComparator;
033 import com.liferay.portal.kernel.util.StringBundler;
034 import com.liferay.portal.kernel.util.StringPool;
035 import com.liferay.portal.kernel.util.StringUtil;
036 import com.liferay.portal.model.ModelListener;
037 import com.liferay.portal.service.persistence.BatchSessionUtil;
038 import com.liferay.portal.service.persistence.ResourcePersistence;
039 import com.liferay.portal.service.persistence.UserPersistence;
040 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
041
042 import com.liferay.portlet.shopping.NoSuchItemPriceException;
043 import com.liferay.portlet.shopping.model.ShoppingItemPrice;
044 import com.liferay.portlet.shopping.model.impl.ShoppingItemPriceImpl;
045 import com.liferay.portlet.shopping.model.impl.ShoppingItemPriceModelImpl;
046
047 import java.io.Serializable;
048
049 import java.util.ArrayList;
050 import java.util.Collections;
051 import java.util.List;
052
053
069 public class ShoppingItemPricePersistenceImpl extends BasePersistenceImpl<ShoppingItemPrice>
070 implements ShoppingItemPricePersistence {
071 public static final String FINDER_CLASS_NAME_ENTITY = ShoppingItemPriceImpl.class.getName();
072 public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
073 ".List";
074 public static final FinderPath FINDER_PATH_FIND_BY_ITEMID = new FinderPath(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
075 ShoppingItemPriceModelImpl.FINDER_CACHE_ENABLED,
076 FINDER_CLASS_NAME_LIST, "findByItemId",
077 new String[] {
078 Long.class.getName(),
079
080 "java.lang.Integer", "java.lang.Integer",
081 "com.liferay.portal.kernel.util.OrderByComparator"
082 });
083 public static final FinderPath FINDER_PATH_COUNT_BY_ITEMID = new FinderPath(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
084 ShoppingItemPriceModelImpl.FINDER_CACHE_ENABLED,
085 FINDER_CLASS_NAME_LIST, "countByItemId",
086 new String[] { Long.class.getName() });
087 public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
088 ShoppingItemPriceModelImpl.FINDER_CACHE_ENABLED,
089 FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
090 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
091 ShoppingItemPriceModelImpl.FINDER_CACHE_ENABLED,
092 FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
093
094
099 public void cacheResult(ShoppingItemPrice shoppingItemPrice) {
100 EntityCacheUtil.putResult(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
101 ShoppingItemPriceImpl.class, shoppingItemPrice.getPrimaryKey(),
102 shoppingItemPrice);
103 }
104
105
110 public void cacheResult(List<ShoppingItemPrice> shoppingItemPrices) {
111 for (ShoppingItemPrice shoppingItemPrice : shoppingItemPrices) {
112 if (EntityCacheUtil.getResult(
113 ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
114 ShoppingItemPriceImpl.class,
115 shoppingItemPrice.getPrimaryKey(), this) == null) {
116 cacheResult(shoppingItemPrice);
117 }
118 }
119 }
120
121
128 public void clearCache() {
129 CacheRegistryUtil.clear(ShoppingItemPriceImpl.class.getName());
130 EntityCacheUtil.clearCache(ShoppingItemPriceImpl.class.getName());
131 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
132 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
133 }
134
135
142 public void clearCache(ShoppingItemPrice shoppingItemPrice) {
143 EntityCacheUtil.removeResult(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
144 ShoppingItemPriceImpl.class, shoppingItemPrice.getPrimaryKey());
145 }
146
147
153 public ShoppingItemPrice create(long itemPriceId) {
154 ShoppingItemPrice shoppingItemPrice = new ShoppingItemPriceImpl();
155
156 shoppingItemPrice.setNew(true);
157 shoppingItemPrice.setPrimaryKey(itemPriceId);
158
159 return shoppingItemPrice;
160 }
161
162
170 public ShoppingItemPrice remove(Serializable primaryKey)
171 throws NoSuchModelException, SystemException {
172 return remove(((Long)primaryKey).longValue());
173 }
174
175
183 public ShoppingItemPrice remove(long itemPriceId)
184 throws NoSuchItemPriceException, SystemException {
185 Session session = null;
186
187 try {
188 session = openSession();
189
190 ShoppingItemPrice shoppingItemPrice = (ShoppingItemPrice)session.get(ShoppingItemPriceImpl.class,
191 new Long(itemPriceId));
192
193 if (shoppingItemPrice == null) {
194 if (_log.isWarnEnabled()) {
195 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + itemPriceId);
196 }
197
198 throw new NoSuchItemPriceException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
199 itemPriceId);
200 }
201
202 return remove(shoppingItemPrice);
203 }
204 catch (NoSuchItemPriceException nsee) {
205 throw nsee;
206 }
207 catch (Exception e) {
208 throw processException(e);
209 }
210 finally {
211 closeSession(session);
212 }
213 }
214
215 protected ShoppingItemPrice removeImpl(ShoppingItemPrice shoppingItemPrice)
216 throws SystemException {
217 shoppingItemPrice = toUnwrappedModel(shoppingItemPrice);
218
219 Session session = null;
220
221 try {
222 session = openSession();
223
224 BatchSessionUtil.delete(session, shoppingItemPrice);
225 }
226 catch (Exception e) {
227 throw processException(e);
228 }
229 finally {
230 closeSession(session);
231 }
232
233 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
234
235 EntityCacheUtil.removeResult(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
236 ShoppingItemPriceImpl.class, shoppingItemPrice.getPrimaryKey());
237
238 return shoppingItemPrice;
239 }
240
241 public ShoppingItemPrice updateImpl(
242 com.liferay.portlet.shopping.model.ShoppingItemPrice shoppingItemPrice,
243 boolean merge) throws SystemException {
244 shoppingItemPrice = toUnwrappedModel(shoppingItemPrice);
245
246 Session session = null;
247
248 try {
249 session = openSession();
250
251 BatchSessionUtil.update(session, shoppingItemPrice, merge);
252
253 shoppingItemPrice.setNew(false);
254 }
255 catch (Exception e) {
256 throw processException(e);
257 }
258 finally {
259 closeSession(session);
260 }
261
262 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
263
264 EntityCacheUtil.putResult(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
265 ShoppingItemPriceImpl.class, shoppingItemPrice.getPrimaryKey(),
266 shoppingItemPrice);
267
268 return shoppingItemPrice;
269 }
270
271 protected ShoppingItemPrice toUnwrappedModel(
272 ShoppingItemPrice shoppingItemPrice) {
273 if (shoppingItemPrice instanceof ShoppingItemPriceImpl) {
274 return shoppingItemPrice;
275 }
276
277 ShoppingItemPriceImpl shoppingItemPriceImpl = new ShoppingItemPriceImpl();
278
279 shoppingItemPriceImpl.setNew(shoppingItemPrice.isNew());
280 shoppingItemPriceImpl.setPrimaryKey(shoppingItemPrice.getPrimaryKey());
281
282 shoppingItemPriceImpl.setItemPriceId(shoppingItemPrice.getItemPriceId());
283 shoppingItemPriceImpl.setItemId(shoppingItemPrice.getItemId());
284 shoppingItemPriceImpl.setMinQuantity(shoppingItemPrice.getMinQuantity());
285 shoppingItemPriceImpl.setMaxQuantity(shoppingItemPrice.getMaxQuantity());
286 shoppingItemPriceImpl.setPrice(shoppingItemPrice.getPrice());
287 shoppingItemPriceImpl.setDiscount(shoppingItemPrice.getDiscount());
288 shoppingItemPriceImpl.setTaxable(shoppingItemPrice.isTaxable());
289 shoppingItemPriceImpl.setShipping(shoppingItemPrice.getShipping());
290 shoppingItemPriceImpl.setUseShippingFormula(shoppingItemPrice.isUseShippingFormula());
291 shoppingItemPriceImpl.setStatus(shoppingItemPrice.getStatus());
292
293 return shoppingItemPriceImpl;
294 }
295
296
304 public ShoppingItemPrice findByPrimaryKey(Serializable primaryKey)
305 throws NoSuchModelException, SystemException {
306 return findByPrimaryKey(((Long)primaryKey).longValue());
307 }
308
309
317 public ShoppingItemPrice findByPrimaryKey(long itemPriceId)
318 throws NoSuchItemPriceException, SystemException {
319 ShoppingItemPrice shoppingItemPrice = fetchByPrimaryKey(itemPriceId);
320
321 if (shoppingItemPrice == null) {
322 if (_log.isWarnEnabled()) {
323 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + itemPriceId);
324 }
325
326 throw new NoSuchItemPriceException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
327 itemPriceId);
328 }
329
330 return shoppingItemPrice;
331 }
332
333
340 public ShoppingItemPrice fetchByPrimaryKey(Serializable primaryKey)
341 throws SystemException {
342 return fetchByPrimaryKey(((Long)primaryKey).longValue());
343 }
344
345
352 public ShoppingItemPrice fetchByPrimaryKey(long itemPriceId)
353 throws SystemException {
354 ShoppingItemPrice shoppingItemPrice = (ShoppingItemPrice)EntityCacheUtil.getResult(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
355 ShoppingItemPriceImpl.class, itemPriceId, this);
356
357 if (shoppingItemPrice == null) {
358 Session session = null;
359
360 try {
361 session = openSession();
362
363 shoppingItemPrice = (ShoppingItemPrice)session.get(ShoppingItemPriceImpl.class,
364 new Long(itemPriceId));
365 }
366 catch (Exception e) {
367 throw processException(e);
368 }
369 finally {
370 if (shoppingItemPrice != null) {
371 cacheResult(shoppingItemPrice);
372 }
373
374 closeSession(session);
375 }
376 }
377
378 return shoppingItemPrice;
379 }
380
381
388 public List<ShoppingItemPrice> findByItemId(long itemId)
389 throws SystemException {
390 return findByItemId(itemId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
391 }
392
393
406 public List<ShoppingItemPrice> findByItemId(long itemId, int start, int end)
407 throws SystemException {
408 return findByItemId(itemId, start, end, null);
409 }
410
411
425 public List<ShoppingItemPrice> findByItemId(long itemId, int start,
426 int end, OrderByComparator orderByComparator) throws SystemException {
427 Object[] finderArgs = new Object[] {
428 itemId,
429
430 String.valueOf(start), String.valueOf(end),
431 String.valueOf(orderByComparator)
432 };
433
434 List<ShoppingItemPrice> list = (List<ShoppingItemPrice>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_ITEMID,
435 finderArgs, this);
436
437 if (list == null) {
438 StringBundler query = null;
439
440 if (orderByComparator != null) {
441 query = new StringBundler(3 +
442 (orderByComparator.getOrderByFields().length * 3));
443 }
444 else {
445 query = new StringBundler(3);
446 }
447
448 query.append(_SQL_SELECT_SHOPPINGITEMPRICE_WHERE);
449
450 query.append(_FINDER_COLUMN_ITEMID_ITEMID_2);
451
452 if (orderByComparator != null) {
453 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
454 orderByComparator);
455 }
456
457 else {
458 query.append(ShoppingItemPriceModelImpl.ORDER_BY_JPQL);
459 }
460
461 String sql = query.toString();
462
463 Session session = null;
464
465 try {
466 session = openSession();
467
468 Query q = session.createQuery(sql);
469
470 QueryPos qPos = QueryPos.getInstance(q);
471
472 qPos.add(itemId);
473
474 list = (List<ShoppingItemPrice>)QueryUtil.list(q, getDialect(),
475 start, end);
476 }
477 catch (Exception e) {
478 throw processException(e);
479 }
480 finally {
481 if (list == null) {
482 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_ITEMID,
483 finderArgs);
484 }
485 else {
486 cacheResult(list);
487
488 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_ITEMID,
489 finderArgs, list);
490 }
491
492 closeSession(session);
493 }
494 }
495
496 return list;
497 }
498
499
512 public ShoppingItemPrice findByItemId_First(long itemId,
513 OrderByComparator orderByComparator)
514 throws NoSuchItemPriceException, SystemException {
515 List<ShoppingItemPrice> list = findByItemId(itemId, 0, 1,
516 orderByComparator);
517
518 if (list.isEmpty()) {
519 StringBundler msg = new StringBundler(4);
520
521 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
522
523 msg.append("itemId=");
524 msg.append(itemId);
525
526 msg.append(StringPool.CLOSE_CURLY_BRACE);
527
528 throw new NoSuchItemPriceException(msg.toString());
529 }
530 else {
531 return list.get(0);
532 }
533 }
534
535
548 public ShoppingItemPrice findByItemId_Last(long itemId,
549 OrderByComparator orderByComparator)
550 throws NoSuchItemPriceException, SystemException {
551 int count = countByItemId(itemId);
552
553 List<ShoppingItemPrice> list = findByItemId(itemId, count - 1, count,
554 orderByComparator);
555
556 if (list.isEmpty()) {
557 StringBundler msg = new StringBundler(4);
558
559 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
560
561 msg.append("itemId=");
562 msg.append(itemId);
563
564 msg.append(StringPool.CLOSE_CURLY_BRACE);
565
566 throw new NoSuchItemPriceException(msg.toString());
567 }
568 else {
569 return list.get(0);
570 }
571 }
572
573
587 public ShoppingItemPrice[] findByItemId_PrevAndNext(long itemPriceId,
588 long itemId, OrderByComparator orderByComparator)
589 throws NoSuchItemPriceException, SystemException {
590 ShoppingItemPrice shoppingItemPrice = findByPrimaryKey(itemPriceId);
591
592 Session session = null;
593
594 try {
595 session = openSession();
596
597 ShoppingItemPrice[] array = new ShoppingItemPriceImpl[3];
598
599 array[0] = getByItemId_PrevAndNext(session, shoppingItemPrice,
600 itemId, orderByComparator, true);
601
602 array[1] = shoppingItemPrice;
603
604 array[2] = getByItemId_PrevAndNext(session, shoppingItemPrice,
605 itemId, orderByComparator, false);
606
607 return array;
608 }
609 catch (Exception e) {
610 throw processException(e);
611 }
612 finally {
613 closeSession(session);
614 }
615 }
616
617 protected ShoppingItemPrice getByItemId_PrevAndNext(Session session,
618 ShoppingItemPrice shoppingItemPrice, long itemId,
619 OrderByComparator orderByComparator, boolean previous) {
620 StringBundler query = null;
621
622 if (orderByComparator != null) {
623 query = new StringBundler(6 +
624 (orderByComparator.getOrderByFields().length * 6));
625 }
626 else {
627 query = new StringBundler(3);
628 }
629
630 query.append(_SQL_SELECT_SHOPPINGITEMPRICE_WHERE);
631
632 query.append(_FINDER_COLUMN_ITEMID_ITEMID_2);
633
634 if (orderByComparator != null) {
635 String[] orderByFields = orderByComparator.getOrderByFields();
636
637 if (orderByFields.length > 0) {
638 query.append(WHERE_AND);
639 }
640
641 for (int i = 0; i < orderByFields.length; i++) {
642 query.append(_ORDER_BY_ENTITY_ALIAS);
643 query.append(orderByFields[i]);
644
645 if ((i + 1) < orderByFields.length) {
646 if (orderByComparator.isAscending() ^ previous) {
647 query.append(WHERE_GREATER_THAN_HAS_NEXT);
648 }
649 else {
650 query.append(WHERE_LESSER_THAN_HAS_NEXT);
651 }
652 }
653 else {
654 if (orderByComparator.isAscending() ^ previous) {
655 query.append(WHERE_GREATER_THAN);
656 }
657 else {
658 query.append(WHERE_LESSER_THAN);
659 }
660 }
661 }
662
663 query.append(ORDER_BY_CLAUSE);
664
665 for (int i = 0; i < orderByFields.length; i++) {
666 query.append(_ORDER_BY_ENTITY_ALIAS);
667 query.append(orderByFields[i]);
668
669 if ((i + 1) < orderByFields.length) {
670 if (orderByComparator.isAscending() ^ previous) {
671 query.append(ORDER_BY_ASC_HAS_NEXT);
672 }
673 else {
674 query.append(ORDER_BY_DESC_HAS_NEXT);
675 }
676 }
677 else {
678 if (orderByComparator.isAscending() ^ previous) {
679 query.append(ORDER_BY_ASC);
680 }
681 else {
682 query.append(ORDER_BY_DESC);
683 }
684 }
685 }
686 }
687
688 else {
689 query.append(ShoppingItemPriceModelImpl.ORDER_BY_JPQL);
690 }
691
692 String sql = query.toString();
693
694 Query q = session.createQuery(sql);
695
696 q.setFirstResult(0);
697 q.setMaxResults(2);
698
699 QueryPos qPos = QueryPos.getInstance(q);
700
701 qPos.add(itemId);
702
703 if (orderByComparator != null) {
704 Object[] values = orderByComparator.getOrderByValues(shoppingItemPrice);
705
706 for (Object value : values) {
707 qPos.add(value);
708 }
709 }
710
711 List<ShoppingItemPrice> list = q.list();
712
713 if (list.size() == 2) {
714 return list.get(1);
715 }
716 else {
717 return null;
718 }
719 }
720
721
727 public List<ShoppingItemPrice> findAll() throws SystemException {
728 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
729 }
730
731
743 public List<ShoppingItemPrice> findAll(int start, int end)
744 throws SystemException {
745 return findAll(start, end, null);
746 }
747
748
761 public List<ShoppingItemPrice> findAll(int start, int end,
762 OrderByComparator orderByComparator) throws SystemException {
763 Object[] finderArgs = new Object[] {
764 String.valueOf(start), String.valueOf(end),
765 String.valueOf(orderByComparator)
766 };
767
768 List<ShoppingItemPrice> list = (List<ShoppingItemPrice>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
769 finderArgs, this);
770
771 if (list == null) {
772 StringBundler query = null;
773 String sql = null;
774
775 if (orderByComparator != null) {
776 query = new StringBundler(2 +
777 (orderByComparator.getOrderByFields().length * 3));
778
779 query.append(_SQL_SELECT_SHOPPINGITEMPRICE);
780
781 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
782 orderByComparator);
783
784 sql = query.toString();
785 }
786 else {
787 sql = _SQL_SELECT_SHOPPINGITEMPRICE.concat(ShoppingItemPriceModelImpl.ORDER_BY_JPQL);
788 }
789
790 Session session = null;
791
792 try {
793 session = openSession();
794
795 Query q = session.createQuery(sql);
796
797 if (orderByComparator == null) {
798 list = (List<ShoppingItemPrice>)QueryUtil.list(q,
799 getDialect(), start, end, false);
800
801 Collections.sort(list);
802 }
803 else {
804 list = (List<ShoppingItemPrice>)QueryUtil.list(q,
805 getDialect(), start, end);
806 }
807 }
808 catch (Exception e) {
809 throw processException(e);
810 }
811 finally {
812 if (list == null) {
813 FinderCacheUtil.removeResult(FINDER_PATH_FIND_ALL,
814 finderArgs);
815 }
816 else {
817 cacheResult(list);
818
819 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs,
820 list);
821 }
822
823 closeSession(session);
824 }
825 }
826
827 return list;
828 }
829
830
836 public void removeByItemId(long itemId) throws SystemException {
837 for (ShoppingItemPrice shoppingItemPrice : findByItemId(itemId)) {
838 remove(shoppingItemPrice);
839 }
840 }
841
842
847 public void removeAll() throws SystemException {
848 for (ShoppingItemPrice shoppingItemPrice : findAll()) {
849 remove(shoppingItemPrice);
850 }
851 }
852
853
860 public int countByItemId(long itemId) throws SystemException {
861 Object[] finderArgs = new Object[] { itemId };
862
863 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_ITEMID,
864 finderArgs, this);
865
866 if (count == null) {
867 StringBundler query = new StringBundler(2);
868
869 query.append(_SQL_COUNT_SHOPPINGITEMPRICE_WHERE);
870
871 query.append(_FINDER_COLUMN_ITEMID_ITEMID_2);
872
873 String sql = query.toString();
874
875 Session session = null;
876
877 try {
878 session = openSession();
879
880 Query q = session.createQuery(sql);
881
882 QueryPos qPos = QueryPos.getInstance(q);
883
884 qPos.add(itemId);
885
886 count = (Long)q.uniqueResult();
887 }
888 catch (Exception e) {
889 throw processException(e);
890 }
891 finally {
892 if (count == null) {
893 count = Long.valueOf(0);
894 }
895
896 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_ITEMID,
897 finderArgs, count);
898
899 closeSession(session);
900 }
901 }
902
903 return count.intValue();
904 }
905
906
912 public int countAll() throws SystemException {
913 Object[] finderArgs = new Object[0];
914
915 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
916 finderArgs, this);
917
918 if (count == null) {
919 Session session = null;
920
921 try {
922 session = openSession();
923
924 Query q = session.createQuery(_SQL_COUNT_SHOPPINGITEMPRICE);
925
926 count = (Long)q.uniqueResult();
927 }
928 catch (Exception e) {
929 throw processException(e);
930 }
931 finally {
932 if (count == null) {
933 count = Long.valueOf(0);
934 }
935
936 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
937 count);
938
939 closeSession(session);
940 }
941 }
942
943 return count.intValue();
944 }
945
946
949 public void afterPropertiesSet() {
950 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
951 com.liferay.portal.util.PropsUtil.get(
952 "value.object.listener.com.liferay.portlet.shopping.model.ShoppingItemPrice")));
953
954 if (listenerClassNames.length > 0) {
955 try {
956 List<ModelListener<ShoppingItemPrice>> listenersList = new ArrayList<ModelListener<ShoppingItemPrice>>();
957
958 for (String listenerClassName : listenerClassNames) {
959 listenersList.add((ModelListener<ShoppingItemPrice>)InstanceFactory.newInstance(
960 listenerClassName));
961 }
962
963 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
964 }
965 catch (Exception e) {
966 _log.error(e);
967 }
968 }
969 }
970
971 public void destroy() {
972 EntityCacheUtil.removeCache(ShoppingItemPriceImpl.class.getName());
973 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
974 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST);
975 }
976
977 @BeanReference(type = ShoppingCartPersistence.class)
978 protected ShoppingCartPersistence shoppingCartPersistence;
979 @BeanReference(type = ShoppingCategoryPersistence.class)
980 protected ShoppingCategoryPersistence shoppingCategoryPersistence;
981 @BeanReference(type = ShoppingCouponPersistence.class)
982 protected ShoppingCouponPersistence shoppingCouponPersistence;
983 @BeanReference(type = ShoppingItemPersistence.class)
984 protected ShoppingItemPersistence shoppingItemPersistence;
985 @BeanReference(type = ShoppingItemFieldPersistence.class)
986 protected ShoppingItemFieldPersistence shoppingItemFieldPersistence;
987 @BeanReference(type = ShoppingItemPricePersistence.class)
988 protected ShoppingItemPricePersistence shoppingItemPricePersistence;
989 @BeanReference(type = ShoppingOrderPersistence.class)
990 protected ShoppingOrderPersistence shoppingOrderPersistence;
991 @BeanReference(type = ShoppingOrderItemPersistence.class)
992 protected ShoppingOrderItemPersistence shoppingOrderItemPersistence;
993 @BeanReference(type = ResourcePersistence.class)
994 protected ResourcePersistence resourcePersistence;
995 @BeanReference(type = UserPersistence.class)
996 protected UserPersistence userPersistence;
997 private static final String _SQL_SELECT_SHOPPINGITEMPRICE = "SELECT shoppingItemPrice FROM ShoppingItemPrice shoppingItemPrice";
998 private static final String _SQL_SELECT_SHOPPINGITEMPRICE_WHERE = "SELECT shoppingItemPrice FROM ShoppingItemPrice shoppingItemPrice WHERE ";
999 private static final String _SQL_COUNT_SHOPPINGITEMPRICE = "SELECT COUNT(shoppingItemPrice) FROM ShoppingItemPrice shoppingItemPrice";
1000 private static final String _SQL_COUNT_SHOPPINGITEMPRICE_WHERE = "SELECT COUNT(shoppingItemPrice) FROM ShoppingItemPrice shoppingItemPrice WHERE ";
1001 private static final String _FINDER_COLUMN_ITEMID_ITEMID_2 = "shoppingItemPrice.itemId = ?";
1002 private static final String _ORDER_BY_ENTITY_ALIAS = "shoppingItemPrice.";
1003 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No ShoppingItemPrice exists with the primary key ";
1004 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No ShoppingItemPrice exists with the key {";
1005 private static Log _log = LogFactoryUtil.getLog(ShoppingItemPricePersistenceImpl.class);
1006 }