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.documentlibrary.service.DLFileEntryTypeLocalService;
044 import com.liferay.portlet.documentlibrary.service.DLFileEntryTypeService;
045 import com.liferay.portlet.documentlibrary.service.persistence.DLFileEntryTypeFinder;
046 import com.liferay.portlet.documentlibrary.service.persistence.DLFileEntryTypePersistence;
047 import com.liferay.portlet.dynamicdatamapping.model.DDMStructure;
048 import com.liferay.portlet.dynamicdatamapping.service.DDMContentLocalService;
049 import com.liferay.portlet.dynamicdatamapping.service.DDMStorageLinkLocalService;
050 import com.liferay.portlet.dynamicdatamapping.service.DDMStructureLinkLocalService;
051 import com.liferay.portlet.dynamicdatamapping.service.DDMStructureLocalService;
052 import com.liferay.portlet.dynamicdatamapping.service.DDMStructureService;
053 import com.liferay.portlet.dynamicdatamapping.service.DDMTemplateLocalService;
054 import com.liferay.portlet.dynamicdatamapping.service.DDMTemplateService;
055 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMContentPersistence;
056 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMStorageLinkPersistence;
057 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMStructureFinder;
058 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMStructureLinkPersistence;
059 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMStructurePersistence;
060 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMTemplateFinder;
061 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMTemplatePersistence;
062
063 import java.io.Serializable;
064
065 import java.util.List;
066
067 import javax.sql.DataSource;
068
069
081 public abstract class DDMStructureLocalServiceBaseImpl
082 implements DDMStructureLocalService, IdentifiableBean {
083
088
089
096 public DDMStructure addDDMStructure(DDMStructure ddmStructure)
097 throws SystemException {
098 ddmStructure.setNew(true);
099
100 ddmStructure = ddmStructurePersistence.update(ddmStructure, false);
101
102 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
103
104 if (indexer != null) {
105 try {
106 indexer.reindex(ddmStructure);
107 }
108 catch (SearchException se) {
109 if (_log.isWarnEnabled()) {
110 _log.warn(se, se);
111 }
112 }
113 }
114
115 return ddmStructure;
116 }
117
118
124 public DDMStructure createDDMStructure(long structureId) {
125 return ddmStructurePersistence.create(structureId);
126 }
127
128
135 public void deleteDDMStructure(long structureId)
136 throws PortalException, SystemException {
137 DDMStructure ddmStructure = ddmStructurePersistence.remove(structureId);
138
139 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
140
141 if (indexer != null) {
142 try {
143 indexer.delete(ddmStructure);
144 }
145 catch (SearchException se) {
146 if (_log.isWarnEnabled()) {
147 _log.warn(se, se);
148 }
149 }
150 }
151 }
152
153
159 public void deleteDDMStructure(DDMStructure ddmStructure)
160 throws SystemException {
161 ddmStructurePersistence.remove(ddmStructure);
162
163 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
164
165 if (indexer != null) {
166 try {
167 indexer.delete(ddmStructure);
168 }
169 catch (SearchException se) {
170 if (_log.isWarnEnabled()) {
171 _log.warn(se, se);
172 }
173 }
174 }
175 }
176
177
184 @SuppressWarnings("rawtypes")
185 public List dynamicQuery(DynamicQuery dynamicQuery)
186 throws SystemException {
187 return ddmStructurePersistence.findWithDynamicQuery(dynamicQuery);
188 }
189
190
203 @SuppressWarnings("rawtypes")
204 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
205 throws SystemException {
206 return ddmStructurePersistence.findWithDynamicQuery(dynamicQuery,
207 start, end);
208 }
209
210
224 @SuppressWarnings("rawtypes")
225 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end,
226 OrderByComparator orderByComparator) throws SystemException {
227 return ddmStructurePersistence.findWithDynamicQuery(dynamicQuery,
228 start, end, orderByComparator);
229 }
230
231
238 public long dynamicQueryCount(DynamicQuery dynamicQuery)
239 throws SystemException {
240 return ddmStructurePersistence.countWithDynamicQuery(dynamicQuery);
241 }
242
243 public DDMStructure fetchDDMStructure(long structureId)
244 throws SystemException {
245 return ddmStructurePersistence.fetchByPrimaryKey(structureId);
246 }
247
248
256 public DDMStructure getDDMStructure(long structureId)
257 throws PortalException, SystemException {
258 return ddmStructurePersistence.findByPrimaryKey(structureId);
259 }
260
261 public PersistedModel getPersistedModel(Serializable primaryKeyObj)
262 throws PortalException, SystemException {
263 return ddmStructurePersistence.findByPrimaryKey(primaryKeyObj);
264 }
265
266
275 public DDMStructure getDDMStructureByUuidAndGroupId(String uuid,
276 long groupId) throws PortalException, SystemException {
277 return ddmStructurePersistence.findByUUID_G(uuid, groupId);
278 }
279
280
292 public List<DDMStructure> getDDMStructures(int start, int end)
293 throws SystemException {
294 return ddmStructurePersistence.findAll(start, end);
295 }
296
297
303 public int getDDMStructuresCount() throws SystemException {
304 return ddmStructurePersistence.countAll();
305 }
306
307
314 public DDMStructure updateDDMStructure(DDMStructure ddmStructure)
315 throws SystemException {
316 return updateDDMStructure(ddmStructure, true);
317 }
318
319
327 public DDMStructure updateDDMStructure(DDMStructure ddmStructure,
328 boolean merge) throws SystemException {
329 ddmStructure.setNew(false);
330
331 ddmStructure = ddmStructurePersistence.update(ddmStructure, merge);
332
333 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
334
335 if (indexer != null) {
336 try {
337 indexer.reindex(ddmStructure);
338 }
339 catch (SearchException se) {
340 if (_log.isWarnEnabled()) {
341 _log.warn(se, se);
342 }
343 }
344 }
345
346 return ddmStructure;
347 }
348
349
354 public DDMContentLocalService getDDMContentLocalService() {
355 return ddmContentLocalService;
356 }
357
358
363 public void setDDMContentLocalService(
364 DDMContentLocalService ddmContentLocalService) {
365 this.ddmContentLocalService = ddmContentLocalService;
366 }
367
368
373 public DDMContentPersistence getDDMContentPersistence() {
374 return ddmContentPersistence;
375 }
376
377
382 public void setDDMContentPersistence(
383 DDMContentPersistence ddmContentPersistence) {
384 this.ddmContentPersistence = ddmContentPersistence;
385 }
386
387
392 public DDMStorageLinkLocalService getDDMStorageLinkLocalService() {
393 return ddmStorageLinkLocalService;
394 }
395
396
401 public void setDDMStorageLinkLocalService(
402 DDMStorageLinkLocalService ddmStorageLinkLocalService) {
403 this.ddmStorageLinkLocalService = ddmStorageLinkLocalService;
404 }
405
406
411 public DDMStorageLinkPersistence getDDMStorageLinkPersistence() {
412 return ddmStorageLinkPersistence;
413 }
414
415
420 public void setDDMStorageLinkPersistence(
421 DDMStorageLinkPersistence ddmStorageLinkPersistence) {
422 this.ddmStorageLinkPersistence = ddmStorageLinkPersistence;
423 }
424
425
430 public DDMStructureLocalService getDDMStructureLocalService() {
431 return ddmStructureLocalService;
432 }
433
434
439 public void setDDMStructureLocalService(
440 DDMStructureLocalService ddmStructureLocalService) {
441 this.ddmStructureLocalService = ddmStructureLocalService;
442 }
443
444
449 public DDMStructureService getDDMStructureService() {
450 return ddmStructureService;
451 }
452
453
458 public void setDDMStructureService(DDMStructureService ddmStructureService) {
459 this.ddmStructureService = ddmStructureService;
460 }
461
462
467 public DDMStructurePersistence getDDMStructurePersistence() {
468 return ddmStructurePersistence;
469 }
470
471
476 public void setDDMStructurePersistence(
477 DDMStructurePersistence ddmStructurePersistence) {
478 this.ddmStructurePersistence = ddmStructurePersistence;
479 }
480
481
486 public DDMStructureFinder getDDMStructureFinder() {
487 return ddmStructureFinder;
488 }
489
490
495 public void setDDMStructureFinder(DDMStructureFinder ddmStructureFinder) {
496 this.ddmStructureFinder = ddmStructureFinder;
497 }
498
499
504 public DDMStructureLinkLocalService getDDMStructureLinkLocalService() {
505 return ddmStructureLinkLocalService;
506 }
507
508
513 public void setDDMStructureLinkLocalService(
514 DDMStructureLinkLocalService ddmStructureLinkLocalService) {
515 this.ddmStructureLinkLocalService = ddmStructureLinkLocalService;
516 }
517
518
523 public DDMStructureLinkPersistence getDDMStructureLinkPersistence() {
524 return ddmStructureLinkPersistence;
525 }
526
527
532 public void setDDMStructureLinkPersistence(
533 DDMStructureLinkPersistence ddmStructureLinkPersistence) {
534 this.ddmStructureLinkPersistence = ddmStructureLinkPersistence;
535 }
536
537
542 public DDMTemplateLocalService getDDMTemplateLocalService() {
543 return ddmTemplateLocalService;
544 }
545
546
551 public void setDDMTemplateLocalService(
552 DDMTemplateLocalService ddmTemplateLocalService) {
553 this.ddmTemplateLocalService = ddmTemplateLocalService;
554 }
555
556
561 public DDMTemplateService getDDMTemplateService() {
562 return ddmTemplateService;
563 }
564
565
570 public void setDDMTemplateService(DDMTemplateService ddmTemplateService) {
571 this.ddmTemplateService = ddmTemplateService;
572 }
573
574
579 public DDMTemplatePersistence getDDMTemplatePersistence() {
580 return ddmTemplatePersistence;
581 }
582
583
588 public void setDDMTemplatePersistence(
589 DDMTemplatePersistence ddmTemplatePersistence) {
590 this.ddmTemplatePersistence = ddmTemplatePersistence;
591 }
592
593
598 public DDMTemplateFinder getDDMTemplateFinder() {
599 return ddmTemplateFinder;
600 }
601
602
607 public void setDDMTemplateFinder(DDMTemplateFinder ddmTemplateFinder) {
608 this.ddmTemplateFinder = ddmTemplateFinder;
609 }
610
611
616 public CounterLocalService getCounterLocalService() {
617 return counterLocalService;
618 }
619
620
625 public void setCounterLocalService(CounterLocalService counterLocalService) {
626 this.counterLocalService = counterLocalService;
627 }
628
629
634 public ResourceLocalService getResourceLocalService() {
635 return resourceLocalService;
636 }
637
638
643 public void setResourceLocalService(
644 ResourceLocalService resourceLocalService) {
645 this.resourceLocalService = resourceLocalService;
646 }
647
648
653 public ResourceService getResourceService() {
654 return resourceService;
655 }
656
657
662 public void setResourceService(ResourceService resourceService) {
663 this.resourceService = resourceService;
664 }
665
666
671 public ResourcePersistence getResourcePersistence() {
672 return resourcePersistence;
673 }
674
675
680 public void setResourcePersistence(ResourcePersistence resourcePersistence) {
681 this.resourcePersistence = resourcePersistence;
682 }
683
684
689 public ResourceFinder getResourceFinder() {
690 return resourceFinder;
691 }
692
693
698 public void setResourceFinder(ResourceFinder resourceFinder) {
699 this.resourceFinder = resourceFinder;
700 }
701
702
707 public UserLocalService getUserLocalService() {
708 return userLocalService;
709 }
710
711
716 public void setUserLocalService(UserLocalService userLocalService) {
717 this.userLocalService = userLocalService;
718 }
719
720
725 public UserService getUserService() {
726 return userService;
727 }
728
729
734 public void setUserService(UserService userService) {
735 this.userService = userService;
736 }
737
738
743 public UserPersistence getUserPersistence() {
744 return userPersistence;
745 }
746
747
752 public void setUserPersistence(UserPersistence userPersistence) {
753 this.userPersistence = userPersistence;
754 }
755
756
761 public UserFinder getUserFinder() {
762 return userFinder;
763 }
764
765
770 public void setUserFinder(UserFinder userFinder) {
771 this.userFinder = userFinder;
772 }
773
774
779 public DLFileEntryTypeLocalService getDLFileEntryTypeLocalService() {
780 return dlFileEntryTypeLocalService;
781 }
782
783
788 public void setDLFileEntryTypeLocalService(
789 DLFileEntryTypeLocalService dlFileEntryTypeLocalService) {
790 this.dlFileEntryTypeLocalService = dlFileEntryTypeLocalService;
791 }
792
793
798 public DLFileEntryTypeService getDLFileEntryTypeService() {
799 return dlFileEntryTypeService;
800 }
801
802
807 public void setDLFileEntryTypeService(
808 DLFileEntryTypeService dlFileEntryTypeService) {
809 this.dlFileEntryTypeService = dlFileEntryTypeService;
810 }
811
812
817 public DLFileEntryTypePersistence getDLFileEntryTypePersistence() {
818 return dlFileEntryTypePersistence;
819 }
820
821
826 public void setDLFileEntryTypePersistence(
827 DLFileEntryTypePersistence dlFileEntryTypePersistence) {
828 this.dlFileEntryTypePersistence = dlFileEntryTypePersistence;
829 }
830
831
836 public DLFileEntryTypeFinder getDLFileEntryTypeFinder() {
837 return dlFileEntryTypeFinder;
838 }
839
840
845 public void setDLFileEntryTypeFinder(
846 DLFileEntryTypeFinder dlFileEntryTypeFinder) {
847 this.dlFileEntryTypeFinder = dlFileEntryTypeFinder;
848 }
849
850 public void afterPropertiesSet() {
851 persistedModelLocalServiceRegistry.register("com.liferay.portlet.dynamicdatamapping.model.DDMStructure",
852 ddmStructureLocalService);
853 }
854
855 public void destroy() {
856 persistedModelLocalServiceRegistry.unregister(
857 "com.liferay.portlet.dynamicdatamapping.model.DDMStructure");
858 }
859
860
865 public String getBeanIdentifier() {
866 return _beanIdentifier;
867 }
868
869
874 public void setBeanIdentifier(String beanIdentifier) {
875 _beanIdentifier = beanIdentifier;
876 }
877
878 protected ClassLoader getClassLoader() {
879 Class<?> clazz = getClass();
880
881 return clazz.getClassLoader();
882 }
883
884 protected Class<?> getModelClass() {
885 return DDMStructure.class;
886 }
887
888 protected String getModelClassName() {
889 return DDMStructure.class.getName();
890 }
891
892
897 protected void runSQL(String sql) throws SystemException {
898 try {
899 DataSource dataSource = ddmStructurePersistence.getDataSource();
900
901 SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
902 sql, new int[0]);
903
904 sqlUpdate.update();
905 }
906 catch (Exception e) {
907 throw new SystemException(e);
908 }
909 }
910
911 @BeanReference(type = DDMContentLocalService.class)
912 protected DDMContentLocalService ddmContentLocalService;
913 @BeanReference(type = DDMContentPersistence.class)
914 protected DDMContentPersistence ddmContentPersistence;
915 @BeanReference(type = DDMStorageLinkLocalService.class)
916 protected DDMStorageLinkLocalService ddmStorageLinkLocalService;
917 @BeanReference(type = DDMStorageLinkPersistence.class)
918 protected DDMStorageLinkPersistence ddmStorageLinkPersistence;
919 @BeanReference(type = DDMStructureLocalService.class)
920 protected DDMStructureLocalService ddmStructureLocalService;
921 @BeanReference(type = DDMStructureService.class)
922 protected DDMStructureService ddmStructureService;
923 @BeanReference(type = DDMStructurePersistence.class)
924 protected DDMStructurePersistence ddmStructurePersistence;
925 @BeanReference(type = DDMStructureFinder.class)
926 protected DDMStructureFinder ddmStructureFinder;
927 @BeanReference(type = DDMStructureLinkLocalService.class)
928 protected DDMStructureLinkLocalService ddmStructureLinkLocalService;
929 @BeanReference(type = DDMStructureLinkPersistence.class)
930 protected DDMStructureLinkPersistence ddmStructureLinkPersistence;
931 @BeanReference(type = DDMTemplateLocalService.class)
932 protected DDMTemplateLocalService ddmTemplateLocalService;
933 @BeanReference(type = DDMTemplateService.class)
934 protected DDMTemplateService ddmTemplateService;
935 @BeanReference(type = DDMTemplatePersistence.class)
936 protected DDMTemplatePersistence ddmTemplatePersistence;
937 @BeanReference(type = DDMTemplateFinder.class)
938 protected DDMTemplateFinder ddmTemplateFinder;
939 @BeanReference(type = CounterLocalService.class)
940 protected CounterLocalService counterLocalService;
941 @BeanReference(type = ResourceLocalService.class)
942 protected ResourceLocalService resourceLocalService;
943 @BeanReference(type = ResourceService.class)
944 protected ResourceService resourceService;
945 @BeanReference(type = ResourcePersistence.class)
946 protected ResourcePersistence resourcePersistence;
947 @BeanReference(type = ResourceFinder.class)
948 protected ResourceFinder resourceFinder;
949 @BeanReference(type = UserLocalService.class)
950 protected UserLocalService userLocalService;
951 @BeanReference(type = UserService.class)
952 protected UserService userService;
953 @BeanReference(type = UserPersistence.class)
954 protected UserPersistence userPersistence;
955 @BeanReference(type = UserFinder.class)
956 protected UserFinder userFinder;
957 @BeanReference(type = DLFileEntryTypeLocalService.class)
958 protected DLFileEntryTypeLocalService dlFileEntryTypeLocalService;
959 @BeanReference(type = DLFileEntryTypeService.class)
960 protected DLFileEntryTypeService dlFileEntryTypeService;
961 @BeanReference(type = DLFileEntryTypePersistence.class)
962 protected DLFileEntryTypePersistence dlFileEntryTypePersistence;
963 @BeanReference(type = DLFileEntryTypeFinder.class)
964 protected DLFileEntryTypeFinder dlFileEntryTypeFinder;
965 @BeanReference(type = PersistedModelLocalServiceRegistry.class)
966 protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
967 private static Log _log = LogFactoryUtil.getLog(DDMStructureLocalServiceBaseImpl.class);
968 private String _beanIdentifier;
969 }