001
014
015 package com.liferay.portlet.mobiledevicerules.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.mobiledevicerules.model.MDRRule;
044 import com.liferay.portlet.mobiledevicerules.service.MDRActionLocalService;
045 import com.liferay.portlet.mobiledevicerules.service.MDRActionService;
046 import com.liferay.portlet.mobiledevicerules.service.MDRRuleGroupInstanceLocalService;
047 import com.liferay.portlet.mobiledevicerules.service.MDRRuleGroupInstanceService;
048 import com.liferay.portlet.mobiledevicerules.service.MDRRuleGroupLocalService;
049 import com.liferay.portlet.mobiledevicerules.service.MDRRuleGroupService;
050 import com.liferay.portlet.mobiledevicerules.service.MDRRuleLocalService;
051 import com.liferay.portlet.mobiledevicerules.service.MDRRuleService;
052 import com.liferay.portlet.mobiledevicerules.service.persistence.MDRActionPersistence;
053 import com.liferay.portlet.mobiledevicerules.service.persistence.MDRRuleGroupFinder;
054 import com.liferay.portlet.mobiledevicerules.service.persistence.MDRRuleGroupInstancePersistence;
055 import com.liferay.portlet.mobiledevicerules.service.persistence.MDRRuleGroupPersistence;
056 import com.liferay.portlet.mobiledevicerules.service.persistence.MDRRulePersistence;
057
058 import java.io.Serializable;
059
060 import java.util.List;
061
062 import javax.sql.DataSource;
063
064
076 public abstract class MDRRuleLocalServiceBaseImpl implements MDRRuleLocalService,
077 IdentifiableBean {
078
083
084
091 public MDRRule addMDRRule(MDRRule mdrRule) throws SystemException {
092 mdrRule.setNew(true);
093
094 mdrRule = mdrRulePersistence.update(mdrRule, false);
095
096 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
097
098 if (indexer != null) {
099 try {
100 indexer.reindex(mdrRule);
101 }
102 catch (SearchException se) {
103 if (_log.isWarnEnabled()) {
104 _log.warn(se, se);
105 }
106 }
107 }
108
109 return mdrRule;
110 }
111
112
118 public MDRRule createMDRRule(long ruleId) {
119 return mdrRulePersistence.create(ruleId);
120 }
121
122
129 public void deleteMDRRule(long ruleId)
130 throws PortalException, SystemException {
131 MDRRule mdrRule = mdrRulePersistence.remove(ruleId);
132
133 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
134
135 if (indexer != null) {
136 try {
137 indexer.delete(mdrRule);
138 }
139 catch (SearchException se) {
140 if (_log.isWarnEnabled()) {
141 _log.warn(se, se);
142 }
143 }
144 }
145 }
146
147
153 public void deleteMDRRule(MDRRule mdrRule) throws SystemException {
154 mdrRulePersistence.remove(mdrRule);
155
156 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
157
158 if (indexer != null) {
159 try {
160 indexer.delete(mdrRule);
161 }
162 catch (SearchException se) {
163 if (_log.isWarnEnabled()) {
164 _log.warn(se, se);
165 }
166 }
167 }
168 }
169
170
177 @SuppressWarnings("rawtypes")
178 public List dynamicQuery(DynamicQuery dynamicQuery)
179 throws SystemException {
180 return mdrRulePersistence.findWithDynamicQuery(dynamicQuery);
181 }
182
183
196 @SuppressWarnings("rawtypes")
197 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
198 throws SystemException {
199 return mdrRulePersistence.findWithDynamicQuery(dynamicQuery, start, end);
200 }
201
202
216 @SuppressWarnings("rawtypes")
217 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end,
218 OrderByComparator orderByComparator) throws SystemException {
219 return mdrRulePersistence.findWithDynamicQuery(dynamicQuery, start,
220 end, orderByComparator);
221 }
222
223
230 public long dynamicQueryCount(DynamicQuery dynamicQuery)
231 throws SystemException {
232 return mdrRulePersistence.countWithDynamicQuery(dynamicQuery);
233 }
234
235 public MDRRule fetchMDRRule(long ruleId) throws SystemException {
236 return mdrRulePersistence.fetchByPrimaryKey(ruleId);
237 }
238
239
247 public MDRRule getMDRRule(long ruleId)
248 throws PortalException, SystemException {
249 return mdrRulePersistence.findByPrimaryKey(ruleId);
250 }
251
252 public PersistedModel getPersistedModel(Serializable primaryKeyObj)
253 throws PortalException, SystemException {
254 return mdrRulePersistence.findByPrimaryKey(primaryKeyObj);
255 }
256
257
266 public MDRRule getMDRRuleByUuidAndGroupId(String uuid, long groupId)
267 throws PortalException, SystemException {
268 return mdrRulePersistence.findByUUID_G(uuid, groupId);
269 }
270
271
283 public List<MDRRule> getMDRRules(int start, int end)
284 throws SystemException {
285 return mdrRulePersistence.findAll(start, end);
286 }
287
288
294 public int getMDRRulesCount() throws SystemException {
295 return mdrRulePersistence.countAll();
296 }
297
298
305 public MDRRule updateMDRRule(MDRRule mdrRule) throws SystemException {
306 return updateMDRRule(mdrRule, true);
307 }
308
309
317 public MDRRule updateMDRRule(MDRRule mdrRule, boolean merge)
318 throws SystemException {
319 mdrRule.setNew(false);
320
321 mdrRule = mdrRulePersistence.update(mdrRule, merge);
322
323 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
324
325 if (indexer != null) {
326 try {
327 indexer.reindex(mdrRule);
328 }
329 catch (SearchException se) {
330 if (_log.isWarnEnabled()) {
331 _log.warn(se, se);
332 }
333 }
334 }
335
336 return mdrRule;
337 }
338
339
344 public MDRActionLocalService getMDRActionLocalService() {
345 return mdrActionLocalService;
346 }
347
348
353 public void setMDRActionLocalService(
354 MDRActionLocalService mdrActionLocalService) {
355 this.mdrActionLocalService = mdrActionLocalService;
356 }
357
358
363 public MDRActionService getMDRActionService() {
364 return mdrActionService;
365 }
366
367
372 public void setMDRActionService(MDRActionService mdrActionService) {
373 this.mdrActionService = mdrActionService;
374 }
375
376
381 public MDRActionPersistence getMDRActionPersistence() {
382 return mdrActionPersistence;
383 }
384
385
390 public void setMDRActionPersistence(
391 MDRActionPersistence mdrActionPersistence) {
392 this.mdrActionPersistence = mdrActionPersistence;
393 }
394
395
400 public MDRRuleLocalService getMDRRuleLocalService() {
401 return mdrRuleLocalService;
402 }
403
404
409 public void setMDRRuleLocalService(MDRRuleLocalService mdrRuleLocalService) {
410 this.mdrRuleLocalService = mdrRuleLocalService;
411 }
412
413
418 public MDRRuleService getMDRRuleService() {
419 return mdrRuleService;
420 }
421
422
427 public void setMDRRuleService(MDRRuleService mdrRuleService) {
428 this.mdrRuleService = mdrRuleService;
429 }
430
431
436 public MDRRulePersistence getMDRRulePersistence() {
437 return mdrRulePersistence;
438 }
439
440
445 public void setMDRRulePersistence(MDRRulePersistence mdrRulePersistence) {
446 this.mdrRulePersistence = mdrRulePersistence;
447 }
448
449
454 public MDRRuleGroupLocalService getMDRRuleGroupLocalService() {
455 return mdrRuleGroupLocalService;
456 }
457
458
463 public void setMDRRuleGroupLocalService(
464 MDRRuleGroupLocalService mdrRuleGroupLocalService) {
465 this.mdrRuleGroupLocalService = mdrRuleGroupLocalService;
466 }
467
468
473 public MDRRuleGroupService getMDRRuleGroupService() {
474 return mdrRuleGroupService;
475 }
476
477
482 public void setMDRRuleGroupService(MDRRuleGroupService mdrRuleGroupService) {
483 this.mdrRuleGroupService = mdrRuleGroupService;
484 }
485
486
491 public MDRRuleGroupPersistence getMDRRuleGroupPersistence() {
492 return mdrRuleGroupPersistence;
493 }
494
495
500 public void setMDRRuleGroupPersistence(
501 MDRRuleGroupPersistence mdrRuleGroupPersistence) {
502 this.mdrRuleGroupPersistence = mdrRuleGroupPersistence;
503 }
504
505
510 public MDRRuleGroupFinder getMDRRuleGroupFinder() {
511 return mdrRuleGroupFinder;
512 }
513
514
519 public void setMDRRuleGroupFinder(MDRRuleGroupFinder mdrRuleGroupFinder) {
520 this.mdrRuleGroupFinder = mdrRuleGroupFinder;
521 }
522
523
528 public MDRRuleGroupInstanceLocalService getMDRRuleGroupInstanceLocalService() {
529 return mdrRuleGroupInstanceLocalService;
530 }
531
532
537 public void setMDRRuleGroupInstanceLocalService(
538 MDRRuleGroupInstanceLocalService mdrRuleGroupInstanceLocalService) {
539 this.mdrRuleGroupInstanceLocalService = mdrRuleGroupInstanceLocalService;
540 }
541
542
547 public MDRRuleGroupInstanceService getMDRRuleGroupInstanceService() {
548 return mdrRuleGroupInstanceService;
549 }
550
551
556 public void setMDRRuleGroupInstanceService(
557 MDRRuleGroupInstanceService mdrRuleGroupInstanceService) {
558 this.mdrRuleGroupInstanceService = mdrRuleGroupInstanceService;
559 }
560
561
566 public MDRRuleGroupInstancePersistence getMDRRuleGroupInstancePersistence() {
567 return mdrRuleGroupInstancePersistence;
568 }
569
570
575 public void setMDRRuleGroupInstancePersistence(
576 MDRRuleGroupInstancePersistence mdrRuleGroupInstancePersistence) {
577 this.mdrRuleGroupInstancePersistence = mdrRuleGroupInstancePersistence;
578 }
579
580
585 public CounterLocalService getCounterLocalService() {
586 return counterLocalService;
587 }
588
589
594 public void setCounterLocalService(CounterLocalService counterLocalService) {
595 this.counterLocalService = counterLocalService;
596 }
597
598
603 public ResourceLocalService getResourceLocalService() {
604 return resourceLocalService;
605 }
606
607
612 public void setResourceLocalService(
613 ResourceLocalService resourceLocalService) {
614 this.resourceLocalService = resourceLocalService;
615 }
616
617
622 public ResourceService getResourceService() {
623 return resourceService;
624 }
625
626
631 public void setResourceService(ResourceService resourceService) {
632 this.resourceService = resourceService;
633 }
634
635
640 public ResourcePersistence getResourcePersistence() {
641 return resourcePersistence;
642 }
643
644
649 public void setResourcePersistence(ResourcePersistence resourcePersistence) {
650 this.resourcePersistence = resourcePersistence;
651 }
652
653
658 public ResourceFinder getResourceFinder() {
659 return resourceFinder;
660 }
661
662
667 public void setResourceFinder(ResourceFinder resourceFinder) {
668 this.resourceFinder = resourceFinder;
669 }
670
671
676 public UserLocalService getUserLocalService() {
677 return userLocalService;
678 }
679
680
685 public void setUserLocalService(UserLocalService userLocalService) {
686 this.userLocalService = userLocalService;
687 }
688
689
694 public UserService getUserService() {
695 return userService;
696 }
697
698
703 public void setUserService(UserService userService) {
704 this.userService = userService;
705 }
706
707
712 public UserPersistence getUserPersistence() {
713 return userPersistence;
714 }
715
716
721 public void setUserPersistence(UserPersistence userPersistence) {
722 this.userPersistence = userPersistence;
723 }
724
725
730 public UserFinder getUserFinder() {
731 return userFinder;
732 }
733
734
739 public void setUserFinder(UserFinder userFinder) {
740 this.userFinder = userFinder;
741 }
742
743 public void afterPropertiesSet() {
744 persistedModelLocalServiceRegistry.register("com.liferay.portlet.mobiledevicerules.model.MDRRule",
745 mdrRuleLocalService);
746 }
747
748 public void destroy() {
749 persistedModelLocalServiceRegistry.unregister(
750 "com.liferay.portlet.mobiledevicerules.model.MDRRule");
751 }
752
753
758 public String getBeanIdentifier() {
759 return _beanIdentifier;
760 }
761
762
767 public void setBeanIdentifier(String beanIdentifier) {
768 _beanIdentifier = beanIdentifier;
769 }
770
771 protected ClassLoader getClassLoader() {
772 Class<?> clazz = getClass();
773
774 return clazz.getClassLoader();
775 }
776
777 protected Class<?> getModelClass() {
778 return MDRRule.class;
779 }
780
781 protected String getModelClassName() {
782 return MDRRule.class.getName();
783 }
784
785
790 protected void runSQL(String sql) throws SystemException {
791 try {
792 DataSource dataSource = mdrRulePersistence.getDataSource();
793
794 SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
795 sql, new int[0]);
796
797 sqlUpdate.update();
798 }
799 catch (Exception e) {
800 throw new SystemException(e);
801 }
802 }
803
804 @BeanReference(type = MDRActionLocalService.class)
805 protected MDRActionLocalService mdrActionLocalService;
806 @BeanReference(type = MDRActionService.class)
807 protected MDRActionService mdrActionService;
808 @BeanReference(type = MDRActionPersistence.class)
809 protected MDRActionPersistence mdrActionPersistence;
810 @BeanReference(type = MDRRuleLocalService.class)
811 protected MDRRuleLocalService mdrRuleLocalService;
812 @BeanReference(type = MDRRuleService.class)
813 protected MDRRuleService mdrRuleService;
814 @BeanReference(type = MDRRulePersistence.class)
815 protected MDRRulePersistence mdrRulePersistence;
816 @BeanReference(type = MDRRuleGroupLocalService.class)
817 protected MDRRuleGroupLocalService mdrRuleGroupLocalService;
818 @BeanReference(type = MDRRuleGroupService.class)
819 protected MDRRuleGroupService mdrRuleGroupService;
820 @BeanReference(type = MDRRuleGroupPersistence.class)
821 protected MDRRuleGroupPersistence mdrRuleGroupPersistence;
822 @BeanReference(type = MDRRuleGroupFinder.class)
823 protected MDRRuleGroupFinder mdrRuleGroupFinder;
824 @BeanReference(type = MDRRuleGroupInstanceLocalService.class)
825 protected MDRRuleGroupInstanceLocalService mdrRuleGroupInstanceLocalService;
826 @BeanReference(type = MDRRuleGroupInstanceService.class)
827 protected MDRRuleGroupInstanceService mdrRuleGroupInstanceService;
828 @BeanReference(type = MDRRuleGroupInstancePersistence.class)
829 protected MDRRuleGroupInstancePersistence mdrRuleGroupInstancePersistence;
830 @BeanReference(type = CounterLocalService.class)
831 protected CounterLocalService counterLocalService;
832 @BeanReference(type = ResourceLocalService.class)
833 protected ResourceLocalService resourceLocalService;
834 @BeanReference(type = ResourceService.class)
835 protected ResourceService resourceService;
836 @BeanReference(type = ResourcePersistence.class)
837 protected ResourcePersistence resourcePersistence;
838 @BeanReference(type = ResourceFinder.class)
839 protected ResourceFinder resourceFinder;
840 @BeanReference(type = UserLocalService.class)
841 protected UserLocalService userLocalService;
842 @BeanReference(type = UserService.class)
843 protected UserService userService;
844 @BeanReference(type = UserPersistence.class)
845 protected UserPersistence userPersistence;
846 @BeanReference(type = UserFinder.class)
847 protected UserFinder userFinder;
848 @BeanReference(type = PersistedModelLocalServiceRegistry.class)
849 protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
850 private static Log _log = LogFactoryUtil.getLog(MDRRuleLocalServiceBaseImpl.class);
851 private String _beanIdentifier;
852 }