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 @Override
345 public List<AssetVocabulary> getAssetVocabulariesByUuidAndCompanyId(
346 String uuid, long companyId) {
347 return assetVocabularyPersistence.findByUuid_C(uuid, companyId);
348 }
349
350 @Override
351 public List<AssetVocabulary> getAssetVocabulariesByUuidAndCompanyId(
352 String uuid, long companyId, int start, int end,
353 OrderByComparator<AssetVocabulary> orderByComparator) {
354 return assetVocabularyPersistence.findByUuid_C(uuid, companyId, start,
355 end, orderByComparator);
356 }
357
358
366 @Override
367 public AssetVocabulary getAssetVocabularyByUuidAndGroupId(String uuid,
368 long groupId) throws PortalException {
369 return assetVocabularyPersistence.findByUUID_G(uuid, groupId);
370 }
371
372
383 @Override
384 public List<AssetVocabulary> getAssetVocabularies(int start, int end) {
385 return assetVocabularyPersistence.findAll(start, end);
386 }
387
388
393 @Override
394 public int getAssetVocabulariesCount() {
395 return assetVocabularyPersistence.countAll();
396 }
397
398
404 @Indexable(type = IndexableType.REINDEX)
405 @Override
406 public AssetVocabulary updateAssetVocabulary(
407 AssetVocabulary assetVocabulary) {
408 return assetVocabularyPersistence.update(assetVocabulary);
409 }
410
411
416 public com.liferay.portlet.asset.service.AssetVocabularyLocalService getAssetVocabularyLocalService() {
417 return assetVocabularyLocalService;
418 }
419
420
425 public void setAssetVocabularyLocalService(
426 com.liferay.portlet.asset.service.AssetVocabularyLocalService assetVocabularyLocalService) {
427 this.assetVocabularyLocalService = assetVocabularyLocalService;
428 }
429
430
435 public com.liferay.portlet.asset.service.AssetVocabularyService getAssetVocabularyService() {
436 return assetVocabularyService;
437 }
438
439
444 public void setAssetVocabularyService(
445 com.liferay.portlet.asset.service.AssetVocabularyService assetVocabularyService) {
446 this.assetVocabularyService = assetVocabularyService;
447 }
448
449
454 public AssetVocabularyPersistence getAssetVocabularyPersistence() {
455 return assetVocabularyPersistence;
456 }
457
458
463 public void setAssetVocabularyPersistence(
464 AssetVocabularyPersistence assetVocabularyPersistence) {
465 this.assetVocabularyPersistence = assetVocabularyPersistence;
466 }
467
468
473 public AssetVocabularyFinder getAssetVocabularyFinder() {
474 return assetVocabularyFinder;
475 }
476
477
482 public void setAssetVocabularyFinder(
483 AssetVocabularyFinder assetVocabularyFinder) {
484 this.assetVocabularyFinder = assetVocabularyFinder;
485 }
486
487
492 public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
493 return counterLocalService;
494 }
495
496
501 public void setCounterLocalService(
502 com.liferay.counter.service.CounterLocalService counterLocalService) {
503 this.counterLocalService = counterLocalService;
504 }
505
506
511 public com.liferay.portal.service.ClassNameLocalService getClassNameLocalService() {
512 return classNameLocalService;
513 }
514
515
520 public void setClassNameLocalService(
521 com.liferay.portal.service.ClassNameLocalService classNameLocalService) {
522 this.classNameLocalService = classNameLocalService;
523 }
524
525
530 public com.liferay.portal.service.ClassNameService getClassNameService() {
531 return classNameService;
532 }
533
534
539 public void setClassNameService(
540 com.liferay.portal.service.ClassNameService classNameService) {
541 this.classNameService = classNameService;
542 }
543
544
549 public ClassNamePersistence getClassNamePersistence() {
550 return classNamePersistence;
551 }
552
553
558 public void setClassNamePersistence(
559 ClassNamePersistence classNamePersistence) {
560 this.classNamePersistence = classNamePersistence;
561 }
562
563
568 public com.liferay.portal.service.GroupLocalService getGroupLocalService() {
569 return groupLocalService;
570 }
571
572
577 public void setGroupLocalService(
578 com.liferay.portal.service.GroupLocalService groupLocalService) {
579 this.groupLocalService = groupLocalService;
580 }
581
582
587 public com.liferay.portal.service.GroupService getGroupService() {
588 return groupService;
589 }
590
591
596 public void setGroupService(
597 com.liferay.portal.service.GroupService groupService) {
598 this.groupService = groupService;
599 }
600
601
606 public GroupPersistence getGroupPersistence() {
607 return groupPersistence;
608 }
609
610
615 public void setGroupPersistence(GroupPersistence groupPersistence) {
616 this.groupPersistence = groupPersistence;
617 }
618
619
624 public GroupFinder getGroupFinder() {
625 return groupFinder;
626 }
627
628
633 public void setGroupFinder(GroupFinder groupFinder) {
634 this.groupFinder = groupFinder;
635 }
636
637
642 public com.liferay.portal.service.ResourceLocalService getResourceLocalService() {
643 return resourceLocalService;
644 }
645
646
651 public void setResourceLocalService(
652 com.liferay.portal.service.ResourceLocalService resourceLocalService) {
653 this.resourceLocalService = resourceLocalService;
654 }
655
656
661 public com.liferay.portal.service.UserLocalService getUserLocalService() {
662 return userLocalService;
663 }
664
665
670 public void setUserLocalService(
671 com.liferay.portal.service.UserLocalService userLocalService) {
672 this.userLocalService = userLocalService;
673 }
674
675
680 public com.liferay.portal.service.UserService getUserService() {
681 return userService;
682 }
683
684
689 public void setUserService(
690 com.liferay.portal.service.UserService userService) {
691 this.userService = userService;
692 }
693
694
699 public UserPersistence getUserPersistence() {
700 return userPersistence;
701 }
702
703
708 public void setUserPersistence(UserPersistence userPersistence) {
709 this.userPersistence = userPersistence;
710 }
711
712
717 public UserFinder getUserFinder() {
718 return userFinder;
719 }
720
721
726 public void setUserFinder(UserFinder userFinder) {
727 this.userFinder = userFinder;
728 }
729
730
735 public com.liferay.portlet.asset.service.AssetCategoryLocalService getAssetCategoryLocalService() {
736 return assetCategoryLocalService;
737 }
738
739
744 public void setAssetCategoryLocalService(
745 com.liferay.portlet.asset.service.AssetCategoryLocalService assetCategoryLocalService) {
746 this.assetCategoryLocalService = assetCategoryLocalService;
747 }
748
749
754 public com.liferay.portlet.asset.service.AssetCategoryService getAssetCategoryService() {
755 return assetCategoryService;
756 }
757
758
763 public void setAssetCategoryService(
764 com.liferay.portlet.asset.service.AssetCategoryService assetCategoryService) {
765 this.assetCategoryService = assetCategoryService;
766 }
767
768
773 public AssetCategoryPersistence getAssetCategoryPersistence() {
774 return assetCategoryPersistence;
775 }
776
777
782 public void setAssetCategoryPersistence(
783 AssetCategoryPersistence assetCategoryPersistence) {
784 this.assetCategoryPersistence = assetCategoryPersistence;
785 }
786
787
792 public AssetCategoryFinder getAssetCategoryFinder() {
793 return assetCategoryFinder;
794 }
795
796
801 public void setAssetCategoryFinder(AssetCategoryFinder assetCategoryFinder) {
802 this.assetCategoryFinder = assetCategoryFinder;
803 }
804
805 public void afterPropertiesSet() {
806 persistedModelLocalServiceRegistry.register("com.liferay.portlet.asset.model.AssetVocabulary",
807 assetVocabularyLocalService);
808 }
809
810 public void destroy() {
811 persistedModelLocalServiceRegistry.unregister(
812 "com.liferay.portlet.asset.model.AssetVocabulary");
813 }
814
815
820 @Override
821 public String getBeanIdentifier() {
822 return _beanIdentifier;
823 }
824
825
830 @Override
831 public void setBeanIdentifier(String beanIdentifier) {
832 _beanIdentifier = beanIdentifier;
833 }
834
835 protected Class<?> getModelClass() {
836 return AssetVocabulary.class;
837 }
838
839 protected String getModelClassName() {
840 return AssetVocabulary.class.getName();
841 }
842
843
848 protected void runSQL(String sql) {
849 try {
850 DataSource dataSource = assetVocabularyPersistence.getDataSource();
851
852 DB db = DBFactoryUtil.getDB();
853
854 sql = db.buildSQL(sql);
855 sql = PortalUtil.transformSQL(sql);
856
857 SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
858 sql, new int[0]);
859
860 sqlUpdate.update();
861 }
862 catch (Exception e) {
863 throw new SystemException(e);
864 }
865 }
866
867 @BeanReference(type = com.liferay.portlet.asset.service.AssetVocabularyLocalService.class)
868 protected com.liferay.portlet.asset.service.AssetVocabularyLocalService assetVocabularyLocalService;
869 @BeanReference(type = com.liferay.portlet.asset.service.AssetVocabularyService.class)
870 protected com.liferay.portlet.asset.service.AssetVocabularyService assetVocabularyService;
871 @BeanReference(type = AssetVocabularyPersistence.class)
872 protected AssetVocabularyPersistence assetVocabularyPersistence;
873 @BeanReference(type = AssetVocabularyFinder.class)
874 protected AssetVocabularyFinder assetVocabularyFinder;
875 @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
876 protected com.liferay.counter.service.CounterLocalService counterLocalService;
877 @BeanReference(type = com.liferay.portal.service.ClassNameLocalService.class)
878 protected com.liferay.portal.service.ClassNameLocalService classNameLocalService;
879 @BeanReference(type = com.liferay.portal.service.ClassNameService.class)
880 protected com.liferay.portal.service.ClassNameService classNameService;
881 @BeanReference(type = ClassNamePersistence.class)
882 protected ClassNamePersistence classNamePersistence;
883 @BeanReference(type = com.liferay.portal.service.GroupLocalService.class)
884 protected com.liferay.portal.service.GroupLocalService groupLocalService;
885 @BeanReference(type = com.liferay.portal.service.GroupService.class)
886 protected com.liferay.portal.service.GroupService groupService;
887 @BeanReference(type = GroupPersistence.class)
888 protected GroupPersistence groupPersistence;
889 @BeanReference(type = GroupFinder.class)
890 protected GroupFinder groupFinder;
891 @BeanReference(type = com.liferay.portal.service.ResourceLocalService.class)
892 protected com.liferay.portal.service.ResourceLocalService resourceLocalService;
893 @BeanReference(type = com.liferay.portal.service.UserLocalService.class)
894 protected com.liferay.portal.service.UserLocalService userLocalService;
895 @BeanReference(type = com.liferay.portal.service.UserService.class)
896 protected com.liferay.portal.service.UserService userService;
897 @BeanReference(type = UserPersistence.class)
898 protected UserPersistence userPersistence;
899 @BeanReference(type = UserFinder.class)
900 protected UserFinder userFinder;
901 @BeanReference(type = com.liferay.portlet.asset.service.AssetCategoryLocalService.class)
902 protected com.liferay.portlet.asset.service.AssetCategoryLocalService assetCategoryLocalService;
903 @BeanReference(type = com.liferay.portlet.asset.service.AssetCategoryService.class)
904 protected com.liferay.portlet.asset.service.AssetCategoryService assetCategoryService;
905 @BeanReference(type = AssetCategoryPersistence.class)
906 protected AssetCategoryPersistence assetCategoryPersistence;
907 @BeanReference(type = AssetCategoryFinder.class)
908 protected AssetCategoryFinder assetCategoryFinder;
909 @BeanReference(type = PersistedModelLocalServiceRegistry.class)
910 protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
911 private String _beanIdentifier;
912 }