001
014
015 package com.liferay.portal.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.model.SystemEvent;
038 import com.liferay.portal.service.BaseLocalServiceImpl;
039 import com.liferay.portal.service.PersistedModelLocalServiceRegistry;
040 import com.liferay.portal.service.SystemEventLocalService;
041 import com.liferay.portal.service.persistence.CompanyPersistence;
042 import com.liferay.portal.service.persistence.GroupFinder;
043 import com.liferay.portal.service.persistence.GroupPersistence;
044 import com.liferay.portal.service.persistence.SystemEventPersistence;
045 import com.liferay.portal.service.persistence.UserFinder;
046 import com.liferay.portal.service.persistence.UserPersistence;
047 import com.liferay.portal.util.PortalUtil;
048
049 import java.io.Serializable;
050
051 import java.util.List;
052
053 import javax.sql.DataSource;
054
055
067 @ProviderType
068 public abstract class SystemEventLocalServiceBaseImpl
069 extends BaseLocalServiceImpl implements SystemEventLocalService,
070 IdentifiableOSGiService {
071
076
077
083 @Indexable(type = IndexableType.REINDEX)
084 @Override
085 public SystemEvent addSystemEvent(SystemEvent systemEvent) {
086 systemEvent.setNew(true);
087
088 return systemEventPersistence.update(systemEvent);
089 }
090
091
097 @Override
098 public SystemEvent createSystemEvent(long systemEventId) {
099 return systemEventPersistence.create(systemEventId);
100 }
101
102
109 @Indexable(type = IndexableType.DELETE)
110 @Override
111 public SystemEvent deleteSystemEvent(long systemEventId)
112 throws PortalException {
113 return systemEventPersistence.remove(systemEventId);
114 }
115
116
122 @Indexable(type = IndexableType.DELETE)
123 @Override
124 public SystemEvent deleteSystemEvent(SystemEvent systemEvent) {
125 return systemEventPersistence.remove(systemEvent);
126 }
127
128 @Override
129 public DynamicQuery dynamicQuery() {
130 Class<?> clazz = getClass();
131
132 return DynamicQueryFactoryUtil.forClass(SystemEvent.class,
133 clazz.getClassLoader());
134 }
135
136
142 @Override
143 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery) {
144 return systemEventPersistence.findWithDynamicQuery(dynamicQuery);
145 }
146
147
159 @Override
160 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
161 int end) {
162 return systemEventPersistence.findWithDynamicQuery(dynamicQuery, start,
163 end);
164 }
165
166
179 @Override
180 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
181 int end, OrderByComparator<T> orderByComparator) {
182 return systemEventPersistence.findWithDynamicQuery(dynamicQuery, start,
183 end, orderByComparator);
184 }
185
186
192 @Override
193 public long dynamicQueryCount(DynamicQuery dynamicQuery) {
194 return systemEventPersistence.countWithDynamicQuery(dynamicQuery);
195 }
196
197
204 @Override
205 public long dynamicQueryCount(DynamicQuery dynamicQuery,
206 Projection projection) {
207 return systemEventPersistence.countWithDynamicQuery(dynamicQuery,
208 projection);
209 }
210
211 @Override
212 public SystemEvent fetchSystemEvent(long systemEventId) {
213 return systemEventPersistence.fetchByPrimaryKey(systemEventId);
214 }
215
216
223 @Override
224 public SystemEvent getSystemEvent(long systemEventId)
225 throws PortalException {
226 return systemEventPersistence.findByPrimaryKey(systemEventId);
227 }
228
229 @Override
230 public ActionableDynamicQuery getActionableDynamicQuery() {
231 ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
232
233 actionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.SystemEventLocalServiceUtil.getService());
234 actionableDynamicQuery.setClassLoader(getClassLoader());
235 actionableDynamicQuery.setModelClass(SystemEvent.class);
236
237 actionableDynamicQuery.setPrimaryKeyPropertyName("systemEventId");
238
239 return actionableDynamicQuery;
240 }
241
242 @Override
243 public IndexableActionableDynamicQuery getIndexableActionableDynamicQuery() {
244 IndexableActionableDynamicQuery indexableActionableDynamicQuery = new IndexableActionableDynamicQuery();
245
246 indexableActionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.SystemEventLocalServiceUtil.getService());
247 indexableActionableDynamicQuery.setClassLoader(getClassLoader());
248 indexableActionableDynamicQuery.setModelClass(SystemEvent.class);
249
250 indexableActionableDynamicQuery.setPrimaryKeyPropertyName(
251 "systemEventId");
252
253 return indexableActionableDynamicQuery;
254 }
255
256 protected void initActionableDynamicQuery(
257 ActionableDynamicQuery actionableDynamicQuery) {
258 actionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.SystemEventLocalServiceUtil.getService());
259 actionableDynamicQuery.setClassLoader(getClassLoader());
260 actionableDynamicQuery.setModelClass(SystemEvent.class);
261
262 actionableDynamicQuery.setPrimaryKeyPropertyName("systemEventId");
263 }
264
265
268 @Override
269 public PersistedModel deletePersistedModel(PersistedModel persistedModel)
270 throws PortalException {
271 return systemEventLocalService.deleteSystemEvent((SystemEvent)persistedModel);
272 }
273
274 @Override
275 public PersistedModel getPersistedModel(Serializable primaryKeyObj)
276 throws PortalException {
277 return systemEventPersistence.findByPrimaryKey(primaryKeyObj);
278 }
279
280
291 @Override
292 public List<SystemEvent> getSystemEvents(int start, int end) {
293 return systemEventPersistence.findAll(start, end);
294 }
295
296
301 @Override
302 public int getSystemEventsCount() {
303 return systemEventPersistence.countAll();
304 }
305
306
312 @Indexable(type = IndexableType.REINDEX)
313 @Override
314 public SystemEvent updateSystemEvent(SystemEvent systemEvent) {
315 return systemEventPersistence.update(systemEvent);
316 }
317
318
323 public SystemEventLocalService getSystemEventLocalService() {
324 return systemEventLocalService;
325 }
326
327
332 public void setSystemEventLocalService(
333 SystemEventLocalService systemEventLocalService) {
334 this.systemEventLocalService = systemEventLocalService;
335 }
336
337
342 public SystemEventPersistence getSystemEventPersistence() {
343 return systemEventPersistence;
344 }
345
346
351 public void setSystemEventPersistence(
352 SystemEventPersistence systemEventPersistence) {
353 this.systemEventPersistence = systemEventPersistence;
354 }
355
356
361 public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
362 return counterLocalService;
363 }
364
365
370 public void setCounterLocalService(
371 com.liferay.counter.service.CounterLocalService counterLocalService) {
372 this.counterLocalService = counterLocalService;
373 }
374
375
380 public com.liferay.portal.service.CompanyLocalService getCompanyLocalService() {
381 return companyLocalService;
382 }
383
384
389 public void setCompanyLocalService(
390 com.liferay.portal.service.CompanyLocalService companyLocalService) {
391 this.companyLocalService = companyLocalService;
392 }
393
394
399 public CompanyPersistence getCompanyPersistence() {
400 return companyPersistence;
401 }
402
403
408 public void setCompanyPersistence(CompanyPersistence companyPersistence) {
409 this.companyPersistence = companyPersistence;
410 }
411
412
417 public com.liferay.portal.service.GroupLocalService getGroupLocalService() {
418 return groupLocalService;
419 }
420
421
426 public void setGroupLocalService(
427 com.liferay.portal.service.GroupLocalService groupLocalService) {
428 this.groupLocalService = groupLocalService;
429 }
430
431
436 public GroupPersistence getGroupPersistence() {
437 return groupPersistence;
438 }
439
440
445 public void setGroupPersistence(GroupPersistence groupPersistence) {
446 this.groupPersistence = groupPersistence;
447 }
448
449
454 public GroupFinder getGroupFinder() {
455 return groupFinder;
456 }
457
458
463 public void setGroupFinder(GroupFinder groupFinder) {
464 this.groupFinder = groupFinder;
465 }
466
467
472 public com.liferay.portal.service.UserLocalService getUserLocalService() {
473 return userLocalService;
474 }
475
476
481 public void setUserLocalService(
482 com.liferay.portal.service.UserLocalService userLocalService) {
483 this.userLocalService = userLocalService;
484 }
485
486
491 public UserPersistence getUserPersistence() {
492 return userPersistence;
493 }
494
495
500 public void setUserPersistence(UserPersistence userPersistence) {
501 this.userPersistence = userPersistence;
502 }
503
504
509 public UserFinder getUserFinder() {
510 return userFinder;
511 }
512
513
518 public void setUserFinder(UserFinder userFinder) {
519 this.userFinder = userFinder;
520 }
521
522 public void afterPropertiesSet() {
523 persistedModelLocalServiceRegistry.register("com.liferay.portal.model.SystemEvent",
524 systemEventLocalService);
525 }
526
527 public void destroy() {
528 persistedModelLocalServiceRegistry.unregister(
529 "com.liferay.portal.model.SystemEvent");
530 }
531
532
537 @Override
538 public String getOSGiServiceIdentifier() {
539 return SystemEventLocalService.class.getName();
540 }
541
542 protected Class<?> getModelClass() {
543 return SystemEvent.class;
544 }
545
546 protected String getModelClassName() {
547 return SystemEvent.class.getName();
548 }
549
550
555 protected void runSQL(String sql) {
556 try {
557 DataSource dataSource = systemEventPersistence.getDataSource();
558
559 DB db = DBManagerUtil.getDB();
560
561 sql = db.buildSQL(sql);
562 sql = PortalUtil.transformSQL(sql);
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 = com.liferay.portal.service.SystemEventLocalService.class)
575 protected SystemEventLocalService systemEventLocalService;
576 @BeanReference(type = SystemEventPersistence.class)
577 protected SystemEventPersistence systemEventPersistence;
578 @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
579 protected com.liferay.counter.service.CounterLocalService counterLocalService;
580 @BeanReference(type = com.liferay.portal.service.CompanyLocalService.class)
581 protected com.liferay.portal.service.CompanyLocalService companyLocalService;
582 @BeanReference(type = CompanyPersistence.class)
583 protected CompanyPersistence companyPersistence;
584 @BeanReference(type = com.liferay.portal.service.GroupLocalService.class)
585 protected com.liferay.portal.service.GroupLocalService groupLocalService;
586 @BeanReference(type = GroupPersistence.class)
587 protected GroupPersistence groupPersistence;
588 @BeanReference(type = GroupFinder.class)
589 protected GroupFinder groupFinder;
590 @BeanReference(type = com.liferay.portal.service.UserLocalService.class)
591 protected com.liferay.portal.service.UserLocalService userLocalService;
592 @BeanReference(type = UserPersistence.class)
593 protected UserPersistence userPersistence;
594 @BeanReference(type = UserFinder.class)
595 protected UserFinder userFinder;
596 @BeanReference(type = PersistedModelLocalServiceRegistry.class)
597 protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
598 }