001
014
015 package com.liferay.portlet.asset.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.GroupFinder;
046 import com.liferay.portal.service.persistence.GroupPersistence;
047 import com.liferay.portal.service.persistence.UserFinder;
048 import com.liferay.portal.service.persistence.UserPersistence;
049 import com.liferay.portal.util.PortalUtil;
050
051 import com.liferay.portlet.asset.model.AssetVocabulary;
052 import com.liferay.portlet.asset.service.AssetVocabularyLocalService;
053 import com.liferay.portlet.asset.service.persistence.AssetCategoryFinder;
054 import com.liferay.portlet.asset.service.persistence.AssetCategoryPersistence;
055 import com.liferay.portlet.asset.service.persistence.AssetVocabularyFinder;
056 import com.liferay.portlet.asset.service.persistence.AssetVocabularyPersistence;
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 AssetVocabularyLocalServiceBaseImpl
078 extends BaseLocalServiceImpl implements AssetVocabularyLocalService,
079 IdentifiableBean {
080
085
086
092 @Indexable(type = IndexableType.REINDEX)
093 @Override
094 public AssetVocabulary addAssetVocabulary(AssetVocabulary assetVocabulary) {
095 assetVocabulary.setNew(true);
096
097 return assetVocabularyPersistence.update(assetVocabulary);
098 }
099
100
106 @Override
107 public AssetVocabulary createAssetVocabulary(long vocabularyId) {
108 return assetVocabularyPersistence.create(vocabularyId);
109 }
110
111
118 @Indexable(type = IndexableType.DELETE)
119 @Override
120 public AssetVocabulary deleteAssetVocabulary(long vocabularyId)
121 throws PortalException {
122 return assetVocabularyPersistence.remove(vocabularyId);
123 }
124
125
131 @Indexable(type = IndexableType.DELETE)
132 @Override
133 public AssetVocabulary deleteAssetVocabulary(
134 AssetVocabulary assetVocabulary) {
135 return assetVocabularyPersistence.remove(assetVocabulary);
136 }
137
138 @Override
139 public DynamicQuery dynamicQuery() {
140 Class<?> clazz = getClass();
141
142 return DynamicQueryFactoryUtil.forClass(AssetVocabulary.class,
143 clazz.getClassLoader());
144 }
145
146
152 @Override
153 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery) {
154 return assetVocabularyPersistence.findWithDynamicQuery(dynamicQuery);
155 }
156
157
169 @Override
170 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
171 int end) {
172 return assetVocabularyPersistence.findWithDynamicQuery(dynamicQuery,
173 start, end);
174 }
175
176
189 @Override
190 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
191 int end, OrderByComparator<T> orderByComparator) {
192 return assetVocabularyPersistence.findWithDynamicQuery(dynamicQuery,
193 start, end, orderByComparator);
194 }
195
196
202 @Override
203 public long dynamicQueryCount(DynamicQuery dynamicQuery) {
204 return assetVocabularyPersistence.countWithDynamicQuery(dynamicQuery);
205 }
206
207
214 @Override
215 public long dynamicQueryCount(DynamicQuery dynamicQuery,
216 Projection projection) {
217 return assetVocabularyPersistence.countWithDynamicQuery(dynamicQuery,
218 projection);
219 }
220
221 @Override
222 public AssetVocabulary fetchAssetVocabulary(long vocabularyId) {
223 return assetVocabularyPersistence.fetchByPrimaryKey(vocabularyId);
224 }
225
226
233 @Override
234 public AssetVocabulary fetchAssetVocabularyByUuidAndGroupId(String uuid,
235 long groupId) {
236 return assetVocabularyPersistence.fetchByUUID_G(uuid, groupId);
237 }
238
239
246 @Override
247 public AssetVocabulary getAssetVocabulary(long vocabularyId)
248 throws PortalException {
249 return assetVocabularyPersistence.findByPrimaryKey(vocabularyId);
250 }
251
252 @Override
253 public ActionableDynamicQuery getActionableDynamicQuery() {
254 ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
255
256 actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.asset.service.AssetVocabularyLocalServiceUtil.getService());
257 actionableDynamicQuery.setClass(AssetVocabulary.class);
258 actionableDynamicQuery.setClassLoader(getClassLoader());
259
260 actionableDynamicQuery.setPrimaryKeyPropertyName("vocabularyId");
261
262 return actionableDynamicQuery;
263 }
264
265 protected void initActionableDynamicQuery(
266 ActionableDynamicQuery actionableDynamicQuery) {
267 actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.asset.service.AssetVocabularyLocalServiceUtil.getService());
268 actionableDynamicQuery.setClass(AssetVocabulary.class);
269 actionableDynamicQuery.setClassLoader(getClassLoader());
270
271 actionableDynamicQuery.setPrimaryKeyPropertyName("vocabularyId");
272 }
273
274 @Override
275 public ExportActionableDynamicQuery getExportActionableDynamicQuery(
276 final PortletDataContext portletDataContext) {
277 final ExportActionableDynamicQuery exportActionableDynamicQuery = new ExportActionableDynamicQuery() {
278 @Override
279 public long performCount() throws PortalException {
280 ManifestSummary manifestSummary = portletDataContext.getManifestSummary();
281
282 StagedModelType stagedModelType = getStagedModelType();
283
284 long modelAdditionCount = super.performCount();
285
286 manifestSummary.addModelAdditionCount(stagedModelType.toString(),
287 modelAdditionCount);
288
289 long modelDeletionCount = ExportImportHelperUtil.getModelDeletionCount(portletDataContext,
290 stagedModelType);
291
292 manifestSummary.addModelDeletionCount(stagedModelType.toString(),
293 modelDeletionCount);
294
295 return modelAdditionCount;
296 }
297 };
298
299 initActionableDynamicQuery(exportActionableDynamicQuery);
300
301 exportActionableDynamicQuery.setAddCriteriaMethod(new ActionableDynamicQuery.AddCriteriaMethod() {
302 @Override
303 public void addCriteria(DynamicQuery dynamicQuery) {
304 portletDataContext.addDateRangeCriteria(dynamicQuery,
305 "modifiedDate");
306 }
307 });
308
309 exportActionableDynamicQuery.setCompanyId(portletDataContext.getCompanyId());
310
311 exportActionableDynamicQuery.setGroupId(portletDataContext.getScopeGroupId());
312
313 exportActionableDynamicQuery.setPerformActionMethod(new ActionableDynamicQuery.PerformActionMethod() {
314 @Override
315 public void performAction(Object object)
316 throws PortalException {
317 AssetVocabulary stagedModel = (AssetVocabulary)object;
318
319 StagedModelDataHandlerUtil.exportStagedModel(portletDataContext,
320 stagedModel);
321 }
322 });
323 exportActionableDynamicQuery.setStagedModelType(new StagedModelType(
324 PortalUtil.getClassNameId(AssetVocabulary.class.getName())));
325
326 return exportActionableDynamicQuery;
327 }
328
329
332 @Override
333 public PersistedModel deletePersistedModel(PersistedModel persistedModel)
334 throws PortalException {
335 return assetVocabularyLocalService.deleteAssetVocabulary((AssetVocabulary)persistedModel);
336 }
337
338 @Override
339 public PersistedModel getPersistedModel(Serializable primaryKeyObj)
340 throws PortalException {
341 return assetVocabularyPersistence.findByPrimaryKey(primaryKeyObj);
342 }
343
344
351 @Override
352 public List<AssetVocabulary> getAssetVocabulariesByUuidAndCompanyId(
353 String uuid, long companyId) {
354 return assetVocabularyPersistence.findByUuid_C(uuid, companyId);
355 }
356
357
367 @Override
368 public List<AssetVocabulary> getAssetVocabulariesByUuidAndCompanyId(
369 String uuid, long companyId, int start, int end,
370 OrderByComparator<AssetVocabulary> orderByComparator) {
371 return assetVocabularyPersistence.findByUuid_C(uuid, companyId, start,
372 end, orderByComparator);
373 }
374
375
383 @Override
384 public AssetVocabulary getAssetVocabularyByUuidAndGroupId(String uuid,
385 long groupId) throws PortalException {
386 return assetVocabularyPersistence.findByUUID_G(uuid, groupId);
387 }
388
389
400 @Override
401 public List<AssetVocabulary> getAssetVocabularies(int start, int end) {
402 return assetVocabularyPersistence.findAll(start, end);
403 }
404
405
410 @Override
411 public int getAssetVocabulariesCount() {
412 return assetVocabularyPersistence.countAll();
413 }
414
415
421 @Indexable(type = IndexableType.REINDEX)
422 @Override
423 public AssetVocabulary updateAssetVocabulary(
424 AssetVocabulary assetVocabulary) {
425 return assetVocabularyPersistence.update(assetVocabulary);
426 }
427
428
433 public com.liferay.portlet.asset.service.AssetVocabularyLocalService getAssetVocabularyLocalService() {
434 return assetVocabularyLocalService;
435 }
436
437
442 public void setAssetVocabularyLocalService(
443 com.liferay.portlet.asset.service.AssetVocabularyLocalService assetVocabularyLocalService) {
444 this.assetVocabularyLocalService = assetVocabularyLocalService;
445 }
446
447
452 public com.liferay.portlet.asset.service.AssetVocabularyService getAssetVocabularyService() {
453 return assetVocabularyService;
454 }
455
456
461 public void setAssetVocabularyService(
462 com.liferay.portlet.asset.service.AssetVocabularyService assetVocabularyService) {
463 this.assetVocabularyService = assetVocabularyService;
464 }
465
466
471 public AssetVocabularyPersistence getAssetVocabularyPersistence() {
472 return assetVocabularyPersistence;
473 }
474
475
480 public void setAssetVocabularyPersistence(
481 AssetVocabularyPersistence assetVocabularyPersistence) {
482 this.assetVocabularyPersistence = assetVocabularyPersistence;
483 }
484
485
490 public AssetVocabularyFinder getAssetVocabularyFinder() {
491 return assetVocabularyFinder;
492 }
493
494
499 public void setAssetVocabularyFinder(
500 AssetVocabularyFinder assetVocabularyFinder) {
501 this.assetVocabularyFinder = assetVocabularyFinder;
502 }
503
504
509 public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
510 return counterLocalService;
511 }
512
513
518 public void setCounterLocalService(
519 com.liferay.counter.service.CounterLocalService counterLocalService) {
520 this.counterLocalService = counterLocalService;
521 }
522
523
528 public com.liferay.portal.service.ClassNameLocalService getClassNameLocalService() {
529 return classNameLocalService;
530 }
531
532
537 public void setClassNameLocalService(
538 com.liferay.portal.service.ClassNameLocalService classNameLocalService) {
539 this.classNameLocalService = classNameLocalService;
540 }
541
542
547 public com.liferay.portal.service.ClassNameService getClassNameService() {
548 return classNameService;
549 }
550
551
556 public void setClassNameService(
557 com.liferay.portal.service.ClassNameService classNameService) {
558 this.classNameService = classNameService;
559 }
560
561
566 public ClassNamePersistence getClassNamePersistence() {
567 return classNamePersistence;
568 }
569
570
575 public void setClassNamePersistence(
576 ClassNamePersistence classNamePersistence) {
577 this.classNamePersistence = classNamePersistence;
578 }
579
580
585 public com.liferay.portal.service.GroupLocalService getGroupLocalService() {
586 return groupLocalService;
587 }
588
589
594 public void setGroupLocalService(
595 com.liferay.portal.service.GroupLocalService groupLocalService) {
596 this.groupLocalService = groupLocalService;
597 }
598
599
604 public com.liferay.portal.service.GroupService getGroupService() {
605 return groupService;
606 }
607
608
613 public void setGroupService(
614 com.liferay.portal.service.GroupService groupService) {
615 this.groupService = groupService;
616 }
617
618
623 public GroupPersistence getGroupPersistence() {
624 return groupPersistence;
625 }
626
627
632 public void setGroupPersistence(GroupPersistence groupPersistence) {
633 this.groupPersistence = groupPersistence;
634 }
635
636
641 public GroupFinder getGroupFinder() {
642 return groupFinder;
643 }
644
645
650 public void setGroupFinder(GroupFinder groupFinder) {
651 this.groupFinder = groupFinder;
652 }
653
654
659 public com.liferay.portal.service.ResourceLocalService getResourceLocalService() {
660 return resourceLocalService;
661 }
662
663
668 public void setResourceLocalService(
669 com.liferay.portal.service.ResourceLocalService resourceLocalService) {
670 this.resourceLocalService = resourceLocalService;
671 }
672
673
678 public com.liferay.portal.service.UserLocalService getUserLocalService() {
679 return userLocalService;
680 }
681
682
687 public void setUserLocalService(
688 com.liferay.portal.service.UserLocalService userLocalService) {
689 this.userLocalService = userLocalService;
690 }
691
692
697 public com.liferay.portal.service.UserService getUserService() {
698 return userService;
699 }
700
701
706 public void setUserService(
707 com.liferay.portal.service.UserService userService) {
708 this.userService = userService;
709 }
710
711
716 public UserPersistence getUserPersistence() {
717 return userPersistence;
718 }
719
720
725 public void setUserPersistence(UserPersistence userPersistence) {
726 this.userPersistence = userPersistence;
727 }
728
729
734 public UserFinder getUserFinder() {
735 return userFinder;
736 }
737
738
743 public void setUserFinder(UserFinder userFinder) {
744 this.userFinder = userFinder;
745 }
746
747
752 public com.liferay.portlet.asset.service.AssetCategoryLocalService getAssetCategoryLocalService() {
753 return assetCategoryLocalService;
754 }
755
756
761 public void setAssetCategoryLocalService(
762 com.liferay.portlet.asset.service.AssetCategoryLocalService assetCategoryLocalService) {
763 this.assetCategoryLocalService = assetCategoryLocalService;
764 }
765
766
771 public com.liferay.portlet.asset.service.AssetCategoryService getAssetCategoryService() {
772 return assetCategoryService;
773 }
774
775
780 public void setAssetCategoryService(
781 com.liferay.portlet.asset.service.AssetCategoryService assetCategoryService) {
782 this.assetCategoryService = assetCategoryService;
783 }
784
785
790 public AssetCategoryPersistence getAssetCategoryPersistence() {
791 return assetCategoryPersistence;
792 }
793
794
799 public void setAssetCategoryPersistence(
800 AssetCategoryPersistence assetCategoryPersistence) {
801 this.assetCategoryPersistence = assetCategoryPersistence;
802 }
803
804
809 public AssetCategoryFinder getAssetCategoryFinder() {
810 return assetCategoryFinder;
811 }
812
813
818 public void setAssetCategoryFinder(AssetCategoryFinder assetCategoryFinder) {
819 this.assetCategoryFinder = assetCategoryFinder;
820 }
821
822 public void afterPropertiesSet() {
823 persistedModelLocalServiceRegistry.register("com.liferay.portlet.asset.model.AssetVocabulary",
824 assetVocabularyLocalService);
825 }
826
827 public void destroy() {
828 persistedModelLocalServiceRegistry.unregister(
829 "com.liferay.portlet.asset.model.AssetVocabulary");
830 }
831
832
837 @Override
838 public String getBeanIdentifier() {
839 return _beanIdentifier;
840 }
841
842
847 @Override
848 public void setBeanIdentifier(String beanIdentifier) {
849 _beanIdentifier = beanIdentifier;
850 }
851
852 protected Class<?> getModelClass() {
853 return AssetVocabulary.class;
854 }
855
856 protected String getModelClassName() {
857 return AssetVocabulary.class.getName();
858 }
859
860
865 protected void runSQL(String sql) {
866 try {
867 DataSource dataSource = assetVocabularyPersistence.getDataSource();
868
869 DB db = DBFactoryUtil.getDB();
870
871 sql = db.buildSQL(sql);
872 sql = PortalUtil.transformSQL(sql);
873
874 SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
875 sql, new int[0]);
876
877 sqlUpdate.update();
878 }
879 catch (Exception e) {
880 throw new SystemException(e);
881 }
882 }
883
884 @BeanReference(type = com.liferay.portlet.asset.service.AssetVocabularyLocalService.class)
885 protected com.liferay.portlet.asset.service.AssetVocabularyLocalService assetVocabularyLocalService;
886 @BeanReference(type = com.liferay.portlet.asset.service.AssetVocabularyService.class)
887 protected com.liferay.portlet.asset.service.AssetVocabularyService assetVocabularyService;
888 @BeanReference(type = AssetVocabularyPersistence.class)
889 protected AssetVocabularyPersistence assetVocabularyPersistence;
890 @BeanReference(type = AssetVocabularyFinder.class)
891 protected AssetVocabularyFinder assetVocabularyFinder;
892 @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
893 protected com.liferay.counter.service.CounterLocalService counterLocalService;
894 @BeanReference(type = com.liferay.portal.service.ClassNameLocalService.class)
895 protected com.liferay.portal.service.ClassNameLocalService classNameLocalService;
896 @BeanReference(type = com.liferay.portal.service.ClassNameService.class)
897 protected com.liferay.portal.service.ClassNameService classNameService;
898 @BeanReference(type = ClassNamePersistence.class)
899 protected ClassNamePersistence classNamePersistence;
900 @BeanReference(type = com.liferay.portal.service.GroupLocalService.class)
901 protected com.liferay.portal.service.GroupLocalService groupLocalService;
902 @BeanReference(type = com.liferay.portal.service.GroupService.class)
903 protected com.liferay.portal.service.GroupService groupService;
904 @BeanReference(type = GroupPersistence.class)
905 protected GroupPersistence groupPersistence;
906 @BeanReference(type = GroupFinder.class)
907 protected GroupFinder groupFinder;
908 @BeanReference(type = com.liferay.portal.service.ResourceLocalService.class)
909 protected com.liferay.portal.service.ResourceLocalService resourceLocalService;
910 @BeanReference(type = com.liferay.portal.service.UserLocalService.class)
911 protected com.liferay.portal.service.UserLocalService userLocalService;
912 @BeanReference(type = com.liferay.portal.service.UserService.class)
913 protected com.liferay.portal.service.UserService userService;
914 @BeanReference(type = UserPersistence.class)
915 protected UserPersistence userPersistence;
916 @BeanReference(type = UserFinder.class)
917 protected UserFinder userFinder;
918 @BeanReference(type = com.liferay.portlet.asset.service.AssetCategoryLocalService.class)
919 protected com.liferay.portlet.asset.service.AssetCategoryLocalService assetCategoryLocalService;
920 @BeanReference(type = com.liferay.portlet.asset.service.AssetCategoryService.class)
921 protected com.liferay.portlet.asset.service.AssetCategoryService assetCategoryService;
922 @BeanReference(type = AssetCategoryPersistence.class)
923 protected AssetCategoryPersistence assetCategoryPersistence;
924 @BeanReference(type = AssetCategoryFinder.class)
925 protected AssetCategoryFinder assetCategoryFinder;
926 @BeanReference(type = PersistedModelLocalServiceRegistry.class)
927 protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
928 private String _beanIdentifier;
929 }