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.dao.orm.DynamicQueryFactoryUtil;
025 import com.liferay.portal.kernel.exception.PortalException;
026 import com.liferay.portal.kernel.exception.SystemException;
027 import com.liferay.portal.kernel.search.Indexable;
028 import com.liferay.portal.kernel.search.IndexableType;
029 import com.liferay.portal.kernel.util.OrderByComparator;
030 import com.liferay.portal.model.PersistedModel;
031 import com.liferay.portal.service.BaseLocalServiceImpl;
032 import com.liferay.portal.service.PersistedModelLocalServiceRegistry;
033 import com.liferay.portal.service.ResourceLocalService;
034 import com.liferay.portal.service.ResourceService;
035 import com.liferay.portal.service.UserLocalService;
036 import com.liferay.portal.service.UserService;
037 import com.liferay.portal.service.persistence.ResourceFinder;
038 import com.liferay.portal.service.persistence.ResourcePersistence;
039 import com.liferay.portal.service.persistence.UserFinder;
040 import com.liferay.portal.service.persistence.UserPersistence;
041
042 import com.liferay.portlet.dynamicdatamapping.model.DDMTemplate;
043 import com.liferay.portlet.dynamicdatamapping.service.DDMContentLocalService;
044 import com.liferay.portlet.dynamicdatamapping.service.DDMStorageLinkLocalService;
045 import com.liferay.portlet.dynamicdatamapping.service.DDMStructureLinkLocalService;
046 import com.liferay.portlet.dynamicdatamapping.service.DDMStructureLocalService;
047 import com.liferay.portlet.dynamicdatamapping.service.DDMStructureService;
048 import com.liferay.portlet.dynamicdatamapping.service.DDMTemplateLocalService;
049 import com.liferay.portlet.dynamicdatamapping.service.DDMTemplateService;
050 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMContentPersistence;
051 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMStorageLinkPersistence;
052 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMStructureFinder;
053 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMStructureLinkPersistence;
054 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMStructurePersistence;
055 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMTemplateFinder;
056 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMTemplatePersistence;
057
058 import java.io.Serializable;
059
060 import java.util.List;
061
062 import javax.sql.DataSource;
063
064
076 public abstract class DDMTemplateLocalServiceBaseImpl
077 extends BaseLocalServiceImpl implements DDMTemplateLocalService,
078 IdentifiableBean {
079
084
085
092 @Indexable(type = IndexableType.REINDEX)
093 public DDMTemplate addDDMTemplate(DDMTemplate ddmTemplate)
094 throws SystemException {
095 ddmTemplate.setNew(true);
096
097 return ddmTemplatePersistence.update(ddmTemplate, false);
098 }
099
100
106 public DDMTemplate createDDMTemplate(long templateId) {
107 return ddmTemplatePersistence.create(templateId);
108 }
109
110
118 @Indexable(type = IndexableType.DELETE)
119 public DDMTemplate deleteDDMTemplate(long templateId)
120 throws PortalException, SystemException {
121 return ddmTemplatePersistence.remove(templateId);
122 }
123
124
131 @Indexable(type = IndexableType.DELETE)
132 public DDMTemplate deleteDDMTemplate(DDMTemplate ddmTemplate)
133 throws SystemException {
134 return ddmTemplatePersistence.remove(ddmTemplate);
135 }
136
137 public DynamicQuery dynamicQuery() {
138 Class<?> clazz = getClass();
139
140 return DynamicQueryFactoryUtil.forClass(DDMTemplate.class,
141 clazz.getClassLoader());
142 }
143
144
151 @SuppressWarnings("rawtypes")
152 public List dynamicQuery(DynamicQuery dynamicQuery)
153 throws SystemException {
154 return ddmTemplatePersistence.findWithDynamicQuery(dynamicQuery);
155 }
156
157
170 @SuppressWarnings("rawtypes")
171 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
172 throws SystemException {
173 return ddmTemplatePersistence.findWithDynamicQuery(dynamicQuery, start,
174 end);
175 }
176
177
191 @SuppressWarnings("rawtypes")
192 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end,
193 OrderByComparator orderByComparator) throws SystemException {
194 return ddmTemplatePersistence.findWithDynamicQuery(dynamicQuery, start,
195 end, orderByComparator);
196 }
197
198
205 public long dynamicQueryCount(DynamicQuery dynamicQuery)
206 throws SystemException {
207 return ddmTemplatePersistence.countWithDynamicQuery(dynamicQuery);
208 }
209
210 public DDMTemplate fetchDDMTemplate(long templateId)
211 throws SystemException {
212 return ddmTemplatePersistence.fetchByPrimaryKey(templateId);
213 }
214
215
223 public DDMTemplate getDDMTemplate(long templateId)
224 throws PortalException, SystemException {
225 return ddmTemplatePersistence.findByPrimaryKey(templateId);
226 }
227
228 public PersistedModel getPersistedModel(Serializable primaryKeyObj)
229 throws PortalException, SystemException {
230 return ddmTemplatePersistence.findByPrimaryKey(primaryKeyObj);
231 }
232
233
242 public DDMTemplate getDDMTemplateByUuidAndGroupId(String uuid, long groupId)
243 throws PortalException, SystemException {
244 return ddmTemplatePersistence.findByUUID_G(uuid, groupId);
245 }
246
247
259 public List<DDMTemplate> getDDMTemplates(int start, int end)
260 throws SystemException {
261 return ddmTemplatePersistence.findAll(start, end);
262 }
263
264
270 public int getDDMTemplatesCount() throws SystemException {
271 return ddmTemplatePersistence.countAll();
272 }
273
274
281 @Indexable(type = IndexableType.REINDEX)
282 public DDMTemplate updateDDMTemplate(DDMTemplate ddmTemplate)
283 throws SystemException {
284 return updateDDMTemplate(ddmTemplate, true);
285 }
286
287
295 @Indexable(type = IndexableType.REINDEX)
296 public DDMTemplate updateDDMTemplate(DDMTemplate ddmTemplate, boolean merge)
297 throws SystemException {
298 ddmTemplate.setNew(false);
299
300 return ddmTemplatePersistence.update(ddmTemplate, merge);
301 }
302
303
308 public DDMContentLocalService getDDMContentLocalService() {
309 return ddmContentLocalService;
310 }
311
312
317 public void setDDMContentLocalService(
318 DDMContentLocalService ddmContentLocalService) {
319 this.ddmContentLocalService = ddmContentLocalService;
320 }
321
322
327 public DDMContentPersistence getDDMContentPersistence() {
328 return ddmContentPersistence;
329 }
330
331
336 public void setDDMContentPersistence(
337 DDMContentPersistence ddmContentPersistence) {
338 this.ddmContentPersistence = ddmContentPersistence;
339 }
340
341
346 public DDMStorageLinkLocalService getDDMStorageLinkLocalService() {
347 return ddmStorageLinkLocalService;
348 }
349
350
355 public void setDDMStorageLinkLocalService(
356 DDMStorageLinkLocalService ddmStorageLinkLocalService) {
357 this.ddmStorageLinkLocalService = ddmStorageLinkLocalService;
358 }
359
360
365 public DDMStorageLinkPersistence getDDMStorageLinkPersistence() {
366 return ddmStorageLinkPersistence;
367 }
368
369
374 public void setDDMStorageLinkPersistence(
375 DDMStorageLinkPersistence ddmStorageLinkPersistence) {
376 this.ddmStorageLinkPersistence = ddmStorageLinkPersistence;
377 }
378
379
384 public DDMStructureLocalService getDDMStructureLocalService() {
385 return ddmStructureLocalService;
386 }
387
388
393 public void setDDMStructureLocalService(
394 DDMStructureLocalService ddmStructureLocalService) {
395 this.ddmStructureLocalService = ddmStructureLocalService;
396 }
397
398
403 public DDMStructureService getDDMStructureService() {
404 return ddmStructureService;
405 }
406
407
412 public void setDDMStructureService(DDMStructureService ddmStructureService) {
413 this.ddmStructureService = ddmStructureService;
414 }
415
416
421 public DDMStructurePersistence getDDMStructurePersistence() {
422 return ddmStructurePersistence;
423 }
424
425
430 public void setDDMStructurePersistence(
431 DDMStructurePersistence ddmStructurePersistence) {
432 this.ddmStructurePersistence = ddmStructurePersistence;
433 }
434
435
440 public DDMStructureFinder getDDMStructureFinder() {
441 return ddmStructureFinder;
442 }
443
444
449 public void setDDMStructureFinder(DDMStructureFinder ddmStructureFinder) {
450 this.ddmStructureFinder = ddmStructureFinder;
451 }
452
453
458 public DDMStructureLinkLocalService getDDMStructureLinkLocalService() {
459 return ddmStructureLinkLocalService;
460 }
461
462
467 public void setDDMStructureLinkLocalService(
468 DDMStructureLinkLocalService ddmStructureLinkLocalService) {
469 this.ddmStructureLinkLocalService = ddmStructureLinkLocalService;
470 }
471
472
477 public DDMStructureLinkPersistence getDDMStructureLinkPersistence() {
478 return ddmStructureLinkPersistence;
479 }
480
481
486 public void setDDMStructureLinkPersistence(
487 DDMStructureLinkPersistence ddmStructureLinkPersistence) {
488 this.ddmStructureLinkPersistence = ddmStructureLinkPersistence;
489 }
490
491
496 public DDMTemplateLocalService getDDMTemplateLocalService() {
497 return ddmTemplateLocalService;
498 }
499
500
505 public void setDDMTemplateLocalService(
506 DDMTemplateLocalService ddmTemplateLocalService) {
507 this.ddmTemplateLocalService = ddmTemplateLocalService;
508 }
509
510
515 public DDMTemplateService getDDMTemplateService() {
516 return ddmTemplateService;
517 }
518
519
524 public void setDDMTemplateService(DDMTemplateService ddmTemplateService) {
525 this.ddmTemplateService = ddmTemplateService;
526 }
527
528
533 public DDMTemplatePersistence getDDMTemplatePersistence() {
534 return ddmTemplatePersistence;
535 }
536
537
542 public void setDDMTemplatePersistence(
543 DDMTemplatePersistence ddmTemplatePersistence) {
544 this.ddmTemplatePersistence = ddmTemplatePersistence;
545 }
546
547
552 public DDMTemplateFinder getDDMTemplateFinder() {
553 return ddmTemplateFinder;
554 }
555
556
561 public void setDDMTemplateFinder(DDMTemplateFinder ddmTemplateFinder) {
562 this.ddmTemplateFinder = ddmTemplateFinder;
563 }
564
565
570 public CounterLocalService getCounterLocalService() {
571 return counterLocalService;
572 }
573
574
579 public void setCounterLocalService(CounterLocalService counterLocalService) {
580 this.counterLocalService = counterLocalService;
581 }
582
583
588 public ResourceLocalService getResourceLocalService() {
589 return resourceLocalService;
590 }
591
592
597 public void setResourceLocalService(
598 ResourceLocalService resourceLocalService) {
599 this.resourceLocalService = resourceLocalService;
600 }
601
602
607 public ResourceService getResourceService() {
608 return resourceService;
609 }
610
611
616 public void setResourceService(ResourceService resourceService) {
617 this.resourceService = resourceService;
618 }
619
620
625 public ResourcePersistence getResourcePersistence() {
626 return resourcePersistence;
627 }
628
629
634 public void setResourcePersistence(ResourcePersistence resourcePersistence) {
635 this.resourcePersistence = resourcePersistence;
636 }
637
638
643 public ResourceFinder getResourceFinder() {
644 return resourceFinder;
645 }
646
647
652 public void setResourceFinder(ResourceFinder resourceFinder) {
653 this.resourceFinder = resourceFinder;
654 }
655
656
661 public UserLocalService getUserLocalService() {
662 return userLocalService;
663 }
664
665
670 public void setUserLocalService(UserLocalService userLocalService) {
671 this.userLocalService = userLocalService;
672 }
673
674
679 public UserService getUserService() {
680 return userService;
681 }
682
683
688 public void setUserService(UserService userService) {
689 this.userService = userService;
690 }
691
692
697 public UserPersistence getUserPersistence() {
698 return userPersistence;
699 }
700
701
706 public void setUserPersistence(UserPersistence userPersistence) {
707 this.userPersistence = userPersistence;
708 }
709
710
715 public UserFinder getUserFinder() {
716 return userFinder;
717 }
718
719
724 public void setUserFinder(UserFinder userFinder) {
725 this.userFinder = userFinder;
726 }
727
728 public void afterPropertiesSet() {
729 persistedModelLocalServiceRegistry.register("com.liferay.portlet.dynamicdatamapping.model.DDMTemplate",
730 ddmTemplateLocalService);
731 }
732
733 public void destroy() {
734 persistedModelLocalServiceRegistry.unregister(
735 "com.liferay.portlet.dynamicdatamapping.model.DDMTemplate");
736 }
737
738
743 public String getBeanIdentifier() {
744 return _beanIdentifier;
745 }
746
747
752 public void setBeanIdentifier(String beanIdentifier) {
753 _beanIdentifier = beanIdentifier;
754 }
755
756 protected Class<?> getModelClass() {
757 return DDMTemplate.class;
758 }
759
760 protected String getModelClassName() {
761 return DDMTemplate.class.getName();
762 }
763
764
769 protected void runSQL(String sql) throws SystemException {
770 try {
771 DataSource dataSource = ddmTemplatePersistence.getDataSource();
772
773 SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
774 sql, new int[0]);
775
776 sqlUpdate.update();
777 }
778 catch (Exception e) {
779 throw new SystemException(e);
780 }
781 }
782
783 @BeanReference(type = DDMContentLocalService.class)
784 protected DDMContentLocalService ddmContentLocalService;
785 @BeanReference(type = DDMContentPersistence.class)
786 protected DDMContentPersistence ddmContentPersistence;
787 @BeanReference(type = DDMStorageLinkLocalService.class)
788 protected DDMStorageLinkLocalService ddmStorageLinkLocalService;
789 @BeanReference(type = DDMStorageLinkPersistence.class)
790 protected DDMStorageLinkPersistence ddmStorageLinkPersistence;
791 @BeanReference(type = DDMStructureLocalService.class)
792 protected DDMStructureLocalService ddmStructureLocalService;
793 @BeanReference(type = DDMStructureService.class)
794 protected DDMStructureService ddmStructureService;
795 @BeanReference(type = DDMStructurePersistence.class)
796 protected DDMStructurePersistence ddmStructurePersistence;
797 @BeanReference(type = DDMStructureFinder.class)
798 protected DDMStructureFinder ddmStructureFinder;
799 @BeanReference(type = DDMStructureLinkLocalService.class)
800 protected DDMStructureLinkLocalService ddmStructureLinkLocalService;
801 @BeanReference(type = DDMStructureLinkPersistence.class)
802 protected DDMStructureLinkPersistence ddmStructureLinkPersistence;
803 @BeanReference(type = DDMTemplateLocalService.class)
804 protected DDMTemplateLocalService ddmTemplateLocalService;
805 @BeanReference(type = DDMTemplateService.class)
806 protected DDMTemplateService ddmTemplateService;
807 @BeanReference(type = DDMTemplatePersistence.class)
808 protected DDMTemplatePersistence ddmTemplatePersistence;
809 @BeanReference(type = DDMTemplateFinder.class)
810 protected DDMTemplateFinder ddmTemplateFinder;
811 @BeanReference(type = CounterLocalService.class)
812 protected CounterLocalService counterLocalService;
813 @BeanReference(type = ResourceLocalService.class)
814 protected ResourceLocalService resourceLocalService;
815 @BeanReference(type = ResourceService.class)
816 protected ResourceService resourceService;
817 @BeanReference(type = ResourcePersistence.class)
818 protected ResourcePersistence resourcePersistence;
819 @BeanReference(type = ResourceFinder.class)
820 protected ResourceFinder resourceFinder;
821 @BeanReference(type = UserLocalService.class)
822 protected UserLocalService userLocalService;
823 @BeanReference(type = UserService.class)
824 protected UserService userService;
825 @BeanReference(type = UserPersistence.class)
826 protected UserPersistence userPersistence;
827 @BeanReference(type = UserFinder.class)
828 protected UserFinder userFinder;
829 @BeanReference(type = PersistedModelLocalServiceRegistry.class)
830 protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
831 private String _beanIdentifier;
832 }