1
22
23 package com.liferay.portlet.shopping.service.persistence;
24
25 import com.liferay.portal.SystemException;
26 import com.liferay.portal.kernel.annotation.BeanReference;
27 import com.liferay.portal.kernel.cache.CacheRegistry;
28 import com.liferay.portal.kernel.dao.orm.DynamicQuery;
29 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
30 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
31 import com.liferay.portal.kernel.dao.orm.FinderPath;
32 import com.liferay.portal.kernel.dao.orm.Query;
33 import com.liferay.portal.kernel.dao.orm.QueryPos;
34 import com.liferay.portal.kernel.dao.orm.QueryUtil;
35 import com.liferay.portal.kernel.dao.orm.Session;
36 import com.liferay.portal.kernel.log.Log;
37 import com.liferay.portal.kernel.log.LogFactoryUtil;
38 import com.liferay.portal.kernel.util.GetterUtil;
39 import com.liferay.portal.kernel.util.OrderByComparator;
40 import com.liferay.portal.kernel.util.StringPool;
41 import com.liferay.portal.kernel.util.StringUtil;
42 import com.liferay.portal.model.ModelListener;
43 import com.liferay.portal.service.persistence.BatchSessionUtil;
44 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
45
46 import com.liferay.portlet.shopping.NoSuchItemPriceException;
47 import com.liferay.portlet.shopping.model.ShoppingItemPrice;
48 import com.liferay.portlet.shopping.model.impl.ShoppingItemPriceImpl;
49 import com.liferay.portlet.shopping.model.impl.ShoppingItemPriceModelImpl;
50
51 import java.util.ArrayList;
52 import java.util.Collections;
53 import java.util.List;
54
55
61 public class ShoppingItemPricePersistenceImpl extends BasePersistenceImpl
62 implements ShoppingItemPricePersistence {
63 public static final String FINDER_CLASS_NAME_ENTITY = ShoppingItemPriceImpl.class.getName();
64 public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
65 ".List";
66 public static final FinderPath FINDER_PATH_FIND_BY_ITEMID = new FinderPath(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
67 ShoppingItemPriceModelImpl.FINDER_CACHE_ENABLED,
68 FINDER_CLASS_NAME_LIST, "findByItemId",
69 new String[] { Long.class.getName() });
70 public static final FinderPath FINDER_PATH_FIND_BY_OBC_ITEMID = new FinderPath(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
71 ShoppingItemPriceModelImpl.FINDER_CACHE_ENABLED,
72 FINDER_CLASS_NAME_LIST, "findByItemId",
73 new String[] {
74 Long.class.getName(),
75
76 "java.lang.Integer", "java.lang.Integer",
77 "com.liferay.portal.kernel.util.OrderByComparator"
78 });
79 public static final FinderPath FINDER_PATH_COUNT_BY_ITEMID = new FinderPath(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
80 ShoppingItemPriceModelImpl.FINDER_CACHE_ENABLED,
81 FINDER_CLASS_NAME_LIST, "countByItemId",
82 new String[] { Long.class.getName() });
83 public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
84 ShoppingItemPriceModelImpl.FINDER_CACHE_ENABLED,
85 FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
86 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
87 ShoppingItemPriceModelImpl.FINDER_CACHE_ENABLED,
88 FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
89
90 public void cacheResult(ShoppingItemPrice shoppingItemPrice) {
91 EntityCacheUtil.putResult(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
92 ShoppingItemPriceImpl.class, shoppingItemPrice.getPrimaryKey(),
93 shoppingItemPrice);
94 }
95
96 public void cacheResult(List<ShoppingItemPrice> shoppingItemPrices) {
97 for (ShoppingItemPrice shoppingItemPrice : shoppingItemPrices) {
98 if (EntityCacheUtil.getResult(
99 ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
100 ShoppingItemPriceImpl.class,
101 shoppingItemPrice.getPrimaryKey(), this) == null) {
102 cacheResult(shoppingItemPrice);
103 }
104 }
105 }
106
107 public void clearCache() {
108 CacheRegistry.clear(ShoppingItemPriceImpl.class.getName());
109 EntityCacheUtil.clearCache(ShoppingItemPriceImpl.class.getName());
110 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
111 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
112 }
113
114 public ShoppingItemPrice create(long itemPriceId) {
115 ShoppingItemPrice shoppingItemPrice = new ShoppingItemPriceImpl();
116
117 shoppingItemPrice.setNew(true);
118 shoppingItemPrice.setPrimaryKey(itemPriceId);
119
120 return shoppingItemPrice;
121 }
122
123 public ShoppingItemPrice remove(long itemPriceId)
124 throws NoSuchItemPriceException, SystemException {
125 Session session = null;
126
127 try {
128 session = openSession();
129
130 ShoppingItemPrice shoppingItemPrice = (ShoppingItemPrice)session.get(ShoppingItemPriceImpl.class,
131 new Long(itemPriceId));
132
133 if (shoppingItemPrice == null) {
134 if (_log.isWarnEnabled()) {
135 _log.warn(
136 "No ShoppingItemPrice exists with the primary key " +
137 itemPriceId);
138 }
139
140 throw new NoSuchItemPriceException(
141 "No ShoppingItemPrice exists with the primary key " +
142 itemPriceId);
143 }
144
145 return remove(shoppingItemPrice);
146 }
147 catch (NoSuchItemPriceException nsee) {
148 throw nsee;
149 }
150 catch (Exception e) {
151 throw processException(e);
152 }
153 finally {
154 closeSession(session);
155 }
156 }
157
158 public ShoppingItemPrice remove(ShoppingItemPrice shoppingItemPrice)
159 throws SystemException {
160 for (ModelListener<ShoppingItemPrice> listener : listeners) {
161 listener.onBeforeRemove(shoppingItemPrice);
162 }
163
164 shoppingItemPrice = removeImpl(shoppingItemPrice);
165
166 for (ModelListener<ShoppingItemPrice> listener : listeners) {
167 listener.onAfterRemove(shoppingItemPrice);
168 }
169
170 return shoppingItemPrice;
171 }
172
173 protected ShoppingItemPrice removeImpl(ShoppingItemPrice shoppingItemPrice)
174 throws SystemException {
175 Session session = null;
176
177 try {
178 session = openSession();
179
180 if (shoppingItemPrice.isCachedModel() ||
181 BatchSessionUtil.isEnabled()) {
182 Object staleObject = session.get(ShoppingItemPriceImpl.class,
183 shoppingItemPrice.getPrimaryKeyObj());
184
185 if (staleObject != null) {
186 session.evict(staleObject);
187 }
188 }
189
190 session.delete(shoppingItemPrice);
191
192 session.flush();
193 }
194 catch (Exception e) {
195 throw processException(e);
196 }
197 finally {
198 closeSession(session);
199 }
200
201 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
202
203 EntityCacheUtil.removeResult(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
204 ShoppingItemPriceImpl.class, shoppingItemPrice.getPrimaryKey());
205
206 return shoppingItemPrice;
207 }
208
209
212 public ShoppingItemPrice update(ShoppingItemPrice shoppingItemPrice)
213 throws SystemException {
214 if (_log.isWarnEnabled()) {
215 _log.warn(
216 "Using the deprecated update(ShoppingItemPrice shoppingItemPrice) method. Use update(ShoppingItemPrice shoppingItemPrice, boolean merge) instead.");
217 }
218
219 return update(shoppingItemPrice, false);
220 }
221
222
235 public ShoppingItemPrice update(ShoppingItemPrice shoppingItemPrice,
236 boolean merge) throws SystemException {
237 boolean isNew = shoppingItemPrice.isNew();
238
239 for (ModelListener<ShoppingItemPrice> listener : listeners) {
240 if (isNew) {
241 listener.onBeforeCreate(shoppingItemPrice);
242 }
243 else {
244 listener.onBeforeUpdate(shoppingItemPrice);
245 }
246 }
247
248 shoppingItemPrice = updateImpl(shoppingItemPrice, merge);
249
250 for (ModelListener<ShoppingItemPrice> listener : listeners) {
251 if (isNew) {
252 listener.onAfterCreate(shoppingItemPrice);
253 }
254 else {
255 listener.onAfterUpdate(shoppingItemPrice);
256 }
257 }
258
259 return shoppingItemPrice;
260 }
261
262 public ShoppingItemPrice updateImpl(
263 com.liferay.portlet.shopping.model.ShoppingItemPrice shoppingItemPrice,
264 boolean merge) throws SystemException {
265 Session session = null;
266
267 try {
268 session = openSession();
269
270 BatchSessionUtil.update(session, shoppingItemPrice, merge);
271
272 shoppingItemPrice.setNew(false);
273 }
274 catch (Exception e) {
275 throw processException(e);
276 }
277 finally {
278 closeSession(session);
279 }
280
281 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
282
283 EntityCacheUtil.putResult(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
284 ShoppingItemPriceImpl.class, shoppingItemPrice.getPrimaryKey(),
285 shoppingItemPrice);
286
287 return shoppingItemPrice;
288 }
289
290 public ShoppingItemPrice findByPrimaryKey(long itemPriceId)
291 throws NoSuchItemPriceException, SystemException {
292 ShoppingItemPrice shoppingItemPrice = fetchByPrimaryKey(itemPriceId);
293
294 if (shoppingItemPrice == null) {
295 if (_log.isWarnEnabled()) {
296 _log.warn("No ShoppingItemPrice exists with the primary key " +
297 itemPriceId);
298 }
299
300 throw new NoSuchItemPriceException(
301 "No ShoppingItemPrice exists with the primary key " +
302 itemPriceId);
303 }
304
305 return shoppingItemPrice;
306 }
307
308 public ShoppingItemPrice fetchByPrimaryKey(long itemPriceId)
309 throws SystemException {
310 ShoppingItemPrice shoppingItemPrice = (ShoppingItemPrice)EntityCacheUtil.getResult(ShoppingItemPriceModelImpl.ENTITY_CACHE_ENABLED,
311 ShoppingItemPriceImpl.class, itemPriceId, this);
312
313 if (shoppingItemPrice == null) {
314 Session session = null;
315
316 try {
317 session = openSession();
318
319 shoppingItemPrice = (ShoppingItemPrice)session.get(ShoppingItemPriceImpl.class,
320 new Long(itemPriceId));
321 }
322 catch (Exception e) {
323 throw processException(e);
324 }
325 finally {
326 if (shoppingItemPrice != null) {
327 cacheResult(shoppingItemPrice);
328 }
329
330 closeSession(session);
331 }
332 }
333
334 return shoppingItemPrice;
335 }
336
337 public List<ShoppingItemPrice> findByItemId(long itemId)
338 throws SystemException {
339 Object[] finderArgs = new Object[] { new Long(itemId) };
340
341 List<ShoppingItemPrice> list = (List<ShoppingItemPrice>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_ITEMID,
342 finderArgs, this);
343
344 if (list == null) {
345 Session session = null;
346
347 try {
348 session = openSession();
349
350 StringBuilder query = new StringBuilder();
351
352 query.append(
353 "SELECT shoppingItemPrice FROM ShoppingItemPrice shoppingItemPrice WHERE ");
354
355 query.append("shoppingItemPrice.itemId = ?");
356
357 query.append(" ");
358
359 query.append("ORDER BY ");
360
361 query.append("shoppingItemPrice.itemId ASC, ");
362 query.append("shoppingItemPrice.itemPriceId ASC");
363
364 Query q = session.createQuery(query.toString());
365
366 QueryPos qPos = QueryPos.getInstance(q);
367
368 qPos.add(itemId);
369
370 list = q.list();
371 }
372 catch (Exception e) {
373 throw processException(e);
374 }
375 finally {
376 if (list == null) {
377 list = new ArrayList<ShoppingItemPrice>();
378 }
379
380 cacheResult(list);
381
382 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_ITEMID,
383 finderArgs, list);
384
385 closeSession(session);
386 }
387 }
388
389 return list;
390 }
391
392 public List<ShoppingItemPrice> findByItemId(long itemId, int start, int end)
393 throws SystemException {
394 return findByItemId(itemId, start, end, null);
395 }
396
397 public List<ShoppingItemPrice> findByItemId(long itemId, int start,
398 int end, OrderByComparator obc) throws SystemException {
399 Object[] finderArgs = new Object[] {
400 new Long(itemId),
401
402 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
403 };
404
405 List<ShoppingItemPrice> list = (List<ShoppingItemPrice>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_ITEMID,
406 finderArgs, this);
407
408 if (list == null) {
409 Session session = null;
410
411 try {
412 session = openSession();
413
414 StringBuilder query = new StringBuilder();
415
416 query.append(
417 "SELECT shoppingItemPrice FROM ShoppingItemPrice shoppingItemPrice WHERE ");
418
419 query.append("shoppingItemPrice.itemId = ?");
420
421 query.append(" ");
422
423 if (obc != null) {
424 query.append("ORDER BY ");
425
426 String[] orderByFields = obc.getOrderByFields();
427
428 for (int i = 0; i < orderByFields.length; i++) {
429 query.append("shoppingItemPrice.");
430 query.append(orderByFields[i]);
431
432 if (obc.isAscending()) {
433 query.append(" ASC");
434 }
435 else {
436 query.append(" DESC");
437 }
438
439 if ((i + 1) < orderByFields.length) {
440 query.append(", ");
441 }
442 }
443 }
444
445 else {
446 query.append("ORDER BY ");
447
448 query.append("shoppingItemPrice.itemId ASC, ");
449 query.append("shoppingItemPrice.itemPriceId ASC");
450 }
451
452 Query q = session.createQuery(query.toString());
453
454 QueryPos qPos = QueryPos.getInstance(q);
455
456 qPos.add(itemId);
457
458 list = (List<ShoppingItemPrice>)QueryUtil.list(q, getDialect(),
459 start, end);
460 }
461 catch (Exception e) {
462 throw processException(e);
463 }
464 finally {
465 if (list == null) {
466 list = new ArrayList<ShoppingItemPrice>();
467 }
468
469 cacheResult(list);
470
471 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_ITEMID,
472 finderArgs, list);
473
474 closeSession(session);
475 }
476 }
477
478 return list;
479 }
480
481 public ShoppingItemPrice findByItemId_First(long itemId,
482 OrderByComparator obc) throws NoSuchItemPriceException, SystemException {
483 List<ShoppingItemPrice> list = findByItemId(itemId, 0, 1, obc);
484
485 if (list.isEmpty()) {
486 StringBuilder msg = new StringBuilder();
487
488 msg.append("No ShoppingItemPrice exists with the key {");
489
490 msg.append("itemId=" + itemId);
491
492 msg.append(StringPool.CLOSE_CURLY_BRACE);
493
494 throw new NoSuchItemPriceException(msg.toString());
495 }
496 else {
497 return list.get(0);
498 }
499 }
500
501 public ShoppingItemPrice findByItemId_Last(long itemId,
502 OrderByComparator obc) throws NoSuchItemPriceException, SystemException {
503 int count = countByItemId(itemId);
504
505 List<ShoppingItemPrice> list = findByItemId(itemId, count - 1, count,
506 obc);
507
508 if (list.isEmpty()) {
509 StringBuilder msg = new StringBuilder();
510
511 msg.append("No ShoppingItemPrice exists with the key {");
512
513 msg.append("itemId=" + itemId);
514
515 msg.append(StringPool.CLOSE_CURLY_BRACE);
516
517 throw new NoSuchItemPriceException(msg.toString());
518 }
519 else {
520 return list.get(0);
521 }
522 }
523
524 public ShoppingItemPrice[] findByItemId_PrevAndNext(long itemPriceId,
525 long itemId, OrderByComparator obc)
526 throws NoSuchItemPriceException, SystemException {
527 ShoppingItemPrice shoppingItemPrice = findByPrimaryKey(itemPriceId);
528
529 int count = countByItemId(itemId);
530
531 Session session = null;
532
533 try {
534 session = openSession();
535
536 StringBuilder query = new StringBuilder();
537
538 query.append(
539 "SELECT shoppingItemPrice FROM ShoppingItemPrice shoppingItemPrice WHERE ");
540
541 query.append("shoppingItemPrice.itemId = ?");
542
543 query.append(" ");
544
545 if (obc != null) {
546 query.append("ORDER BY ");
547
548 String[] orderByFields = obc.getOrderByFields();
549
550 for (int i = 0; i < orderByFields.length; i++) {
551 query.append("shoppingItemPrice.");
552 query.append(orderByFields[i]);
553
554 if (obc.isAscending()) {
555 query.append(" ASC");
556 }
557 else {
558 query.append(" DESC");
559 }
560
561 if ((i + 1) < orderByFields.length) {
562 query.append(", ");
563 }
564 }
565 }
566
567 else {
568 query.append("ORDER BY ");
569
570 query.append("shoppingItemPrice.itemId ASC, ");
571 query.append("shoppingItemPrice.itemPriceId ASC");
572 }
573
574 Query q = session.createQuery(query.toString());
575
576 QueryPos qPos = QueryPos.getInstance(q);
577
578 qPos.add(itemId);
579
580 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
581 shoppingItemPrice);
582
583 ShoppingItemPrice[] array = new ShoppingItemPriceImpl[3];
584
585 array[0] = (ShoppingItemPrice)objArray[0];
586 array[1] = (ShoppingItemPrice)objArray[1];
587 array[2] = (ShoppingItemPrice)objArray[2];
588
589 return array;
590 }
591 catch (Exception e) {
592 throw processException(e);
593 }
594 finally {
595 closeSession(session);
596 }
597 }
598
599 public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
600 throws SystemException {
601 Session session = null;
602
603 try {
604 session = openSession();
605
606 dynamicQuery.compile(session);
607
608 return dynamicQuery.list();
609 }
610 catch (Exception e) {
611 throw processException(e);
612 }
613 finally {
614 closeSession(session);
615 }
616 }
617
618 public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
619 int start, int end) throws SystemException {
620 Session session = null;
621
622 try {
623 session = openSession();
624
625 dynamicQuery.setLimit(start, end);
626
627 dynamicQuery.compile(session);
628
629 return dynamicQuery.list();
630 }
631 catch (Exception e) {
632 throw processException(e);
633 }
634 finally {
635 closeSession(session);
636 }
637 }
638
639 public List<ShoppingItemPrice> findAll() throws SystemException {
640 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
641 }
642
643 public List<ShoppingItemPrice> findAll(int start, int end)
644 throws SystemException {
645 return findAll(start, end, null);
646 }
647
648 public List<ShoppingItemPrice> findAll(int start, int end,
649 OrderByComparator obc) throws SystemException {
650 Object[] finderArgs = new Object[] {
651 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
652 };
653
654 List<ShoppingItemPrice> list = (List<ShoppingItemPrice>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
655 finderArgs, this);
656
657 if (list == null) {
658 Session session = null;
659
660 try {
661 session = openSession();
662
663 StringBuilder query = new StringBuilder();
664
665 query.append(
666 "SELECT shoppingItemPrice FROM ShoppingItemPrice shoppingItemPrice ");
667
668 if (obc != null) {
669 query.append("ORDER BY ");
670
671 String[] orderByFields = obc.getOrderByFields();
672
673 for (int i = 0; i < orderByFields.length; i++) {
674 query.append("shoppingItemPrice.");
675 query.append(orderByFields[i]);
676
677 if (obc.isAscending()) {
678 query.append(" ASC");
679 }
680 else {
681 query.append(" DESC");
682 }
683
684 if ((i + 1) < orderByFields.length) {
685 query.append(", ");
686 }
687 }
688 }
689
690 else {
691 query.append("ORDER BY ");
692
693 query.append("shoppingItemPrice.itemId ASC, ");
694 query.append("shoppingItemPrice.itemPriceId ASC");
695 }
696
697 Query q = session.createQuery(query.toString());
698
699 if (obc == null) {
700 list = (List<ShoppingItemPrice>)QueryUtil.list(q,
701 getDialect(), start, end, false);
702
703 Collections.sort(list);
704 }
705 else {
706 list = (List<ShoppingItemPrice>)QueryUtil.list(q,
707 getDialect(), start, end);
708 }
709 }
710 catch (Exception e) {
711 throw processException(e);
712 }
713 finally {
714 if (list == null) {
715 list = new ArrayList<ShoppingItemPrice>();
716 }
717
718 cacheResult(list);
719
720 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
721
722 closeSession(session);
723 }
724 }
725
726 return list;
727 }
728
729 public void removeByItemId(long itemId) throws SystemException {
730 for (ShoppingItemPrice shoppingItemPrice : findByItemId(itemId)) {
731 remove(shoppingItemPrice);
732 }
733 }
734
735 public void removeAll() throws SystemException {
736 for (ShoppingItemPrice shoppingItemPrice : findAll()) {
737 remove(shoppingItemPrice);
738 }
739 }
740
741 public int countByItemId(long itemId) throws SystemException {
742 Object[] finderArgs = new Object[] { new Long(itemId) };
743
744 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_ITEMID,
745 finderArgs, this);
746
747 if (count == null) {
748 Session session = null;
749
750 try {
751 session = openSession();
752
753 StringBuilder query = new StringBuilder();
754
755 query.append("SELECT COUNT(shoppingItemPrice) ");
756 query.append("FROM ShoppingItemPrice shoppingItemPrice WHERE ");
757
758 query.append("shoppingItemPrice.itemId = ?");
759
760 query.append(" ");
761
762 Query q = session.createQuery(query.toString());
763
764 QueryPos qPos = QueryPos.getInstance(q);
765
766 qPos.add(itemId);
767
768 count = (Long)q.uniqueResult();
769 }
770 catch (Exception e) {
771 throw processException(e);
772 }
773 finally {
774 if (count == null) {
775 count = Long.valueOf(0);
776 }
777
778 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_ITEMID,
779 finderArgs, count);
780
781 closeSession(session);
782 }
783 }
784
785 return count.intValue();
786 }
787
788 public int countAll() throws SystemException {
789 Object[] finderArgs = new Object[0];
790
791 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
792 finderArgs, this);
793
794 if (count == null) {
795 Session session = null;
796
797 try {
798 session = openSession();
799
800 Query q = session.createQuery(
801 "SELECT COUNT(shoppingItemPrice) FROM ShoppingItemPrice shoppingItemPrice");
802
803 count = (Long)q.uniqueResult();
804 }
805 catch (Exception e) {
806 throw processException(e);
807 }
808 finally {
809 if (count == null) {
810 count = Long.valueOf(0);
811 }
812
813 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
814 count);
815
816 closeSession(session);
817 }
818 }
819
820 return count.intValue();
821 }
822
823 public void afterPropertiesSet() {
824 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
825 com.liferay.portal.util.PropsUtil.get(
826 "value.object.listener.com.liferay.portlet.shopping.model.ShoppingItemPrice")));
827
828 if (listenerClassNames.length > 0) {
829 try {
830 List<ModelListener<ShoppingItemPrice>> listenersList = new ArrayList<ModelListener<ShoppingItemPrice>>();
831
832 for (String listenerClassName : listenerClassNames) {
833 listenersList.add((ModelListener<ShoppingItemPrice>)Class.forName(
834 listenerClassName).newInstance());
835 }
836
837 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
838 }
839 catch (Exception e) {
840 _log.error(e);
841 }
842 }
843 }
844
845 @BeanReference(name = "com.liferay.portlet.shopping.service.persistence.ShoppingCartPersistence.impl")
846 protected com.liferay.portlet.shopping.service.persistence.ShoppingCartPersistence shoppingCartPersistence;
847 @BeanReference(name = "com.liferay.portlet.shopping.service.persistence.ShoppingCategoryPersistence.impl")
848 protected com.liferay.portlet.shopping.service.persistence.ShoppingCategoryPersistence shoppingCategoryPersistence;
849 @BeanReference(name = "com.liferay.portlet.shopping.service.persistence.ShoppingCouponPersistence.impl")
850 protected com.liferay.portlet.shopping.service.persistence.ShoppingCouponPersistence shoppingCouponPersistence;
851 @BeanReference(name = "com.liferay.portlet.shopping.service.persistence.ShoppingItemPersistence.impl")
852 protected com.liferay.portlet.shopping.service.persistence.ShoppingItemPersistence shoppingItemPersistence;
853 @BeanReference(name = "com.liferay.portlet.shopping.service.persistence.ShoppingItemFieldPersistence.impl")
854 protected com.liferay.portlet.shopping.service.persistence.ShoppingItemFieldPersistence shoppingItemFieldPersistence;
855 @BeanReference(name = "com.liferay.portlet.shopping.service.persistence.ShoppingItemPricePersistence.impl")
856 protected com.liferay.portlet.shopping.service.persistence.ShoppingItemPricePersistence shoppingItemPricePersistence;
857 @BeanReference(name = "com.liferay.portlet.shopping.service.persistence.ShoppingOrderPersistence.impl")
858 protected com.liferay.portlet.shopping.service.persistence.ShoppingOrderPersistence shoppingOrderPersistence;
859 @BeanReference(name = "com.liferay.portlet.shopping.service.persistence.ShoppingOrderItemPersistence.impl")
860 protected com.liferay.portlet.shopping.service.persistence.ShoppingOrderItemPersistence shoppingOrderItemPersistence;
861 private static Log _log = LogFactoryUtil.getLog(ShoppingItemPricePersistenceImpl.class);
862 }