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.DBFactoryUtil;
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.Projection;
029 import com.liferay.portal.kernel.exception.PortalException;
030 import com.liferay.portal.kernel.exception.SystemException;
031 import com.liferay.portal.kernel.module.framework.service.IdentifiableOSGiService;
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.ListType;
036 import com.liferay.portal.model.PersistedModel;
037 import com.liferay.portal.service.BaseLocalServiceImpl;
038 import com.liferay.portal.service.ListTypeLocalService;
039 import com.liferay.portal.service.PersistedModelLocalServiceRegistry;
040 import com.liferay.portal.service.persistence.ClassNamePersistence;
041 import com.liferay.portal.service.persistence.ListTypePersistence;
042 import com.liferay.portal.util.PortalUtil;
043
044 import java.io.Serializable;
045
046 import java.util.List;
047
048 import javax.sql.DataSource;
049
050
062 @ProviderType
063 public abstract class ListTypeLocalServiceBaseImpl extends BaseLocalServiceImpl
064 implements ListTypeLocalService, IdentifiableOSGiService {
065
070
071
077 @Indexable(type = IndexableType.REINDEX)
078 @Override
079 public ListType addListType(ListType listType) {
080 listType.setNew(true);
081
082 return listTypePersistence.update(listType);
083 }
084
085
091 @Override
092 public ListType createListType(long listTypeId) {
093 return listTypePersistence.create(listTypeId);
094 }
095
096
103 @Indexable(type = IndexableType.DELETE)
104 @Override
105 public ListType deleteListType(long listTypeId) throws PortalException {
106 return listTypePersistence.remove(listTypeId);
107 }
108
109
115 @Indexable(type = IndexableType.DELETE)
116 @Override
117 public ListType deleteListType(ListType listType) {
118 return listTypePersistence.remove(listType);
119 }
120
121 @Override
122 public DynamicQuery dynamicQuery() {
123 Class<?> clazz = getClass();
124
125 return DynamicQueryFactoryUtil.forClass(ListType.class,
126 clazz.getClassLoader());
127 }
128
129
135 @Override
136 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery) {
137 return listTypePersistence.findWithDynamicQuery(dynamicQuery);
138 }
139
140
152 @Override
153 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
154 int end) {
155 return listTypePersistence.findWithDynamicQuery(dynamicQuery, start, end);
156 }
157
158
171 @Override
172 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
173 int end, OrderByComparator<T> orderByComparator) {
174 return listTypePersistence.findWithDynamicQuery(dynamicQuery, start,
175 end, orderByComparator);
176 }
177
178
184 @Override
185 public long dynamicQueryCount(DynamicQuery dynamicQuery) {
186 return listTypePersistence.countWithDynamicQuery(dynamicQuery);
187 }
188
189
196 @Override
197 public long dynamicQueryCount(DynamicQuery dynamicQuery,
198 Projection projection) {
199 return listTypePersistence.countWithDynamicQuery(dynamicQuery,
200 projection);
201 }
202
203 @Override
204 public ListType fetchListType(long listTypeId) {
205 return listTypePersistence.fetchByPrimaryKey(listTypeId);
206 }
207
208
215 @Override
216 public ListType getListType(long listTypeId) throws PortalException {
217 return listTypePersistence.findByPrimaryKey(listTypeId);
218 }
219
220 @Override
221 public ActionableDynamicQuery getActionableDynamicQuery() {
222 ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
223
224 actionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.ListTypeLocalServiceUtil.getService());
225 actionableDynamicQuery.setClass(ListType.class);
226 actionableDynamicQuery.setClassLoader(getClassLoader());
227
228 actionableDynamicQuery.setPrimaryKeyPropertyName("listTypeId");
229
230 return actionableDynamicQuery;
231 }
232
233 protected void initActionableDynamicQuery(
234 ActionableDynamicQuery actionableDynamicQuery) {
235 actionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.ListTypeLocalServiceUtil.getService());
236 actionableDynamicQuery.setClass(ListType.class);
237 actionableDynamicQuery.setClassLoader(getClassLoader());
238
239 actionableDynamicQuery.setPrimaryKeyPropertyName("listTypeId");
240 }
241
242
245 @Override
246 public PersistedModel deletePersistedModel(PersistedModel persistedModel)
247 throws PortalException {
248 return listTypeLocalService.deleteListType((ListType)persistedModel);
249 }
250
251 @Override
252 public PersistedModel getPersistedModel(Serializable primaryKeyObj)
253 throws PortalException {
254 return listTypePersistence.findByPrimaryKey(primaryKeyObj);
255 }
256
257
268 @Override
269 public List<ListType> getListTypes(int start, int end) {
270 return listTypePersistence.findAll(start, end);
271 }
272
273
278 @Override
279 public int getListTypesCount() {
280 return listTypePersistence.countAll();
281 }
282
283
289 @Indexable(type = IndexableType.REINDEX)
290 @Override
291 public ListType updateListType(ListType listType) {
292 return listTypePersistence.update(listType);
293 }
294
295
300 public ListTypeLocalService getListTypeLocalService() {
301 return listTypeLocalService;
302 }
303
304
309 public void setListTypeLocalService(
310 ListTypeLocalService listTypeLocalService) {
311 this.listTypeLocalService = listTypeLocalService;
312 }
313
314
319 public com.liferay.portal.service.ListTypeService getListTypeService() {
320 return listTypeService;
321 }
322
323
328 public void setListTypeService(
329 com.liferay.portal.service.ListTypeService listTypeService) {
330 this.listTypeService = listTypeService;
331 }
332
333
338 public ListTypePersistence getListTypePersistence() {
339 return listTypePersistence;
340 }
341
342
347 public void setListTypePersistence(ListTypePersistence listTypePersistence) {
348 this.listTypePersistence = listTypePersistence;
349 }
350
351
356 public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
357 return counterLocalService;
358 }
359
360
365 public void setCounterLocalService(
366 com.liferay.counter.service.CounterLocalService counterLocalService) {
367 this.counterLocalService = counterLocalService;
368 }
369
370
375 public com.liferay.portal.service.ClassNameLocalService getClassNameLocalService() {
376 return classNameLocalService;
377 }
378
379
384 public void setClassNameLocalService(
385 com.liferay.portal.service.ClassNameLocalService classNameLocalService) {
386 this.classNameLocalService = classNameLocalService;
387 }
388
389
394 public com.liferay.portal.service.ClassNameService getClassNameService() {
395 return classNameService;
396 }
397
398
403 public void setClassNameService(
404 com.liferay.portal.service.ClassNameService classNameService) {
405 this.classNameService = classNameService;
406 }
407
408
413 public ClassNamePersistence getClassNamePersistence() {
414 return classNamePersistence;
415 }
416
417
422 public void setClassNamePersistence(
423 ClassNamePersistence classNamePersistence) {
424 this.classNamePersistence = classNamePersistence;
425 }
426
427 public void afterPropertiesSet() {
428 persistedModelLocalServiceRegistry.register("com.liferay.portal.model.ListType",
429 listTypeLocalService);
430 }
431
432 public void destroy() {
433 persistedModelLocalServiceRegistry.unregister(
434 "com.liferay.portal.model.ListType");
435 }
436
437
442 @Override
443 public String getOSGiServiceIdentifier() {
444 return ListTypeLocalService.class.getName();
445 }
446
447 protected Class<?> getModelClass() {
448 return ListType.class;
449 }
450
451 protected String getModelClassName() {
452 return ListType.class.getName();
453 }
454
455
460 protected void runSQL(String sql) {
461 try {
462 DataSource dataSource = listTypePersistence.getDataSource();
463
464 DB db = DBFactoryUtil.getDB();
465
466 sql = db.buildSQL(sql);
467 sql = PortalUtil.transformSQL(sql);
468
469 SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
470 sql, new int[0]);
471
472 sqlUpdate.update();
473 }
474 catch (Exception e) {
475 throw new SystemException(e);
476 }
477 }
478
479 @BeanReference(type = com.liferay.portal.service.ListTypeLocalService.class)
480 protected ListTypeLocalService listTypeLocalService;
481 @BeanReference(type = com.liferay.portal.service.ListTypeService.class)
482 protected com.liferay.portal.service.ListTypeService listTypeService;
483 @BeanReference(type = ListTypePersistence.class)
484 protected ListTypePersistence listTypePersistence;
485 @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
486 protected com.liferay.counter.service.CounterLocalService counterLocalService;
487 @BeanReference(type = com.liferay.portal.service.ClassNameLocalService.class)
488 protected com.liferay.portal.service.ClassNameLocalService classNameLocalService;
489 @BeanReference(type = com.liferay.portal.service.ClassNameService.class)
490 protected com.liferay.portal.service.ClassNameService classNameService;
491 @BeanReference(type = ClassNamePersistence.class)
492 protected ClassNamePersistence classNamePersistence;
493 @BeanReference(type = PersistedModelLocalServiceRegistry.class)
494 protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
495 }