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