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.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.model.PortalPreferences;
037 import com.liferay.portal.service.BaseLocalServiceImpl;
038 import com.liferay.portal.service.PersistedModelLocalServiceRegistry;
039 import com.liferay.portal.service.PortalPreferencesLocalService;
040 import com.liferay.portal.service.persistence.PortalPreferencesPersistence;
041 import com.liferay.portal.util.PortalUtil;
042
043 import java.io.Serializable;
044
045 import java.util.List;
046
047 import javax.sql.DataSource;
048
049
061 @ProviderType
062 public abstract class PortalPreferencesLocalServiceBaseImpl
063 extends BaseLocalServiceImpl implements PortalPreferencesLocalService,
064 IdentifiableBean {
065
070
071
077 @Indexable(type = IndexableType.REINDEX)
078 @Override
079 public PortalPreferences addPortalPreferences(
080 PortalPreferences portalPreferences) {
081 portalPreferences.setNew(true);
082
083 return portalPreferencesPersistence.update(portalPreferences);
084 }
085
086
092 @Override
093 public PortalPreferences createPortalPreferences(long portalPreferencesId) {
094 return portalPreferencesPersistence.create(portalPreferencesId);
095 }
096
097
104 @Indexable(type = IndexableType.DELETE)
105 @Override
106 public PortalPreferences deletePortalPreferences(long portalPreferencesId)
107 throws PortalException {
108 return portalPreferencesPersistence.remove(portalPreferencesId);
109 }
110
111
117 @Indexable(type = IndexableType.DELETE)
118 @Override
119 public PortalPreferences deletePortalPreferences(
120 PortalPreferences portalPreferences) {
121 return portalPreferencesPersistence.remove(portalPreferences);
122 }
123
124 @Override
125 public DynamicQuery dynamicQuery() {
126 Class<?> clazz = getClass();
127
128 return DynamicQueryFactoryUtil.forClass(PortalPreferences.class,
129 clazz.getClassLoader());
130 }
131
132
138 @Override
139 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery) {
140 return portalPreferencesPersistence.findWithDynamicQuery(dynamicQuery);
141 }
142
143
155 @Override
156 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
157 int end) {
158 return portalPreferencesPersistence.findWithDynamicQuery(dynamicQuery,
159 start, end);
160 }
161
162
175 @Override
176 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
177 int end, OrderByComparator<T> orderByComparator) {
178 return portalPreferencesPersistence.findWithDynamicQuery(dynamicQuery,
179 start, end, orderByComparator);
180 }
181
182
188 @Override
189 public long dynamicQueryCount(DynamicQuery dynamicQuery) {
190 return portalPreferencesPersistence.countWithDynamicQuery(dynamicQuery);
191 }
192
193
200 @Override
201 public long dynamicQueryCount(DynamicQuery dynamicQuery,
202 Projection projection) {
203 return portalPreferencesPersistence.countWithDynamicQuery(dynamicQuery,
204 projection);
205 }
206
207 @Override
208 public PortalPreferences fetchPortalPreferences(long portalPreferencesId) {
209 return portalPreferencesPersistence.fetchByPrimaryKey(portalPreferencesId);
210 }
211
212
219 @Override
220 public PortalPreferences getPortalPreferences(long portalPreferencesId)
221 throws PortalException {
222 return portalPreferencesPersistence.findByPrimaryKey(portalPreferencesId);
223 }
224
225 @Override
226 public ActionableDynamicQuery getActionableDynamicQuery() {
227 ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
228
229 actionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.PortalPreferencesLocalServiceUtil.getService());
230 actionableDynamicQuery.setClass(PortalPreferences.class);
231 actionableDynamicQuery.setClassLoader(getClassLoader());
232
233 actionableDynamicQuery.setPrimaryKeyPropertyName("portalPreferencesId");
234
235 return actionableDynamicQuery;
236 }
237
238 protected void initActionableDynamicQuery(
239 ActionableDynamicQuery actionableDynamicQuery) {
240 actionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.PortalPreferencesLocalServiceUtil.getService());
241 actionableDynamicQuery.setClass(PortalPreferences.class);
242 actionableDynamicQuery.setClassLoader(getClassLoader());
243
244 actionableDynamicQuery.setPrimaryKeyPropertyName("portalPreferencesId");
245 }
246
247
250 @Override
251 public PersistedModel deletePersistedModel(PersistedModel persistedModel)
252 throws PortalException {
253 return portalPreferencesLocalService.deletePortalPreferences((PortalPreferences)persistedModel);
254 }
255
256 @Override
257 public PersistedModel getPersistedModel(Serializable primaryKeyObj)
258 throws PortalException {
259 return portalPreferencesPersistence.findByPrimaryKey(primaryKeyObj);
260 }
261
262
273 @Override
274 public List<PortalPreferences> getPortalPreferenceses(int start, int end) {
275 return portalPreferencesPersistence.findAll(start, end);
276 }
277
278
283 @Override
284 public int getPortalPreferencesesCount() {
285 return portalPreferencesPersistence.countAll();
286 }
287
288
294 @Indexable(type = IndexableType.REINDEX)
295 @Override
296 public PortalPreferences updatePortalPreferences(
297 PortalPreferences portalPreferences) {
298 return portalPreferencesPersistence.update(portalPreferences);
299 }
300
301
306 public PortalPreferencesLocalService getPortalPreferencesLocalService() {
307 return portalPreferencesLocalService;
308 }
309
310
315 public void setPortalPreferencesLocalService(
316 PortalPreferencesLocalService portalPreferencesLocalService) {
317 this.portalPreferencesLocalService = portalPreferencesLocalService;
318 }
319
320
325 public PortalPreferencesPersistence getPortalPreferencesPersistence() {
326 return portalPreferencesPersistence;
327 }
328
329
334 public void setPortalPreferencesPersistence(
335 PortalPreferencesPersistence portalPreferencesPersistence) {
336 this.portalPreferencesPersistence = portalPreferencesPersistence;
337 }
338
339
344 public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
345 return counterLocalService;
346 }
347
348
353 public void setCounterLocalService(
354 com.liferay.counter.service.CounterLocalService counterLocalService) {
355 this.counterLocalService = counterLocalService;
356 }
357
358 public void afterPropertiesSet() {
359 persistedModelLocalServiceRegistry.register("com.liferay.portal.model.PortalPreferences",
360 portalPreferencesLocalService);
361 }
362
363 public void destroy() {
364 persistedModelLocalServiceRegistry.unregister(
365 "com.liferay.portal.model.PortalPreferences");
366 }
367
368
373 @Override
374 public String getBeanIdentifier() {
375 return _beanIdentifier;
376 }
377
378
383 @Override
384 public void setBeanIdentifier(String beanIdentifier) {
385 _beanIdentifier = beanIdentifier;
386 }
387
388 protected Class<?> getModelClass() {
389 return PortalPreferences.class;
390 }
391
392 protected String getModelClassName() {
393 return PortalPreferences.class.getName();
394 }
395
396
401 protected void runSQL(String sql) {
402 try {
403 DataSource dataSource = portalPreferencesPersistence.getDataSource();
404
405 DB db = DBFactoryUtil.getDB();
406
407 sql = db.buildSQL(sql);
408 sql = PortalUtil.transformSQL(sql);
409
410 SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
411 sql, new int[0]);
412
413 sqlUpdate.update();
414 }
415 catch (Exception e) {
416 throw new SystemException(e);
417 }
418 }
419
420 @BeanReference(type = com.liferay.portal.service.PortalPreferencesLocalService.class)
421 protected PortalPreferencesLocalService portalPreferencesLocalService;
422 @BeanReference(type = PortalPreferencesPersistence.class)
423 protected PortalPreferencesPersistence portalPreferencesPersistence;
424 @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
425 protected com.liferay.counter.service.CounterLocalService counterLocalService;
426 @BeanReference(type = PersistedModelLocalServiceRegistry.class)
427 protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
428 private String _beanIdentifier;
429 }