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.dao.db.DB;
021 import com.liferay.portal.kernel.dao.db.DBFactoryUtil;
022 import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
023 import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
024 import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery;
025 import com.liferay.portal.kernel.dao.orm.DefaultActionableDynamicQuery;
026 import com.liferay.portal.kernel.dao.orm.DynamicQuery;
027 import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil;
028 import com.liferay.portal.kernel.dao.orm.ExportActionableDynamicQuery;
029 import com.liferay.portal.kernel.dao.orm.Projection;
030 import com.liferay.portal.kernel.exception.PortalException;
031 import com.liferay.portal.kernel.exception.SystemException;
032 import com.liferay.portal.kernel.module.framework.service.IdentifiableOSGiService;
033 import com.liferay.portal.kernel.search.Indexable;
034 import com.liferay.portal.kernel.search.IndexableType;
035 import com.liferay.portal.kernel.util.OrderByComparator;
036 import com.liferay.portal.model.PersistedModel;
037 import com.liferay.portal.service.BaseLocalServiceImpl;
038 import com.liferay.portal.service.PersistedModelLocalServiceRegistry;
039 import com.liferay.portal.service.persistence.ClassNamePersistence;
040 import com.liferay.portal.service.persistence.GroupFinder;
041 import com.liferay.portal.service.persistence.GroupPersistence;
042 import com.liferay.portal.service.persistence.UserFinder;
043 import com.liferay.portal.service.persistence.UserPersistence;
044 import com.liferay.portal.util.PortalUtil;
045
046 import com.liferay.portlet.asset.model.AssetVocabulary;
047 import com.liferay.portlet.asset.service.AssetVocabularyLocalService;
048 import com.liferay.portlet.asset.service.persistence.AssetCategoryFinder;
049 import com.liferay.portlet.asset.service.persistence.AssetCategoryPersistence;
050 import com.liferay.portlet.asset.service.persistence.AssetVocabularyFinder;
051 import com.liferay.portlet.asset.service.persistence.AssetVocabularyPersistence;
052 import com.liferay.portlet.exportimport.lar.ExportImportHelperUtil;
053 import com.liferay.portlet.exportimport.lar.ManifestSummary;
054 import com.liferay.portlet.exportimport.lar.PortletDataContext;
055 import com.liferay.portlet.exportimport.lar.StagedModelDataHandlerUtil;
056 import com.liferay.portlet.exportimport.lar.StagedModelType;
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 IdentifiableOSGiService {
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,
287 modelAdditionCount);
288
289 long modelDeletionCount = ExportImportHelperUtil.getModelDeletionCount(portletDataContext,
290 stagedModelType);
291
292 manifestSummary.addModelDeletionCount(stagedModelType,
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<AssetVocabulary>() {
314 @Override
315 public void performAction(AssetVocabulary assetVocabulary)
316 throws PortalException {
317 StagedModelDataHandlerUtil.exportStagedModel(portletDataContext,
318 assetVocabulary);
319 }
320 });
321 exportActionableDynamicQuery.setStagedModelType(new StagedModelType(
322 PortalUtil.getClassNameId(AssetVocabulary.class.getName())));
323
324 return exportActionableDynamicQuery;
325 }
326
327
330 @Override
331 public PersistedModel deletePersistedModel(PersistedModel persistedModel)
332 throws PortalException {
333 return assetVocabularyLocalService.deleteAssetVocabulary((AssetVocabulary)persistedModel);
334 }
335
336 @Override
337 public PersistedModel getPersistedModel(Serializable primaryKeyObj)
338 throws PortalException {
339 return assetVocabularyPersistence.findByPrimaryKey(primaryKeyObj);
340 }
341
342
349 @Override
350 public List<AssetVocabulary> getAssetVocabulariesByUuidAndCompanyId(
351 String uuid, long companyId) {
352 return assetVocabularyPersistence.findByUuid_C(uuid, companyId);
353 }
354
355
365 @Override
366 public List<AssetVocabulary> getAssetVocabulariesByUuidAndCompanyId(
367 String uuid, long companyId, int start, int end,
368 OrderByComparator<AssetVocabulary> orderByComparator) {
369 return assetVocabularyPersistence.findByUuid_C(uuid, companyId, start,
370 end, orderByComparator);
371 }
372
373
381 @Override
382 public AssetVocabulary getAssetVocabularyByUuidAndGroupId(String uuid,
383 long groupId) throws PortalException {
384 return assetVocabularyPersistence.findByUUID_G(uuid, groupId);
385 }
386
387
398 @Override
399 public List<AssetVocabulary> getAssetVocabularies(int start, int end) {
400 return assetVocabularyPersistence.findAll(start, end);
401 }
402
403
408 @Override
409 public int getAssetVocabulariesCount() {
410 return assetVocabularyPersistence.countAll();
411 }
412
413
419 @Indexable(type = IndexableType.REINDEX)
420 @Override
421 public AssetVocabulary updateAssetVocabulary(
422 AssetVocabulary assetVocabulary) {
423 return assetVocabularyPersistence.update(assetVocabulary);
424 }
425
426
431 public AssetVocabularyLocalService getAssetVocabularyLocalService() {
432 return assetVocabularyLocalService;
433 }
434
435
440 public void setAssetVocabularyLocalService(
441 AssetVocabularyLocalService assetVocabularyLocalService) {
442 this.assetVocabularyLocalService = assetVocabularyLocalService;
443 }
444
445
450 public com.liferay.portlet.asset.service.AssetVocabularyService getAssetVocabularyService() {
451 return assetVocabularyService;
452 }
453
454
459 public void setAssetVocabularyService(
460 com.liferay.portlet.asset.service.AssetVocabularyService assetVocabularyService) {
461 this.assetVocabularyService = assetVocabularyService;
462 }
463
464
469 public AssetVocabularyPersistence getAssetVocabularyPersistence() {
470 return assetVocabularyPersistence;
471 }
472
473
478 public void setAssetVocabularyPersistence(
479 AssetVocabularyPersistence assetVocabularyPersistence) {
480 this.assetVocabularyPersistence = assetVocabularyPersistence;
481 }
482
483
488 public AssetVocabularyFinder getAssetVocabularyFinder() {
489 return assetVocabularyFinder;
490 }
491
492
497 public void setAssetVocabularyFinder(
498 AssetVocabularyFinder assetVocabularyFinder) {
499 this.assetVocabularyFinder = assetVocabularyFinder;
500 }
501
502
507 public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
508 return counterLocalService;
509 }
510
511
516 public void setCounterLocalService(
517 com.liferay.counter.service.CounterLocalService counterLocalService) {
518 this.counterLocalService = counterLocalService;
519 }
520
521
526 public com.liferay.portal.service.ClassNameLocalService getClassNameLocalService() {
527 return classNameLocalService;
528 }
529
530
535 public void setClassNameLocalService(
536 com.liferay.portal.service.ClassNameLocalService classNameLocalService) {
537 this.classNameLocalService = classNameLocalService;
538 }
539
540
545 public com.liferay.portal.service.ClassNameService getClassNameService() {
546 return classNameService;
547 }
548
549
554 public void setClassNameService(
555 com.liferay.portal.service.ClassNameService classNameService) {
556 this.classNameService = classNameService;
557 }
558
559
564 public ClassNamePersistence getClassNamePersistence() {
565 return classNamePersistence;
566 }
567
568
573 public void setClassNamePersistence(
574 ClassNamePersistence classNamePersistence) {
575 this.classNamePersistence = classNamePersistence;
576 }
577
578
583 public com.liferay.portal.service.GroupLocalService getGroupLocalService() {
584 return groupLocalService;
585 }
586
587
592 public void setGroupLocalService(
593 com.liferay.portal.service.GroupLocalService groupLocalService) {
594 this.groupLocalService = groupLocalService;
595 }
596
597
602 public com.liferay.portal.service.GroupService getGroupService() {
603 return groupService;
604 }
605
606
611 public void setGroupService(
612 com.liferay.portal.service.GroupService groupService) {
613 this.groupService = groupService;
614 }
615
616
621 public GroupPersistence getGroupPersistence() {
622 return groupPersistence;
623 }
624
625
630 public void setGroupPersistence(GroupPersistence groupPersistence) {
631 this.groupPersistence = groupPersistence;
632 }
633
634
639 public GroupFinder getGroupFinder() {
640 return groupFinder;
641 }
642
643
648 public void setGroupFinder(GroupFinder groupFinder) {
649 this.groupFinder = groupFinder;
650 }
651
652
657 public com.liferay.portal.service.ResourceLocalService getResourceLocalService() {
658 return resourceLocalService;
659 }
660
661
666 public void setResourceLocalService(
667 com.liferay.portal.service.ResourceLocalService resourceLocalService) {
668 this.resourceLocalService = resourceLocalService;
669 }
670
671
676 public com.liferay.portal.service.UserLocalService getUserLocalService() {
677 return userLocalService;
678 }
679
680
685 public void setUserLocalService(
686 com.liferay.portal.service.UserLocalService userLocalService) {
687 this.userLocalService = userLocalService;
688 }
689
690
695 public com.liferay.portal.service.UserService getUserService() {
696 return userService;
697 }
698
699
704 public void setUserService(
705 com.liferay.portal.service.UserService userService) {
706 this.userService = userService;
707 }
708
709
714 public UserPersistence getUserPersistence() {
715 return userPersistence;
716 }
717
718
723 public void setUserPersistence(UserPersistence userPersistence) {
724 this.userPersistence = userPersistence;
725 }
726
727
732 public UserFinder getUserFinder() {
733 return userFinder;
734 }
735
736
741 public void setUserFinder(UserFinder userFinder) {
742 this.userFinder = userFinder;
743 }
744
745
750 public com.liferay.portlet.asset.service.AssetCategoryLocalService getAssetCategoryLocalService() {
751 return assetCategoryLocalService;
752 }
753
754
759 public void setAssetCategoryLocalService(
760 com.liferay.portlet.asset.service.AssetCategoryLocalService assetCategoryLocalService) {
761 this.assetCategoryLocalService = assetCategoryLocalService;
762 }
763
764
769 public com.liferay.portlet.asset.service.AssetCategoryService getAssetCategoryService() {
770 return assetCategoryService;
771 }
772
773
778 public void setAssetCategoryService(
779 com.liferay.portlet.asset.service.AssetCategoryService assetCategoryService) {
780 this.assetCategoryService = assetCategoryService;
781 }
782
783
788 public AssetCategoryPersistence getAssetCategoryPersistence() {
789 return assetCategoryPersistence;
790 }
791
792
797 public void setAssetCategoryPersistence(
798 AssetCategoryPersistence assetCategoryPersistence) {
799 this.assetCategoryPersistence = assetCategoryPersistence;
800 }
801
802
807 public AssetCategoryFinder getAssetCategoryFinder() {
808 return assetCategoryFinder;
809 }
810
811
816 public void setAssetCategoryFinder(AssetCategoryFinder assetCategoryFinder) {
817 this.assetCategoryFinder = assetCategoryFinder;
818 }
819
820 public void afterPropertiesSet() {
821 persistedModelLocalServiceRegistry.register("com.liferay.portlet.asset.model.AssetVocabulary",
822 assetVocabularyLocalService);
823 }
824
825 public void destroy() {
826 persistedModelLocalServiceRegistry.unregister(
827 "com.liferay.portlet.asset.model.AssetVocabulary");
828 }
829
830
835 @Override
836 public String getOSGiServiceIdentifier() {
837 return AssetVocabularyLocalService.class.getName();
838 }
839
840 protected Class<?> getModelClass() {
841 return AssetVocabulary.class;
842 }
843
844 protected String getModelClassName() {
845 return AssetVocabulary.class.getName();
846 }
847
848
853 protected void runSQL(String sql) {
854 try {
855 DataSource dataSource = assetVocabularyPersistence.getDataSource();
856
857 DB db = DBFactoryUtil.getDB();
858
859 sql = db.buildSQL(sql);
860 sql = PortalUtil.transformSQL(sql);
861
862 SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
863 sql, new int[0]);
864
865 sqlUpdate.update();
866 }
867 catch (Exception e) {
868 throw new SystemException(e);
869 }
870 }
871
872 @BeanReference(type = com.liferay.portlet.asset.service.AssetVocabularyLocalService.class)
873 protected AssetVocabularyLocalService assetVocabularyLocalService;
874 @BeanReference(type = com.liferay.portlet.asset.service.AssetVocabularyService.class)
875 protected com.liferay.portlet.asset.service.AssetVocabularyService assetVocabularyService;
876 @BeanReference(type = AssetVocabularyPersistence.class)
877 protected AssetVocabularyPersistence assetVocabularyPersistence;
878 @BeanReference(type = AssetVocabularyFinder.class)
879 protected AssetVocabularyFinder assetVocabularyFinder;
880 @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
881 protected com.liferay.counter.service.CounterLocalService counterLocalService;
882 @BeanReference(type = com.liferay.portal.service.ClassNameLocalService.class)
883 protected com.liferay.portal.service.ClassNameLocalService classNameLocalService;
884 @BeanReference(type = com.liferay.portal.service.ClassNameService.class)
885 protected com.liferay.portal.service.ClassNameService classNameService;
886 @BeanReference(type = ClassNamePersistence.class)
887 protected ClassNamePersistence classNamePersistence;
888 @BeanReference(type = com.liferay.portal.service.GroupLocalService.class)
889 protected com.liferay.portal.service.GroupLocalService groupLocalService;
890 @BeanReference(type = com.liferay.portal.service.GroupService.class)
891 protected com.liferay.portal.service.GroupService groupService;
892 @BeanReference(type = GroupPersistence.class)
893 protected GroupPersistence groupPersistence;
894 @BeanReference(type = GroupFinder.class)
895 protected GroupFinder groupFinder;
896 @BeanReference(type = com.liferay.portal.service.ResourceLocalService.class)
897 protected com.liferay.portal.service.ResourceLocalService resourceLocalService;
898 @BeanReference(type = com.liferay.portal.service.UserLocalService.class)
899 protected com.liferay.portal.service.UserLocalService userLocalService;
900 @BeanReference(type = com.liferay.portal.service.UserService.class)
901 protected com.liferay.portal.service.UserService userService;
902 @BeanReference(type = UserPersistence.class)
903 protected UserPersistence userPersistence;
904 @BeanReference(type = UserFinder.class)
905 protected UserFinder userFinder;
906 @BeanReference(type = com.liferay.portlet.asset.service.AssetCategoryLocalService.class)
907 protected com.liferay.portlet.asset.service.AssetCategoryLocalService assetCategoryLocalService;
908 @BeanReference(type = com.liferay.portlet.asset.service.AssetCategoryService.class)
909 protected com.liferay.portlet.asset.service.AssetCategoryService assetCategoryService;
910 @BeanReference(type = AssetCategoryPersistence.class)
911 protected AssetCategoryPersistence assetCategoryPersistence;
912 @BeanReference(type = AssetCategoryFinder.class)
913 protected AssetCategoryFinder assetCategoryFinder;
914 @BeanReference(type = PersistedModelLocalServiceRegistry.class)
915 protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
916 }