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.NoSuchOrderItemException;
043 import com.liferay.portlet.shopping.model.ShoppingOrderItem;
044 import com.liferay.portlet.shopping.model.impl.ShoppingOrderItemImpl;
045 import com.liferay.portlet.shopping.model.impl.ShoppingOrderItemModelImpl;
046
047 import java.io.Serializable;
048
049 import java.util.ArrayList;
050 import java.util.Collections;
051 import java.util.List;
052
053
059 public class ShoppingOrderItemPersistenceImpl extends BasePersistenceImpl<ShoppingOrderItem>
060 implements ShoppingOrderItemPersistence {
061 public static final String FINDER_CLASS_NAME_ENTITY = ShoppingOrderItemImpl.class.getName();
062 public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
063 ".List";
064 public static final FinderPath FINDER_PATH_FIND_BY_ORDERID = new FinderPath(ShoppingOrderItemModelImpl.ENTITY_CACHE_ENABLED,
065 ShoppingOrderItemModelImpl.FINDER_CACHE_ENABLED,
066 FINDER_CLASS_NAME_LIST, "findByOrderId",
067 new String[] {
068 Long.class.getName(),
069
070 "java.lang.Integer", "java.lang.Integer",
071 "com.liferay.portal.kernel.util.OrderByComparator"
072 });
073 public static final FinderPath FINDER_PATH_COUNT_BY_ORDERID = new FinderPath(ShoppingOrderItemModelImpl.ENTITY_CACHE_ENABLED,
074 ShoppingOrderItemModelImpl.FINDER_CACHE_ENABLED,
075 FINDER_CLASS_NAME_LIST, "countByOrderId",
076 new String[] { Long.class.getName() });
077 public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(ShoppingOrderItemModelImpl.ENTITY_CACHE_ENABLED,
078 ShoppingOrderItemModelImpl.FINDER_CACHE_ENABLED,
079 FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
080 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(ShoppingOrderItemModelImpl.ENTITY_CACHE_ENABLED,
081 ShoppingOrderItemModelImpl.FINDER_CACHE_ENABLED,
082 FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
083
084 public void cacheResult(ShoppingOrderItem shoppingOrderItem) {
085 EntityCacheUtil.putResult(ShoppingOrderItemModelImpl.ENTITY_CACHE_ENABLED,
086 ShoppingOrderItemImpl.class, shoppingOrderItem.getPrimaryKey(),
087 shoppingOrderItem);
088 }
089
090 public void cacheResult(List<ShoppingOrderItem> shoppingOrderItems) {
091 for (ShoppingOrderItem shoppingOrderItem : shoppingOrderItems) {
092 if (EntityCacheUtil.getResult(
093 ShoppingOrderItemModelImpl.ENTITY_CACHE_ENABLED,
094 ShoppingOrderItemImpl.class,
095 shoppingOrderItem.getPrimaryKey(), this) == null) {
096 cacheResult(shoppingOrderItem);
097 }
098 }
099 }
100
101 public void clearCache() {
102 CacheRegistryUtil.clear(ShoppingOrderItemImpl.class.getName());
103 EntityCacheUtil.clearCache(ShoppingOrderItemImpl.class.getName());
104 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
105 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
106 }
107
108 public void clearCache(ShoppingOrderItem shoppingOrderItem) {
109 EntityCacheUtil.removeResult(ShoppingOrderItemModelImpl.ENTITY_CACHE_ENABLED,
110 ShoppingOrderItemImpl.class, shoppingOrderItem.getPrimaryKey());
111 }
112
113 public ShoppingOrderItem create(long orderItemId) {
114 ShoppingOrderItem shoppingOrderItem = new ShoppingOrderItemImpl();
115
116 shoppingOrderItem.setNew(true);
117 shoppingOrderItem.setPrimaryKey(orderItemId);
118
119 return shoppingOrderItem;
120 }
121
122 public ShoppingOrderItem remove(Serializable primaryKey)
123 throws NoSuchModelException, SystemException {
124 return remove(((Long)primaryKey).longValue());
125 }
126
127 public ShoppingOrderItem remove(long orderItemId)
128 throws NoSuchOrderItemException, SystemException {
129 Session session = null;
130
131 try {
132 session = openSession();
133
134 ShoppingOrderItem shoppingOrderItem = (ShoppingOrderItem)session.get(ShoppingOrderItemImpl.class,
135 new Long(orderItemId));
136
137 if (shoppingOrderItem == null) {
138 if (_log.isWarnEnabled()) {
139 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + orderItemId);
140 }
141
142 throw new NoSuchOrderItemException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
143 orderItemId);
144 }
145
146 return remove(shoppingOrderItem);
147 }
148 catch (NoSuchOrderItemException nsee) {
149 throw nsee;
150 }
151 catch (Exception e) {
152 throw processException(e);
153 }
154 finally {
155 closeSession(session);
156 }
157 }
158
159 protected ShoppingOrderItem removeImpl(ShoppingOrderItem shoppingOrderItem)
160 throws SystemException {
161 shoppingOrderItem = toUnwrappedModel(shoppingOrderItem);
162
163 Session session = null;
164
165 try {
166 session = openSession();
167
168 if (shoppingOrderItem.isCachedModel() ||
169 BatchSessionUtil.isEnabled()) {
170 Object staleObject = session.get(ShoppingOrderItemImpl.class,
171 shoppingOrderItem.getPrimaryKeyObj());
172
173 if (staleObject != null) {
174 session.evict(staleObject);
175 }
176 }
177
178 session.delete(shoppingOrderItem);
179
180 session.flush();
181 }
182 catch (Exception e) {
183 throw processException(e);
184 }
185 finally {
186 closeSession(session);
187 }
188
189 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
190
191 EntityCacheUtil.removeResult(ShoppingOrderItemModelImpl.ENTITY_CACHE_ENABLED,
192 ShoppingOrderItemImpl.class, shoppingOrderItem.getPrimaryKey());
193
194 return shoppingOrderItem;
195 }
196
197 public ShoppingOrderItem updateImpl(
198 com.liferay.portlet.shopping.model.ShoppingOrderItem shoppingOrderItem,
199 boolean merge) throws SystemException {
200 shoppingOrderItem = toUnwrappedModel(shoppingOrderItem);
201
202 Session session = null;
203
204 try {
205 session = openSession();
206
207 BatchSessionUtil.update(session, shoppingOrderItem, merge);
208
209 shoppingOrderItem.setNew(false);
210 }
211 catch (Exception e) {
212 throw processException(e);
213 }
214 finally {
215 closeSession(session);
216 }
217
218 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
219
220 EntityCacheUtil.putResult(ShoppingOrderItemModelImpl.ENTITY_CACHE_ENABLED,
221 ShoppingOrderItemImpl.class, shoppingOrderItem.getPrimaryKey(),
222 shoppingOrderItem);
223
224 return shoppingOrderItem;
225 }
226
227 protected ShoppingOrderItem toUnwrappedModel(
228 ShoppingOrderItem shoppingOrderItem) {
229 if (shoppingOrderItem instanceof ShoppingOrderItemImpl) {
230 return shoppingOrderItem;
231 }
232
233 ShoppingOrderItemImpl shoppingOrderItemImpl = new ShoppingOrderItemImpl();
234
235 shoppingOrderItemImpl.setNew(shoppingOrderItem.isNew());
236 shoppingOrderItemImpl.setPrimaryKey(shoppingOrderItem.getPrimaryKey());
237
238 shoppingOrderItemImpl.setOrderItemId(shoppingOrderItem.getOrderItemId());
239 shoppingOrderItemImpl.setOrderId(shoppingOrderItem.getOrderId());
240 shoppingOrderItemImpl.setItemId(shoppingOrderItem.getItemId());
241 shoppingOrderItemImpl.setSku(shoppingOrderItem.getSku());
242 shoppingOrderItemImpl.setName(shoppingOrderItem.getName());
243 shoppingOrderItemImpl.setDescription(shoppingOrderItem.getDescription());
244 shoppingOrderItemImpl.setProperties(shoppingOrderItem.getProperties());
245 shoppingOrderItemImpl.setPrice(shoppingOrderItem.getPrice());
246 shoppingOrderItemImpl.setQuantity(shoppingOrderItem.getQuantity());
247 shoppingOrderItemImpl.setShippedDate(shoppingOrderItem.getShippedDate());
248
249 return shoppingOrderItemImpl;
250 }
251
252 public ShoppingOrderItem findByPrimaryKey(Serializable primaryKey)
253 throws NoSuchModelException, SystemException {
254 return findByPrimaryKey(((Long)primaryKey).longValue());
255 }
256
257 public ShoppingOrderItem findByPrimaryKey(long orderItemId)
258 throws NoSuchOrderItemException, SystemException {
259 ShoppingOrderItem shoppingOrderItem = fetchByPrimaryKey(orderItemId);
260
261 if (shoppingOrderItem == null) {
262 if (_log.isWarnEnabled()) {
263 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + orderItemId);
264 }
265
266 throw new NoSuchOrderItemException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
267 orderItemId);
268 }
269
270 return shoppingOrderItem;
271 }
272
273 public ShoppingOrderItem fetchByPrimaryKey(Serializable primaryKey)
274 throws SystemException {
275 return fetchByPrimaryKey(((Long)primaryKey).longValue());
276 }
277
278 public ShoppingOrderItem fetchByPrimaryKey(long orderItemId)
279 throws SystemException {
280 ShoppingOrderItem shoppingOrderItem = (ShoppingOrderItem)EntityCacheUtil.getResult(ShoppingOrderItemModelImpl.ENTITY_CACHE_ENABLED,
281 ShoppingOrderItemImpl.class, orderItemId, this);
282
283 if (shoppingOrderItem == null) {
284 Session session = null;
285
286 try {
287 session = openSession();
288
289 shoppingOrderItem = (ShoppingOrderItem)session.get(ShoppingOrderItemImpl.class,
290 new Long(orderItemId));
291 }
292 catch (Exception e) {
293 throw processException(e);
294 }
295 finally {
296 if (shoppingOrderItem != null) {
297 cacheResult(shoppingOrderItem);
298 }
299
300 closeSession(session);
301 }
302 }
303
304 return shoppingOrderItem;
305 }
306
307 public List<ShoppingOrderItem> findByOrderId(long orderId)
308 throws SystemException {
309 return findByOrderId(orderId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
310 }
311
312 public List<ShoppingOrderItem> findByOrderId(long orderId, int start,
313 int end) throws SystemException {
314 return findByOrderId(orderId, start, end, null);
315 }
316
317 public List<ShoppingOrderItem> findByOrderId(long orderId, int start,
318 int end, OrderByComparator orderByComparator) throws SystemException {
319 Object[] finderArgs = new Object[] {
320 orderId,
321
322 String.valueOf(start), String.valueOf(end),
323 String.valueOf(orderByComparator)
324 };
325
326 List<ShoppingOrderItem> list = (List<ShoppingOrderItem>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_ORDERID,
327 finderArgs, this);
328
329 if (list == null) {
330 Session session = null;
331
332 try {
333 session = openSession();
334
335 StringBundler query = null;
336
337 if (orderByComparator != null) {
338 query = new StringBundler(3 +
339 (orderByComparator.getOrderByFields().length * 3));
340 }
341 else {
342 query = new StringBundler(3);
343 }
344
345 query.append(_SQL_SELECT_SHOPPINGORDERITEM_WHERE);
346
347 query.append(_FINDER_COLUMN_ORDERID_ORDERID_2);
348
349 if (orderByComparator != null) {
350 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
351 orderByComparator);
352 }
353
354 else {
355 query.append(ShoppingOrderItemModelImpl.ORDER_BY_JPQL);
356 }
357
358 String sql = query.toString();
359
360 Query q = session.createQuery(sql);
361
362 QueryPos qPos = QueryPos.getInstance(q);
363
364 qPos.add(orderId);
365
366 list = (List<ShoppingOrderItem>)QueryUtil.list(q, getDialect(),
367 start, end);
368 }
369 catch (Exception e) {
370 throw processException(e);
371 }
372 finally {
373 if (list == null) {
374 list = new ArrayList<ShoppingOrderItem>();
375 }
376
377 cacheResult(list);
378
379 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_ORDERID,
380 finderArgs, list);
381
382 closeSession(session);
383 }
384 }
385
386 return list;
387 }
388
389 public ShoppingOrderItem findByOrderId_First(long orderId,
390 OrderByComparator orderByComparator)
391 throws NoSuchOrderItemException, SystemException {
392 List<ShoppingOrderItem> list = findByOrderId(orderId, 0, 1,
393 orderByComparator);
394
395 if (list.isEmpty()) {
396 StringBundler msg = new StringBundler(4);
397
398 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
399
400 msg.append("orderId=");
401 msg.append(orderId);
402
403 msg.append(StringPool.CLOSE_CURLY_BRACE);
404
405 throw new NoSuchOrderItemException(msg.toString());
406 }
407 else {
408 return list.get(0);
409 }
410 }
411
412 public ShoppingOrderItem findByOrderId_Last(long orderId,
413 OrderByComparator orderByComparator)
414 throws NoSuchOrderItemException, SystemException {
415 int count = countByOrderId(orderId);
416
417 List<ShoppingOrderItem> list = findByOrderId(orderId, count - 1, count,
418 orderByComparator);
419
420 if (list.isEmpty()) {
421 StringBundler msg = new StringBundler(4);
422
423 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
424
425 msg.append("orderId=");
426 msg.append(orderId);
427
428 msg.append(StringPool.CLOSE_CURLY_BRACE);
429
430 throw new NoSuchOrderItemException(msg.toString());
431 }
432 else {
433 return list.get(0);
434 }
435 }
436
437 public ShoppingOrderItem[] findByOrderId_PrevAndNext(long orderItemId,
438 long orderId, OrderByComparator orderByComparator)
439 throws NoSuchOrderItemException, SystemException {
440 ShoppingOrderItem shoppingOrderItem = findByPrimaryKey(orderItemId);
441
442 Session session = null;
443
444 try {
445 session = openSession();
446
447 ShoppingOrderItem[] array = new ShoppingOrderItemImpl[3];
448
449 array[0] = getByOrderId_PrevAndNext(session, shoppingOrderItem,
450 orderId, orderByComparator, true);
451
452 array[1] = shoppingOrderItem;
453
454 array[2] = getByOrderId_PrevAndNext(session, shoppingOrderItem,
455 orderId, orderByComparator, false);
456
457 return array;
458 }
459 catch (Exception e) {
460 throw processException(e);
461 }
462 finally {
463 closeSession(session);
464 }
465 }
466
467 protected ShoppingOrderItem getByOrderId_PrevAndNext(Session session,
468 ShoppingOrderItem shoppingOrderItem, long orderId,
469 OrderByComparator orderByComparator, boolean previous) {
470 StringBundler query = null;
471
472 if (orderByComparator != null) {
473 query = new StringBundler(6 +
474 (orderByComparator.getOrderByFields().length * 6));
475 }
476 else {
477 query = new StringBundler(3);
478 }
479
480 query.append(_SQL_SELECT_SHOPPINGORDERITEM_WHERE);
481
482 query.append(_FINDER_COLUMN_ORDERID_ORDERID_2);
483
484 if (orderByComparator != null) {
485 String[] orderByFields = orderByComparator.getOrderByFields();
486
487 if (orderByFields.length > 0) {
488 query.append(WHERE_AND);
489 }
490
491 for (int i = 0; i < orderByFields.length; i++) {
492 query.append(_ORDER_BY_ENTITY_ALIAS);
493 query.append(orderByFields[i]);
494
495 if ((i + 1) < orderByFields.length) {
496 if (orderByComparator.isAscending() ^ previous) {
497 query.append(WHERE_GREATER_THAN_HAS_NEXT);
498 }
499 else {
500 query.append(WHERE_LESSER_THAN_HAS_NEXT);
501 }
502 }
503 else {
504 if (orderByComparator.isAscending() ^ previous) {
505 query.append(WHERE_GREATER_THAN);
506 }
507 else {
508 query.append(WHERE_LESSER_THAN);
509 }
510 }
511 }
512
513 query.append(ORDER_BY_CLAUSE);
514
515 for (int i = 0; i < orderByFields.length; i++) {
516 query.append(_ORDER_BY_ENTITY_ALIAS);
517 query.append(orderByFields[i]);
518
519 if ((i + 1) < orderByFields.length) {
520 if (orderByComparator.isAscending() ^ previous) {
521 query.append(ORDER_BY_ASC_HAS_NEXT);
522 }
523 else {
524 query.append(ORDER_BY_DESC_HAS_NEXT);
525 }
526 }
527 else {
528 if (orderByComparator.isAscending() ^ previous) {
529 query.append(ORDER_BY_ASC);
530 }
531 else {
532 query.append(ORDER_BY_DESC);
533 }
534 }
535 }
536 }
537
538 else {
539 query.append(ShoppingOrderItemModelImpl.ORDER_BY_JPQL);
540 }
541
542 String sql = query.toString();
543
544 Query q = session.createQuery(sql);
545
546 q.setFirstResult(0);
547 q.setMaxResults(2);
548
549 QueryPos qPos = QueryPos.getInstance(q);
550
551 qPos.add(orderId);
552
553 if (orderByComparator != null) {
554 Object[] values = orderByComparator.getOrderByValues(shoppingOrderItem);
555
556 for (Object value : values) {
557 qPos.add(value);
558 }
559 }
560
561 List<ShoppingOrderItem> list = q.list();
562
563 if (list.size() == 2) {
564 return list.get(1);
565 }
566 else {
567 return null;
568 }
569 }
570
571 public List<ShoppingOrderItem> findAll() throws SystemException {
572 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
573 }
574
575 public List<ShoppingOrderItem> findAll(int start, int end)
576 throws SystemException {
577 return findAll(start, end, null);
578 }
579
580 public List<ShoppingOrderItem> findAll(int start, int end,
581 OrderByComparator orderByComparator) throws SystemException {
582 Object[] finderArgs = new Object[] {
583 String.valueOf(start), String.valueOf(end),
584 String.valueOf(orderByComparator)
585 };
586
587 List<ShoppingOrderItem> list = (List<ShoppingOrderItem>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
588 finderArgs, this);
589
590 if (list == null) {
591 Session session = null;
592
593 try {
594 session = openSession();
595
596 StringBundler query = null;
597 String sql = null;
598
599 if (orderByComparator != null) {
600 query = new StringBundler(2 +
601 (orderByComparator.getOrderByFields().length * 3));
602
603 query.append(_SQL_SELECT_SHOPPINGORDERITEM);
604
605 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
606 orderByComparator);
607
608 sql = query.toString();
609 }
610 else {
611 sql = _SQL_SELECT_SHOPPINGORDERITEM.concat(ShoppingOrderItemModelImpl.ORDER_BY_JPQL);
612 }
613
614 Query q = session.createQuery(sql);
615
616 if (orderByComparator == null) {
617 list = (List<ShoppingOrderItem>)QueryUtil.list(q,
618 getDialect(), start, end, false);
619
620 Collections.sort(list);
621 }
622 else {
623 list = (List<ShoppingOrderItem>)QueryUtil.list(q,
624 getDialect(), start, end);
625 }
626 }
627 catch (Exception e) {
628 throw processException(e);
629 }
630 finally {
631 if (list == null) {
632 list = new ArrayList<ShoppingOrderItem>();
633 }
634
635 cacheResult(list);
636
637 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
638
639 closeSession(session);
640 }
641 }
642
643 return list;
644 }
645
646 public void removeByOrderId(long orderId) throws SystemException {
647 for (ShoppingOrderItem shoppingOrderItem : findByOrderId(orderId)) {
648 remove(shoppingOrderItem);
649 }
650 }
651
652 public void removeAll() throws SystemException {
653 for (ShoppingOrderItem shoppingOrderItem : findAll()) {
654 remove(shoppingOrderItem);
655 }
656 }
657
658 public int countByOrderId(long orderId) throws SystemException {
659 Object[] finderArgs = new Object[] { orderId };
660
661 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_ORDERID,
662 finderArgs, this);
663
664 if (count == null) {
665 Session session = null;
666
667 try {
668 session = openSession();
669
670 StringBundler query = new StringBundler(2);
671
672 query.append(_SQL_COUNT_SHOPPINGORDERITEM_WHERE);
673
674 query.append(_FINDER_COLUMN_ORDERID_ORDERID_2);
675
676 String sql = query.toString();
677
678 Query q = session.createQuery(sql);
679
680 QueryPos qPos = QueryPos.getInstance(q);
681
682 qPos.add(orderId);
683
684 count = (Long)q.uniqueResult();
685 }
686 catch (Exception e) {
687 throw processException(e);
688 }
689 finally {
690 if (count == null) {
691 count = Long.valueOf(0);
692 }
693
694 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_ORDERID,
695 finderArgs, count);
696
697 closeSession(session);
698 }
699 }
700
701 return count.intValue();
702 }
703
704 public int countAll() throws SystemException {
705 Object[] finderArgs = new Object[0];
706
707 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
708 finderArgs, this);
709
710 if (count == null) {
711 Session session = null;
712
713 try {
714 session = openSession();
715
716 Query q = session.createQuery(_SQL_COUNT_SHOPPINGORDERITEM);
717
718 count = (Long)q.uniqueResult();
719 }
720 catch (Exception e) {
721 throw processException(e);
722 }
723 finally {
724 if (count == null) {
725 count = Long.valueOf(0);
726 }
727
728 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
729 count);
730
731 closeSession(session);
732 }
733 }
734
735 return count.intValue();
736 }
737
738 public void afterPropertiesSet() {
739 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
740 com.liferay.portal.util.PropsUtil.get(
741 "value.object.listener.com.liferay.portlet.shopping.model.ShoppingOrderItem")));
742
743 if (listenerClassNames.length > 0) {
744 try {
745 List<ModelListener<ShoppingOrderItem>> listenersList = new ArrayList<ModelListener<ShoppingOrderItem>>();
746
747 for (String listenerClassName : listenerClassNames) {
748 listenersList.add((ModelListener<ShoppingOrderItem>)InstanceFactory.newInstance(
749 listenerClassName));
750 }
751
752 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
753 }
754 catch (Exception e) {
755 _log.error(e);
756 }
757 }
758 }
759
760 @BeanReference(type = ShoppingCartPersistence.class)
761 protected ShoppingCartPersistence shoppingCartPersistence;
762 @BeanReference(type = ShoppingCategoryPersistence.class)
763 protected ShoppingCategoryPersistence shoppingCategoryPersistence;
764 @BeanReference(type = ShoppingCouponPersistence.class)
765 protected ShoppingCouponPersistence shoppingCouponPersistence;
766 @BeanReference(type = ShoppingItemPersistence.class)
767 protected ShoppingItemPersistence shoppingItemPersistence;
768 @BeanReference(type = ShoppingItemFieldPersistence.class)
769 protected ShoppingItemFieldPersistence shoppingItemFieldPersistence;
770 @BeanReference(type = ShoppingItemPricePersistence.class)
771 protected ShoppingItemPricePersistence shoppingItemPricePersistence;
772 @BeanReference(type = ShoppingOrderPersistence.class)
773 protected ShoppingOrderPersistence shoppingOrderPersistence;
774 @BeanReference(type = ShoppingOrderItemPersistence.class)
775 protected ShoppingOrderItemPersistence shoppingOrderItemPersistence;
776 @BeanReference(type = ResourcePersistence.class)
777 protected ResourcePersistence resourcePersistence;
778 @BeanReference(type = UserPersistence.class)
779 protected UserPersistence userPersistence;
780 private static final String _SQL_SELECT_SHOPPINGORDERITEM = "SELECT shoppingOrderItem FROM ShoppingOrderItem shoppingOrderItem";
781 private static final String _SQL_SELECT_SHOPPINGORDERITEM_WHERE = "SELECT shoppingOrderItem FROM ShoppingOrderItem shoppingOrderItem WHERE ";
782 private static final String _SQL_COUNT_SHOPPINGORDERITEM = "SELECT COUNT(shoppingOrderItem) FROM ShoppingOrderItem shoppingOrderItem";
783 private static final String _SQL_COUNT_SHOPPINGORDERITEM_WHERE = "SELECT COUNT(shoppingOrderItem) FROM ShoppingOrderItem shoppingOrderItem WHERE ";
784 private static final String _FINDER_COLUMN_ORDERID_ORDERID_2 = "shoppingOrderItem.orderId = ?";
785 private static final String _ORDER_BY_ENTITY_ALIAS = "shoppingOrderItem.";
786 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No ShoppingOrderItem exists with the primary key ";
787 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No ShoppingOrderItem exists with the key {";
788 private static Log _log = LogFactoryUtil.getLog(ShoppingOrderItemPersistenceImpl.class);
789 }