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.DDMStorageLink;
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 DDMStorageLinkLocalServiceBaseImpl
078 implements DDMStorageLinkLocalService, IdentifiableBean {
079
084
085
092 public DDMStorageLink addDDMStorageLink(DDMStorageLink ddmStorageLink)
093 throws SystemException {
094 ddmStorageLink.setNew(true);
095
096 ddmStorageLink = ddmStorageLinkPersistence.update(ddmStorageLink, false);
097
098 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
099
100 if (indexer != null) {
101 try {
102 indexer.reindex(ddmStorageLink);
103 }
104 catch (SearchException se) {
105 if (_log.isWarnEnabled()) {
106 _log.warn(se, se);
107 }
108 }
109 }
110
111 return ddmStorageLink;
112 }
113
114
120 public DDMStorageLink createDDMStorageLink(long storageLinkId) {
121 return ddmStorageLinkPersistence.create(storageLinkId);
122 }
123
124
131 public void deleteDDMStorageLink(long storageLinkId)
132 throws PortalException, SystemException {
133 DDMStorageLink ddmStorageLink = ddmStorageLinkPersistence.remove(storageLinkId);
134
135 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
136
137 if (indexer != null) {
138 try {
139 indexer.delete(ddmStorageLink);
140 }
141 catch (SearchException se) {
142 if (_log.isWarnEnabled()) {
143 _log.warn(se, se);
144 }
145 }
146 }
147 }
148
149
155 public void deleteDDMStorageLink(DDMStorageLink ddmStorageLink)
156 throws SystemException {
157 ddmStorageLinkPersistence.remove(ddmStorageLink);
158
159 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
160
161 if (indexer != null) {
162 try {
163 indexer.delete(ddmStorageLink);
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 ddmStorageLinkPersistence.findWithDynamicQuery(dynamicQuery);
184 }
185
186
199 @SuppressWarnings("rawtypes")
200 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
201 throws SystemException {
202 return ddmStorageLinkPersistence.findWithDynamicQuery(dynamicQuery,
203 start, end);
204 }
205
206
220 @SuppressWarnings("rawtypes")
221 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end,
222 OrderByComparator orderByComparator) throws SystemException {
223 return ddmStorageLinkPersistence.findWithDynamicQuery(dynamicQuery,
224 start, end, orderByComparator);
225 }
226
227
234 public long dynamicQueryCount(DynamicQuery dynamicQuery)
235 throws SystemException {
236 return ddmStorageLinkPersistence.countWithDynamicQuery(dynamicQuery);
237 }
238
239 public DDMStorageLink fetchDDMStorageLink(long storageLinkId)
240 throws SystemException {
241 return ddmStorageLinkPersistence.fetchByPrimaryKey(storageLinkId);
242 }
243
244
252 public DDMStorageLink getDDMStorageLink(long storageLinkId)
253 throws PortalException, SystemException {
254 return ddmStorageLinkPersistence.findByPrimaryKey(storageLinkId);
255 }
256
257 public PersistedModel getPersistedModel(Serializable primaryKeyObj)
258 throws PortalException, SystemException {
259 return ddmStorageLinkPersistence.findByPrimaryKey(primaryKeyObj);
260 }
261
262
274 public List<DDMStorageLink> getDDMStorageLinks(int start, int end)
275 throws SystemException {
276 return ddmStorageLinkPersistence.findAll(start, end);
277 }
278
279
285 public int getDDMStorageLinksCount() throws SystemException {
286 return ddmStorageLinkPersistence.countAll();
287 }
288
289
296 public DDMStorageLink updateDDMStorageLink(DDMStorageLink ddmStorageLink)
297 throws SystemException {
298 return updateDDMStorageLink(ddmStorageLink, true);
299 }
300
301
309 public DDMStorageLink updateDDMStorageLink(DDMStorageLink ddmStorageLink,
310 boolean merge) throws SystemException {
311 ddmStorageLink.setNew(false);
312
313 ddmStorageLink = ddmStorageLinkPersistence.update(ddmStorageLink, merge);
314
315 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
316
317 if (indexer != null) {
318 try {
319 indexer.reindex(ddmStorageLink);
320 }
321 catch (SearchException se) {
322 if (_log.isWarnEnabled()) {
323 _log.warn(se, se);
324 }
325 }
326 }
327
328 return ddmStorageLink;
329 }
330
331
336 public DDMContentLocalService getDDMContentLocalService() {
337 return ddmContentLocalService;
338 }
339
340
345 public void setDDMContentLocalService(
346 DDMContentLocalService ddmContentLocalService) {
347 this.ddmContentLocalService = ddmContentLocalService;
348 }
349
350
355 public DDMContentPersistence getDDMContentPersistence() {
356 return ddmContentPersistence;
357 }
358
359
364 public void setDDMContentPersistence(
365 DDMContentPersistence ddmContentPersistence) {
366 this.ddmContentPersistence = ddmContentPersistence;
367 }
368
369
374 public DDMStorageLinkLocalService getDDMStorageLinkLocalService() {
375 return ddmStorageLinkLocalService;
376 }
377
378
383 public void setDDMStorageLinkLocalService(
384 DDMStorageLinkLocalService ddmStorageLinkLocalService) {
385 this.ddmStorageLinkLocalService = ddmStorageLinkLocalService;
386 }
387
388
393 public DDMStorageLinkPersistence getDDMStorageLinkPersistence() {
394 return ddmStorageLinkPersistence;
395 }
396
397
402 public void setDDMStorageLinkPersistence(
403 DDMStorageLinkPersistence ddmStorageLinkPersistence) {
404 this.ddmStorageLinkPersistence = ddmStorageLinkPersistence;
405 }
406
407
412 public DDMStructureLocalService getDDMStructureLocalService() {
413 return ddmStructureLocalService;
414 }
415
416
421 public void setDDMStructureLocalService(
422 DDMStructureLocalService ddmStructureLocalService) {
423 this.ddmStructureLocalService = ddmStructureLocalService;
424 }
425
426
431 public DDMStructureService getDDMStructureService() {
432 return ddmStructureService;
433 }
434
435
440 public void setDDMStructureService(DDMStructureService ddmStructureService) {
441 this.ddmStructureService = ddmStructureService;
442 }
443
444
449 public DDMStructurePersistence getDDMStructurePersistence() {
450 return ddmStructurePersistence;
451 }
452
453
458 public void setDDMStructurePersistence(
459 DDMStructurePersistence ddmStructurePersistence) {
460 this.ddmStructurePersistence = ddmStructurePersistence;
461 }
462
463
468 public DDMStructureFinder getDDMStructureFinder() {
469 return ddmStructureFinder;
470 }
471
472
477 public void setDDMStructureFinder(DDMStructureFinder ddmStructureFinder) {
478 this.ddmStructureFinder = ddmStructureFinder;
479 }
480
481
486 public DDMStructureLinkLocalService getDDMStructureLinkLocalService() {
487 return ddmStructureLinkLocalService;
488 }
489
490
495 public void setDDMStructureLinkLocalService(
496 DDMStructureLinkLocalService ddmStructureLinkLocalService) {
497 this.ddmStructureLinkLocalService = ddmStructureLinkLocalService;
498 }
499
500
505 public DDMStructureLinkPersistence getDDMStructureLinkPersistence() {
506 return ddmStructureLinkPersistence;
507 }
508
509
514 public void setDDMStructureLinkPersistence(
515 DDMStructureLinkPersistence ddmStructureLinkPersistence) {
516 this.ddmStructureLinkPersistence = ddmStructureLinkPersistence;
517 }
518
519
524 public DDMTemplateLocalService getDDMTemplateLocalService() {
525 return ddmTemplateLocalService;
526 }
527
528
533 public void setDDMTemplateLocalService(
534 DDMTemplateLocalService ddmTemplateLocalService) {
535 this.ddmTemplateLocalService = ddmTemplateLocalService;
536 }
537
538
543 public DDMTemplateService getDDMTemplateService() {
544 return ddmTemplateService;
545 }
546
547
552 public void setDDMTemplateService(DDMTemplateService ddmTemplateService) {
553 this.ddmTemplateService = ddmTemplateService;
554 }
555
556
561 public DDMTemplatePersistence getDDMTemplatePersistence() {
562 return ddmTemplatePersistence;
563 }
564
565
570 public void setDDMTemplatePersistence(
571 DDMTemplatePersistence ddmTemplatePersistence) {
572 this.ddmTemplatePersistence = ddmTemplatePersistence;
573 }
574
575
580 public DDMTemplateFinder getDDMTemplateFinder() {
581 return ddmTemplateFinder;
582 }
583
584
589 public void setDDMTemplateFinder(DDMTemplateFinder ddmTemplateFinder) {
590 this.ddmTemplateFinder = ddmTemplateFinder;
591 }
592
593
598 public CounterLocalService getCounterLocalService() {
599 return counterLocalService;
600 }
601
602
607 public void setCounterLocalService(CounterLocalService counterLocalService) {
608 this.counterLocalService = counterLocalService;
609 }
610
611
616 public ResourceLocalService getResourceLocalService() {
617 return resourceLocalService;
618 }
619
620
625 public void setResourceLocalService(
626 ResourceLocalService resourceLocalService) {
627 this.resourceLocalService = resourceLocalService;
628 }
629
630
635 public ResourceService getResourceService() {
636 return resourceService;
637 }
638
639
644 public void setResourceService(ResourceService resourceService) {
645 this.resourceService = resourceService;
646 }
647
648
653 public ResourcePersistence getResourcePersistence() {
654 return resourcePersistence;
655 }
656
657
662 public void setResourcePersistence(ResourcePersistence resourcePersistence) {
663 this.resourcePersistence = resourcePersistence;
664 }
665
666
671 public ResourceFinder getResourceFinder() {
672 return resourceFinder;
673 }
674
675
680 public void setResourceFinder(ResourceFinder resourceFinder) {
681 this.resourceFinder = resourceFinder;
682 }
683
684
689 public UserLocalService getUserLocalService() {
690 return userLocalService;
691 }
692
693
698 public void setUserLocalService(UserLocalService userLocalService) {
699 this.userLocalService = userLocalService;
700 }
701
702
707 public UserService getUserService() {
708 return userService;
709 }
710
711
716 public void setUserService(UserService userService) {
717 this.userService = userService;
718 }
719
720
725 public UserPersistence getUserPersistence() {
726 return userPersistence;
727 }
728
729
734 public void setUserPersistence(UserPersistence userPersistence) {
735 this.userPersistence = userPersistence;
736 }
737
738
743 public UserFinder getUserFinder() {
744 return userFinder;
745 }
746
747
752 public void setUserFinder(UserFinder userFinder) {
753 this.userFinder = userFinder;
754 }
755
756 public void afterPropertiesSet() {
757 persistedModelLocalServiceRegistry.register("com.liferay.portlet.dynamicdatamapping.model.DDMStorageLink",
758 ddmStorageLinkLocalService);
759 }
760
761 public void destroy() {
762 persistedModelLocalServiceRegistry.unregister(
763 "com.liferay.portlet.dynamicdatamapping.model.DDMStorageLink");
764 }
765
766
771 public String getBeanIdentifier() {
772 return _beanIdentifier;
773 }
774
775
780 public void setBeanIdentifier(String beanIdentifier) {
781 _beanIdentifier = beanIdentifier;
782 }
783
784 protected ClassLoader getClassLoader() {
785 Class<?> clazz = getClass();
786
787 return clazz.getClassLoader();
788 }
789
790 protected Class<?> getModelClass() {
791 return DDMStorageLink.class;
792 }
793
794 protected String getModelClassName() {
795 return DDMStorageLink.class.getName();
796 }
797
798
803 protected void runSQL(String sql) throws SystemException {
804 try {
805 DataSource dataSource = ddmStorageLinkPersistence.getDataSource();
806
807 SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
808 sql, new int[0]);
809
810 sqlUpdate.update();
811 }
812 catch (Exception e) {
813 throw new SystemException(e);
814 }
815 }
816
817 @BeanReference(type = DDMContentLocalService.class)
818 protected DDMContentLocalService ddmContentLocalService;
819 @BeanReference(type = DDMContentPersistence.class)
820 protected DDMContentPersistence ddmContentPersistence;
821 @BeanReference(type = DDMStorageLinkLocalService.class)
822 protected DDMStorageLinkLocalService ddmStorageLinkLocalService;
823 @BeanReference(type = DDMStorageLinkPersistence.class)
824 protected DDMStorageLinkPersistence ddmStorageLinkPersistence;
825 @BeanReference(type = DDMStructureLocalService.class)
826 protected DDMStructureLocalService ddmStructureLocalService;
827 @BeanReference(type = DDMStructureService.class)
828 protected DDMStructureService ddmStructureService;
829 @BeanReference(type = DDMStructurePersistence.class)
830 protected DDMStructurePersistence ddmStructurePersistence;
831 @BeanReference(type = DDMStructureFinder.class)
832 protected DDMStructureFinder ddmStructureFinder;
833 @BeanReference(type = DDMStructureLinkLocalService.class)
834 protected DDMStructureLinkLocalService ddmStructureLinkLocalService;
835 @BeanReference(type = DDMStructureLinkPersistence.class)
836 protected DDMStructureLinkPersistence ddmStructureLinkPersistence;
837 @BeanReference(type = DDMTemplateLocalService.class)
838 protected DDMTemplateLocalService ddmTemplateLocalService;
839 @BeanReference(type = DDMTemplateService.class)
840 protected DDMTemplateService ddmTemplateService;
841 @BeanReference(type = DDMTemplatePersistence.class)
842 protected DDMTemplatePersistence ddmTemplatePersistence;
843 @BeanReference(type = DDMTemplateFinder.class)
844 protected DDMTemplateFinder ddmTemplateFinder;
845 @BeanReference(type = CounterLocalService.class)
846 protected CounterLocalService counterLocalService;
847 @BeanReference(type = ResourceLocalService.class)
848 protected ResourceLocalService resourceLocalService;
849 @BeanReference(type = ResourceService.class)
850 protected ResourceService resourceService;
851 @BeanReference(type = ResourcePersistence.class)
852 protected ResourcePersistence resourcePersistence;
853 @BeanReference(type = ResourceFinder.class)
854 protected ResourceFinder resourceFinder;
855 @BeanReference(type = UserLocalService.class)
856 protected UserLocalService userLocalService;
857 @BeanReference(type = UserService.class)
858 protected UserService userService;
859 @BeanReference(type = UserPersistence.class)
860 protected UserPersistence userPersistence;
861 @BeanReference(type = UserFinder.class)
862 protected UserFinder userFinder;
863 @BeanReference(type = PersistedModelLocalServiceRegistry.class)
864 protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
865 private static Log _log = LogFactoryUtil.getLog(DDMStorageLinkLocalServiceBaseImpl.class);
866 private String _beanIdentifier;
867 }