001
014
015 package com.liferay.portlet.social.service.base;
016
017 import aQute.bnd.annotation.ProviderType;
018
019 import com.liferay.portal.kernel.bean.BeanReference;
020 import com.liferay.portal.kernel.bean.IdentifiableBean;
021 import com.liferay.portal.kernel.dao.db.DB;
022 import com.liferay.portal.kernel.dao.db.DBFactoryUtil;
023 import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
024 import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
025 import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery;
026 import com.liferay.portal.kernel.dao.orm.DefaultActionableDynamicQuery;
027 import com.liferay.portal.kernel.dao.orm.DynamicQuery;
028 import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil;
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.search.Indexable;
033 import com.liferay.portal.kernel.search.IndexableType;
034 import com.liferay.portal.kernel.util.OrderByComparator;
035 import com.liferay.portal.model.PersistedModel;
036 import com.liferay.portal.service.BaseLocalServiceImpl;
037 import com.liferay.portal.service.PersistedModelLocalServiceRegistry;
038 import com.liferay.portal.service.persistence.ClassNamePersistence;
039 import com.liferay.portal.service.persistence.UserFinder;
040 import com.liferay.portal.service.persistence.UserPersistence;
041 import com.liferay.portal.util.PortalUtil;
042
043 import com.liferay.portlet.social.model.SocialRelation;
044 import com.liferay.portlet.social.service.SocialRelationLocalService;
045 import com.liferay.portlet.social.service.persistence.SocialRelationPersistence;
046
047 import java.io.Serializable;
048
049 import java.util.List;
050
051 import javax.sql.DataSource;
052
053
065 @ProviderType
066 public abstract class SocialRelationLocalServiceBaseImpl
067 extends BaseLocalServiceImpl implements SocialRelationLocalService,
068 IdentifiableBean {
069
074
075
081 @Indexable(type = IndexableType.REINDEX)
082 @Override
083 public SocialRelation addSocialRelation(SocialRelation socialRelation) {
084 socialRelation.setNew(true);
085
086 return socialRelationPersistence.update(socialRelation);
087 }
088
089
095 @Override
096 public SocialRelation createSocialRelation(long relationId) {
097 return socialRelationPersistence.create(relationId);
098 }
099
100
107 @Indexable(type = IndexableType.DELETE)
108 @Override
109 public SocialRelation deleteSocialRelation(long relationId)
110 throws PortalException {
111 return socialRelationPersistence.remove(relationId);
112 }
113
114
120 @Indexable(type = IndexableType.DELETE)
121 @Override
122 public SocialRelation deleteSocialRelation(SocialRelation socialRelation) {
123 return socialRelationPersistence.remove(socialRelation);
124 }
125
126 @Override
127 public DynamicQuery dynamicQuery() {
128 Class<?> clazz = getClass();
129
130 return DynamicQueryFactoryUtil.forClass(SocialRelation.class,
131 clazz.getClassLoader());
132 }
133
134
140 @Override
141 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery) {
142 return socialRelationPersistence.findWithDynamicQuery(dynamicQuery);
143 }
144
145
157 @Override
158 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
159 int end) {
160 return socialRelationPersistence.findWithDynamicQuery(dynamicQuery,
161 start, end);
162 }
163
164
177 @Override
178 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
179 int end, OrderByComparator<T> orderByComparator) {
180 return socialRelationPersistence.findWithDynamicQuery(dynamicQuery,
181 start, end, orderByComparator);
182 }
183
184
190 @Override
191 public long dynamicQueryCount(DynamicQuery dynamicQuery) {
192 return socialRelationPersistence.countWithDynamicQuery(dynamicQuery);
193 }
194
195
202 @Override
203 public long dynamicQueryCount(DynamicQuery dynamicQuery,
204 Projection projection) {
205 return socialRelationPersistence.countWithDynamicQuery(dynamicQuery,
206 projection);
207 }
208
209 @Override
210 public SocialRelation fetchSocialRelation(long relationId) {
211 return socialRelationPersistence.fetchByPrimaryKey(relationId);
212 }
213
214
221 @Override
222 public SocialRelation fetchSocialRelationByUuidAndCompanyId(String uuid,
223 long companyId) {
224 return socialRelationPersistence.fetchByUuid_C_First(uuid, companyId,
225 null);
226 }
227
228
235 @Override
236 public SocialRelation getSocialRelation(long relationId)
237 throws PortalException {
238 return socialRelationPersistence.findByPrimaryKey(relationId);
239 }
240
241 @Override
242 public ActionableDynamicQuery getActionableDynamicQuery() {
243 ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
244
245 actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.social.service.SocialRelationLocalServiceUtil.getService());
246 actionableDynamicQuery.setClass(SocialRelation.class);
247 actionableDynamicQuery.setClassLoader(getClassLoader());
248
249 actionableDynamicQuery.setPrimaryKeyPropertyName("relationId");
250
251 return actionableDynamicQuery;
252 }
253
254 protected void initActionableDynamicQuery(
255 ActionableDynamicQuery actionableDynamicQuery) {
256 actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.social.service.SocialRelationLocalServiceUtil.getService());
257 actionableDynamicQuery.setClass(SocialRelation.class);
258 actionableDynamicQuery.setClassLoader(getClassLoader());
259
260 actionableDynamicQuery.setPrimaryKeyPropertyName("relationId");
261 }
262
263
266 @Override
267 public PersistedModel deletePersistedModel(PersistedModel persistedModel)
268 throws PortalException {
269 return socialRelationLocalService.deleteSocialRelation((SocialRelation)persistedModel);
270 }
271
272 @Override
273 public PersistedModel getPersistedModel(Serializable primaryKeyObj)
274 throws PortalException {
275 return socialRelationPersistence.findByPrimaryKey(primaryKeyObj);
276 }
277
278
286 @Override
287 public SocialRelation getSocialRelationByUuidAndCompanyId(String uuid,
288 long companyId) throws PortalException {
289 return socialRelationPersistence.findByUuid_C_First(uuid, companyId,
290 null);
291 }
292
293
304 @Override
305 public List<SocialRelation> getSocialRelations(int start, int end) {
306 return socialRelationPersistence.findAll(start, end);
307 }
308
309
314 @Override
315 public int getSocialRelationsCount() {
316 return socialRelationPersistence.countAll();
317 }
318
319
325 @Indexable(type = IndexableType.REINDEX)
326 @Override
327 public SocialRelation updateSocialRelation(SocialRelation socialRelation) {
328 return socialRelationPersistence.update(socialRelation);
329 }
330
331
336 public SocialRelationLocalService getSocialRelationLocalService() {
337 return socialRelationLocalService;
338 }
339
340
345 public void setSocialRelationLocalService(
346 SocialRelationLocalService socialRelationLocalService) {
347 this.socialRelationLocalService = socialRelationLocalService;
348 }
349
350
355 public SocialRelationPersistence getSocialRelationPersistence() {
356 return socialRelationPersistence;
357 }
358
359
364 public void setSocialRelationPersistence(
365 SocialRelationPersistence socialRelationPersistence) {
366 this.socialRelationPersistence = socialRelationPersistence;
367 }
368
369
374 public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
375 return counterLocalService;
376 }
377
378
383 public void setCounterLocalService(
384 com.liferay.counter.service.CounterLocalService counterLocalService) {
385 this.counterLocalService = counterLocalService;
386 }
387
388
393 public com.liferay.portal.service.ClassNameLocalService getClassNameLocalService() {
394 return classNameLocalService;
395 }
396
397
402 public void setClassNameLocalService(
403 com.liferay.portal.service.ClassNameLocalService classNameLocalService) {
404 this.classNameLocalService = classNameLocalService;
405 }
406
407
412 public com.liferay.portal.service.ClassNameService getClassNameService() {
413 return classNameService;
414 }
415
416
421 public void setClassNameService(
422 com.liferay.portal.service.ClassNameService classNameService) {
423 this.classNameService = classNameService;
424 }
425
426
431 public ClassNamePersistence getClassNamePersistence() {
432 return classNamePersistence;
433 }
434
435
440 public void setClassNamePersistence(
441 ClassNamePersistence classNamePersistence) {
442 this.classNamePersistence = classNamePersistence;
443 }
444
445
450 public com.liferay.portal.service.UserLocalService getUserLocalService() {
451 return userLocalService;
452 }
453
454
459 public void setUserLocalService(
460 com.liferay.portal.service.UserLocalService userLocalService) {
461 this.userLocalService = userLocalService;
462 }
463
464
469 public com.liferay.portal.service.UserService getUserService() {
470 return userService;
471 }
472
473
478 public void setUserService(
479 com.liferay.portal.service.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.social.model.SocialRelation",
521 socialRelationLocalService);
522 }
523
524 public void destroy() {
525 persistedModelLocalServiceRegistry.unregister(
526 "com.liferay.portlet.social.model.SocialRelation");
527 }
528
529
534 @Override
535 public String getBeanIdentifier() {
536 return _beanIdentifier;
537 }
538
539
544 @Override
545 public void setBeanIdentifier(String beanIdentifier) {
546 _beanIdentifier = beanIdentifier;
547 }
548
549 protected Class<?> getModelClass() {
550 return SocialRelation.class;
551 }
552
553 protected String getModelClassName() {
554 return SocialRelation.class.getName();
555 }
556
557
562 protected void runSQL(String sql) {
563 try {
564 DataSource dataSource = socialRelationPersistence.getDataSource();
565
566 DB db = DBFactoryUtil.getDB();
567
568 sql = db.buildSQL(sql);
569 sql = PortalUtil.transformSQL(sql);
570
571 SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
572 sql, new int[0]);
573
574 sqlUpdate.update();
575 }
576 catch (Exception e) {
577 throw new SystemException(e);
578 }
579 }
580
581 @BeanReference(type = com.liferay.portlet.social.service.SocialRelationLocalService.class)
582 protected SocialRelationLocalService socialRelationLocalService;
583 @BeanReference(type = SocialRelationPersistence.class)
584 protected SocialRelationPersistence socialRelationPersistence;
585 @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
586 protected com.liferay.counter.service.CounterLocalService counterLocalService;
587 @BeanReference(type = com.liferay.portal.service.ClassNameLocalService.class)
588 protected com.liferay.portal.service.ClassNameLocalService classNameLocalService;
589 @BeanReference(type = com.liferay.portal.service.ClassNameService.class)
590 protected com.liferay.portal.service.ClassNameService classNameService;
591 @BeanReference(type = ClassNamePersistence.class)
592 protected ClassNamePersistence classNamePersistence;
593 @BeanReference(type = com.liferay.portal.service.UserLocalService.class)
594 protected com.liferay.portal.service.UserLocalService userLocalService;
595 @BeanReference(type = com.liferay.portal.service.UserService.class)
596 protected com.liferay.portal.service.UserService userService;
597 @BeanReference(type = UserPersistence.class)
598 protected UserPersistence userPersistence;
599 @BeanReference(type = UserFinder.class)
600 protected UserFinder userFinder;
601 @BeanReference(type = PersistedModelLocalServiceRegistry.class)
602 protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
603 private String _beanIdentifier;
604 }