001
014
015 package com.liferay.portlet.trash.service.base;
016
017 import com.liferay.counter.service.CounterLocalService;
018
019 import com.liferay.portal.kernel.bean.BeanReference;
020 import com.liferay.portal.kernel.bean.IdentifiableBean;
021 import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
022 import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
023 import com.liferay.portal.kernel.dao.orm.DynamicQuery;
024 import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil;
025 import com.liferay.portal.kernel.exception.PortalException;
026 import com.liferay.portal.kernel.exception.SystemException;
027 import com.liferay.portal.kernel.search.Indexable;
028 import com.liferay.portal.kernel.search.IndexableType;
029 import com.liferay.portal.kernel.util.OrderByComparator;
030 import com.liferay.portal.model.PersistedModel;
031 import com.liferay.portal.service.BaseLocalServiceImpl;
032 import com.liferay.portal.service.GroupLocalService;
033 import com.liferay.portal.service.GroupService;
034 import com.liferay.portal.service.PersistedModelLocalServiceRegistry;
035 import com.liferay.portal.service.ResourceLocalService;
036 import com.liferay.portal.service.UserLocalService;
037 import com.liferay.portal.service.UserService;
038 import com.liferay.portal.service.persistence.GroupFinder;
039 import com.liferay.portal.service.persistence.GroupPersistence;
040 import com.liferay.portal.service.persistence.UserFinder;
041 import com.liferay.portal.service.persistence.UserPersistence;
042
043 import com.liferay.portlet.trash.model.TrashEntry;
044 import com.liferay.portlet.trash.service.TrashEntryLocalService;
045 import com.liferay.portlet.trash.service.TrashEntryService;
046 import com.liferay.portlet.trash.service.persistence.TrashEntryPersistence;
047 import com.liferay.portlet.trash.service.persistence.TrashVersionPersistence;
048
049 import java.io.Serializable;
050
051 import java.util.List;
052
053 import javax.sql.DataSource;
054
055
067 public abstract class TrashEntryLocalServiceBaseImpl
068 extends BaseLocalServiceImpl implements TrashEntryLocalService,
069 IdentifiableBean {
070
075
076
083 @Indexable(type = IndexableType.REINDEX)
084 public TrashEntry addTrashEntry(TrashEntry trashEntry)
085 throws SystemException {
086 trashEntry.setNew(true);
087
088 return trashEntryPersistence.update(trashEntry);
089 }
090
091
097 public TrashEntry createTrashEntry(long entryId) {
098 return trashEntryPersistence.create(entryId);
099 }
100
101
109 @Indexable(type = IndexableType.DELETE)
110 public TrashEntry deleteTrashEntry(long entryId)
111 throws PortalException, SystemException {
112 return trashEntryPersistence.remove(entryId);
113 }
114
115
122 @Indexable(type = IndexableType.DELETE)
123 public TrashEntry deleteTrashEntry(TrashEntry trashEntry)
124 throws SystemException {
125 return trashEntryPersistence.remove(trashEntry);
126 }
127
128 public DynamicQuery dynamicQuery() {
129 Class<?> clazz = getClass();
130
131 return DynamicQueryFactoryUtil.forClass(TrashEntry.class,
132 clazz.getClassLoader());
133 }
134
135
142 @SuppressWarnings("rawtypes")
143 public List dynamicQuery(DynamicQuery dynamicQuery)
144 throws SystemException {
145 return trashEntryPersistence.findWithDynamicQuery(dynamicQuery);
146 }
147
148
161 @SuppressWarnings("rawtypes")
162 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
163 throws SystemException {
164 return trashEntryPersistence.findWithDynamicQuery(dynamicQuery, start,
165 end);
166 }
167
168
182 @SuppressWarnings("rawtypes")
183 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end,
184 OrderByComparator orderByComparator) throws SystemException {
185 return trashEntryPersistence.findWithDynamicQuery(dynamicQuery, start,
186 end, orderByComparator);
187 }
188
189
196 public long dynamicQueryCount(DynamicQuery dynamicQuery)
197 throws SystemException {
198 return trashEntryPersistence.countWithDynamicQuery(dynamicQuery);
199 }
200
201 public TrashEntry fetchTrashEntry(long entryId) throws SystemException {
202 return trashEntryPersistence.fetchByPrimaryKey(entryId);
203 }
204
205
213 public TrashEntry getTrashEntry(long entryId)
214 throws PortalException, SystemException {
215 return trashEntryPersistence.findByPrimaryKey(entryId);
216 }
217
218 public PersistedModel getPersistedModel(Serializable primaryKeyObj)
219 throws PortalException, SystemException {
220 return trashEntryPersistence.findByPrimaryKey(primaryKeyObj);
221 }
222
223
235 public List<TrashEntry> getTrashEntries(int start, int end)
236 throws SystemException {
237 return trashEntryPersistence.findAll(start, end);
238 }
239
240
246 public int getTrashEntriesCount() throws SystemException {
247 return trashEntryPersistence.countAll();
248 }
249
250
257 @Indexable(type = IndexableType.REINDEX)
258 public TrashEntry updateTrashEntry(TrashEntry trashEntry)
259 throws SystemException {
260 return trashEntryPersistence.update(trashEntry);
261 }
262
263
268 public TrashEntryLocalService getTrashEntryLocalService() {
269 return trashEntryLocalService;
270 }
271
272
277 public void setTrashEntryLocalService(
278 TrashEntryLocalService trashEntryLocalService) {
279 this.trashEntryLocalService = trashEntryLocalService;
280 }
281
282
287 public TrashEntryService getTrashEntryService() {
288 return trashEntryService;
289 }
290
291
296 public void setTrashEntryService(TrashEntryService trashEntryService) {
297 this.trashEntryService = trashEntryService;
298 }
299
300
305 public TrashEntryPersistence getTrashEntryPersistence() {
306 return trashEntryPersistence;
307 }
308
309
314 public void setTrashEntryPersistence(
315 TrashEntryPersistence trashEntryPersistence) {
316 this.trashEntryPersistence = trashEntryPersistence;
317 }
318
319
324 public TrashVersionPersistence getTrashVersionPersistence() {
325 return trashVersionPersistence;
326 }
327
328
333 public void setTrashVersionPersistence(
334 TrashVersionPersistence trashVersionPersistence) {
335 this.trashVersionPersistence = trashVersionPersistence;
336 }
337
338
343 public CounterLocalService getCounterLocalService() {
344 return counterLocalService;
345 }
346
347
352 public void setCounterLocalService(CounterLocalService counterLocalService) {
353 this.counterLocalService = counterLocalService;
354 }
355
356
361 public GroupLocalService getGroupLocalService() {
362 return groupLocalService;
363 }
364
365
370 public void setGroupLocalService(GroupLocalService groupLocalService) {
371 this.groupLocalService = groupLocalService;
372 }
373
374
379 public GroupService getGroupService() {
380 return groupService;
381 }
382
383
388 public void setGroupService(GroupService groupService) {
389 this.groupService = groupService;
390 }
391
392
397 public GroupPersistence getGroupPersistence() {
398 return groupPersistence;
399 }
400
401
406 public void setGroupPersistence(GroupPersistence groupPersistence) {
407 this.groupPersistence = groupPersistence;
408 }
409
410
415 public GroupFinder getGroupFinder() {
416 return groupFinder;
417 }
418
419
424 public void setGroupFinder(GroupFinder groupFinder) {
425 this.groupFinder = groupFinder;
426 }
427
428
433 public ResourceLocalService getResourceLocalService() {
434 return resourceLocalService;
435 }
436
437
442 public void setResourceLocalService(
443 ResourceLocalService resourceLocalService) {
444 this.resourceLocalService = resourceLocalService;
445 }
446
447
452 public UserLocalService getUserLocalService() {
453 return userLocalService;
454 }
455
456
461 public void setUserLocalService(UserLocalService userLocalService) {
462 this.userLocalService = userLocalService;
463 }
464
465
470 public UserService getUserService() {
471 return userService;
472 }
473
474
479 public void setUserService(UserService userService) {
480 this.userService = userService;
481 }
482
483
488 public UserPersistence getUserPersistence() {
489 return userPersistence;
490 }
491
492
497 public void setUserPersistence(UserPersistence userPersistence) {
498 this.userPersistence = userPersistence;
499 }
500
501
506 public UserFinder getUserFinder() {
507 return userFinder;
508 }
509
510
515 public void setUserFinder(UserFinder userFinder) {
516 this.userFinder = userFinder;
517 }
518
519 public void afterPropertiesSet() {
520 persistedModelLocalServiceRegistry.register("com.liferay.portlet.trash.model.TrashEntry",
521 trashEntryLocalService);
522 }
523
524 public void destroy() {
525 persistedModelLocalServiceRegistry.unregister(
526 "com.liferay.portlet.trash.model.TrashEntry");
527 }
528
529
534 public String getBeanIdentifier() {
535 return _beanIdentifier;
536 }
537
538
543 public void setBeanIdentifier(String beanIdentifier) {
544 _beanIdentifier = beanIdentifier;
545 }
546
547 protected Class<?> getModelClass() {
548 return TrashEntry.class;
549 }
550
551 protected String getModelClassName() {
552 return TrashEntry.class.getName();
553 }
554
555
560 protected void runSQL(String sql) throws SystemException {
561 try {
562 DataSource dataSource = trashEntryPersistence.getDataSource();
563
564 SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
565 sql, new int[0]);
566
567 sqlUpdate.update();
568 }
569 catch (Exception e) {
570 throw new SystemException(e);
571 }
572 }
573
574 @BeanReference(type = TrashEntryLocalService.class)
575 protected TrashEntryLocalService trashEntryLocalService;
576 @BeanReference(type = TrashEntryService.class)
577 protected TrashEntryService trashEntryService;
578 @BeanReference(type = TrashEntryPersistence.class)
579 protected TrashEntryPersistence trashEntryPersistence;
580 @BeanReference(type = TrashVersionPersistence.class)
581 protected TrashVersionPersistence trashVersionPersistence;
582 @BeanReference(type = CounterLocalService.class)
583 protected CounterLocalService counterLocalService;
584 @BeanReference(type = GroupLocalService.class)
585 protected GroupLocalService groupLocalService;
586 @BeanReference(type = GroupService.class)
587 protected GroupService groupService;
588 @BeanReference(type = GroupPersistence.class)
589 protected GroupPersistence groupPersistence;
590 @BeanReference(type = GroupFinder.class)
591 protected GroupFinder groupFinder;
592 @BeanReference(type = ResourceLocalService.class)
593 protected ResourceLocalService resourceLocalService;
594 @BeanReference(type = UserLocalService.class)
595 protected UserLocalService userLocalService;
596 @BeanReference(type = UserService.class)
597 protected UserService userService;
598 @BeanReference(type = UserPersistence.class)
599 protected UserPersistence userPersistence;
600 @BeanReference(type = UserFinder.class)
601 protected UserFinder userFinder;
602 @BeanReference(type = PersistedModelLocalServiceRegistry.class)
603 protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
604 private String _beanIdentifier;
605 }