001
014
015 package com.liferay.portlet.asset.service.base;
016
017 import aQute.bnd.annotation.ProviderType;
018
019 import com.liferay.asset.kernel.model.AssetVocabulary;
020 import com.liferay.asset.kernel.service.AssetVocabularyLocalService;
021 import com.liferay.asset.kernel.service.persistence.AssetCategoryFinder;
022 import com.liferay.asset.kernel.service.persistence.AssetCategoryPersistence;
023 import com.liferay.asset.kernel.service.persistence.AssetVocabularyFinder;
024 import com.liferay.asset.kernel.service.persistence.AssetVocabularyPersistence;
025
026 import com.liferay.exportimport.kernel.lar.ExportImportHelperUtil;
027 import com.liferay.exportimport.kernel.lar.ManifestSummary;
028 import com.liferay.exportimport.kernel.lar.PortletDataContext;
029 import com.liferay.exportimport.kernel.lar.StagedModelDataHandlerUtil;
030 import com.liferay.exportimport.kernel.lar.StagedModelType;
031
032 import com.liferay.portal.kernel.bean.BeanReference;
033 import com.liferay.portal.kernel.dao.db.DB;
034 import com.liferay.portal.kernel.dao.db.DBManagerUtil;
035 import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
036 import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
037 import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery;
038 import com.liferay.portal.kernel.dao.orm.DefaultActionableDynamicQuery;
039 import com.liferay.portal.kernel.dao.orm.DynamicQuery;
040 import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil;
041 import com.liferay.portal.kernel.dao.orm.ExportActionableDynamicQuery;
042 import com.liferay.portal.kernel.dao.orm.IndexableActionableDynamicQuery;
043 import com.liferay.portal.kernel.dao.orm.Projection;
044 import com.liferay.portal.kernel.exception.PortalException;
045 import com.liferay.portal.kernel.exception.SystemException;
046 import com.liferay.portal.kernel.model.PersistedModel;
047 import com.liferay.portal.kernel.module.framework.service.IdentifiableOSGiService;
048 import com.liferay.portal.kernel.search.Indexable;
049 import com.liferay.portal.kernel.search.IndexableType;
050 import com.liferay.portal.kernel.service.BaseLocalServiceImpl;
051 import com.liferay.portal.kernel.service.PersistedModelLocalServiceRegistry;
052 import com.liferay.portal.kernel.service.persistence.ClassNamePersistence;
053 import com.liferay.portal.kernel.service.persistence.GroupFinder;
054 import com.liferay.portal.kernel.service.persistence.GroupPersistence;
055 import com.liferay.portal.kernel.service.persistence.UserFinder;
056 import com.liferay.portal.kernel.service.persistence.UserPersistence;
057 import com.liferay.portal.kernel.util.OrderByComparator;
058 import com.liferay.portal.kernel.util.PortalUtil;
059
060 import java.io.Serializable;
061
062 import java.util.List;
063
064 import javax.sql.DataSource;
065
066
078 @ProviderType
079 public abstract class AssetVocabularyLocalServiceBaseImpl
080 extends BaseLocalServiceImpl implements AssetVocabularyLocalService,
081 IdentifiableOSGiService {
082
087
088
094 @Indexable(type = IndexableType.REINDEX)
095 @Override
096 public AssetVocabulary addAssetVocabulary(AssetVocabulary assetVocabulary) {
097 assetVocabulary.setNew(true);
098
099 return assetVocabularyPersistence.update(assetVocabulary);
100 }
101
102
108 @Override
109 public AssetVocabulary createAssetVocabulary(long vocabularyId) {
110 return assetVocabularyPersistence.create(vocabularyId);
111 }
112
113
120 @Indexable(type = IndexableType.DELETE)
121 @Override
122 public AssetVocabulary deleteAssetVocabulary(long vocabularyId)
123 throws PortalException {
124 return assetVocabularyPersistence.remove(vocabularyId);
125 }
126
127
133 @Indexable(type = IndexableType.DELETE)
134 @Override
135 public AssetVocabulary deleteAssetVocabulary(
136 AssetVocabulary assetVocabulary) {
137 return assetVocabularyPersistence.remove(assetVocabulary);
138 }
139
140 @Override
141 public DynamicQuery dynamicQuery() {
142 Class<?> clazz = getClass();
143
144 return DynamicQueryFactoryUtil.forClass(AssetVocabulary.class,
145 clazz.getClassLoader());
146 }
147
148
154 @Override
155 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery) {
156 return assetVocabularyPersistence.findWithDynamicQuery(dynamicQuery);
157 }
158
159
171 @Override
172 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
173 int end) {
174 return assetVocabularyPersistence.findWithDynamicQuery(dynamicQuery,
175 start, end);
176 }
177
178
191 @Override
192 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
193 int end, OrderByComparator<T> orderByComparator) {
194 return assetVocabularyPersistence.findWithDynamicQuery(dynamicQuery,
195 start, end, orderByComparator);
196 }
197
198
204 @Override
205 public long dynamicQueryCount(DynamicQuery dynamicQuery) {
206 return assetVocabularyPersistence.countWithDynamicQuery(dynamicQuery);
207 }
208
209
216 @Override
217 public long dynamicQueryCount(DynamicQuery dynamicQuery,
218 Projection projection) {
219 return assetVocabularyPersistence.countWithDynamicQuery(dynamicQuery,
220 projection);
221 }
222
223 @Override
224 public AssetVocabulary fetchAssetVocabulary(long vocabularyId) {
225 return assetVocabularyPersistence.fetchByPrimaryKey(vocabularyId);
226 }
227
228
235 @Override
236 public AssetVocabulary fetchAssetVocabularyByUuidAndGroupId(String uuid,
237 long groupId) {
238 return assetVocabularyPersistence.fetchByUUID_G(uuid, groupId);
239 }
240
241
248 @Override
249 public AssetVocabulary getAssetVocabulary(long vocabularyId)
250 throws PortalException {
251 return assetVocabularyPersistence.findByPrimaryKey(vocabularyId);
252 }
253
254 @Override
255 public ActionableDynamicQuery getActionableDynamicQuery() {
256 ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
257
258 actionableDynamicQuery.setBaseLocalService(assetVocabularyLocalService);
259 actionableDynamicQuery.setClassLoader(getClassLoader());
260 actionableDynamicQuery.setModelClass(AssetVocabulary.class);
261
262 actionableDynamicQuery.setPrimaryKeyPropertyName("vocabularyId");
263
264 return actionableDynamicQuery;
265 }
266
267 @Override
268 public IndexableActionableDynamicQuery getIndexableActionableDynamicQuery() {
269 IndexableActionableDynamicQuery indexableActionableDynamicQuery = new IndexableActionableDynamicQuery();
270
271 indexableActionableDynamicQuery.setBaseLocalService(assetVocabularyLocalService);
272 indexableActionableDynamicQuery.setClassLoader(getClassLoader());
273 indexableActionableDynamicQuery.setModelClass(AssetVocabulary.class);
274
275 indexableActionableDynamicQuery.setPrimaryKeyPropertyName(
276 "vocabularyId");
277
278 return indexableActionableDynamicQuery;
279 }
280
281 protected void initActionableDynamicQuery(
282 ActionableDynamicQuery actionableDynamicQuery) {
283 actionableDynamicQuery.setBaseLocalService(assetVocabularyLocalService);
284 actionableDynamicQuery.setClassLoader(getClassLoader());
285 actionableDynamicQuery.setModelClass(AssetVocabulary.class);
286
287 actionableDynamicQuery.setPrimaryKeyPropertyName("vocabularyId");
288 }
289
290 @Override
291 public ExportActionableDynamicQuery getExportActionableDynamicQuery(
292 final PortletDataContext portletDataContext) {
293 final ExportActionableDynamicQuery exportActionableDynamicQuery = new ExportActionableDynamicQuery() {
294 @Override
295 public long performCount() throws PortalException {
296 ManifestSummary manifestSummary = portletDataContext.getManifestSummary();
297
298 StagedModelType stagedModelType = getStagedModelType();
299
300 long modelAdditionCount = super.performCount();
301
302 manifestSummary.addModelAdditionCount(stagedModelType,
303 modelAdditionCount);
304
305 long modelDeletionCount = ExportImportHelperUtil.getModelDeletionCount(portletDataContext,
306 stagedModelType);
307
308 manifestSummary.addModelDeletionCount(stagedModelType,
309 modelDeletionCount);
310
311 return modelAdditionCount;
312 }
313 };
314
315 initActionableDynamicQuery(exportActionableDynamicQuery);
316
317 exportActionableDynamicQuery.setAddCriteriaMethod(new ActionableDynamicQuery.AddCriteriaMethod() {
318 @Override
319 public void addCriteria(DynamicQuery dynamicQuery) {
320 portletDataContext.addDateRangeCriteria(dynamicQuery,
321 "modifiedDate");
322 }
323 });
324
325 exportActionableDynamicQuery.setCompanyId(portletDataContext.getCompanyId());
326
327 exportActionableDynamicQuery.setGroupId(portletDataContext.getScopeGroupId());
328
329 exportActionableDynamicQuery.setPerformActionMethod(new ActionableDynamicQuery.PerformActionMethod<AssetVocabulary>() {
330 @Override
331 public void performAction(AssetVocabulary assetVocabulary)
332 throws PortalException {
333 StagedModelDataHandlerUtil.exportStagedModel(portletDataContext,
334 assetVocabulary);
335 }
336 });
337 exportActionableDynamicQuery.setStagedModelType(new StagedModelType(
338 PortalUtil.getClassNameId(AssetVocabulary.class.getName())));
339
340 return exportActionableDynamicQuery;
341 }
342
343
346 @Override
347 public PersistedModel deletePersistedModel(PersistedModel persistedModel)
348 throws PortalException {
349 return assetVocabularyLocalService.deleteAssetVocabulary((AssetVocabulary)persistedModel);
350 }
351
352 @Override
353 public PersistedModel getPersistedModel(Serializable primaryKeyObj)
354 throws PortalException {
355 return assetVocabularyPersistence.findByPrimaryKey(primaryKeyObj);
356 }
357
358
365 @Override
366 public List<AssetVocabulary> getAssetVocabulariesByUuidAndCompanyId(
367 String uuid, long companyId) {
368 return assetVocabularyPersistence.findByUuid_C(uuid, companyId);
369 }
370
371
381 @Override
382 public List<AssetVocabulary> getAssetVocabulariesByUuidAndCompanyId(
383 String uuid, long companyId, int start, int end,
384 OrderByComparator<AssetVocabulary> orderByComparator) {
385 return assetVocabularyPersistence.findByUuid_C(uuid, companyId, start,
386 end, orderByComparator);
387 }
388
389
397 @Override
398 public AssetVocabulary getAssetVocabularyByUuidAndGroupId(String uuid,
399 long groupId) throws PortalException {
400 return assetVocabularyPersistence.findByUUID_G(uuid, groupId);
401 }
402
403
414 @Override
415 public List<AssetVocabulary> getAssetVocabularies(int start, int end) {
416 return assetVocabularyPersistence.findAll(start, end);
417 }
418
419
424 @Override
425 public int getAssetVocabulariesCount() {
426 return assetVocabularyPersistence.countAll();
427 }
428
429
435 @Indexable(type = IndexableType.REINDEX)
436 @Override
437 public AssetVocabulary updateAssetVocabulary(
438 AssetVocabulary assetVocabulary) {
439 return assetVocabularyPersistence.update(assetVocabulary);
440 }
441
442
447 public AssetVocabularyLocalService getAssetVocabularyLocalService() {
448 return assetVocabularyLocalService;
449 }
450
451
456 public void setAssetVocabularyLocalService(
457 AssetVocabularyLocalService assetVocabularyLocalService) {
458 this.assetVocabularyLocalService = assetVocabularyLocalService;
459 }
460
461
466 public AssetVocabularyPersistence getAssetVocabularyPersistence() {
467 return assetVocabularyPersistence;
468 }
469
470
475 public void setAssetVocabularyPersistence(
476 AssetVocabularyPersistence assetVocabularyPersistence) {
477 this.assetVocabularyPersistence = assetVocabularyPersistence;
478 }
479
480
485 public AssetVocabularyFinder getAssetVocabularyFinder() {
486 return assetVocabularyFinder;
487 }
488
489
494 public void setAssetVocabularyFinder(
495 AssetVocabularyFinder assetVocabularyFinder) {
496 this.assetVocabularyFinder = assetVocabularyFinder;
497 }
498
499
504 public com.liferay.counter.kernel.service.CounterLocalService getCounterLocalService() {
505 return counterLocalService;
506 }
507
508
513 public void setCounterLocalService(
514 com.liferay.counter.kernel.service.CounterLocalService counterLocalService) {
515 this.counterLocalService = counterLocalService;
516 }
517
518
523 public com.liferay.portal.kernel.service.ClassNameLocalService getClassNameLocalService() {
524 return classNameLocalService;
525 }
526
527
532 public void setClassNameLocalService(
533 com.liferay.portal.kernel.service.ClassNameLocalService classNameLocalService) {
534 this.classNameLocalService = classNameLocalService;
535 }
536
537
542 public ClassNamePersistence getClassNamePersistence() {
543 return classNamePersistence;
544 }
545
546
551 public void setClassNamePersistence(
552 ClassNamePersistence classNamePersistence) {
553 this.classNamePersistence = classNamePersistence;
554 }
555
556
561 public com.liferay.portal.kernel.service.GroupLocalService getGroupLocalService() {
562 return groupLocalService;
563 }
564
565
570 public void setGroupLocalService(
571 com.liferay.portal.kernel.service.GroupLocalService groupLocalService) {
572 this.groupLocalService = groupLocalService;
573 }
574
575
580 public GroupPersistence getGroupPersistence() {
581 return groupPersistence;
582 }
583
584
589 public void setGroupPersistence(GroupPersistence groupPersistence) {
590 this.groupPersistence = groupPersistence;
591 }
592
593
598 public GroupFinder getGroupFinder() {
599 return groupFinder;
600 }
601
602
607 public void setGroupFinder(GroupFinder groupFinder) {
608 this.groupFinder = groupFinder;
609 }
610
611
616 public com.liferay.portal.kernel.service.ResourceLocalService getResourceLocalService() {
617 return resourceLocalService;
618 }
619
620
625 public void setResourceLocalService(
626 com.liferay.portal.kernel.service.ResourceLocalService resourceLocalService) {
627 this.resourceLocalService = resourceLocalService;
628 }
629
630
635 public com.liferay.portal.kernel.service.UserLocalService getUserLocalService() {
636 return userLocalService;
637 }
638
639
644 public void setUserLocalService(
645 com.liferay.portal.kernel.service.UserLocalService userLocalService) {
646 this.userLocalService = userLocalService;
647 }
648
649
654 public UserPersistence getUserPersistence() {
655 return userPersistence;
656 }
657
658
663 public void setUserPersistence(UserPersistence userPersistence) {
664 this.userPersistence = userPersistence;
665 }
666
667
672 public UserFinder getUserFinder() {
673 return userFinder;
674 }
675
676
681 public void setUserFinder(UserFinder userFinder) {
682 this.userFinder = userFinder;
683 }
684
685
690 public com.liferay.asset.kernel.service.AssetCategoryLocalService getAssetCategoryLocalService() {
691 return assetCategoryLocalService;
692 }
693
694
699 public void setAssetCategoryLocalService(
700 com.liferay.asset.kernel.service.AssetCategoryLocalService assetCategoryLocalService) {
701 this.assetCategoryLocalService = assetCategoryLocalService;
702 }
703
704
709 public AssetCategoryPersistence getAssetCategoryPersistence() {
710 return assetCategoryPersistence;
711 }
712
713
718 public void setAssetCategoryPersistence(
719 AssetCategoryPersistence assetCategoryPersistence) {
720 this.assetCategoryPersistence = assetCategoryPersistence;
721 }
722
723
728 public AssetCategoryFinder getAssetCategoryFinder() {
729 return assetCategoryFinder;
730 }
731
732
737 public void setAssetCategoryFinder(AssetCategoryFinder assetCategoryFinder) {
738 this.assetCategoryFinder = assetCategoryFinder;
739 }
740
741 public void afterPropertiesSet() {
742 persistedModelLocalServiceRegistry.register("com.liferay.asset.kernel.model.AssetVocabulary",
743 assetVocabularyLocalService);
744 }
745
746 public void destroy() {
747 persistedModelLocalServiceRegistry.unregister(
748 "com.liferay.asset.kernel.model.AssetVocabulary");
749 }
750
751
756 @Override
757 public String getOSGiServiceIdentifier() {
758 return AssetVocabularyLocalService.class.getName();
759 }
760
761 protected Class<?> getModelClass() {
762 return AssetVocabulary.class;
763 }
764
765 protected String getModelClassName() {
766 return AssetVocabulary.class.getName();
767 }
768
769
774 protected void runSQL(String sql) {
775 try {
776 DataSource dataSource = assetVocabularyPersistence.getDataSource();
777
778 DB db = DBManagerUtil.getDB();
779
780 sql = db.buildSQL(sql);
781 sql = PortalUtil.transformSQL(sql);
782
783 SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
784 sql);
785
786 sqlUpdate.update();
787 }
788 catch (Exception e) {
789 throw new SystemException(e);
790 }
791 }
792
793 @BeanReference(type = AssetVocabularyLocalService.class)
794 protected AssetVocabularyLocalService assetVocabularyLocalService;
795 @BeanReference(type = AssetVocabularyPersistence.class)
796 protected AssetVocabularyPersistence assetVocabularyPersistence;
797 @BeanReference(type = AssetVocabularyFinder.class)
798 protected AssetVocabularyFinder assetVocabularyFinder;
799 @BeanReference(type = com.liferay.counter.kernel.service.CounterLocalService.class)
800 protected com.liferay.counter.kernel.service.CounterLocalService counterLocalService;
801 @BeanReference(type = com.liferay.portal.kernel.service.ClassNameLocalService.class)
802 protected com.liferay.portal.kernel.service.ClassNameLocalService classNameLocalService;
803 @BeanReference(type = ClassNamePersistence.class)
804 protected ClassNamePersistence classNamePersistence;
805 @BeanReference(type = com.liferay.portal.kernel.service.GroupLocalService.class)
806 protected com.liferay.portal.kernel.service.GroupLocalService groupLocalService;
807 @BeanReference(type = GroupPersistence.class)
808 protected GroupPersistence groupPersistence;
809 @BeanReference(type = GroupFinder.class)
810 protected GroupFinder groupFinder;
811 @BeanReference(type = com.liferay.portal.kernel.service.ResourceLocalService.class)
812 protected com.liferay.portal.kernel.service.ResourceLocalService resourceLocalService;
813 @BeanReference(type = com.liferay.portal.kernel.service.UserLocalService.class)
814 protected com.liferay.portal.kernel.service.UserLocalService userLocalService;
815 @BeanReference(type = UserPersistence.class)
816 protected UserPersistence userPersistence;
817 @BeanReference(type = UserFinder.class)
818 protected UserFinder userFinder;
819 @BeanReference(type = com.liferay.asset.kernel.service.AssetCategoryLocalService.class)
820 protected com.liferay.asset.kernel.service.AssetCategoryLocalService assetCategoryLocalService;
821 @BeanReference(type = AssetCategoryPersistence.class)
822 protected AssetCategoryPersistence assetCategoryPersistence;
823 @BeanReference(type = AssetCategoryFinder.class)
824 protected AssetCategoryFinder assetCategoryFinder;
825 @BeanReference(type = PersistedModelLocalServiceRegistry.class)
826 protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
827 }