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