001
014
015 package com.liferay.portlet.dynamicdatamapping.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.dynamicdatamapping.model.DDMContent;
044 import com.liferay.portlet.dynamicdatamapping.service.DDMContentLocalService;
045 import com.liferay.portlet.dynamicdatamapping.service.DDMStorageLinkLocalService;
046 import com.liferay.portlet.dynamicdatamapping.service.DDMStructureLinkLocalService;
047 import com.liferay.portlet.dynamicdatamapping.service.DDMStructureLocalService;
048 import com.liferay.portlet.dynamicdatamapping.service.DDMStructureService;
049 import com.liferay.portlet.dynamicdatamapping.service.DDMTemplateLocalService;
050 import com.liferay.portlet.dynamicdatamapping.service.DDMTemplateService;
051 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMContentPersistence;
052 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMStorageLinkPersistence;
053 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMStructureFinder;
054 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMStructureLinkPersistence;
055 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMStructurePersistence;
056 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMTemplateFinder;
057 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMTemplatePersistence;
058
059 import java.io.Serializable;
060
061 import java.util.List;
062
063 import javax.sql.DataSource;
064
065
077 public abstract class DDMContentLocalServiceBaseImpl
078 implements DDMContentLocalService, IdentifiableBean {
079
084
085
092 public DDMContent addDDMContent(DDMContent ddmContent)
093 throws SystemException {
094 ddmContent.setNew(true);
095
096 ddmContent = ddmContentPersistence.update(ddmContent, false);
097
098 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
099
100 if (indexer != null) {
101 try {
102 indexer.reindex(ddmContent);
103 }
104 catch (SearchException se) {
105 if (_log.isWarnEnabled()) {
106 _log.warn(se, se);
107 }
108 }
109 }
110
111 return ddmContent;
112 }
113
114
120 public DDMContent createDDMContent(long contentId) {
121 return ddmContentPersistence.create(contentId);
122 }
123
124
131 public void deleteDDMContent(long contentId)
132 throws PortalException, SystemException {
133 DDMContent ddmContent = ddmContentPersistence.remove(contentId);
134
135 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
136
137 if (indexer != null) {
138 try {
139 indexer.delete(ddmContent);
140 }
141 catch (SearchException se) {
142 if (_log.isWarnEnabled()) {
143 _log.warn(se, se);
144 }
145 }
146 }
147 }
148
149
155 public void deleteDDMContent(DDMContent ddmContent)
156 throws SystemException {
157 ddmContentPersistence.remove(ddmContent);
158
159 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
160
161 if (indexer != null) {
162 try {
163 indexer.delete(ddmContent);
164 }
165 catch (SearchException se) {
166 if (_log.isWarnEnabled()) {
167 _log.warn(se, se);
168 }
169 }
170 }
171 }
172
173
180 @SuppressWarnings("rawtypes")
181 public List dynamicQuery(DynamicQuery dynamicQuery)
182 throws SystemException {
183 return ddmContentPersistence.findWithDynamicQuery(dynamicQuery);
184 }
185
186
199 @SuppressWarnings("rawtypes")
200 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
201 throws SystemException {
202 return ddmContentPersistence.findWithDynamicQuery(dynamicQuery, start,
203 end);
204 }
205
206
220 @SuppressWarnings("rawtypes")
221 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end,
222 OrderByComparator orderByComparator) throws SystemException {
223 return ddmContentPersistence.findWithDynamicQuery(dynamicQuery, start,
224 end, orderByComparator);
225 }
226
227
234 public long dynamicQueryCount(DynamicQuery dynamicQuery)
235 throws SystemException {
236 return ddmContentPersistence.countWithDynamicQuery(dynamicQuery);
237 }
238
239 public DDMContent fetchDDMContent(long contentId) throws SystemException {
240 return ddmContentPersistence.fetchByPrimaryKey(contentId);
241 }
242
243
251 public DDMContent getDDMContent(long contentId)
252 throws PortalException, SystemException {
253 return ddmContentPersistence.findByPrimaryKey(contentId);
254 }
255
256 public PersistedModel getPersistedModel(Serializable primaryKeyObj)
257 throws PortalException, SystemException {
258 return ddmContentPersistence.findByPrimaryKey(primaryKeyObj);
259 }
260
261
270 public DDMContent getDDMContentByUuidAndGroupId(String uuid, long groupId)
271 throws PortalException, SystemException {
272 return ddmContentPersistence.findByUUID_G(uuid, groupId);
273 }
274
275
287 public List<DDMContent> getDDMContents(int start, int end)
288 throws SystemException {
289 return ddmContentPersistence.findAll(start, end);
290 }
291
292
298 public int getDDMContentsCount() throws SystemException {
299 return ddmContentPersistence.countAll();
300 }
301
302
309 public DDMContent updateDDMContent(DDMContent ddmContent)
310 throws SystemException {
311 return updateDDMContent(ddmContent, true);
312 }
313
314
322 public DDMContent updateDDMContent(DDMContent ddmContent, boolean merge)
323 throws SystemException {
324 ddmContent.setNew(false);
325
326 ddmContent = ddmContentPersistence.update(ddmContent, merge);
327
328 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
329
330 if (indexer != null) {
331 try {
332 indexer.reindex(ddmContent);
333 }
334 catch (SearchException se) {
335 if (_log.isWarnEnabled()) {
336 _log.warn(se, se);
337 }
338 }
339 }
340
341 return ddmContent;
342 }
343
344
349 public DDMContentLocalService getDDMContentLocalService() {
350 return ddmContentLocalService;
351 }
352
353
358 public void setDDMContentLocalService(
359 DDMContentLocalService ddmContentLocalService) {
360 this.ddmContentLocalService = ddmContentLocalService;
361 }
362
363
368 public DDMContentPersistence getDDMContentPersistence() {
369 return ddmContentPersistence;
370 }
371
372
377 public void setDDMContentPersistence(
378 DDMContentPersistence ddmContentPersistence) {
379 this.ddmContentPersistence = ddmContentPersistence;
380 }
381
382
387 public DDMStorageLinkLocalService getDDMStorageLinkLocalService() {
388 return ddmStorageLinkLocalService;
389 }
390
391
396 public void setDDMStorageLinkLocalService(
397 DDMStorageLinkLocalService ddmStorageLinkLocalService) {
398 this.ddmStorageLinkLocalService = ddmStorageLinkLocalService;
399 }
400
401
406 public DDMStorageLinkPersistence getDDMStorageLinkPersistence() {
407 return ddmStorageLinkPersistence;
408 }
409
410
415 public void setDDMStorageLinkPersistence(
416 DDMStorageLinkPersistence ddmStorageLinkPersistence) {
417 this.ddmStorageLinkPersistence = ddmStorageLinkPersistence;
418 }
419
420
425 public DDMStructureLocalService getDDMStructureLocalService() {
426 return ddmStructureLocalService;
427 }
428
429
434 public void setDDMStructureLocalService(
435 DDMStructureLocalService ddmStructureLocalService) {
436 this.ddmStructureLocalService = ddmStructureLocalService;
437 }
438
439
444 public DDMStructureService getDDMStructureService() {
445 return ddmStructureService;
446 }
447
448
453 public void setDDMStructureService(DDMStructureService ddmStructureService) {
454 this.ddmStructureService = ddmStructureService;
455 }
456
457
462 public DDMStructurePersistence getDDMStructurePersistence() {
463 return ddmStructurePersistence;
464 }
465
466
471 public void setDDMStructurePersistence(
472 DDMStructurePersistence ddmStructurePersistence) {
473 this.ddmStructurePersistence = ddmStructurePersistence;
474 }
475
476
481 public DDMStructureFinder getDDMStructureFinder() {
482 return ddmStructureFinder;
483 }
484
485
490 public void setDDMStructureFinder(DDMStructureFinder ddmStructureFinder) {
491 this.ddmStructureFinder = ddmStructureFinder;
492 }
493
494
499 public DDMStructureLinkLocalService getDDMStructureLinkLocalService() {
500 return ddmStructureLinkLocalService;
501 }
502
503
508 public void setDDMStructureLinkLocalService(
509 DDMStructureLinkLocalService ddmStructureLinkLocalService) {
510 this.ddmStructureLinkLocalService = ddmStructureLinkLocalService;
511 }
512
513
518 public DDMStructureLinkPersistence getDDMStructureLinkPersistence() {
519 return ddmStructureLinkPersistence;
520 }
521
522
527 public void setDDMStructureLinkPersistence(
528 DDMStructureLinkPersistence ddmStructureLinkPersistence) {
529 this.ddmStructureLinkPersistence = ddmStructureLinkPersistence;
530 }
531
532
537 public DDMTemplateLocalService getDDMTemplateLocalService() {
538 return ddmTemplateLocalService;
539 }
540
541
546 public void setDDMTemplateLocalService(
547 DDMTemplateLocalService ddmTemplateLocalService) {
548 this.ddmTemplateLocalService = ddmTemplateLocalService;
549 }
550
551
556 public DDMTemplateService getDDMTemplateService() {
557 return ddmTemplateService;
558 }
559
560
565 public void setDDMTemplateService(DDMTemplateService ddmTemplateService) {
566 this.ddmTemplateService = ddmTemplateService;
567 }
568
569
574 public DDMTemplatePersistence getDDMTemplatePersistence() {
575 return ddmTemplatePersistence;
576 }
577
578
583 public void setDDMTemplatePersistence(
584 DDMTemplatePersistence ddmTemplatePersistence) {
585 this.ddmTemplatePersistence = ddmTemplatePersistence;
586 }
587
588
593 public DDMTemplateFinder getDDMTemplateFinder() {
594 return ddmTemplateFinder;
595 }
596
597
602 public void setDDMTemplateFinder(DDMTemplateFinder ddmTemplateFinder) {
603 this.ddmTemplateFinder = ddmTemplateFinder;
604 }
605
606
611 public CounterLocalService getCounterLocalService() {
612 return counterLocalService;
613 }
614
615
620 public void setCounterLocalService(CounterLocalService counterLocalService) {
621 this.counterLocalService = counterLocalService;
622 }
623
624
629 public ResourceLocalService getResourceLocalService() {
630 return resourceLocalService;
631 }
632
633
638 public void setResourceLocalService(
639 ResourceLocalService resourceLocalService) {
640 this.resourceLocalService = resourceLocalService;
641 }
642
643
648 public ResourceService getResourceService() {
649 return resourceService;
650 }
651
652
657 public void setResourceService(ResourceService resourceService) {
658 this.resourceService = resourceService;
659 }
660
661
666 public ResourcePersistence getResourcePersistence() {
667 return resourcePersistence;
668 }
669
670
675 public void setResourcePersistence(ResourcePersistence resourcePersistence) {
676 this.resourcePersistence = resourcePersistence;
677 }
678
679
684 public ResourceFinder getResourceFinder() {
685 return resourceFinder;
686 }
687
688
693 public void setResourceFinder(ResourceFinder resourceFinder) {
694 this.resourceFinder = resourceFinder;
695 }
696
697
702 public UserLocalService getUserLocalService() {
703 return userLocalService;
704 }
705
706
711 public void setUserLocalService(UserLocalService userLocalService) {
712 this.userLocalService = userLocalService;
713 }
714
715
720 public UserService getUserService() {
721 return userService;
722 }
723
724
729 public void setUserService(UserService userService) {
730 this.userService = userService;
731 }
732
733
738 public UserPersistence getUserPersistence() {
739 return userPersistence;
740 }
741
742
747 public void setUserPersistence(UserPersistence userPersistence) {
748 this.userPersistence = userPersistence;
749 }
750
751
756 public UserFinder getUserFinder() {
757 return userFinder;
758 }
759
760
765 public void setUserFinder(UserFinder userFinder) {
766 this.userFinder = userFinder;
767 }
768
769 public void afterPropertiesSet() {
770 persistedModelLocalServiceRegistry.register("com.liferay.portlet.dynamicdatamapping.model.DDMContent",
771 ddmContentLocalService);
772 }
773
774 public void destroy() {
775 persistedModelLocalServiceRegistry.unregister(
776 "com.liferay.portlet.dynamicdatamapping.model.DDMContent");
777 }
778
779
784 public String getBeanIdentifier() {
785 return _beanIdentifier;
786 }
787
788
793 public void setBeanIdentifier(String beanIdentifier) {
794 _beanIdentifier = beanIdentifier;
795 }
796
797 protected ClassLoader getClassLoader() {
798 Class<?> clazz = getClass();
799
800 return clazz.getClassLoader();
801 }
802
803 protected Class<?> getModelClass() {
804 return DDMContent.class;
805 }
806
807 protected String getModelClassName() {
808 return DDMContent.class.getName();
809 }
810
811
816 protected void runSQL(String sql) throws SystemException {
817 try {
818 DataSource dataSource = ddmContentPersistence.getDataSource();
819
820 SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
821 sql, new int[0]);
822
823 sqlUpdate.update();
824 }
825 catch (Exception e) {
826 throw new SystemException(e);
827 }
828 }
829
830 @BeanReference(type = DDMContentLocalService.class)
831 protected DDMContentLocalService ddmContentLocalService;
832 @BeanReference(type = DDMContentPersistence.class)
833 protected DDMContentPersistence ddmContentPersistence;
834 @BeanReference(type = DDMStorageLinkLocalService.class)
835 protected DDMStorageLinkLocalService ddmStorageLinkLocalService;
836 @BeanReference(type = DDMStorageLinkPersistence.class)
837 protected DDMStorageLinkPersistence ddmStorageLinkPersistence;
838 @BeanReference(type = DDMStructureLocalService.class)
839 protected DDMStructureLocalService ddmStructureLocalService;
840 @BeanReference(type = DDMStructureService.class)
841 protected DDMStructureService ddmStructureService;
842 @BeanReference(type = DDMStructurePersistence.class)
843 protected DDMStructurePersistence ddmStructurePersistence;
844 @BeanReference(type = DDMStructureFinder.class)
845 protected DDMStructureFinder ddmStructureFinder;
846 @BeanReference(type = DDMStructureLinkLocalService.class)
847 protected DDMStructureLinkLocalService ddmStructureLinkLocalService;
848 @BeanReference(type = DDMStructureLinkPersistence.class)
849 protected DDMStructureLinkPersistence ddmStructureLinkPersistence;
850 @BeanReference(type = DDMTemplateLocalService.class)
851 protected DDMTemplateLocalService ddmTemplateLocalService;
852 @BeanReference(type = DDMTemplateService.class)
853 protected DDMTemplateService ddmTemplateService;
854 @BeanReference(type = DDMTemplatePersistence.class)
855 protected DDMTemplatePersistence ddmTemplatePersistence;
856 @BeanReference(type = DDMTemplateFinder.class)
857 protected DDMTemplateFinder ddmTemplateFinder;
858 @BeanReference(type = CounterLocalService.class)
859 protected CounterLocalService counterLocalService;
860 @BeanReference(type = ResourceLocalService.class)
861 protected ResourceLocalService resourceLocalService;
862 @BeanReference(type = ResourceService.class)
863 protected ResourceService resourceService;
864 @BeanReference(type = ResourcePersistence.class)
865 protected ResourcePersistence resourcePersistence;
866 @BeanReference(type = ResourceFinder.class)
867 protected ResourceFinder resourceFinder;
868 @BeanReference(type = UserLocalService.class)
869 protected UserLocalService userLocalService;
870 @BeanReference(type = UserService.class)
871 protected UserService userService;
872 @BeanReference(type = UserPersistence.class)
873 protected UserPersistence userPersistence;
874 @BeanReference(type = UserFinder.class)
875 protected UserFinder userFinder;
876 @BeanReference(type = PersistedModelLocalServiceRegistry.class)
877 protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
878 private static Log _log = LogFactoryUtil.getLog(DDMContentLocalServiceBaseImpl.class);
879 private String _beanIdentifier;
880 }