001
014
015 package com.liferay.portlet.shopping.service.base;
016
017 import com.liferay.counter.service.CounterLocalService;
018
019 import com.liferay.portal.kernel.bean.BeanReference;
020 import com.liferay.portal.kernel.bean.IdentifiableBean;
021 import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
022 import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
023 import com.liferay.portal.kernel.dao.orm.DynamicQuery;
024 import com.liferay.portal.kernel.exception.PortalException;
025 import com.liferay.portal.kernel.exception.SystemException;
026 import com.liferay.portal.kernel.log.Log;
027 import com.liferay.portal.kernel.log.LogFactoryUtil;
028 import com.liferay.portal.kernel.search.Indexer;
029 import com.liferay.portal.kernel.search.IndexerRegistryUtil;
030 import com.liferay.portal.kernel.search.SearchException;
031 import com.liferay.portal.kernel.util.OrderByComparator;
032 import com.liferay.portal.model.PersistedModel;
033 import com.liferay.portal.service.PersistedModelLocalServiceRegistry;
034 import com.liferay.portal.service.ResourceLocalService;
035 import com.liferay.portal.service.ResourceService;
036 import com.liferay.portal.service.UserLocalService;
037 import com.liferay.portal.service.UserService;
038 import com.liferay.portal.service.persistence.ResourceFinder;
039 import com.liferay.portal.service.persistence.ResourcePersistence;
040 import com.liferay.portal.service.persistence.UserFinder;
041 import com.liferay.portal.service.persistence.UserPersistence;
042
043 import com.liferay.portlet.shopping.model.ShoppingCoupon;
044 import com.liferay.portlet.shopping.service.ShoppingCartLocalService;
045 import com.liferay.portlet.shopping.service.ShoppingCategoryLocalService;
046 import com.liferay.portlet.shopping.service.ShoppingCategoryService;
047 import com.liferay.portlet.shopping.service.ShoppingCouponLocalService;
048 import com.liferay.portlet.shopping.service.ShoppingCouponService;
049 import com.liferay.portlet.shopping.service.ShoppingItemFieldLocalService;
050 import com.liferay.portlet.shopping.service.ShoppingItemLocalService;
051 import com.liferay.portlet.shopping.service.ShoppingItemPriceLocalService;
052 import com.liferay.portlet.shopping.service.ShoppingItemService;
053 import com.liferay.portlet.shopping.service.ShoppingOrderItemLocalService;
054 import com.liferay.portlet.shopping.service.ShoppingOrderLocalService;
055 import com.liferay.portlet.shopping.service.ShoppingOrderService;
056 import com.liferay.portlet.shopping.service.persistence.ShoppingCartPersistence;
057 import com.liferay.portlet.shopping.service.persistence.ShoppingCategoryPersistence;
058 import com.liferay.portlet.shopping.service.persistence.ShoppingCouponFinder;
059 import com.liferay.portlet.shopping.service.persistence.ShoppingCouponPersistence;
060 import com.liferay.portlet.shopping.service.persistence.ShoppingItemFieldPersistence;
061 import com.liferay.portlet.shopping.service.persistence.ShoppingItemFinder;
062 import com.liferay.portlet.shopping.service.persistence.ShoppingItemPersistence;
063 import com.liferay.portlet.shopping.service.persistence.ShoppingItemPricePersistence;
064 import com.liferay.portlet.shopping.service.persistence.ShoppingOrderFinder;
065 import com.liferay.portlet.shopping.service.persistence.ShoppingOrderItemPersistence;
066 import com.liferay.portlet.shopping.service.persistence.ShoppingOrderPersistence;
067
068 import java.io.Serializable;
069
070 import java.util.List;
071
072 import javax.sql.DataSource;
073
074
086 public abstract class ShoppingCouponLocalServiceBaseImpl
087 implements ShoppingCouponLocalService, IdentifiableBean {
088
093
094
101 public ShoppingCoupon addShoppingCoupon(ShoppingCoupon shoppingCoupon)
102 throws SystemException {
103 shoppingCoupon.setNew(true);
104
105 shoppingCoupon = shoppingCouponPersistence.update(shoppingCoupon, false);
106
107 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
108
109 if (indexer != null) {
110 try {
111 indexer.reindex(shoppingCoupon);
112 }
113 catch (SearchException se) {
114 if (_log.isWarnEnabled()) {
115 _log.warn(se, se);
116 }
117 }
118 }
119
120 return shoppingCoupon;
121 }
122
123
129 public ShoppingCoupon createShoppingCoupon(long couponId) {
130 return shoppingCouponPersistence.create(couponId);
131 }
132
133
140 public void deleteShoppingCoupon(long couponId)
141 throws PortalException, SystemException {
142 ShoppingCoupon shoppingCoupon = shoppingCouponPersistence.remove(couponId);
143
144 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
145
146 if (indexer != null) {
147 try {
148 indexer.delete(shoppingCoupon);
149 }
150 catch (SearchException se) {
151 if (_log.isWarnEnabled()) {
152 _log.warn(se, se);
153 }
154 }
155 }
156 }
157
158
164 public void deleteShoppingCoupon(ShoppingCoupon shoppingCoupon)
165 throws SystemException {
166 shoppingCouponPersistence.remove(shoppingCoupon);
167
168 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
169
170 if (indexer != null) {
171 try {
172 indexer.delete(shoppingCoupon);
173 }
174 catch (SearchException se) {
175 if (_log.isWarnEnabled()) {
176 _log.warn(se, se);
177 }
178 }
179 }
180 }
181
182
189 @SuppressWarnings("rawtypes")
190 public List dynamicQuery(DynamicQuery dynamicQuery)
191 throws SystemException {
192 return shoppingCouponPersistence.findWithDynamicQuery(dynamicQuery);
193 }
194
195
208 @SuppressWarnings("rawtypes")
209 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
210 throws SystemException {
211 return shoppingCouponPersistence.findWithDynamicQuery(dynamicQuery,
212 start, end);
213 }
214
215
229 @SuppressWarnings("rawtypes")
230 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end,
231 OrderByComparator orderByComparator) throws SystemException {
232 return shoppingCouponPersistence.findWithDynamicQuery(dynamicQuery,
233 start, end, orderByComparator);
234 }
235
236
243 public long dynamicQueryCount(DynamicQuery dynamicQuery)
244 throws SystemException {
245 return shoppingCouponPersistence.countWithDynamicQuery(dynamicQuery);
246 }
247
248 public ShoppingCoupon fetchShoppingCoupon(long couponId)
249 throws SystemException {
250 return shoppingCouponPersistence.fetchByPrimaryKey(couponId);
251 }
252
253
261 public ShoppingCoupon getShoppingCoupon(long couponId)
262 throws PortalException, SystemException {
263 return shoppingCouponPersistence.findByPrimaryKey(couponId);
264 }
265
266 public PersistedModel getPersistedModel(Serializable primaryKeyObj)
267 throws PortalException, SystemException {
268 return shoppingCouponPersistence.findByPrimaryKey(primaryKeyObj);
269 }
270
271
283 public List<ShoppingCoupon> getShoppingCoupons(int start, int end)
284 throws SystemException {
285 return shoppingCouponPersistence.findAll(start, end);
286 }
287
288
294 public int getShoppingCouponsCount() throws SystemException {
295 return shoppingCouponPersistence.countAll();
296 }
297
298
305 public ShoppingCoupon updateShoppingCoupon(ShoppingCoupon shoppingCoupon)
306 throws SystemException {
307 return updateShoppingCoupon(shoppingCoupon, true);
308 }
309
310
318 public ShoppingCoupon updateShoppingCoupon(ShoppingCoupon shoppingCoupon,
319 boolean merge) throws SystemException {
320 shoppingCoupon.setNew(false);
321
322 shoppingCoupon = shoppingCouponPersistence.update(shoppingCoupon, merge);
323
324 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
325
326 if (indexer != null) {
327 try {
328 indexer.reindex(shoppingCoupon);
329 }
330 catch (SearchException se) {
331 if (_log.isWarnEnabled()) {
332 _log.warn(se, se);
333 }
334 }
335 }
336
337 return shoppingCoupon;
338 }
339
340
345 public ShoppingCartLocalService getShoppingCartLocalService() {
346 return shoppingCartLocalService;
347 }
348
349
354 public void setShoppingCartLocalService(
355 ShoppingCartLocalService shoppingCartLocalService) {
356 this.shoppingCartLocalService = shoppingCartLocalService;
357 }
358
359
364 public ShoppingCartPersistence getShoppingCartPersistence() {
365 return shoppingCartPersistence;
366 }
367
368
373 public void setShoppingCartPersistence(
374 ShoppingCartPersistence shoppingCartPersistence) {
375 this.shoppingCartPersistence = shoppingCartPersistence;
376 }
377
378
383 public ShoppingCategoryLocalService getShoppingCategoryLocalService() {
384 return shoppingCategoryLocalService;
385 }
386
387
392 public void setShoppingCategoryLocalService(
393 ShoppingCategoryLocalService shoppingCategoryLocalService) {
394 this.shoppingCategoryLocalService = shoppingCategoryLocalService;
395 }
396
397
402 public ShoppingCategoryService getShoppingCategoryService() {
403 return shoppingCategoryService;
404 }
405
406
411 public void setShoppingCategoryService(
412 ShoppingCategoryService shoppingCategoryService) {
413 this.shoppingCategoryService = shoppingCategoryService;
414 }
415
416
421 public ShoppingCategoryPersistence getShoppingCategoryPersistence() {
422 return shoppingCategoryPersistence;
423 }
424
425
430 public void setShoppingCategoryPersistence(
431 ShoppingCategoryPersistence shoppingCategoryPersistence) {
432 this.shoppingCategoryPersistence = shoppingCategoryPersistence;
433 }
434
435
440 public ShoppingCouponLocalService getShoppingCouponLocalService() {
441 return shoppingCouponLocalService;
442 }
443
444
449 public void setShoppingCouponLocalService(
450 ShoppingCouponLocalService shoppingCouponLocalService) {
451 this.shoppingCouponLocalService = shoppingCouponLocalService;
452 }
453
454
459 public ShoppingCouponService getShoppingCouponService() {
460 return shoppingCouponService;
461 }
462
463
468 public void setShoppingCouponService(
469 ShoppingCouponService shoppingCouponService) {
470 this.shoppingCouponService = shoppingCouponService;
471 }
472
473
478 public ShoppingCouponPersistence getShoppingCouponPersistence() {
479 return shoppingCouponPersistence;
480 }
481
482
487 public void setShoppingCouponPersistence(
488 ShoppingCouponPersistence shoppingCouponPersistence) {
489 this.shoppingCouponPersistence = shoppingCouponPersistence;
490 }
491
492
497 public ShoppingCouponFinder getShoppingCouponFinder() {
498 return shoppingCouponFinder;
499 }
500
501
506 public void setShoppingCouponFinder(
507 ShoppingCouponFinder shoppingCouponFinder) {
508 this.shoppingCouponFinder = shoppingCouponFinder;
509 }
510
511
516 public ShoppingItemLocalService getShoppingItemLocalService() {
517 return shoppingItemLocalService;
518 }
519
520
525 public void setShoppingItemLocalService(
526 ShoppingItemLocalService shoppingItemLocalService) {
527 this.shoppingItemLocalService = shoppingItemLocalService;
528 }
529
530
535 public ShoppingItemService getShoppingItemService() {
536 return shoppingItemService;
537 }
538
539
544 public void setShoppingItemService(ShoppingItemService shoppingItemService) {
545 this.shoppingItemService = shoppingItemService;
546 }
547
548
553 public ShoppingItemPersistence getShoppingItemPersistence() {
554 return shoppingItemPersistence;
555 }
556
557
562 public void setShoppingItemPersistence(
563 ShoppingItemPersistence shoppingItemPersistence) {
564 this.shoppingItemPersistence = shoppingItemPersistence;
565 }
566
567
572 public ShoppingItemFinder getShoppingItemFinder() {
573 return shoppingItemFinder;
574 }
575
576
581 public void setShoppingItemFinder(ShoppingItemFinder shoppingItemFinder) {
582 this.shoppingItemFinder = shoppingItemFinder;
583 }
584
585
590 public ShoppingItemFieldLocalService getShoppingItemFieldLocalService() {
591 return shoppingItemFieldLocalService;
592 }
593
594
599 public void setShoppingItemFieldLocalService(
600 ShoppingItemFieldLocalService shoppingItemFieldLocalService) {
601 this.shoppingItemFieldLocalService = shoppingItemFieldLocalService;
602 }
603
604
609 public ShoppingItemFieldPersistence getShoppingItemFieldPersistence() {
610 return shoppingItemFieldPersistence;
611 }
612
613
618 public void setShoppingItemFieldPersistence(
619 ShoppingItemFieldPersistence shoppingItemFieldPersistence) {
620 this.shoppingItemFieldPersistence = shoppingItemFieldPersistence;
621 }
622
623
628 public ShoppingItemPriceLocalService getShoppingItemPriceLocalService() {
629 return shoppingItemPriceLocalService;
630 }
631
632
637 public void setShoppingItemPriceLocalService(
638 ShoppingItemPriceLocalService shoppingItemPriceLocalService) {
639 this.shoppingItemPriceLocalService = shoppingItemPriceLocalService;
640 }
641
642
647 public ShoppingItemPricePersistence getShoppingItemPricePersistence() {
648 return shoppingItemPricePersistence;
649 }
650
651
656 public void setShoppingItemPricePersistence(
657 ShoppingItemPricePersistence shoppingItemPricePersistence) {
658 this.shoppingItemPricePersistence = shoppingItemPricePersistence;
659 }
660
661
666 public ShoppingOrderLocalService getShoppingOrderLocalService() {
667 return shoppingOrderLocalService;
668 }
669
670
675 public void setShoppingOrderLocalService(
676 ShoppingOrderLocalService shoppingOrderLocalService) {
677 this.shoppingOrderLocalService = shoppingOrderLocalService;
678 }
679
680
685 public ShoppingOrderService getShoppingOrderService() {
686 return shoppingOrderService;
687 }
688
689
694 public void setShoppingOrderService(
695 ShoppingOrderService shoppingOrderService) {
696 this.shoppingOrderService = shoppingOrderService;
697 }
698
699
704 public ShoppingOrderPersistence getShoppingOrderPersistence() {
705 return shoppingOrderPersistence;
706 }
707
708
713 public void setShoppingOrderPersistence(
714 ShoppingOrderPersistence shoppingOrderPersistence) {
715 this.shoppingOrderPersistence = shoppingOrderPersistence;
716 }
717
718
723 public ShoppingOrderFinder getShoppingOrderFinder() {
724 return shoppingOrderFinder;
725 }
726
727
732 public void setShoppingOrderFinder(ShoppingOrderFinder shoppingOrderFinder) {
733 this.shoppingOrderFinder = shoppingOrderFinder;
734 }
735
736
741 public ShoppingOrderItemLocalService getShoppingOrderItemLocalService() {
742 return shoppingOrderItemLocalService;
743 }
744
745
750 public void setShoppingOrderItemLocalService(
751 ShoppingOrderItemLocalService shoppingOrderItemLocalService) {
752 this.shoppingOrderItemLocalService = shoppingOrderItemLocalService;
753 }
754
755
760 public ShoppingOrderItemPersistence getShoppingOrderItemPersistence() {
761 return shoppingOrderItemPersistence;
762 }
763
764
769 public void setShoppingOrderItemPersistence(
770 ShoppingOrderItemPersistence shoppingOrderItemPersistence) {
771 this.shoppingOrderItemPersistence = shoppingOrderItemPersistence;
772 }
773
774
779 public CounterLocalService getCounterLocalService() {
780 return counterLocalService;
781 }
782
783
788 public void setCounterLocalService(CounterLocalService counterLocalService) {
789 this.counterLocalService = counterLocalService;
790 }
791
792
797 public ResourceLocalService getResourceLocalService() {
798 return resourceLocalService;
799 }
800
801
806 public void setResourceLocalService(
807 ResourceLocalService resourceLocalService) {
808 this.resourceLocalService = resourceLocalService;
809 }
810
811
816 public ResourceService getResourceService() {
817 return resourceService;
818 }
819
820
825 public void setResourceService(ResourceService resourceService) {
826 this.resourceService = resourceService;
827 }
828
829
834 public ResourcePersistence getResourcePersistence() {
835 return resourcePersistence;
836 }
837
838
843 public void setResourcePersistence(ResourcePersistence resourcePersistence) {
844 this.resourcePersistence = resourcePersistence;
845 }
846
847
852 public ResourceFinder getResourceFinder() {
853 return resourceFinder;
854 }
855
856
861 public void setResourceFinder(ResourceFinder resourceFinder) {
862 this.resourceFinder = resourceFinder;
863 }
864
865
870 public UserLocalService getUserLocalService() {
871 return userLocalService;
872 }
873
874
879 public void setUserLocalService(UserLocalService userLocalService) {
880 this.userLocalService = userLocalService;
881 }
882
883
888 public UserService getUserService() {
889 return userService;
890 }
891
892
897 public void setUserService(UserService userService) {
898 this.userService = userService;
899 }
900
901
906 public UserPersistence getUserPersistence() {
907 return userPersistence;
908 }
909
910
915 public void setUserPersistence(UserPersistence userPersistence) {
916 this.userPersistence = userPersistence;
917 }
918
919
924 public UserFinder getUserFinder() {
925 return userFinder;
926 }
927
928
933 public void setUserFinder(UserFinder userFinder) {
934 this.userFinder = userFinder;
935 }
936
937 public void afterPropertiesSet() {
938 persistedModelLocalServiceRegistry.register("com.liferay.portlet.shopping.model.ShoppingCoupon",
939 shoppingCouponLocalService);
940 }
941
942 public void destroy() {
943 persistedModelLocalServiceRegistry.unregister(
944 "com.liferay.portlet.shopping.model.ShoppingCoupon");
945 }
946
947
952 public String getBeanIdentifier() {
953 return _beanIdentifier;
954 }
955
956
961 public void setBeanIdentifier(String beanIdentifier) {
962 _beanIdentifier = beanIdentifier;
963 }
964
965 protected ClassLoader getClassLoader() {
966 Class<?> clazz = getClass();
967
968 return clazz.getClassLoader();
969 }
970
971 protected Class<?> getModelClass() {
972 return ShoppingCoupon.class;
973 }
974
975 protected String getModelClassName() {
976 return ShoppingCoupon.class.getName();
977 }
978
979
984 protected void runSQL(String sql) throws SystemException {
985 try {
986 DataSource dataSource = shoppingCouponPersistence.getDataSource();
987
988 SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
989 sql, new int[0]);
990
991 sqlUpdate.update();
992 }
993 catch (Exception e) {
994 throw new SystemException(e);
995 }
996 }
997
998 @BeanReference(type = ShoppingCartLocalService.class)
999 protected ShoppingCartLocalService shoppingCartLocalService;
1000 @BeanReference(type = ShoppingCartPersistence.class)
1001 protected ShoppingCartPersistence shoppingCartPersistence;
1002 @BeanReference(type = ShoppingCategoryLocalService.class)
1003 protected ShoppingCategoryLocalService shoppingCategoryLocalService;
1004 @BeanReference(type = ShoppingCategoryService.class)
1005 protected ShoppingCategoryService shoppingCategoryService;
1006 @BeanReference(type = ShoppingCategoryPersistence.class)
1007 protected ShoppingCategoryPersistence shoppingCategoryPersistence;
1008 @BeanReference(type = ShoppingCouponLocalService.class)
1009 protected ShoppingCouponLocalService shoppingCouponLocalService;
1010 @BeanReference(type = ShoppingCouponService.class)
1011 protected ShoppingCouponService shoppingCouponService;
1012 @BeanReference(type = ShoppingCouponPersistence.class)
1013 protected ShoppingCouponPersistence shoppingCouponPersistence;
1014 @BeanReference(type = ShoppingCouponFinder.class)
1015 protected ShoppingCouponFinder shoppingCouponFinder;
1016 @BeanReference(type = ShoppingItemLocalService.class)
1017 protected ShoppingItemLocalService shoppingItemLocalService;
1018 @BeanReference(type = ShoppingItemService.class)
1019 protected ShoppingItemService shoppingItemService;
1020 @BeanReference(type = ShoppingItemPersistence.class)
1021 protected ShoppingItemPersistence shoppingItemPersistence;
1022 @BeanReference(type = ShoppingItemFinder.class)
1023 protected ShoppingItemFinder shoppingItemFinder;
1024 @BeanReference(type = ShoppingItemFieldLocalService.class)
1025 protected ShoppingItemFieldLocalService shoppingItemFieldLocalService;
1026 @BeanReference(type = ShoppingItemFieldPersistence.class)
1027 protected ShoppingItemFieldPersistence shoppingItemFieldPersistence;
1028 @BeanReference(type = ShoppingItemPriceLocalService.class)
1029 protected ShoppingItemPriceLocalService shoppingItemPriceLocalService;
1030 @BeanReference(type = ShoppingItemPricePersistence.class)
1031 protected ShoppingItemPricePersistence shoppingItemPricePersistence;
1032 @BeanReference(type = ShoppingOrderLocalService.class)
1033 protected ShoppingOrderLocalService shoppingOrderLocalService;
1034 @BeanReference(type = ShoppingOrderService.class)
1035 protected ShoppingOrderService shoppingOrderService;
1036 @BeanReference(type = ShoppingOrderPersistence.class)
1037 protected ShoppingOrderPersistence shoppingOrderPersistence;
1038 @BeanReference(type = ShoppingOrderFinder.class)
1039 protected ShoppingOrderFinder shoppingOrderFinder;
1040 @BeanReference(type = ShoppingOrderItemLocalService.class)
1041 protected ShoppingOrderItemLocalService shoppingOrderItemLocalService;
1042 @BeanReference(type = ShoppingOrderItemPersistence.class)
1043 protected ShoppingOrderItemPersistence shoppingOrderItemPersistence;
1044 @BeanReference(type = CounterLocalService.class)
1045 protected CounterLocalService counterLocalService;
1046 @BeanReference(type = ResourceLocalService.class)
1047 protected ResourceLocalService resourceLocalService;
1048 @BeanReference(type = ResourceService.class)
1049 protected ResourceService resourceService;
1050 @BeanReference(type = ResourcePersistence.class)
1051 protected ResourcePersistence resourcePersistence;
1052 @BeanReference(type = ResourceFinder.class)
1053 protected ResourceFinder resourceFinder;
1054 @BeanReference(type = UserLocalService.class)
1055 protected UserLocalService userLocalService;
1056 @BeanReference(type = UserService.class)
1057 protected UserService userService;
1058 @BeanReference(type = UserPersistence.class)
1059 protected UserPersistence userPersistence;
1060 @BeanReference(type = UserFinder.class)
1061 protected UserFinder userFinder;
1062 @BeanReference(type = PersistedModelLocalServiceRegistry.class)
1063 protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
1064 private static Log _log = LogFactoryUtil.getLog(ShoppingCouponLocalServiceBaseImpl.class);
1065 private String _beanIdentifier;
1066 }