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 @Override
342 public List<JournalFeed> getJournalFeedsByUuidAndCompanyId(String uuid,
343 long companyId) {
344 return journalFeedPersistence.findByUuid_C(uuid, companyId);
345 }
346
347 @Override
348 public List<JournalFeed> getJournalFeedsByUuidAndCompanyId(String uuid,
349 long companyId, int start, int end,
350 OrderByComparator<JournalFeed> orderByComparator) {
351 return journalFeedPersistence.findByUuid_C(uuid, companyId, start, end,
352 orderByComparator);
353 }
354
355
363 @Override
364 public JournalFeed getJournalFeedByUuidAndGroupId(String uuid, long groupId)
365 throws PortalException {
366 return journalFeedPersistence.findByUUID_G(uuid, groupId);
367 }
368
369
380 @Override
381 public List<JournalFeed> getJournalFeeds(int start, int end) {
382 return journalFeedPersistence.findAll(start, end);
383 }
384
385
390 @Override
391 public int getJournalFeedsCount() {
392 return journalFeedPersistence.countAll();
393 }
394
395
401 @Indexable(type = IndexableType.REINDEX)
402 @Override
403 public JournalFeed updateJournalFeed(JournalFeed journalFeed) {
404 return journalFeedPersistence.update(journalFeed);
405 }
406
407
412 public com.liferay.portlet.journal.service.JournalFeedLocalService getJournalFeedLocalService() {
413 return journalFeedLocalService;
414 }
415
416
421 public void setJournalFeedLocalService(
422 com.liferay.portlet.journal.service.JournalFeedLocalService journalFeedLocalService) {
423 this.journalFeedLocalService = journalFeedLocalService;
424 }
425
426
431 public com.liferay.portlet.journal.service.JournalFeedService getJournalFeedService() {
432 return journalFeedService;
433 }
434
435
440 public void setJournalFeedService(
441 com.liferay.portlet.journal.service.JournalFeedService journalFeedService) {
442 this.journalFeedService = journalFeedService;
443 }
444
445
450 public JournalFeedPersistence getJournalFeedPersistence() {
451 return journalFeedPersistence;
452 }
453
454
459 public void setJournalFeedPersistence(
460 JournalFeedPersistence journalFeedPersistence) {
461 this.journalFeedPersistence = journalFeedPersistence;
462 }
463
464
469 public JournalFeedFinder getJournalFeedFinder() {
470 return journalFeedFinder;
471 }
472
473
478 public void setJournalFeedFinder(JournalFeedFinder journalFeedFinder) {
479 this.journalFeedFinder = journalFeedFinder;
480 }
481
482
487 public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
488 return counterLocalService;
489 }
490
491
496 public void setCounterLocalService(
497 com.liferay.counter.service.CounterLocalService counterLocalService) {
498 this.counterLocalService = counterLocalService;
499 }
500
501
506 public com.liferay.portal.service.ClassNameLocalService getClassNameLocalService() {
507 return classNameLocalService;
508 }
509
510
515 public void setClassNameLocalService(
516 com.liferay.portal.service.ClassNameLocalService classNameLocalService) {
517 this.classNameLocalService = classNameLocalService;
518 }
519
520
525 public com.liferay.portal.service.ClassNameService getClassNameService() {
526 return classNameService;
527 }
528
529
534 public void setClassNameService(
535 com.liferay.portal.service.ClassNameService classNameService) {
536 this.classNameService = classNameService;
537 }
538
539
544 public ClassNamePersistence getClassNamePersistence() {
545 return classNamePersistence;
546 }
547
548
553 public void setClassNamePersistence(
554 ClassNamePersistence classNamePersistence) {
555 this.classNamePersistence = classNamePersistence;
556 }
557
558
563 public com.liferay.portal.service.ResourceLocalService getResourceLocalService() {
564 return resourceLocalService;
565 }
566
567
572 public void setResourceLocalService(
573 com.liferay.portal.service.ResourceLocalService resourceLocalService) {
574 this.resourceLocalService = resourceLocalService;
575 }
576
577
582 public com.liferay.portal.service.SystemEventLocalService getSystemEventLocalService() {
583 return systemEventLocalService;
584 }
585
586
591 public void setSystemEventLocalService(
592 com.liferay.portal.service.SystemEventLocalService systemEventLocalService) {
593 this.systemEventLocalService = systemEventLocalService;
594 }
595
596
601 public SystemEventPersistence getSystemEventPersistence() {
602 return systemEventPersistence;
603 }
604
605
610 public void setSystemEventPersistence(
611 SystemEventPersistence systemEventPersistence) {
612 this.systemEventPersistence = systemEventPersistence;
613 }
614
615
620 public com.liferay.portal.service.UserLocalService getUserLocalService() {
621 return userLocalService;
622 }
623
624
629 public void setUserLocalService(
630 com.liferay.portal.service.UserLocalService userLocalService) {
631 this.userLocalService = userLocalService;
632 }
633
634
639 public com.liferay.portal.service.UserService getUserService() {
640 return userService;
641 }
642
643
648 public void setUserService(
649 com.liferay.portal.service.UserService userService) {
650 this.userService = userService;
651 }
652
653
658 public UserPersistence getUserPersistence() {
659 return userPersistence;
660 }
661
662
667 public void setUserPersistence(UserPersistence userPersistence) {
668 this.userPersistence = userPersistence;
669 }
670
671
676 public UserFinder getUserFinder() {
677 return userFinder;
678 }
679
680
685 public void setUserFinder(UserFinder userFinder) {
686 this.userFinder = userFinder;
687 }
688
689
694 public com.liferay.portlet.dynamicdatamapping.service.DDMStructureLocalService getDDMStructureLocalService() {
695 return ddmStructureLocalService;
696 }
697
698
703 public void setDDMStructureLocalService(
704 com.liferay.portlet.dynamicdatamapping.service.DDMStructureLocalService ddmStructureLocalService) {
705 this.ddmStructureLocalService = ddmStructureLocalService;
706 }
707
708
713 public com.liferay.portlet.dynamicdatamapping.service.DDMStructureService getDDMStructureService() {
714 return ddmStructureService;
715 }
716
717
722 public void setDDMStructureService(
723 com.liferay.portlet.dynamicdatamapping.service.DDMStructureService ddmStructureService) {
724 this.ddmStructureService = ddmStructureService;
725 }
726
727
732 public DDMStructurePersistence getDDMStructurePersistence() {
733 return ddmStructurePersistence;
734 }
735
736
741 public void setDDMStructurePersistence(
742 DDMStructurePersistence ddmStructurePersistence) {
743 this.ddmStructurePersistence = ddmStructurePersistence;
744 }
745
746
751 public DDMStructureFinder getDDMStructureFinder() {
752 return ddmStructureFinder;
753 }
754
755
760 public void setDDMStructureFinder(DDMStructureFinder ddmStructureFinder) {
761 this.ddmStructureFinder = ddmStructureFinder;
762 }
763
764
769 public com.liferay.portlet.expando.service.ExpandoValueLocalService getExpandoValueLocalService() {
770 return expandoValueLocalService;
771 }
772
773
778 public void setExpandoValueLocalService(
779 com.liferay.portlet.expando.service.ExpandoValueLocalService expandoValueLocalService) {
780 this.expandoValueLocalService = expandoValueLocalService;
781 }
782
783
788 public com.liferay.portlet.expando.service.ExpandoValueService getExpandoValueService() {
789 return expandoValueService;
790 }
791
792
797 public void setExpandoValueService(
798 com.liferay.portlet.expando.service.ExpandoValueService expandoValueService) {
799 this.expandoValueService = expandoValueService;
800 }
801
802
807 public ExpandoValuePersistence getExpandoValuePersistence() {
808 return expandoValuePersistence;
809 }
810
811
816 public void setExpandoValuePersistence(
817 ExpandoValuePersistence expandoValuePersistence) {
818 this.expandoValuePersistence = expandoValuePersistence;
819 }
820
821 public void afterPropertiesSet() {
822 persistedModelLocalServiceRegistry.register("com.liferay.portlet.journal.model.JournalFeed",
823 journalFeedLocalService);
824 }
825
826 public void destroy() {
827 persistedModelLocalServiceRegistry.unregister(
828 "com.liferay.portlet.journal.model.JournalFeed");
829 }
830
831
836 @Override
837 public String getBeanIdentifier() {
838 return _beanIdentifier;
839 }
840
841
846 @Override
847 public void setBeanIdentifier(String beanIdentifier) {
848 _beanIdentifier = beanIdentifier;
849 }
850
851 protected Class<?> getModelClass() {
852 return JournalFeed.class;
853 }
854
855 protected String getModelClassName() {
856 return JournalFeed.class.getName();
857 }
858
859
864 protected void runSQL(String sql) {
865 try {
866 DataSource dataSource = journalFeedPersistence.getDataSource();
867
868 DB db = DBFactoryUtil.getDB();
869
870 sql = db.buildSQL(sql);
871 sql = PortalUtil.transformSQL(sql);
872
873 SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
874 sql, new int[0]);
875
876 sqlUpdate.update();
877 }
878 catch (Exception e) {
879 throw new SystemException(e);
880 }
881 }
882
883 @BeanReference(type = com.liferay.portlet.journal.service.JournalFeedLocalService.class)
884 protected com.liferay.portlet.journal.service.JournalFeedLocalService journalFeedLocalService;
885 @BeanReference(type = com.liferay.portlet.journal.service.JournalFeedService.class)
886 protected com.liferay.portlet.journal.service.JournalFeedService journalFeedService;
887 @BeanReference(type = JournalFeedPersistence.class)
888 protected JournalFeedPersistence journalFeedPersistence;
889 @BeanReference(type = JournalFeedFinder.class)
890 protected JournalFeedFinder journalFeedFinder;
891 @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
892 protected com.liferay.counter.service.CounterLocalService counterLocalService;
893 @BeanReference(type = com.liferay.portal.service.ClassNameLocalService.class)
894 protected com.liferay.portal.service.ClassNameLocalService classNameLocalService;
895 @BeanReference(type = com.liferay.portal.service.ClassNameService.class)
896 protected com.liferay.portal.service.ClassNameService classNameService;
897 @BeanReference(type = ClassNamePersistence.class)
898 protected ClassNamePersistence classNamePersistence;
899 @BeanReference(type = com.liferay.portal.service.ResourceLocalService.class)
900 protected com.liferay.portal.service.ResourceLocalService resourceLocalService;
901 @BeanReference(type = com.liferay.portal.service.SystemEventLocalService.class)
902 protected com.liferay.portal.service.SystemEventLocalService systemEventLocalService;
903 @BeanReference(type = SystemEventPersistence.class)
904 protected SystemEventPersistence systemEventPersistence;
905 @BeanReference(type = com.liferay.portal.service.UserLocalService.class)
906 protected com.liferay.portal.service.UserLocalService userLocalService;
907 @BeanReference(type = com.liferay.portal.service.UserService.class)
908 protected com.liferay.portal.service.UserService userService;
909 @BeanReference(type = UserPersistence.class)
910 protected UserPersistence userPersistence;
911 @BeanReference(type = UserFinder.class)
912 protected UserFinder userFinder;
913 @BeanReference(type = com.liferay.portlet.dynamicdatamapping.service.DDMStructureLocalService.class)
914 protected com.liferay.portlet.dynamicdatamapping.service.DDMStructureLocalService ddmStructureLocalService;
915 @BeanReference(type = com.liferay.portlet.dynamicdatamapping.service.DDMStructureService.class)
916 protected com.liferay.portlet.dynamicdatamapping.service.DDMStructureService ddmStructureService;
917 @BeanReference(type = DDMStructurePersistence.class)
918 protected DDMStructurePersistence ddmStructurePersistence;
919 @BeanReference(type = DDMStructureFinder.class)
920 protected DDMStructureFinder ddmStructureFinder;
921 @BeanReference(type = com.liferay.portlet.expando.service.ExpandoValueLocalService.class)
922 protected com.liferay.portlet.expando.service.ExpandoValueLocalService expandoValueLocalService;
923 @BeanReference(type = com.liferay.portlet.expando.service.ExpandoValueService.class)
924 protected com.liferay.portlet.expando.service.ExpandoValueService expandoValueService;
925 @BeanReference(type = ExpandoValuePersistence.class)
926 protected ExpandoValuePersistence expandoValuePersistence;
927 @BeanReference(type = PersistedModelLocalServiceRegistry.class)
928 protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
929 private String _beanIdentifier;
930 }