001
014
015 package com.liferay.portlet.trash.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.IndexableActionableDynamicQuery;
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.SystemEventPersistence;
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.trash.model.TrashEntry;
048 import com.liferay.portlet.trash.service.TrashEntryLocalService;
049 import com.liferay.portlet.trash.service.persistence.TrashEntryPersistence;
050 import com.liferay.portlet.trash.service.persistence.TrashVersionPersistence;
051
052 import java.io.Serializable;
053
054 import java.util.List;
055
056 import javax.sql.DataSource;
057
058
070 @ProviderType
071 public abstract class TrashEntryLocalServiceBaseImpl
072 extends BaseLocalServiceImpl implements TrashEntryLocalService,
073 IdentifiableOSGiService {
074
079
080
086 @Indexable(type = IndexableType.REINDEX)
087 @Override
088 public TrashEntry addTrashEntry(TrashEntry trashEntry) {
089 trashEntry.setNew(true);
090
091 return trashEntryPersistence.update(trashEntry);
092 }
093
094
100 @Override
101 public TrashEntry createTrashEntry(long entryId) {
102 return trashEntryPersistence.create(entryId);
103 }
104
105
112 @Indexable(type = IndexableType.DELETE)
113 @Override
114 public TrashEntry deleteTrashEntry(long entryId) throws PortalException {
115 return trashEntryPersistence.remove(entryId);
116 }
117
118
124 @Indexable(type = IndexableType.DELETE)
125 @Override
126 public TrashEntry deleteTrashEntry(TrashEntry trashEntry) {
127 return trashEntryPersistence.remove(trashEntry);
128 }
129
130 @Override
131 public DynamicQuery dynamicQuery() {
132 Class<?> clazz = getClass();
133
134 return DynamicQueryFactoryUtil.forClass(TrashEntry.class,
135 clazz.getClassLoader());
136 }
137
138
144 @Override
145 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery) {
146 return trashEntryPersistence.findWithDynamicQuery(dynamicQuery);
147 }
148
149
161 @Override
162 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
163 int end) {
164 return trashEntryPersistence.findWithDynamicQuery(dynamicQuery, start,
165 end);
166 }
167
168
181 @Override
182 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
183 int end, OrderByComparator<T> orderByComparator) {
184 return trashEntryPersistence.findWithDynamicQuery(dynamicQuery, start,
185 end, orderByComparator);
186 }
187
188
194 @Override
195 public long dynamicQueryCount(DynamicQuery dynamicQuery) {
196 return trashEntryPersistence.countWithDynamicQuery(dynamicQuery);
197 }
198
199
206 @Override
207 public long dynamicQueryCount(DynamicQuery dynamicQuery,
208 Projection projection) {
209 return trashEntryPersistence.countWithDynamicQuery(dynamicQuery,
210 projection);
211 }
212
213 @Override
214 public TrashEntry fetchTrashEntry(long entryId) {
215 return trashEntryPersistence.fetchByPrimaryKey(entryId);
216 }
217
218
225 @Override
226 public TrashEntry getTrashEntry(long entryId) throws PortalException {
227 return trashEntryPersistence.findByPrimaryKey(entryId);
228 }
229
230 @Override
231 public ActionableDynamicQuery getActionableDynamicQuery() {
232 ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
233
234 actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.trash.service.TrashEntryLocalServiceUtil.getService());
235 actionableDynamicQuery.setClassLoader(getClassLoader());
236 actionableDynamicQuery.setModelClass(TrashEntry.class);
237
238 actionableDynamicQuery.setPrimaryKeyPropertyName("entryId");
239
240 return actionableDynamicQuery;
241 }
242
243 @Override
244 public IndexableActionableDynamicQuery getIndexableActionableDynamicQuery() {
245 IndexableActionableDynamicQuery indexableActionableDynamicQuery = new IndexableActionableDynamicQuery();
246
247 indexableActionableDynamicQuery.setBaseLocalService(com.liferay.portlet.trash.service.TrashEntryLocalServiceUtil.getService());
248 indexableActionableDynamicQuery.setClassLoader(getClassLoader());
249 indexableActionableDynamicQuery.setModelClass(TrashEntry.class);
250
251 indexableActionableDynamicQuery.setPrimaryKeyPropertyName("entryId");
252
253 return indexableActionableDynamicQuery;
254 }
255
256 protected void initActionableDynamicQuery(
257 ActionableDynamicQuery actionableDynamicQuery) {
258 actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.trash.service.TrashEntryLocalServiceUtil.getService());
259 actionableDynamicQuery.setClassLoader(getClassLoader());
260 actionableDynamicQuery.setModelClass(TrashEntry.class);
261
262 actionableDynamicQuery.setPrimaryKeyPropertyName("entryId");
263 }
264
265
268 @Override
269 public PersistedModel deletePersistedModel(PersistedModel persistedModel)
270 throws PortalException {
271 return trashEntryLocalService.deleteTrashEntry((TrashEntry)persistedModel);
272 }
273
274 @Override
275 public PersistedModel getPersistedModel(Serializable primaryKeyObj)
276 throws PortalException {
277 return trashEntryPersistence.findByPrimaryKey(primaryKeyObj);
278 }
279
280
291 @Override
292 public List<TrashEntry> getTrashEntries(int start, int end) {
293 return trashEntryPersistence.findAll(start, end);
294 }
295
296
301 @Override
302 public int getTrashEntriesCount() {
303 return trashEntryPersistence.countAll();
304 }
305
306
312 @Indexable(type = IndexableType.REINDEX)
313 @Override
314 public TrashEntry updateTrashEntry(TrashEntry trashEntry) {
315 return trashEntryPersistence.update(trashEntry);
316 }
317
318
323 public TrashEntryLocalService getTrashEntryLocalService() {
324 return trashEntryLocalService;
325 }
326
327
332 public void setTrashEntryLocalService(
333 TrashEntryLocalService trashEntryLocalService) {
334 this.trashEntryLocalService = trashEntryLocalService;
335 }
336
337
342 public TrashEntryPersistence getTrashEntryPersistence() {
343 return trashEntryPersistence;
344 }
345
346
351 public void setTrashEntryPersistence(
352 TrashEntryPersistence trashEntryPersistence) {
353 this.trashEntryPersistence = trashEntryPersistence;
354 }
355
356
361 public com.liferay.portlet.trash.service.TrashVersionLocalService getTrashVersionLocalService() {
362 return trashVersionLocalService;
363 }
364
365
370 public void setTrashVersionLocalService(
371 com.liferay.portlet.trash.service.TrashVersionLocalService trashVersionLocalService) {
372 this.trashVersionLocalService = trashVersionLocalService;
373 }
374
375
380 public TrashVersionPersistence getTrashVersionPersistence() {
381 return trashVersionPersistence;
382 }
383
384
389 public void setTrashVersionPersistence(
390 TrashVersionPersistence trashVersionPersistence) {
391 this.trashVersionPersistence = trashVersionPersistence;
392 }
393
394
399 public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
400 return counterLocalService;
401 }
402
403
408 public void setCounterLocalService(
409 com.liferay.counter.service.CounterLocalService counterLocalService) {
410 this.counterLocalService = counterLocalService;
411 }
412
413
418 public com.liferay.portal.service.ClassNameLocalService getClassNameLocalService() {
419 return classNameLocalService;
420 }
421
422
427 public void setClassNameLocalService(
428 com.liferay.portal.service.ClassNameLocalService classNameLocalService) {
429 this.classNameLocalService = classNameLocalService;
430 }
431
432
437 public ClassNamePersistence getClassNamePersistence() {
438 return classNamePersistence;
439 }
440
441
446 public void setClassNamePersistence(
447 ClassNamePersistence classNamePersistence) {
448 this.classNamePersistence = classNamePersistence;
449 }
450
451
456 public com.liferay.portal.service.GroupLocalService getGroupLocalService() {
457 return groupLocalService;
458 }
459
460
465 public void setGroupLocalService(
466 com.liferay.portal.service.GroupLocalService groupLocalService) {
467 this.groupLocalService = groupLocalService;
468 }
469
470
475 public GroupPersistence getGroupPersistence() {
476 return groupPersistence;
477 }
478
479
484 public void setGroupPersistence(GroupPersistence groupPersistence) {
485 this.groupPersistence = groupPersistence;
486 }
487
488
493 public GroupFinder getGroupFinder() {
494 return groupFinder;
495 }
496
497
502 public void setGroupFinder(GroupFinder groupFinder) {
503 this.groupFinder = groupFinder;
504 }
505
506
511 public com.liferay.portal.service.ResourceLocalService getResourceLocalService() {
512 return resourceLocalService;
513 }
514
515
520 public void setResourceLocalService(
521 com.liferay.portal.service.ResourceLocalService resourceLocalService) {
522 this.resourceLocalService = resourceLocalService;
523 }
524
525
530 public com.liferay.portal.service.SystemEventLocalService getSystemEventLocalService() {
531 return systemEventLocalService;
532 }
533
534
539 public void setSystemEventLocalService(
540 com.liferay.portal.service.SystemEventLocalService systemEventLocalService) {
541 this.systemEventLocalService = systemEventLocalService;
542 }
543
544
549 public SystemEventPersistence getSystemEventPersistence() {
550 return systemEventPersistence;
551 }
552
553
558 public void setSystemEventPersistence(
559 SystemEventPersistence systemEventPersistence) {
560 this.systemEventPersistence = systemEventPersistence;
561 }
562
563
568 public com.liferay.portal.service.UserLocalService getUserLocalService() {
569 return userLocalService;
570 }
571
572
577 public void setUserLocalService(
578 com.liferay.portal.service.UserLocalService userLocalService) {
579 this.userLocalService = userLocalService;
580 }
581
582
587 public UserPersistence getUserPersistence() {
588 return userPersistence;
589 }
590
591
596 public void setUserPersistence(UserPersistence userPersistence) {
597 this.userPersistence = userPersistence;
598 }
599
600
605 public UserFinder getUserFinder() {
606 return userFinder;
607 }
608
609
614 public void setUserFinder(UserFinder userFinder) {
615 this.userFinder = userFinder;
616 }
617
618 public void afterPropertiesSet() {
619 persistedModelLocalServiceRegistry.register("com.liferay.portlet.trash.model.TrashEntry",
620 trashEntryLocalService);
621 }
622
623 public void destroy() {
624 persistedModelLocalServiceRegistry.unregister(
625 "com.liferay.portlet.trash.model.TrashEntry");
626 }
627
628
633 @Override
634 public String getOSGiServiceIdentifier() {
635 return TrashEntryLocalService.class.getName();
636 }
637
638 protected Class<?> getModelClass() {
639 return TrashEntry.class;
640 }
641
642 protected String getModelClassName() {
643 return TrashEntry.class.getName();
644 }
645
646
651 protected void runSQL(String sql) {
652 try {
653 DataSource dataSource = trashEntryPersistence.getDataSource();
654
655 DB db = DBManagerUtil.getDB();
656
657 sql = db.buildSQL(sql);
658 sql = PortalUtil.transformSQL(sql);
659
660 SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
661 sql, new int[0]);
662
663 sqlUpdate.update();
664 }
665 catch (Exception e) {
666 throw new SystemException(e);
667 }
668 }
669
670 @BeanReference(type = com.liferay.portlet.trash.service.TrashEntryLocalService.class)
671 protected TrashEntryLocalService trashEntryLocalService;
672 @BeanReference(type = TrashEntryPersistence.class)
673 protected TrashEntryPersistence trashEntryPersistence;
674 @BeanReference(type = com.liferay.portlet.trash.service.TrashVersionLocalService.class)
675 protected com.liferay.portlet.trash.service.TrashVersionLocalService trashVersionLocalService;
676 @BeanReference(type = TrashVersionPersistence.class)
677 protected TrashVersionPersistence trashVersionPersistence;
678 @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
679 protected com.liferay.counter.service.CounterLocalService counterLocalService;
680 @BeanReference(type = com.liferay.portal.service.ClassNameLocalService.class)
681 protected com.liferay.portal.service.ClassNameLocalService classNameLocalService;
682 @BeanReference(type = ClassNamePersistence.class)
683 protected ClassNamePersistence classNamePersistence;
684 @BeanReference(type = com.liferay.portal.service.GroupLocalService.class)
685 protected com.liferay.portal.service.GroupLocalService groupLocalService;
686 @BeanReference(type = GroupPersistence.class)
687 protected GroupPersistence groupPersistence;
688 @BeanReference(type = GroupFinder.class)
689 protected GroupFinder groupFinder;
690 @BeanReference(type = com.liferay.portal.service.ResourceLocalService.class)
691 protected com.liferay.portal.service.ResourceLocalService resourceLocalService;
692 @BeanReference(type = com.liferay.portal.service.SystemEventLocalService.class)
693 protected com.liferay.portal.service.SystemEventLocalService systemEventLocalService;
694 @BeanReference(type = SystemEventPersistence.class)
695 protected SystemEventPersistence systemEventPersistence;
696 @BeanReference(type = com.liferay.portal.service.UserLocalService.class)
697 protected com.liferay.portal.service.UserLocalService userLocalService;
698 @BeanReference(type = UserPersistence.class)
699 protected UserPersistence userPersistence;
700 @BeanReference(type = UserFinder.class)
701 protected UserFinder userFinder;
702 @BeanReference(type = PersistedModelLocalServiceRegistry.class)
703 protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
704 }