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.ListType;
037 import com.liferay.portal.model.PersistedModel;
038 import com.liferay.portal.service.BaseLocalServiceImpl;
039 import com.liferay.portal.service.ListTypeLocalService;
040 import com.liferay.portal.service.PersistedModelLocalServiceRegistry;
041 import com.liferay.portal.service.persistence.ClassNamePersistence;
042 import com.liferay.portal.service.persistence.ListTypePersistence;
043 import com.liferay.portal.util.PortalUtil;
044
045 import java.io.Serializable;
046
047 import java.util.List;
048
049 import javax.sql.DataSource;
050
051
063 @ProviderType
064 public abstract class ListTypeLocalServiceBaseImpl extends BaseLocalServiceImpl
065 implements ListTypeLocalService, IdentifiableOSGiService {
066
071
072
078 @Indexable(type = IndexableType.REINDEX)
079 @Override
080 public ListType addListType(ListType listType) {
081 listType.setNew(true);
082
083 return listTypePersistence.update(listType);
084 }
085
086
092 @Override
093 public ListType createListType(long listTypeId) {
094 return listTypePersistence.create(listTypeId);
095 }
096
097
104 @Indexable(type = IndexableType.DELETE)
105 @Override
106 public ListType deleteListType(long listTypeId) throws PortalException {
107 return listTypePersistence.remove(listTypeId);
108 }
109
110
116 @Indexable(type = IndexableType.DELETE)
117 @Override
118 public ListType deleteListType(ListType listType) {
119 return listTypePersistence.remove(listType);
120 }
121
122 @Override
123 public DynamicQuery dynamicQuery() {
124 Class<?> clazz = getClass();
125
126 return DynamicQueryFactoryUtil.forClass(ListType.class,
127 clazz.getClassLoader());
128 }
129
130
136 @Override
137 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery) {
138 return listTypePersistence.findWithDynamicQuery(dynamicQuery);
139 }
140
141
153 @Override
154 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
155 int end) {
156 return listTypePersistence.findWithDynamicQuery(dynamicQuery, start, end);
157 }
158
159
172 @Override
173 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
174 int end, OrderByComparator<T> orderByComparator) {
175 return listTypePersistence.findWithDynamicQuery(dynamicQuery, start,
176 end, orderByComparator);
177 }
178
179
185 @Override
186 public long dynamicQueryCount(DynamicQuery dynamicQuery) {
187 return listTypePersistence.countWithDynamicQuery(dynamicQuery);
188 }
189
190
197 @Override
198 public long dynamicQueryCount(DynamicQuery dynamicQuery,
199 Projection projection) {
200 return listTypePersistence.countWithDynamicQuery(dynamicQuery,
201 projection);
202 }
203
204 @Override
205 public ListType fetchListType(long listTypeId) {
206 return listTypePersistence.fetchByPrimaryKey(listTypeId);
207 }
208
209
216 @Override
217 public ListType getListType(long listTypeId) throws PortalException {
218 return listTypePersistence.findByPrimaryKey(listTypeId);
219 }
220
221 @Override
222 public ActionableDynamicQuery getActionableDynamicQuery() {
223 ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
224
225 actionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.ListTypeLocalServiceUtil.getService());
226 actionableDynamicQuery.setClassLoader(getClassLoader());
227 actionableDynamicQuery.setModelClass(ListType.class);
228
229 actionableDynamicQuery.setPrimaryKeyPropertyName("listTypeId");
230
231 return actionableDynamicQuery;
232 }
233
234 @Override
235 public IndexableActionableDynamicQuery getIndexableActionableDynamicQuery() {
236 IndexableActionableDynamicQuery indexableActionableDynamicQuery = new IndexableActionableDynamicQuery();
237
238 indexableActionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.ListTypeLocalServiceUtil.getService());
239 indexableActionableDynamicQuery.setClassLoader(getClassLoader());
240 indexableActionableDynamicQuery.setModelClass(ListType.class);
241
242 indexableActionableDynamicQuery.setPrimaryKeyPropertyName("listTypeId");
243
244 return indexableActionableDynamicQuery;
245 }
246
247 protected void initActionableDynamicQuery(
248 ActionableDynamicQuery actionableDynamicQuery) {
249 actionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.ListTypeLocalServiceUtil.getService());
250 actionableDynamicQuery.setClassLoader(getClassLoader());
251 actionableDynamicQuery.setModelClass(ListType.class);
252
253 actionableDynamicQuery.setPrimaryKeyPropertyName("listTypeId");
254 }
255
256
259 @Override
260 public PersistedModel deletePersistedModel(PersistedModel persistedModel)
261 throws PortalException {
262 return listTypeLocalService.deleteListType((ListType)persistedModel);
263 }
264
265 @Override
266 public PersistedModel getPersistedModel(Serializable primaryKeyObj)
267 throws PortalException {
268 return listTypePersistence.findByPrimaryKey(primaryKeyObj);
269 }
270
271
282 @Override
283 public List<ListType> getListTypes(int start, int end) {
284 return listTypePersistence.findAll(start, end);
285 }
286
287
292 @Override
293 public int getListTypesCount() {
294 return listTypePersistence.countAll();
295 }
296
297
303 @Indexable(type = IndexableType.REINDEX)
304 @Override
305 public ListType updateListType(ListType listType) {
306 return listTypePersistence.update(listType);
307 }
308
309
314 public ListTypeLocalService getListTypeLocalService() {
315 return listTypeLocalService;
316 }
317
318
323 public void setListTypeLocalService(
324 ListTypeLocalService listTypeLocalService) {
325 this.listTypeLocalService = listTypeLocalService;
326 }
327
328
333 public ListTypePersistence getListTypePersistence() {
334 return listTypePersistence;
335 }
336
337
342 public void setListTypePersistence(ListTypePersistence listTypePersistence) {
343 this.listTypePersistence = listTypePersistence;
344 }
345
346
351 public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
352 return counterLocalService;
353 }
354
355
360 public void setCounterLocalService(
361 com.liferay.counter.service.CounterLocalService counterLocalService) {
362 this.counterLocalService = counterLocalService;
363 }
364
365
370 public com.liferay.portal.service.ClassNameLocalService getClassNameLocalService() {
371 return classNameLocalService;
372 }
373
374
379 public void setClassNameLocalService(
380 com.liferay.portal.service.ClassNameLocalService classNameLocalService) {
381 this.classNameLocalService = classNameLocalService;
382 }
383
384
389 public ClassNamePersistence getClassNamePersistence() {
390 return classNamePersistence;
391 }
392
393
398 public void setClassNamePersistence(
399 ClassNamePersistence classNamePersistence) {
400 this.classNamePersistence = classNamePersistence;
401 }
402
403 public void afterPropertiesSet() {
404 persistedModelLocalServiceRegistry.register("com.liferay.portal.model.ListType",
405 listTypeLocalService);
406 }
407
408 public void destroy() {
409 persistedModelLocalServiceRegistry.unregister(
410 "com.liferay.portal.model.ListType");
411 }
412
413
418 @Override
419 public String getOSGiServiceIdentifier() {
420 return ListTypeLocalService.class.getName();
421 }
422
423 protected Class<?> getModelClass() {
424 return ListType.class;
425 }
426
427 protected String getModelClassName() {
428 return ListType.class.getName();
429 }
430
431
436 protected void runSQL(String sql) {
437 try {
438 DataSource dataSource = listTypePersistence.getDataSource();
439
440 DB db = DBManagerUtil.getDB();
441
442 sql = db.buildSQL(sql);
443 sql = PortalUtil.transformSQL(sql);
444
445 SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
446 sql, new int[0]);
447
448 sqlUpdate.update();
449 }
450 catch (Exception e) {
451 throw new SystemException(e);
452 }
453 }
454
455 @BeanReference(type = com.liferay.portal.service.ListTypeLocalService.class)
456 protected ListTypeLocalService listTypeLocalService;
457 @BeanReference(type = ListTypePersistence.class)
458 protected ListTypePersistence listTypePersistence;
459 @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
460 protected com.liferay.counter.service.CounterLocalService counterLocalService;
461 @BeanReference(type = com.liferay.portal.service.ClassNameLocalService.class)
462 protected com.liferay.portal.service.ClassNameLocalService classNameLocalService;
463 @BeanReference(type = ClassNamePersistence.class)
464 protected ClassNamePersistence classNamePersistence;
465 @BeanReference(type = PersistedModelLocalServiceRegistry.class)
466 protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
467 }