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