001
014
015 package com.liferay.portlet.journal.service.base;
016
017 import aQute.bnd.annotation.ProviderType;
018
019 import com.liferay.portal.kernel.bean.BeanReference;
020 import com.liferay.portal.kernel.bean.IdentifiableBean;
021 import com.liferay.portal.kernel.dao.db.DB;
022 import com.liferay.portal.kernel.dao.db.DBFactoryUtil;
023 import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
024 import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
025 import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery;
026 import com.liferay.portal.kernel.dao.orm.DefaultActionableDynamicQuery;
027 import com.liferay.portal.kernel.dao.orm.DynamicQuery;
028 import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil;
029 import com.liferay.portal.kernel.dao.orm.ExportActionableDynamicQuery;
030 import com.liferay.portal.kernel.dao.orm.Projection;
031 import com.liferay.portal.kernel.exception.PortalException;
032 import com.liferay.portal.kernel.exception.SystemException;
033 import com.liferay.portal.kernel.lar.ExportImportHelperUtil;
034 import com.liferay.portal.kernel.lar.ManifestSummary;
035 import com.liferay.portal.kernel.lar.PortletDataContext;
036 import com.liferay.portal.kernel.lar.StagedModelDataHandlerUtil;
037 import com.liferay.portal.kernel.lar.StagedModelType;
038 import com.liferay.portal.kernel.search.Indexable;
039 import com.liferay.portal.kernel.search.IndexableType;
040 import com.liferay.portal.kernel.util.OrderByComparator;
041 import com.liferay.portal.model.PersistedModel;
042 import com.liferay.portal.service.BaseLocalServiceImpl;
043 import com.liferay.portal.service.PersistedModelLocalServiceRegistry;
044 import com.liferay.portal.service.persistence.ClassNamePersistence;
045 import com.liferay.portal.service.persistence.SystemEventPersistence;
046 import com.liferay.portal.service.persistence.UserFinder;
047 import com.liferay.portal.service.persistence.UserPersistence;
048 import com.liferay.portal.util.PortalUtil;
049
050 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMStructureFinder;
051 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMStructurePersistence;
052 import com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence;
053 import com.liferay.portlet.journal.model.JournalFeed;
054 import com.liferay.portlet.journal.service.JournalFeedLocalService;
055 import com.liferay.portlet.journal.service.persistence.JournalFeedFinder;
056 import com.liferay.portlet.journal.service.persistence.JournalFeedPersistence;
057
058 import java.io.Serializable;
059
060 import java.util.List;
061
062 import javax.sql.DataSource;
063
064
076 @ProviderType
077 public abstract class JournalFeedLocalServiceBaseImpl
078 extends BaseLocalServiceImpl implements JournalFeedLocalService,
079 IdentifiableBean {
080
085
086
092 @Indexable(type = IndexableType.REINDEX)
093 @Override
094 public JournalFeed addJournalFeed(JournalFeed journalFeed) {
095 journalFeed.setNew(true);
096
097 return journalFeedPersistence.update(journalFeed);
098 }
099
100
106 @Override
107 public JournalFeed createJournalFeed(long id) {
108 return journalFeedPersistence.create(id);
109 }
110
111
118 @Indexable(type = IndexableType.DELETE)
119 @Override
120 public JournalFeed deleteJournalFeed(long id) throws PortalException {
121 return journalFeedPersistence.remove(id);
122 }
123
124
130 @Indexable(type = IndexableType.DELETE)
131 @Override
132 public JournalFeed deleteJournalFeed(JournalFeed journalFeed) {
133 return journalFeedPersistence.remove(journalFeed);
134 }
135
136 @Override
137 public DynamicQuery dynamicQuery() {
138 Class<?> clazz = getClass();
139
140 return DynamicQueryFactoryUtil.forClass(JournalFeed.class,
141 clazz.getClassLoader());
142 }
143
144
150 @Override
151 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery) {
152 return journalFeedPersistence.findWithDynamicQuery(dynamicQuery);
153 }
154
155
167 @Override
168 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
169 int end) {
170 return journalFeedPersistence.findWithDynamicQuery(dynamicQuery, start,
171 end);
172 }
173
174
187 @Override
188 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
189 int end, OrderByComparator<T> orderByComparator) {
190 return journalFeedPersistence.findWithDynamicQuery(dynamicQuery, start,
191 end, orderByComparator);
192 }
193
194
200 @Override
201 public long dynamicQueryCount(DynamicQuery dynamicQuery) {
202 return journalFeedPersistence.countWithDynamicQuery(dynamicQuery);
203 }
204
205
212 @Override
213 public long dynamicQueryCount(DynamicQuery dynamicQuery,
214 Projection projection) {
215 return journalFeedPersistence.countWithDynamicQuery(dynamicQuery,
216 projection);
217 }
218
219 @Override
220 public JournalFeed fetchJournalFeed(long id) {
221 return journalFeedPersistence.fetchByPrimaryKey(id);
222 }
223
224
231 @Override
232 public JournalFeed fetchJournalFeedByUuidAndGroupId(String uuid,
233 long groupId) {
234 return journalFeedPersistence.fetchByUUID_G(uuid, groupId);
235 }
236
237
244 @Override
245 public JournalFeed getJournalFeed(long id) throws PortalException {
246 return journalFeedPersistence.findByPrimaryKey(id);
247 }
248
249 @Override
250 public ActionableDynamicQuery getActionableDynamicQuery() {
251 ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
252
253 actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.journal.service.JournalFeedLocalServiceUtil.getService());
254 actionableDynamicQuery.setClass(JournalFeed.class);
255 actionableDynamicQuery.setClassLoader(getClassLoader());
256
257 actionableDynamicQuery.setPrimaryKeyPropertyName("id");
258
259 return actionableDynamicQuery;
260 }
261
262 protected void initActionableDynamicQuery(
263 ActionableDynamicQuery actionableDynamicQuery) {
264 actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.journal.service.JournalFeedLocalServiceUtil.getService());
265 actionableDynamicQuery.setClass(JournalFeed.class);
266 actionableDynamicQuery.setClassLoader(getClassLoader());
267
268 actionableDynamicQuery.setPrimaryKeyPropertyName("id");
269 }
270
271 @Override
272 public ExportActionableDynamicQuery getExportActionableDynamicQuery(
273 final PortletDataContext portletDataContext) {
274 final ExportActionableDynamicQuery exportActionableDynamicQuery = new ExportActionableDynamicQuery() {
275 @Override
276 public long performCount() throws PortalException {
277 ManifestSummary manifestSummary = portletDataContext.getManifestSummary();
278
279 StagedModelType stagedModelType = getStagedModelType();
280
281 long modelAdditionCount = super.performCount();
282
283 manifestSummary.addModelAdditionCount(stagedModelType.toString(),
284 modelAdditionCount);
285
286 long modelDeletionCount = ExportImportHelperUtil.getModelDeletionCount(portletDataContext,
287 stagedModelType);
288
289 manifestSummary.addModelDeletionCount(stagedModelType.toString(),
290 modelDeletionCount);
291
292 return modelAdditionCount;
293 }
294 };
295
296 initActionableDynamicQuery(exportActionableDynamicQuery);
297
298 exportActionableDynamicQuery.setAddCriteriaMethod(new ActionableDynamicQuery.AddCriteriaMethod() {
299 @Override
300 public void addCriteria(DynamicQuery dynamicQuery) {
301 portletDataContext.addDateRangeCriteria(dynamicQuery,
302 "modifiedDate");
303 }
304 });
305
306 exportActionableDynamicQuery.setCompanyId(portletDataContext.getCompanyId());
307
308 exportActionableDynamicQuery.setGroupId(portletDataContext.getScopeGroupId());
309
310 exportActionableDynamicQuery.setPerformActionMethod(new ActionableDynamicQuery.PerformActionMethod() {
311 @Override
312 public void performAction(Object object)
313 throws PortalException {
314 JournalFeed stagedModel = (JournalFeed)object;
315
316 StagedModelDataHandlerUtil.exportStagedModel(portletDataContext,
317 stagedModel);
318 }
319 });
320 exportActionableDynamicQuery.setStagedModelType(new StagedModelType(
321 PortalUtil.getClassNameId(JournalFeed.class.getName())));
322
323 return exportActionableDynamicQuery;
324 }
325
326
329 @Override
330 public PersistedModel deletePersistedModel(PersistedModel persistedModel)
331 throws PortalException {
332 return journalFeedLocalService.deleteJournalFeed((JournalFeed)persistedModel);
333 }
334
335 @Override
336 public PersistedModel getPersistedModel(Serializable primaryKeyObj)
337 throws PortalException {
338 return journalFeedPersistence.findByPrimaryKey(primaryKeyObj);
339 }
340
341
348 @Override
349 public List<JournalFeed> getJournalFeedsByUuidAndCompanyId(String uuid,
350 long companyId) {
351 return journalFeedPersistence.findByUuid_C(uuid, companyId);
352 }
353
354
364 @Override
365 public List<JournalFeed> getJournalFeedsByUuidAndCompanyId(String uuid,
366 long companyId, int start, int end,
367 OrderByComparator<JournalFeed> orderByComparator) {
368 return journalFeedPersistence.findByUuid_C(uuid, companyId, start, end,
369 orderByComparator);
370 }
371
372
380 @Override
381 public JournalFeed getJournalFeedByUuidAndGroupId(String uuid, long groupId)
382 throws PortalException {
383 return journalFeedPersistence.findByUUID_G(uuid, groupId);
384 }
385
386
397 @Override
398 public List<JournalFeed> getJournalFeeds(int start, int end) {
399 return journalFeedPersistence.findAll(start, end);
400 }
401
402
407 @Override
408 public int getJournalFeedsCount() {
409 return journalFeedPersistence.countAll();
410 }
411
412
418 @Indexable(type = IndexableType.REINDEX)
419 @Override
420 public JournalFeed updateJournalFeed(JournalFeed journalFeed) {
421 return journalFeedPersistence.update(journalFeed);
422 }
423
424
429 public com.liferay.portlet.journal.service.JournalFeedLocalService getJournalFeedLocalService() {
430 return journalFeedLocalService;
431 }
432
433
438 public void setJournalFeedLocalService(
439 com.liferay.portlet.journal.service.JournalFeedLocalService journalFeedLocalService) {
440 this.journalFeedLocalService = journalFeedLocalService;
441 }
442
443
448 public com.liferay.portlet.journal.service.JournalFeedService getJournalFeedService() {
449 return journalFeedService;
450 }
451
452
457 public void setJournalFeedService(
458 com.liferay.portlet.journal.service.JournalFeedService journalFeedService) {
459 this.journalFeedService = journalFeedService;
460 }
461
462
467 public JournalFeedPersistence getJournalFeedPersistence() {
468 return journalFeedPersistence;
469 }
470
471
476 public void setJournalFeedPersistence(
477 JournalFeedPersistence journalFeedPersistence) {
478 this.journalFeedPersistence = journalFeedPersistence;
479 }
480
481
486 public JournalFeedFinder getJournalFeedFinder() {
487 return journalFeedFinder;
488 }
489
490
495 public void setJournalFeedFinder(JournalFeedFinder journalFeedFinder) {
496 this.journalFeedFinder = journalFeedFinder;
497 }
498
499
504 public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
505 return counterLocalService;
506 }
507
508
513 public void setCounterLocalService(
514 com.liferay.counter.service.CounterLocalService counterLocalService) {
515 this.counterLocalService = counterLocalService;
516 }
517
518
523 public com.liferay.portal.service.ClassNameLocalService getClassNameLocalService() {
524 return classNameLocalService;
525 }
526
527
532 public void setClassNameLocalService(
533 com.liferay.portal.service.ClassNameLocalService classNameLocalService) {
534 this.classNameLocalService = classNameLocalService;
535 }
536
537
542 public com.liferay.portal.service.ClassNameService getClassNameService() {
543 return classNameService;
544 }
545
546
551 public void setClassNameService(
552 com.liferay.portal.service.ClassNameService classNameService) {
553 this.classNameService = classNameService;
554 }
555
556
561 public ClassNamePersistence getClassNamePersistence() {
562 return classNamePersistence;
563 }
564
565
570 public void setClassNamePersistence(
571 ClassNamePersistence classNamePersistence) {
572 this.classNamePersistence = classNamePersistence;
573 }
574
575
580 public com.liferay.portal.service.ResourceLocalService getResourceLocalService() {
581 return resourceLocalService;
582 }
583
584
589 public void setResourceLocalService(
590 com.liferay.portal.service.ResourceLocalService resourceLocalService) {
591 this.resourceLocalService = resourceLocalService;
592 }
593
594
599 public com.liferay.portal.service.SystemEventLocalService getSystemEventLocalService() {
600 return systemEventLocalService;
601 }
602
603
608 public void setSystemEventLocalService(
609 com.liferay.portal.service.SystemEventLocalService systemEventLocalService) {
610 this.systemEventLocalService = systemEventLocalService;
611 }
612
613
618 public SystemEventPersistence getSystemEventPersistence() {
619 return systemEventPersistence;
620 }
621
622
627 public void setSystemEventPersistence(
628 SystemEventPersistence systemEventPersistence) {
629 this.systemEventPersistence = systemEventPersistence;
630 }
631
632
637 public com.liferay.portal.service.UserLocalService getUserLocalService() {
638 return userLocalService;
639 }
640
641
646 public void setUserLocalService(
647 com.liferay.portal.service.UserLocalService userLocalService) {
648 this.userLocalService = userLocalService;
649 }
650
651
656 public com.liferay.portal.service.UserService getUserService() {
657 return userService;
658 }
659
660
665 public void setUserService(
666 com.liferay.portal.service.UserService userService) {
667 this.userService = userService;
668 }
669
670
675 public UserPersistence getUserPersistence() {
676 return userPersistence;
677 }
678
679
684 public void setUserPersistence(UserPersistence userPersistence) {
685 this.userPersistence = userPersistence;
686 }
687
688
693 public UserFinder getUserFinder() {
694 return userFinder;
695 }
696
697
702 public void setUserFinder(UserFinder userFinder) {
703 this.userFinder = userFinder;
704 }
705
706
711 public com.liferay.portlet.dynamicdatamapping.service.DDMStructureLocalService getDDMStructureLocalService() {
712 return ddmStructureLocalService;
713 }
714
715
720 public void setDDMStructureLocalService(
721 com.liferay.portlet.dynamicdatamapping.service.DDMStructureLocalService ddmStructureLocalService) {
722 this.ddmStructureLocalService = ddmStructureLocalService;
723 }
724
725
730 public com.liferay.portlet.dynamicdatamapping.service.DDMStructureService getDDMStructureService() {
731 return ddmStructureService;
732 }
733
734
739 public void setDDMStructureService(
740 com.liferay.portlet.dynamicdatamapping.service.DDMStructureService ddmStructureService) {
741 this.ddmStructureService = ddmStructureService;
742 }
743
744
749 public DDMStructurePersistence getDDMStructurePersistence() {
750 return ddmStructurePersistence;
751 }
752
753
758 public void setDDMStructurePersistence(
759 DDMStructurePersistence ddmStructurePersistence) {
760 this.ddmStructurePersistence = ddmStructurePersistence;
761 }
762
763
768 public DDMStructureFinder getDDMStructureFinder() {
769 return ddmStructureFinder;
770 }
771
772
777 public void setDDMStructureFinder(DDMStructureFinder ddmStructureFinder) {
778 this.ddmStructureFinder = ddmStructureFinder;
779 }
780
781
786 public com.liferay.portlet.expando.service.ExpandoValueLocalService getExpandoValueLocalService() {
787 return expandoValueLocalService;
788 }
789
790
795 public void setExpandoValueLocalService(
796 com.liferay.portlet.expando.service.ExpandoValueLocalService expandoValueLocalService) {
797 this.expandoValueLocalService = expandoValueLocalService;
798 }
799
800
805 public com.liferay.portlet.expando.service.ExpandoValueService getExpandoValueService() {
806 return expandoValueService;
807 }
808
809
814 public void setExpandoValueService(
815 com.liferay.portlet.expando.service.ExpandoValueService expandoValueService) {
816 this.expandoValueService = expandoValueService;
817 }
818
819
824 public ExpandoValuePersistence getExpandoValuePersistence() {
825 return expandoValuePersistence;
826 }
827
828
833 public void setExpandoValuePersistence(
834 ExpandoValuePersistence expandoValuePersistence) {
835 this.expandoValuePersistence = expandoValuePersistence;
836 }
837
838 public void afterPropertiesSet() {
839 persistedModelLocalServiceRegistry.register("com.liferay.portlet.journal.model.JournalFeed",
840 journalFeedLocalService);
841 }
842
843 public void destroy() {
844 persistedModelLocalServiceRegistry.unregister(
845 "com.liferay.portlet.journal.model.JournalFeed");
846 }
847
848
853 @Override
854 public String getBeanIdentifier() {
855 return _beanIdentifier;
856 }
857
858
863 @Override
864 public void setBeanIdentifier(String beanIdentifier) {
865 _beanIdentifier = beanIdentifier;
866 }
867
868 protected Class<?> getModelClass() {
869 return JournalFeed.class;
870 }
871
872 protected String getModelClassName() {
873 return JournalFeed.class.getName();
874 }
875
876
881 protected void runSQL(String sql) {
882 try {
883 DataSource dataSource = journalFeedPersistence.getDataSource();
884
885 DB db = DBFactoryUtil.getDB();
886
887 sql = db.buildSQL(sql);
888 sql = PortalUtil.transformSQL(sql);
889
890 SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
891 sql, new int[0]);
892
893 sqlUpdate.update();
894 }
895 catch (Exception e) {
896 throw new SystemException(e);
897 }
898 }
899
900 @BeanReference(type = com.liferay.portlet.journal.service.JournalFeedLocalService.class)
901 protected com.liferay.portlet.journal.service.JournalFeedLocalService journalFeedLocalService;
902 @BeanReference(type = com.liferay.portlet.journal.service.JournalFeedService.class)
903 protected com.liferay.portlet.journal.service.JournalFeedService journalFeedService;
904 @BeanReference(type = JournalFeedPersistence.class)
905 protected JournalFeedPersistence journalFeedPersistence;
906 @BeanReference(type = JournalFeedFinder.class)
907 protected JournalFeedFinder journalFeedFinder;
908 @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
909 protected com.liferay.counter.service.CounterLocalService counterLocalService;
910 @BeanReference(type = com.liferay.portal.service.ClassNameLocalService.class)
911 protected com.liferay.portal.service.ClassNameLocalService classNameLocalService;
912 @BeanReference(type = com.liferay.portal.service.ClassNameService.class)
913 protected com.liferay.portal.service.ClassNameService classNameService;
914 @BeanReference(type = ClassNamePersistence.class)
915 protected ClassNamePersistence classNamePersistence;
916 @BeanReference(type = com.liferay.portal.service.ResourceLocalService.class)
917 protected com.liferay.portal.service.ResourceLocalService resourceLocalService;
918 @BeanReference(type = com.liferay.portal.service.SystemEventLocalService.class)
919 protected com.liferay.portal.service.SystemEventLocalService systemEventLocalService;
920 @BeanReference(type = SystemEventPersistence.class)
921 protected SystemEventPersistence systemEventPersistence;
922 @BeanReference(type = com.liferay.portal.service.UserLocalService.class)
923 protected com.liferay.portal.service.UserLocalService userLocalService;
924 @BeanReference(type = com.liferay.portal.service.UserService.class)
925 protected com.liferay.portal.service.UserService userService;
926 @BeanReference(type = UserPersistence.class)
927 protected UserPersistence userPersistence;
928 @BeanReference(type = UserFinder.class)
929 protected UserFinder userFinder;
930 @BeanReference(type = com.liferay.portlet.dynamicdatamapping.service.DDMStructureLocalService.class)
931 protected com.liferay.portlet.dynamicdatamapping.service.DDMStructureLocalService ddmStructureLocalService;
932 @BeanReference(type = com.liferay.portlet.dynamicdatamapping.service.DDMStructureService.class)
933 protected com.liferay.portlet.dynamicdatamapping.service.DDMStructureService ddmStructureService;
934 @BeanReference(type = DDMStructurePersistence.class)
935 protected DDMStructurePersistence ddmStructurePersistence;
936 @BeanReference(type = DDMStructureFinder.class)
937 protected DDMStructureFinder ddmStructureFinder;
938 @BeanReference(type = com.liferay.portlet.expando.service.ExpandoValueLocalService.class)
939 protected com.liferay.portlet.expando.service.ExpandoValueLocalService expandoValueLocalService;
940 @BeanReference(type = com.liferay.portlet.expando.service.ExpandoValueService.class)
941 protected com.liferay.portlet.expando.service.ExpandoValueService expandoValueService;
942 @BeanReference(type = ExpandoValuePersistence.class)
943 protected ExpandoValuePersistence expandoValuePersistence;
944 @BeanReference(type = PersistedModelLocalServiceRegistry.class)
945 protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
946 private String _beanIdentifier;
947 }