001
014
015 package com.liferay.portlet.dynamicdatalists.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.WorkflowInstanceLinkLocalService;
039 import com.liferay.portal.service.persistence.ResourceFinder;
040 import com.liferay.portal.service.persistence.ResourcePersistence;
041 import com.liferay.portal.service.persistence.UserFinder;
042 import com.liferay.portal.service.persistence.UserPersistence;
043 import com.liferay.portal.service.persistence.WorkflowInstanceLinkPersistence;
044
045 import com.liferay.portlet.asset.service.AssetEntryLocalService;
046 import com.liferay.portlet.asset.service.AssetEntryService;
047 import com.liferay.portlet.asset.service.persistence.AssetEntryFinder;
048 import com.liferay.portlet.asset.service.persistence.AssetEntryPersistence;
049 import com.liferay.portlet.dynamicdatalists.model.DDLRecord;
050 import com.liferay.portlet.dynamicdatalists.service.DDLRecordLocalService;
051 import com.liferay.portlet.dynamicdatalists.service.DDLRecordService;
052 import com.liferay.portlet.dynamicdatalists.service.DDLRecordSetLocalService;
053 import com.liferay.portlet.dynamicdatalists.service.DDLRecordSetService;
054 import com.liferay.portlet.dynamicdatalists.service.persistence.DDLRecordFinder;
055 import com.liferay.portlet.dynamicdatalists.service.persistence.DDLRecordPersistence;
056 import com.liferay.portlet.dynamicdatalists.service.persistence.DDLRecordSetFinder;
057 import com.liferay.portlet.dynamicdatalists.service.persistence.DDLRecordSetPersistence;
058 import com.liferay.portlet.dynamicdatalists.service.persistence.DDLRecordVersionPersistence;
059 import com.liferay.portlet.dynamicdatamapping.service.DDMStructureLocalService;
060 import com.liferay.portlet.dynamicdatamapping.service.DDMStructureService;
061 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMStructureFinder;
062 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMStructurePersistence;
063
064 import java.io.Serializable;
065
066 import java.util.List;
067
068 import javax.sql.DataSource;
069
070
082 public abstract class DDLRecordLocalServiceBaseImpl
083 implements DDLRecordLocalService, IdentifiableBean {
084
089
090
097 public DDLRecord addDDLRecord(DDLRecord ddlRecord)
098 throws SystemException {
099 ddlRecord.setNew(true);
100
101 ddlRecord = ddlRecordPersistence.update(ddlRecord, false);
102
103 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
104
105 if (indexer != null) {
106 try {
107 indexer.reindex(ddlRecord);
108 }
109 catch (SearchException se) {
110 if (_log.isWarnEnabled()) {
111 _log.warn(se, se);
112 }
113 }
114 }
115
116 return ddlRecord;
117 }
118
119
125 public DDLRecord createDDLRecord(long recordId) {
126 return ddlRecordPersistence.create(recordId);
127 }
128
129
136 public void deleteDDLRecord(long recordId)
137 throws PortalException, SystemException {
138 DDLRecord ddlRecord = ddlRecordPersistence.remove(recordId);
139
140 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
141
142 if (indexer != null) {
143 try {
144 indexer.delete(ddlRecord);
145 }
146 catch (SearchException se) {
147 if (_log.isWarnEnabled()) {
148 _log.warn(se, se);
149 }
150 }
151 }
152 }
153
154
160 public void deleteDDLRecord(DDLRecord ddlRecord) throws SystemException {
161 ddlRecordPersistence.remove(ddlRecord);
162
163 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
164
165 if (indexer != null) {
166 try {
167 indexer.delete(ddlRecord);
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 ddlRecordPersistence.findWithDynamicQuery(dynamicQuery);
188 }
189
190
203 @SuppressWarnings("rawtypes")
204 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
205 throws SystemException {
206 return ddlRecordPersistence.findWithDynamicQuery(dynamicQuery, start,
207 end);
208 }
209
210
224 @SuppressWarnings("rawtypes")
225 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end,
226 OrderByComparator orderByComparator) throws SystemException {
227 return ddlRecordPersistence.findWithDynamicQuery(dynamicQuery, start,
228 end, orderByComparator);
229 }
230
231
238 public long dynamicQueryCount(DynamicQuery dynamicQuery)
239 throws SystemException {
240 return ddlRecordPersistence.countWithDynamicQuery(dynamicQuery);
241 }
242
243 public DDLRecord fetchDDLRecord(long recordId) throws SystemException {
244 return ddlRecordPersistence.fetchByPrimaryKey(recordId);
245 }
246
247
255 public DDLRecord getDDLRecord(long recordId)
256 throws PortalException, SystemException {
257 return ddlRecordPersistence.findByPrimaryKey(recordId);
258 }
259
260 public PersistedModel getPersistedModel(Serializable primaryKeyObj)
261 throws PortalException, SystemException {
262 return ddlRecordPersistence.findByPrimaryKey(primaryKeyObj);
263 }
264
265
274 public DDLRecord getDDLRecordByUuidAndGroupId(String uuid, long groupId)
275 throws PortalException, SystemException {
276 return ddlRecordPersistence.findByUUID_G(uuid, groupId);
277 }
278
279
291 public List<DDLRecord> getDDLRecords(int start, int end)
292 throws SystemException {
293 return ddlRecordPersistence.findAll(start, end);
294 }
295
296
302 public int getDDLRecordsCount() throws SystemException {
303 return ddlRecordPersistence.countAll();
304 }
305
306
313 public DDLRecord updateDDLRecord(DDLRecord ddlRecord)
314 throws SystemException {
315 return updateDDLRecord(ddlRecord, true);
316 }
317
318
326 public DDLRecord updateDDLRecord(DDLRecord ddlRecord, boolean merge)
327 throws SystemException {
328 ddlRecord.setNew(false);
329
330 ddlRecord = ddlRecordPersistence.update(ddlRecord, merge);
331
332 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
333
334 if (indexer != null) {
335 try {
336 indexer.reindex(ddlRecord);
337 }
338 catch (SearchException se) {
339 if (_log.isWarnEnabled()) {
340 _log.warn(se, se);
341 }
342 }
343 }
344
345 return ddlRecord;
346 }
347
348
353 public DDLRecordLocalService getDDLRecordLocalService() {
354 return ddlRecordLocalService;
355 }
356
357
362 public void setDDLRecordLocalService(
363 DDLRecordLocalService ddlRecordLocalService) {
364 this.ddlRecordLocalService = ddlRecordLocalService;
365 }
366
367
372 public DDLRecordService getDDLRecordService() {
373 return ddlRecordService;
374 }
375
376
381 public void setDDLRecordService(DDLRecordService ddlRecordService) {
382 this.ddlRecordService = ddlRecordService;
383 }
384
385
390 public DDLRecordPersistence getDDLRecordPersistence() {
391 return ddlRecordPersistence;
392 }
393
394
399 public void setDDLRecordPersistence(
400 DDLRecordPersistence ddlRecordPersistence) {
401 this.ddlRecordPersistence = ddlRecordPersistence;
402 }
403
404
409 public DDLRecordFinder getDDLRecordFinder() {
410 return ddlRecordFinder;
411 }
412
413
418 public void setDDLRecordFinder(DDLRecordFinder ddlRecordFinder) {
419 this.ddlRecordFinder = ddlRecordFinder;
420 }
421
422
427 public DDLRecordSetLocalService getDDLRecordSetLocalService() {
428 return ddlRecordSetLocalService;
429 }
430
431
436 public void setDDLRecordSetLocalService(
437 DDLRecordSetLocalService ddlRecordSetLocalService) {
438 this.ddlRecordSetLocalService = ddlRecordSetLocalService;
439 }
440
441
446 public DDLRecordSetService getDDLRecordSetService() {
447 return ddlRecordSetService;
448 }
449
450
455 public void setDDLRecordSetService(DDLRecordSetService ddlRecordSetService) {
456 this.ddlRecordSetService = ddlRecordSetService;
457 }
458
459
464 public DDLRecordSetPersistence getDDLRecordSetPersistence() {
465 return ddlRecordSetPersistence;
466 }
467
468
473 public void setDDLRecordSetPersistence(
474 DDLRecordSetPersistence ddlRecordSetPersistence) {
475 this.ddlRecordSetPersistence = ddlRecordSetPersistence;
476 }
477
478
483 public DDLRecordSetFinder getDDLRecordSetFinder() {
484 return ddlRecordSetFinder;
485 }
486
487
492 public void setDDLRecordSetFinder(DDLRecordSetFinder ddlRecordSetFinder) {
493 this.ddlRecordSetFinder = ddlRecordSetFinder;
494 }
495
496
501 public DDLRecordVersionPersistence getDDLRecordVersionPersistence() {
502 return ddlRecordVersionPersistence;
503 }
504
505
510 public void setDDLRecordVersionPersistence(
511 DDLRecordVersionPersistence ddlRecordVersionPersistence) {
512 this.ddlRecordVersionPersistence = ddlRecordVersionPersistence;
513 }
514
515
520 public CounterLocalService getCounterLocalService() {
521 return counterLocalService;
522 }
523
524
529 public void setCounterLocalService(CounterLocalService counterLocalService) {
530 this.counterLocalService = counterLocalService;
531 }
532
533
538 public ResourceLocalService getResourceLocalService() {
539 return resourceLocalService;
540 }
541
542
547 public void setResourceLocalService(
548 ResourceLocalService resourceLocalService) {
549 this.resourceLocalService = resourceLocalService;
550 }
551
552
557 public ResourceService getResourceService() {
558 return resourceService;
559 }
560
561
566 public void setResourceService(ResourceService resourceService) {
567 this.resourceService = resourceService;
568 }
569
570
575 public ResourcePersistence getResourcePersistence() {
576 return resourcePersistence;
577 }
578
579
584 public void setResourcePersistence(ResourcePersistence resourcePersistence) {
585 this.resourcePersistence = resourcePersistence;
586 }
587
588
593 public ResourceFinder getResourceFinder() {
594 return resourceFinder;
595 }
596
597
602 public void setResourceFinder(ResourceFinder resourceFinder) {
603 this.resourceFinder = resourceFinder;
604 }
605
606
611 public UserLocalService getUserLocalService() {
612 return userLocalService;
613 }
614
615
620 public void setUserLocalService(UserLocalService userLocalService) {
621 this.userLocalService = userLocalService;
622 }
623
624
629 public UserService getUserService() {
630 return userService;
631 }
632
633
638 public void setUserService(UserService userService) {
639 this.userService = userService;
640 }
641
642
647 public UserPersistence getUserPersistence() {
648 return userPersistence;
649 }
650
651
656 public void setUserPersistence(UserPersistence userPersistence) {
657 this.userPersistence = userPersistence;
658 }
659
660
665 public UserFinder getUserFinder() {
666 return userFinder;
667 }
668
669
674 public void setUserFinder(UserFinder userFinder) {
675 this.userFinder = userFinder;
676 }
677
678
683 public WorkflowInstanceLinkLocalService getWorkflowInstanceLinkLocalService() {
684 return workflowInstanceLinkLocalService;
685 }
686
687
692 public void setWorkflowInstanceLinkLocalService(
693 WorkflowInstanceLinkLocalService workflowInstanceLinkLocalService) {
694 this.workflowInstanceLinkLocalService = workflowInstanceLinkLocalService;
695 }
696
697
702 public WorkflowInstanceLinkPersistence getWorkflowInstanceLinkPersistence() {
703 return workflowInstanceLinkPersistence;
704 }
705
706
711 public void setWorkflowInstanceLinkPersistence(
712 WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence) {
713 this.workflowInstanceLinkPersistence = workflowInstanceLinkPersistence;
714 }
715
716
721 public AssetEntryLocalService getAssetEntryLocalService() {
722 return assetEntryLocalService;
723 }
724
725
730 public void setAssetEntryLocalService(
731 AssetEntryLocalService assetEntryLocalService) {
732 this.assetEntryLocalService = assetEntryLocalService;
733 }
734
735
740 public AssetEntryService getAssetEntryService() {
741 return assetEntryService;
742 }
743
744
749 public void setAssetEntryService(AssetEntryService assetEntryService) {
750 this.assetEntryService = assetEntryService;
751 }
752
753
758 public AssetEntryPersistence getAssetEntryPersistence() {
759 return assetEntryPersistence;
760 }
761
762
767 public void setAssetEntryPersistence(
768 AssetEntryPersistence assetEntryPersistence) {
769 this.assetEntryPersistence = assetEntryPersistence;
770 }
771
772
777 public AssetEntryFinder getAssetEntryFinder() {
778 return assetEntryFinder;
779 }
780
781
786 public void setAssetEntryFinder(AssetEntryFinder assetEntryFinder) {
787 this.assetEntryFinder = assetEntryFinder;
788 }
789
790
795 public DDMStructureLocalService getDDMStructureLocalService() {
796 return ddmStructureLocalService;
797 }
798
799
804 public void setDDMStructureLocalService(
805 DDMStructureLocalService ddmStructureLocalService) {
806 this.ddmStructureLocalService = ddmStructureLocalService;
807 }
808
809
814 public DDMStructureService getDDMStructureService() {
815 return ddmStructureService;
816 }
817
818
823 public void setDDMStructureService(DDMStructureService ddmStructureService) {
824 this.ddmStructureService = ddmStructureService;
825 }
826
827
832 public DDMStructurePersistence getDDMStructurePersistence() {
833 return ddmStructurePersistence;
834 }
835
836
841 public void setDDMStructurePersistence(
842 DDMStructurePersistence ddmStructurePersistence) {
843 this.ddmStructurePersistence = ddmStructurePersistence;
844 }
845
846
851 public DDMStructureFinder getDDMStructureFinder() {
852 return ddmStructureFinder;
853 }
854
855
860 public void setDDMStructureFinder(DDMStructureFinder ddmStructureFinder) {
861 this.ddmStructureFinder = ddmStructureFinder;
862 }
863
864 public void afterPropertiesSet() {
865 persistedModelLocalServiceRegistry.register("com.liferay.portlet.dynamicdatalists.model.DDLRecord",
866 ddlRecordLocalService);
867 }
868
869 public void destroy() {
870 persistedModelLocalServiceRegistry.unregister(
871 "com.liferay.portlet.dynamicdatalists.model.DDLRecord");
872 }
873
874
879 public String getBeanIdentifier() {
880 return _beanIdentifier;
881 }
882
883
888 public void setBeanIdentifier(String beanIdentifier) {
889 _beanIdentifier = beanIdentifier;
890 }
891
892 protected ClassLoader getClassLoader() {
893 Class<?> clazz = getClass();
894
895 return clazz.getClassLoader();
896 }
897
898 protected Class<?> getModelClass() {
899 return DDLRecord.class;
900 }
901
902 protected String getModelClassName() {
903 return DDLRecord.class.getName();
904 }
905
906
911 protected void runSQL(String sql) throws SystemException {
912 try {
913 DataSource dataSource = ddlRecordPersistence.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 = DDLRecordLocalService.class)
926 protected DDLRecordLocalService ddlRecordLocalService;
927 @BeanReference(type = DDLRecordService.class)
928 protected DDLRecordService ddlRecordService;
929 @BeanReference(type = DDLRecordPersistence.class)
930 protected DDLRecordPersistence ddlRecordPersistence;
931 @BeanReference(type = DDLRecordFinder.class)
932 protected DDLRecordFinder ddlRecordFinder;
933 @BeanReference(type = DDLRecordSetLocalService.class)
934 protected DDLRecordSetLocalService ddlRecordSetLocalService;
935 @BeanReference(type = DDLRecordSetService.class)
936 protected DDLRecordSetService ddlRecordSetService;
937 @BeanReference(type = DDLRecordSetPersistence.class)
938 protected DDLRecordSetPersistence ddlRecordSetPersistence;
939 @BeanReference(type = DDLRecordSetFinder.class)
940 protected DDLRecordSetFinder ddlRecordSetFinder;
941 @BeanReference(type = DDLRecordVersionPersistence.class)
942 protected DDLRecordVersionPersistence ddlRecordVersionPersistence;
943 @BeanReference(type = CounterLocalService.class)
944 protected CounterLocalService counterLocalService;
945 @BeanReference(type = ResourceLocalService.class)
946 protected ResourceLocalService resourceLocalService;
947 @BeanReference(type = ResourceService.class)
948 protected ResourceService resourceService;
949 @BeanReference(type = ResourcePersistence.class)
950 protected ResourcePersistence resourcePersistence;
951 @BeanReference(type = ResourceFinder.class)
952 protected ResourceFinder resourceFinder;
953 @BeanReference(type = UserLocalService.class)
954 protected UserLocalService userLocalService;
955 @BeanReference(type = UserService.class)
956 protected UserService userService;
957 @BeanReference(type = UserPersistence.class)
958 protected UserPersistence userPersistence;
959 @BeanReference(type = UserFinder.class)
960 protected UserFinder userFinder;
961 @BeanReference(type = WorkflowInstanceLinkLocalService.class)
962 protected WorkflowInstanceLinkLocalService workflowInstanceLinkLocalService;
963 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
964 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
965 @BeanReference(type = AssetEntryLocalService.class)
966 protected AssetEntryLocalService assetEntryLocalService;
967 @BeanReference(type = AssetEntryService.class)
968 protected AssetEntryService assetEntryService;
969 @BeanReference(type = AssetEntryPersistence.class)
970 protected AssetEntryPersistence assetEntryPersistence;
971 @BeanReference(type = AssetEntryFinder.class)
972 protected AssetEntryFinder assetEntryFinder;
973 @BeanReference(type = DDMStructureLocalService.class)
974 protected DDMStructureLocalService ddmStructureLocalService;
975 @BeanReference(type = DDMStructureService.class)
976 protected DDMStructureService ddmStructureService;
977 @BeanReference(type = DDMStructurePersistence.class)
978 protected DDMStructurePersistence ddmStructurePersistence;
979 @BeanReference(type = DDMStructureFinder.class)
980 protected DDMStructureFinder ddmStructureFinder;
981 @BeanReference(type = PersistedModelLocalServiceRegistry.class)
982 protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
983 private static Log _log = LogFactoryUtil.getLog(DDLRecordLocalServiceBaseImpl.class);
984 private String _beanIdentifier;
985 }