001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.documentlibrary.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.util.PortalUtil;
039    
040    import com.liferay.portlet.documentlibrary.model.DLSyncEvent;
041    import com.liferay.portlet.documentlibrary.service.DLSyncEventLocalService;
042    import com.liferay.portlet.documentlibrary.service.persistence.DLSyncEventPersistence;
043    
044    import java.io.Serializable;
045    
046    import java.util.List;
047    
048    import javax.sql.DataSource;
049    
050    /**
051     * Provides the base implementation for the d l sync event local service.
052     *
053     * <p>
054     * This implementation exists only as a container for the default service methods generated by ServiceBuilder. All custom service methods should be put in {@link com.liferay.portlet.documentlibrary.service.impl.DLSyncEventLocalServiceImpl}.
055     * </p>
056     *
057     * @author Brian Wing Shun Chan
058     * @see com.liferay.portlet.documentlibrary.service.impl.DLSyncEventLocalServiceImpl
059     * @see com.liferay.portlet.documentlibrary.service.DLSyncEventLocalServiceUtil
060     * @generated
061     */
062    @ProviderType
063    public abstract class DLSyncEventLocalServiceBaseImpl
064            extends BaseLocalServiceImpl implements DLSyncEventLocalService,
065                    IdentifiableBean {
066            /*
067             * NOTE FOR DEVELOPERS:
068             *
069             * Never modify or reference this class directly. Always use {@link com.liferay.portlet.documentlibrary.service.DLSyncEventLocalServiceUtil} to access the d l sync event local service.
070             */
071    
072            /**
073             * Adds the d l sync event to the database. Also notifies the appropriate model listeners.
074             *
075             * @param dlSyncEvent the d l sync event
076             * @return the d l sync event that was added
077             */
078            @Indexable(type = IndexableType.REINDEX)
079            @Override
080            public DLSyncEvent addDLSyncEvent(DLSyncEvent dlSyncEvent) {
081                    dlSyncEvent.setNew(true);
082    
083                    return dlSyncEventPersistence.update(dlSyncEvent);
084            }
085    
086            /**
087             * Creates a new d l sync event with the primary key. Does not add the d l sync event to the database.
088             *
089             * @param syncEventId the primary key for the new d l sync event
090             * @return the new d l sync event
091             */
092            @Override
093            public DLSyncEvent createDLSyncEvent(long syncEventId) {
094                    return dlSyncEventPersistence.create(syncEventId);
095            }
096    
097            /**
098             * Deletes the d l sync event with the primary key from the database. Also notifies the appropriate model listeners.
099             *
100             * @param syncEventId the primary key of the d l sync event
101             * @return the d l sync event that was removed
102             * @throws PortalException if a d l sync event with the primary key could not be found
103             */
104            @Indexable(type = IndexableType.DELETE)
105            @Override
106            public DLSyncEvent deleteDLSyncEvent(long syncEventId)
107                    throws PortalException {
108                    return dlSyncEventPersistence.remove(syncEventId);
109            }
110    
111            /**
112             * Deletes the d l sync event from the database. Also notifies the appropriate model listeners.
113             *
114             * @param dlSyncEvent the d l sync event
115             * @return the d l sync event that was removed
116             */
117            @Indexable(type = IndexableType.DELETE)
118            @Override
119            public DLSyncEvent deleteDLSyncEvent(DLSyncEvent dlSyncEvent) {
120                    return dlSyncEventPersistence.remove(dlSyncEvent);
121            }
122    
123            @Override
124            public DynamicQuery dynamicQuery() {
125                    Class<?> clazz = getClass();
126    
127                    return DynamicQueryFactoryUtil.forClass(DLSyncEvent.class,
128                            clazz.getClassLoader());
129            }
130    
131            /**
132             * Performs a dynamic query on the database and returns the matching rows.
133             *
134             * @param dynamicQuery the dynamic query
135             * @return the matching rows
136             */
137            @Override
138            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery) {
139                    return dlSyncEventPersistence.findWithDynamicQuery(dynamicQuery);
140            }
141    
142            /**
143             * Performs a dynamic query on the database and returns a range of the matching rows.
144             *
145             * <p>
146             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.documentlibrary.model.impl.DLSyncEventModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
147             * </p>
148             *
149             * @param dynamicQuery the dynamic query
150             * @param start the lower bound of the range of model instances
151             * @param end the upper bound of the range of model instances (not inclusive)
152             * @return the range of matching rows
153             */
154            @Override
155            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
156                    int end) {
157                    return dlSyncEventPersistence.findWithDynamicQuery(dynamicQuery, start,
158                            end);
159            }
160    
161            /**
162             * Performs a dynamic query on the database and returns an ordered range of the matching rows.
163             *
164             * <p>
165             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.documentlibrary.model.impl.DLSyncEventModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
166             * </p>
167             *
168             * @param dynamicQuery the dynamic query
169             * @param start the lower bound of the range of model instances
170             * @param end the upper bound of the range of model instances (not inclusive)
171             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
172             * @return the ordered range of matching rows
173             */
174            @Override
175            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
176                    int end, OrderByComparator<T> orderByComparator) {
177                    return dlSyncEventPersistence.findWithDynamicQuery(dynamicQuery, start,
178                            end, orderByComparator);
179            }
180    
181            /**
182             * Returns the number of rows matching the dynamic query.
183             *
184             * @param dynamicQuery the dynamic query
185             * @return the number of rows matching the dynamic query
186             */
187            @Override
188            public long dynamicQueryCount(DynamicQuery dynamicQuery) {
189                    return dlSyncEventPersistence.countWithDynamicQuery(dynamicQuery);
190            }
191    
192            /**
193             * Returns the number of rows matching the dynamic query.
194             *
195             * @param dynamicQuery the dynamic query
196             * @param projection the projection to apply to the query
197             * @return the number of rows matching the dynamic query
198             */
199            @Override
200            public long dynamicQueryCount(DynamicQuery dynamicQuery,
201                    Projection projection) {
202                    return dlSyncEventPersistence.countWithDynamicQuery(dynamicQuery,
203                            projection);
204            }
205    
206            @Override
207            public DLSyncEvent fetchDLSyncEvent(long syncEventId) {
208                    return dlSyncEventPersistence.fetchByPrimaryKey(syncEventId);
209            }
210    
211            /**
212             * Returns the d l sync event with the primary key.
213             *
214             * @param syncEventId the primary key of the d l sync event
215             * @return the d l sync event
216             * @throws PortalException if a d l sync event with the primary key could not be found
217             */
218            @Override
219            public DLSyncEvent getDLSyncEvent(long syncEventId)
220                    throws PortalException {
221                    return dlSyncEventPersistence.findByPrimaryKey(syncEventId);
222            }
223    
224            @Override
225            public ActionableDynamicQuery getActionableDynamicQuery() {
226                    ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
227    
228                    actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.documentlibrary.service.DLSyncEventLocalServiceUtil.getService());
229                    actionableDynamicQuery.setClass(DLSyncEvent.class);
230                    actionableDynamicQuery.setClassLoader(getClassLoader());
231    
232                    actionableDynamicQuery.setPrimaryKeyPropertyName("syncEventId");
233    
234                    return actionableDynamicQuery;
235            }
236    
237            protected void initActionableDynamicQuery(
238                    ActionableDynamicQuery actionableDynamicQuery) {
239                    actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.documentlibrary.service.DLSyncEventLocalServiceUtil.getService());
240                    actionableDynamicQuery.setClass(DLSyncEvent.class);
241                    actionableDynamicQuery.setClassLoader(getClassLoader());
242    
243                    actionableDynamicQuery.setPrimaryKeyPropertyName("syncEventId");
244            }
245    
246            /**
247             * @throws PortalException
248             */
249            @Override
250            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
251                    throws PortalException {
252                    return dlSyncEventLocalService.deleteDLSyncEvent((DLSyncEvent)persistedModel);
253            }
254    
255            @Override
256            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
257                    throws PortalException {
258                    return dlSyncEventPersistence.findByPrimaryKey(primaryKeyObj);
259            }
260    
261            /**
262             * Returns a range of all the d l sync events.
263             *
264             * <p>
265             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.documentlibrary.model.impl.DLSyncEventModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
266             * </p>
267             *
268             * @param start the lower bound of the range of d l sync events
269             * @param end the upper bound of the range of d l sync events (not inclusive)
270             * @return the range of d l sync events
271             */
272            @Override
273            public List<DLSyncEvent> getDLSyncEvents(int start, int end) {
274                    return dlSyncEventPersistence.findAll(start, end);
275            }
276    
277            /**
278             * Returns the number of d l sync events.
279             *
280             * @return the number of d l sync events
281             */
282            @Override
283            public int getDLSyncEventsCount() {
284                    return dlSyncEventPersistence.countAll();
285            }
286    
287            /**
288             * Updates the d l sync event in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
289             *
290             * @param dlSyncEvent the d l sync event
291             * @return the d l sync event that was updated
292             */
293            @Indexable(type = IndexableType.REINDEX)
294            @Override
295            public DLSyncEvent updateDLSyncEvent(DLSyncEvent dlSyncEvent) {
296                    return dlSyncEventPersistence.update(dlSyncEvent);
297            }
298    
299            /**
300             * Returns the d l sync event local service.
301             *
302             * @return the d l sync event local service
303             */
304            public DLSyncEventLocalService getDLSyncEventLocalService() {
305                    return dlSyncEventLocalService;
306            }
307    
308            /**
309             * Sets the d l sync event local service.
310             *
311             * @param dlSyncEventLocalService the d l sync event local service
312             */
313            public void setDLSyncEventLocalService(
314                    DLSyncEventLocalService dlSyncEventLocalService) {
315                    this.dlSyncEventLocalService = dlSyncEventLocalService;
316            }
317    
318            /**
319             * Returns the d l sync event persistence.
320             *
321             * @return the d l sync event persistence
322             */
323            public DLSyncEventPersistence getDLSyncEventPersistence() {
324                    return dlSyncEventPersistence;
325            }
326    
327            /**
328             * Sets the d l sync event persistence.
329             *
330             * @param dlSyncEventPersistence the d l sync event persistence
331             */
332            public void setDLSyncEventPersistence(
333                    DLSyncEventPersistence dlSyncEventPersistence) {
334                    this.dlSyncEventPersistence = dlSyncEventPersistence;
335            }
336    
337            /**
338             * Returns the counter local service.
339             *
340             * @return the counter local service
341             */
342            public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
343                    return counterLocalService;
344            }
345    
346            /**
347             * Sets the counter local service.
348             *
349             * @param counterLocalService the counter local service
350             */
351            public void setCounterLocalService(
352                    com.liferay.counter.service.CounterLocalService counterLocalService) {
353                    this.counterLocalService = counterLocalService;
354            }
355    
356            public void afterPropertiesSet() {
357                    persistedModelLocalServiceRegistry.register("com.liferay.portlet.documentlibrary.model.DLSyncEvent",
358                            dlSyncEventLocalService);
359            }
360    
361            public void destroy() {
362                    persistedModelLocalServiceRegistry.unregister(
363                            "com.liferay.portlet.documentlibrary.model.DLSyncEvent");
364            }
365    
366            /**
367             * Returns the Spring bean ID for this bean.
368             *
369             * @return the Spring bean ID for this bean
370             */
371            @Override
372            public String getBeanIdentifier() {
373                    return _beanIdentifier;
374            }
375    
376            /**
377             * Sets the Spring bean ID for this bean.
378             *
379             * @param beanIdentifier the Spring bean ID for this bean
380             */
381            @Override
382            public void setBeanIdentifier(String beanIdentifier) {
383                    _beanIdentifier = beanIdentifier;
384            }
385    
386            protected Class<?> getModelClass() {
387                    return DLSyncEvent.class;
388            }
389    
390            protected String getModelClassName() {
391                    return DLSyncEvent.class.getName();
392            }
393    
394            /**
395             * Performs a SQL query.
396             *
397             * @param sql the sql query
398             */
399            protected void runSQL(String sql) {
400                    try {
401                            DataSource dataSource = dlSyncEventPersistence.getDataSource();
402    
403                            DB db = DBFactoryUtil.getDB();
404    
405                            sql = db.buildSQL(sql);
406                            sql = PortalUtil.transformSQL(sql);
407    
408                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
409                                            sql, new int[0]);
410    
411                            sqlUpdate.update();
412                    }
413                    catch (Exception e) {
414                            throw new SystemException(e);
415                    }
416            }
417    
418            @BeanReference(type = com.liferay.portlet.documentlibrary.service.DLSyncEventLocalService.class)
419            protected DLSyncEventLocalService dlSyncEventLocalService;
420            @BeanReference(type = DLSyncEventPersistence.class)
421            protected DLSyncEventPersistence dlSyncEventPersistence;
422            @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
423            protected com.liferay.counter.service.CounterLocalService counterLocalService;
424            @BeanReference(type = PersistedModelLocalServiceRegistry.class)
425            protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
426            private String _beanIdentifier;
427    }