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.DDMStructureLinkService;
052 import com.liferay.portlet.dynamicdatamapping.service.DDMStructureLocalService;
053 import com.liferay.portlet.dynamicdatamapping.service.DDMStructureService;
054 import com.liferay.portlet.dynamicdatamapping.service.DDMTemplateLocalService;
055 import com.liferay.portlet.dynamicdatamapping.service.DDMTemplateService;
056 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMContentPersistence;
057 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMStorageLinkPersistence;
058 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMStructureFinder;
059 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMStructureLinkPersistence;
060 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMStructurePersistence;
061 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMTemplateFinder;
062 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMTemplatePersistence;
063
064 import java.io.Serializable;
065
066 import java.util.List;
067
068 import javax.sql.DataSource;
069
070
082 public abstract class DDMStructureLocalServiceBaseImpl
083 implements DDMStructureLocalService, IdentifiableBean {
084
089
090
097 public DDMStructure addDDMStructure(DDMStructure ddmStructure)
098 throws SystemException {
099 ddmStructure.setNew(true);
100
101 ddmStructure = ddmStructurePersistence.update(ddmStructure, false);
102
103 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
104
105 if (indexer != null) {
106 try {
107 indexer.reindex(ddmStructure);
108 }
109 catch (SearchException se) {
110 if (_log.isWarnEnabled()) {
111 _log.warn(se, se);
112 }
113 }
114 }
115
116 return ddmStructure;
117 }
118
119
125 public DDMStructure createDDMStructure(long structureId) {
126 return ddmStructurePersistence.create(structureId);
127 }
128
129
136 public void deleteDDMStructure(long structureId)
137 throws PortalException, SystemException {
138 DDMStructure ddmStructure = ddmStructurePersistence.remove(structureId);
139
140 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
141
142 if (indexer != null) {
143 try {
144 indexer.delete(ddmStructure);
145 }
146 catch (SearchException se) {
147 if (_log.isWarnEnabled()) {
148 _log.warn(se, se);
149 }
150 }
151 }
152 }
153
154
160 public void deleteDDMStructure(DDMStructure ddmStructure)
161 throws SystemException {
162 ddmStructurePersistence.remove(ddmStructure);
163
164 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
165
166 if (indexer != null) {
167 try {
168 indexer.delete(ddmStructure);
169 }
170 catch (SearchException se) {
171 if (_log.isWarnEnabled()) {
172 _log.warn(se, se);
173 }
174 }
175 }
176 }
177
178
185 @SuppressWarnings("rawtypes")
186 public List dynamicQuery(DynamicQuery dynamicQuery)
187 throws SystemException {
188 return ddmStructurePersistence.findWithDynamicQuery(dynamicQuery);
189 }
190
191
204 @SuppressWarnings("rawtypes")
205 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
206 throws SystemException {
207 return ddmStructurePersistence.findWithDynamicQuery(dynamicQuery,
208 start, end);
209 }
210
211
225 @SuppressWarnings("rawtypes")
226 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end,
227 OrderByComparator orderByComparator) throws SystemException {
228 return ddmStructurePersistence.findWithDynamicQuery(dynamicQuery,
229 start, end, orderByComparator);
230 }
231
232
239 public long dynamicQueryCount(DynamicQuery dynamicQuery)
240 throws SystemException {
241 return ddmStructurePersistence.countWithDynamicQuery(dynamicQuery);
242 }
243
244 public DDMStructure fetchDDMStructure(long structureId)
245 throws SystemException {
246 return ddmStructurePersistence.fetchByPrimaryKey(structureId);
247 }
248
249
257 public DDMStructure getDDMStructure(long structureId)
258 throws PortalException, SystemException {
259 return ddmStructurePersistence.findByPrimaryKey(structureId);
260 }
261
262 public PersistedModel getPersistedModel(Serializable primaryKeyObj)
263 throws PortalException, SystemException {
264 return ddmStructurePersistence.findByPrimaryKey(primaryKeyObj);
265 }
266
267
276 public DDMStructure getDDMStructureByUuidAndGroupId(String uuid,
277 long groupId) throws PortalException, SystemException {
278 return ddmStructurePersistence.findByUUID_G(uuid, groupId);
279 }
280
281
293 public List<DDMStructure> getDDMStructures(int start, int end)
294 throws SystemException {
295 return ddmStructurePersistence.findAll(start, end);
296 }
297
298
304 public int getDDMStructuresCount() throws SystemException {
305 return ddmStructurePersistence.countAll();
306 }
307
308
315 public DDMStructure updateDDMStructure(DDMStructure ddmStructure)
316 throws SystemException {
317 return updateDDMStructure(ddmStructure, true);
318 }
319
320
328 public DDMStructure updateDDMStructure(DDMStructure ddmStructure,
329 boolean merge) throws SystemException {
330 ddmStructure.setNew(false);
331
332 ddmStructure = ddmStructurePersistence.update(ddmStructure, merge);
333
334 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
335
336 if (indexer != null) {
337 try {
338 indexer.reindex(ddmStructure);
339 }
340 catch (SearchException se) {
341 if (_log.isWarnEnabled()) {
342 _log.warn(se, se);
343 }
344 }
345 }
346
347 return ddmStructure;
348 }
349
350
355 public DDMContentLocalService getDDMContentLocalService() {
356 return ddmContentLocalService;
357 }
358
359
364 public void setDDMContentLocalService(
365 DDMContentLocalService ddmContentLocalService) {
366 this.ddmContentLocalService = ddmContentLocalService;
367 }
368
369
374 public DDMContentPersistence getDDMContentPersistence() {
375 return ddmContentPersistence;
376 }
377
378
383 public void setDDMContentPersistence(
384 DDMContentPersistence ddmContentPersistence) {
385 this.ddmContentPersistence = ddmContentPersistence;
386 }
387
388
393 public DDMStorageLinkLocalService getDDMStorageLinkLocalService() {
394 return ddmStorageLinkLocalService;
395 }
396
397
402 public void setDDMStorageLinkLocalService(
403 DDMStorageLinkLocalService ddmStorageLinkLocalService) {
404 this.ddmStorageLinkLocalService = ddmStorageLinkLocalService;
405 }
406
407
412 public DDMStorageLinkPersistence getDDMStorageLinkPersistence() {
413 return ddmStorageLinkPersistence;
414 }
415
416
421 public void setDDMStorageLinkPersistence(
422 DDMStorageLinkPersistence ddmStorageLinkPersistence) {
423 this.ddmStorageLinkPersistence = ddmStorageLinkPersistence;
424 }
425
426
431 public DDMStructureLocalService getDDMStructureLocalService() {
432 return ddmStructureLocalService;
433 }
434
435
440 public void setDDMStructureLocalService(
441 DDMStructureLocalService ddmStructureLocalService) {
442 this.ddmStructureLocalService = ddmStructureLocalService;
443 }
444
445
450 public DDMStructureService getDDMStructureService() {
451 return ddmStructureService;
452 }
453
454
459 public void setDDMStructureService(DDMStructureService ddmStructureService) {
460 this.ddmStructureService = ddmStructureService;
461 }
462
463
468 public DDMStructurePersistence getDDMStructurePersistence() {
469 return ddmStructurePersistence;
470 }
471
472
477 public void setDDMStructurePersistence(
478 DDMStructurePersistence ddmStructurePersistence) {
479 this.ddmStructurePersistence = ddmStructurePersistence;
480 }
481
482
487 public DDMStructureFinder getDDMStructureFinder() {
488 return ddmStructureFinder;
489 }
490
491
496 public void setDDMStructureFinder(DDMStructureFinder ddmStructureFinder) {
497 this.ddmStructureFinder = ddmStructureFinder;
498 }
499
500
505 public DDMStructureLinkLocalService getDDMStructureLinkLocalService() {
506 return ddmStructureLinkLocalService;
507 }
508
509
514 public void setDDMStructureLinkLocalService(
515 DDMStructureLinkLocalService ddmStructureLinkLocalService) {
516 this.ddmStructureLinkLocalService = ddmStructureLinkLocalService;
517 }
518
519
524 public DDMStructureLinkService getDDMStructureLinkService() {
525 return ddmStructureLinkService;
526 }
527
528
533 public void setDDMStructureLinkService(
534 DDMStructureLinkService ddmStructureLinkService) {
535 this.ddmStructureLinkService = ddmStructureLinkService;
536 }
537
538
543 public DDMStructureLinkPersistence getDDMStructureLinkPersistence() {
544 return ddmStructureLinkPersistence;
545 }
546
547
552 public void setDDMStructureLinkPersistence(
553 DDMStructureLinkPersistence ddmStructureLinkPersistence) {
554 this.ddmStructureLinkPersistence = ddmStructureLinkPersistence;
555 }
556
557
562 public DDMTemplateLocalService getDDMTemplateLocalService() {
563 return ddmTemplateLocalService;
564 }
565
566
571 public void setDDMTemplateLocalService(
572 DDMTemplateLocalService ddmTemplateLocalService) {
573 this.ddmTemplateLocalService = ddmTemplateLocalService;
574 }
575
576
581 public DDMTemplateService getDDMTemplateService() {
582 return ddmTemplateService;
583 }
584
585
590 public void setDDMTemplateService(DDMTemplateService ddmTemplateService) {
591 this.ddmTemplateService = ddmTemplateService;
592 }
593
594
599 public DDMTemplatePersistence getDDMTemplatePersistence() {
600 return ddmTemplatePersistence;
601 }
602
603
608 public void setDDMTemplatePersistence(
609 DDMTemplatePersistence ddmTemplatePersistence) {
610 this.ddmTemplatePersistence = ddmTemplatePersistence;
611 }
612
613
618 public DDMTemplateFinder getDDMTemplateFinder() {
619 return ddmTemplateFinder;
620 }
621
622
627 public void setDDMTemplateFinder(DDMTemplateFinder ddmTemplateFinder) {
628 this.ddmTemplateFinder = ddmTemplateFinder;
629 }
630
631
636 public CounterLocalService getCounterLocalService() {
637 return counterLocalService;
638 }
639
640
645 public void setCounterLocalService(CounterLocalService counterLocalService) {
646 this.counterLocalService = counterLocalService;
647 }
648
649
654 public ResourceLocalService getResourceLocalService() {
655 return resourceLocalService;
656 }
657
658
663 public void setResourceLocalService(
664 ResourceLocalService resourceLocalService) {
665 this.resourceLocalService = resourceLocalService;
666 }
667
668
673 public ResourceService getResourceService() {
674 return resourceService;
675 }
676
677
682 public void setResourceService(ResourceService resourceService) {
683 this.resourceService = resourceService;
684 }
685
686
691 public ResourcePersistence getResourcePersistence() {
692 return resourcePersistence;
693 }
694
695
700 public void setResourcePersistence(ResourcePersistence resourcePersistence) {
701 this.resourcePersistence = resourcePersistence;
702 }
703
704
709 public ResourceFinder getResourceFinder() {
710 return resourceFinder;
711 }
712
713
718 public void setResourceFinder(ResourceFinder resourceFinder) {
719 this.resourceFinder = resourceFinder;
720 }
721
722
727 public UserLocalService getUserLocalService() {
728 return userLocalService;
729 }
730
731
736 public void setUserLocalService(UserLocalService userLocalService) {
737 this.userLocalService = userLocalService;
738 }
739
740
745 public UserService getUserService() {
746 return userService;
747 }
748
749
754 public void setUserService(UserService userService) {
755 this.userService = userService;
756 }
757
758
763 public UserPersistence getUserPersistence() {
764 return userPersistence;
765 }
766
767
772 public void setUserPersistence(UserPersistence userPersistence) {
773 this.userPersistence = userPersistence;
774 }
775
776
781 public UserFinder getUserFinder() {
782 return userFinder;
783 }
784
785
790 public void setUserFinder(UserFinder userFinder) {
791 this.userFinder = userFinder;
792 }
793
794
799 public DLFileEntryTypeLocalService getDLFileEntryTypeLocalService() {
800 return dlFileEntryTypeLocalService;
801 }
802
803
808 public void setDLFileEntryTypeLocalService(
809 DLFileEntryTypeLocalService dlFileEntryTypeLocalService) {
810 this.dlFileEntryTypeLocalService = dlFileEntryTypeLocalService;
811 }
812
813
818 public DLFileEntryTypeService getDLFileEntryTypeService() {
819 return dlFileEntryTypeService;
820 }
821
822
827 public void setDLFileEntryTypeService(
828 DLFileEntryTypeService dlFileEntryTypeService) {
829 this.dlFileEntryTypeService = dlFileEntryTypeService;
830 }
831
832
837 public DLFileEntryTypePersistence getDLFileEntryTypePersistence() {
838 return dlFileEntryTypePersistence;
839 }
840
841
846 public void setDLFileEntryTypePersistence(
847 DLFileEntryTypePersistence dlFileEntryTypePersistence) {
848 this.dlFileEntryTypePersistence = dlFileEntryTypePersistence;
849 }
850
851
856 public DLFileEntryTypeFinder getDLFileEntryTypeFinder() {
857 return dlFileEntryTypeFinder;
858 }
859
860
865 public void setDLFileEntryTypeFinder(
866 DLFileEntryTypeFinder dlFileEntryTypeFinder) {
867 this.dlFileEntryTypeFinder = dlFileEntryTypeFinder;
868 }
869
870 public void afterPropertiesSet() {
871 persistedModelLocalServiceRegistry.register("com.liferay.portlet.dynamicdatamapping.model.DDMStructure",
872 ddmStructureLocalService);
873 }
874
875 public void destroy() {
876 persistedModelLocalServiceRegistry.unregister(
877 "com.liferay.portlet.dynamicdatamapping.model.DDMStructure");
878 }
879
880
885 public String getBeanIdentifier() {
886 return _beanIdentifier;
887 }
888
889
894 public void setBeanIdentifier(String beanIdentifier) {
895 _beanIdentifier = beanIdentifier;
896 }
897
898 protected Class<?> getModelClass() {
899 return DDMStructure.class;
900 }
901
902 protected String getModelClassName() {
903 return DDMStructure.class.getName();
904 }
905
906
911 protected void runSQL(String sql) throws SystemException {
912 try {
913 DataSource dataSource = ddmStructurePersistence.getDataSource();
914
915 SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
916 sql, new int[0]);
917
918 sqlUpdate.update();
919 }
920 catch (Exception e) {
921 throw new SystemException(e);
922 }
923 }
924
925 @BeanReference(type = DDMContentLocalService.class)
926 protected DDMContentLocalService ddmContentLocalService;
927 @BeanReference(type = DDMContentPersistence.class)
928 protected DDMContentPersistence ddmContentPersistence;
929 @BeanReference(type = DDMStorageLinkLocalService.class)
930 protected DDMStorageLinkLocalService ddmStorageLinkLocalService;
931 @BeanReference(type = DDMStorageLinkPersistence.class)
932 protected DDMStorageLinkPersistence ddmStorageLinkPersistence;
933 @BeanReference(type = DDMStructureLocalService.class)
934 protected DDMStructureLocalService ddmStructureLocalService;
935 @BeanReference(type = DDMStructureService.class)
936 protected DDMStructureService ddmStructureService;
937 @BeanReference(type = DDMStructurePersistence.class)
938 protected DDMStructurePersistence ddmStructurePersistence;
939 @BeanReference(type = DDMStructureFinder.class)
940 protected DDMStructureFinder ddmStructureFinder;
941 @BeanReference(type = DDMStructureLinkLocalService.class)
942 protected DDMStructureLinkLocalService ddmStructureLinkLocalService;
943 @BeanReference(type = DDMStructureLinkService.class)
944 protected DDMStructureLinkService ddmStructureLinkService;
945 @BeanReference(type = DDMStructureLinkPersistence.class)
946 protected DDMStructureLinkPersistence ddmStructureLinkPersistence;
947 @BeanReference(type = DDMTemplateLocalService.class)
948 protected DDMTemplateLocalService ddmTemplateLocalService;
949 @BeanReference(type = DDMTemplateService.class)
950 protected DDMTemplateService ddmTemplateService;
951 @BeanReference(type = DDMTemplatePersistence.class)
952 protected DDMTemplatePersistence ddmTemplatePersistence;
953 @BeanReference(type = DDMTemplateFinder.class)
954 protected DDMTemplateFinder ddmTemplateFinder;
955 @BeanReference(type = CounterLocalService.class)
956 protected CounterLocalService counterLocalService;
957 @BeanReference(type = ResourceLocalService.class)
958 protected ResourceLocalService resourceLocalService;
959 @BeanReference(type = ResourceService.class)
960 protected ResourceService resourceService;
961 @BeanReference(type = ResourcePersistence.class)
962 protected ResourcePersistence resourcePersistence;
963 @BeanReference(type = ResourceFinder.class)
964 protected ResourceFinder resourceFinder;
965 @BeanReference(type = UserLocalService.class)
966 protected UserLocalService userLocalService;
967 @BeanReference(type = UserService.class)
968 protected UserService userService;
969 @BeanReference(type = UserPersistence.class)
970 protected UserPersistence userPersistence;
971 @BeanReference(type = UserFinder.class)
972 protected UserFinder userFinder;
973 @BeanReference(type = DLFileEntryTypeLocalService.class)
974 protected DLFileEntryTypeLocalService dlFileEntryTypeLocalService;
975 @BeanReference(type = DLFileEntryTypeService.class)
976 protected DLFileEntryTypeService dlFileEntryTypeService;
977 @BeanReference(type = DLFileEntryTypePersistence.class)
978 protected DLFileEntryTypePersistence dlFileEntryTypePersistence;
979 @BeanReference(type = DLFileEntryTypeFinder.class)
980 protected DLFileEntryTypeFinder dlFileEntryTypeFinder;
981 @BeanReference(type = PersistedModelLocalServiceRegistry.class)
982 protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
983 private static Log _log = LogFactoryUtil.getLog(DDMStructureLocalServiceBaseImpl.class);
984 private String _beanIdentifier;
985 }