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.service.persistence.LayoutFinder;
040    import com.liferay.portal.service.persistence.LayoutPersistence;
041    import com.liferay.portal.util.PortalUtil;
042    
043    import com.liferay.portlet.documentlibrary.model.DLFileRank;
044    import com.liferay.portlet.documentlibrary.service.DLFileRankLocalService;
045    import com.liferay.portlet.documentlibrary.service.persistence.DLFileRankFinder;
046    import com.liferay.portlet.documentlibrary.service.persistence.DLFileRankPersistence;
047    import com.liferay.portlet.documentlibrary.service.persistence.DLFolderFinder;
048    import com.liferay.portlet.documentlibrary.service.persistence.DLFolderPersistence;
049    
050    import java.io.Serializable;
051    
052    import java.util.List;
053    
054    import javax.sql.DataSource;
055    
056    /**
057     * Provides the base implementation for the document library file rank local service.
058     *
059     * <p>
060     * 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.DLFileRankLocalServiceImpl}.
061     * </p>
062     *
063     * @author Brian Wing Shun Chan
064     * @see com.liferay.portlet.documentlibrary.service.impl.DLFileRankLocalServiceImpl
065     * @see com.liferay.portlet.documentlibrary.service.DLFileRankLocalServiceUtil
066     * @generated
067     */
068    @ProviderType
069    public abstract class DLFileRankLocalServiceBaseImpl
070            extends BaseLocalServiceImpl implements DLFileRankLocalService,
071                    IdentifiableOSGiService {
072            /*
073             * NOTE FOR DEVELOPERS:
074             *
075             * Never modify or reference this class directly. Always use {@link com.liferay.portlet.documentlibrary.service.DLFileRankLocalServiceUtil} to access the document library file rank local service.
076             */
077    
078            /**
079             * Adds the document library file rank to the database. Also notifies the appropriate model listeners.
080             *
081             * @param dlFileRank the document library file rank
082             * @return the document library file rank that was added
083             */
084            @Indexable(type = IndexableType.REINDEX)
085            @Override
086            public DLFileRank addDLFileRank(DLFileRank dlFileRank) {
087                    dlFileRank.setNew(true);
088    
089                    return dlFileRankPersistence.update(dlFileRank);
090            }
091    
092            /**
093             * Creates a new document library file rank with the primary key. Does not add the document library file rank to the database.
094             *
095             * @param fileRankId the primary key for the new document library file rank
096             * @return the new document library file rank
097             */
098            @Override
099            public DLFileRank createDLFileRank(long fileRankId) {
100                    return dlFileRankPersistence.create(fileRankId);
101            }
102    
103            /**
104             * Deletes the document library file rank with the primary key from the database. Also notifies the appropriate model listeners.
105             *
106             * @param fileRankId the primary key of the document library file rank
107             * @return the document library file rank that was removed
108             * @throws PortalException if a document library file rank with the primary key could not be found
109             */
110            @Indexable(type = IndexableType.DELETE)
111            @Override
112            public DLFileRank deleteDLFileRank(long fileRankId)
113                    throws PortalException {
114                    return dlFileRankPersistence.remove(fileRankId);
115            }
116    
117            /**
118             * Deletes the document library file rank from the database. Also notifies the appropriate model listeners.
119             *
120             * @param dlFileRank the document library file rank
121             * @return the document library file rank that was removed
122             */
123            @Indexable(type = IndexableType.DELETE)
124            @Override
125            public DLFileRank deleteDLFileRank(DLFileRank dlFileRank) {
126                    return dlFileRankPersistence.remove(dlFileRank);
127            }
128    
129            @Override
130            public DynamicQuery dynamicQuery() {
131                    Class<?> clazz = getClass();
132    
133                    return DynamicQueryFactoryUtil.forClass(DLFileRank.class,
134                            clazz.getClassLoader());
135            }
136    
137            /**
138             * Performs a dynamic query on the database and returns the matching rows.
139             *
140             * @param dynamicQuery the dynamic query
141             * @return the matching rows
142             */
143            @Override
144            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery) {
145                    return dlFileRankPersistence.findWithDynamicQuery(dynamicQuery);
146            }
147    
148            /**
149             * Performs a dynamic query on the database and returns a range of the matching rows.
150             *
151             * <p>
152             * 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.DLFileRankModelImpl}. 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.
153             * </p>
154             *
155             * @param dynamicQuery the dynamic query
156             * @param start the lower bound of the range of model instances
157             * @param end the upper bound of the range of model instances (not inclusive)
158             * @return the range of matching rows
159             */
160            @Override
161            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
162                    int end) {
163                    return dlFileRankPersistence.findWithDynamicQuery(dynamicQuery, start,
164                            end);
165            }
166    
167            /**
168             * Performs a dynamic query on the database and returns an ordered range of the matching rows.
169             *
170             * <p>
171             * 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.DLFileRankModelImpl}. 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.
172             * </p>
173             *
174             * @param dynamicQuery the dynamic query
175             * @param start the lower bound of the range of model instances
176             * @param end the upper bound of the range of model instances (not inclusive)
177             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
178             * @return the ordered range of matching rows
179             */
180            @Override
181            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
182                    int end, OrderByComparator<T> orderByComparator) {
183                    return dlFileRankPersistence.findWithDynamicQuery(dynamicQuery, start,
184                            end, orderByComparator);
185            }
186    
187            /**
188             * Returns the number of rows matching the dynamic query.
189             *
190             * @param dynamicQuery the dynamic query
191             * @return the number of rows matching the dynamic query
192             */
193            @Override
194            public long dynamicQueryCount(DynamicQuery dynamicQuery) {
195                    return dlFileRankPersistence.countWithDynamicQuery(dynamicQuery);
196            }
197    
198            /**
199             * Returns the number of rows matching the dynamic query.
200             *
201             * @param dynamicQuery the dynamic query
202             * @param projection the projection to apply to the query
203             * @return the number of rows matching the dynamic query
204             */
205            @Override
206            public long dynamicQueryCount(DynamicQuery dynamicQuery,
207                    Projection projection) {
208                    return dlFileRankPersistence.countWithDynamicQuery(dynamicQuery,
209                            projection);
210            }
211    
212            @Override
213            public DLFileRank fetchDLFileRank(long fileRankId) {
214                    return dlFileRankPersistence.fetchByPrimaryKey(fileRankId);
215            }
216    
217            /**
218             * Returns the document library file rank with the primary key.
219             *
220             * @param fileRankId the primary key of the document library file rank
221             * @return the document library file rank
222             * @throws PortalException if a document library file rank with the primary key could not be found
223             */
224            @Override
225            public DLFileRank getDLFileRank(long fileRankId) throws PortalException {
226                    return dlFileRankPersistence.findByPrimaryKey(fileRankId);
227            }
228    
229            @Override
230            public ActionableDynamicQuery getActionableDynamicQuery() {
231                    ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
232    
233                    actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.documentlibrary.service.DLFileRankLocalServiceUtil.getService());
234                    actionableDynamicQuery.setClassLoader(getClassLoader());
235                    actionableDynamicQuery.setModelClass(DLFileRank.class);
236    
237                    actionableDynamicQuery.setPrimaryKeyPropertyName("fileRankId");
238    
239                    return actionableDynamicQuery;
240            }
241    
242            @Override
243            public IndexableActionableDynamicQuery getIndexableActionableDynamicQuery() {
244                    IndexableActionableDynamicQuery indexableActionableDynamicQuery = new IndexableActionableDynamicQuery();
245    
246                    indexableActionableDynamicQuery.setBaseLocalService(com.liferay.portlet.documentlibrary.service.DLFileRankLocalServiceUtil.getService());
247                    indexableActionableDynamicQuery.setClassLoader(getClassLoader());
248                    indexableActionableDynamicQuery.setModelClass(DLFileRank.class);
249    
250                    indexableActionableDynamicQuery.setPrimaryKeyPropertyName("fileRankId");
251    
252                    return indexableActionableDynamicQuery;
253            }
254    
255            protected void initActionableDynamicQuery(
256                    ActionableDynamicQuery actionableDynamicQuery) {
257                    actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.documentlibrary.service.DLFileRankLocalServiceUtil.getService());
258                    actionableDynamicQuery.setClassLoader(getClassLoader());
259                    actionableDynamicQuery.setModelClass(DLFileRank.class);
260    
261                    actionableDynamicQuery.setPrimaryKeyPropertyName("fileRankId");
262            }
263    
264            /**
265             * @throws PortalException
266             */
267            @Override
268            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
269                    throws PortalException {
270                    return dlFileRankLocalService.deleteDLFileRank((DLFileRank)persistedModel);
271            }
272    
273            @Override
274            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
275                    throws PortalException {
276                    return dlFileRankPersistence.findByPrimaryKey(primaryKeyObj);
277            }
278    
279            /**
280             * Returns a range of all the document library file ranks.
281             *
282             * <p>
283             * 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.DLFileRankModelImpl}. 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.
284             * </p>
285             *
286             * @param start the lower bound of the range of document library file ranks
287             * @param end the upper bound of the range of document library file ranks (not inclusive)
288             * @return the range of document library file ranks
289             */
290            @Override
291            public List<DLFileRank> getDLFileRanks(int start, int end) {
292                    return dlFileRankPersistence.findAll(start, end);
293            }
294    
295            /**
296             * Returns the number of document library file ranks.
297             *
298             * @return the number of document library file ranks
299             */
300            @Override
301            public int getDLFileRanksCount() {
302                    return dlFileRankPersistence.countAll();
303            }
304    
305            /**
306             * Updates the document library file rank in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
307             *
308             * @param dlFileRank the document library file rank
309             * @return the document library file rank that was updated
310             */
311            @Indexable(type = IndexableType.REINDEX)
312            @Override
313            public DLFileRank updateDLFileRank(DLFileRank dlFileRank) {
314                    return dlFileRankPersistence.update(dlFileRank);
315            }
316    
317            /**
318             * Returns the document library file rank local service.
319             *
320             * @return the document library file rank local service
321             */
322            public DLFileRankLocalService getDLFileRankLocalService() {
323                    return dlFileRankLocalService;
324            }
325    
326            /**
327             * Sets the document library file rank local service.
328             *
329             * @param dlFileRankLocalService the document library file rank local service
330             */
331            public void setDLFileRankLocalService(
332                    DLFileRankLocalService dlFileRankLocalService) {
333                    this.dlFileRankLocalService = dlFileRankLocalService;
334            }
335    
336            /**
337             * Returns the document library file rank persistence.
338             *
339             * @return the document library file rank persistence
340             */
341            public DLFileRankPersistence getDLFileRankPersistence() {
342                    return dlFileRankPersistence;
343            }
344    
345            /**
346             * Sets the document library file rank persistence.
347             *
348             * @param dlFileRankPersistence the document library file rank persistence
349             */
350            public void setDLFileRankPersistence(
351                    DLFileRankPersistence dlFileRankPersistence) {
352                    this.dlFileRankPersistence = dlFileRankPersistence;
353            }
354    
355            /**
356             * Returns the document library file rank finder.
357             *
358             * @return the document library file rank finder
359             */
360            public DLFileRankFinder getDLFileRankFinder() {
361                    return dlFileRankFinder;
362            }
363    
364            /**
365             * Sets the document library file rank finder.
366             *
367             * @param dlFileRankFinder the document library file rank finder
368             */
369            public void setDLFileRankFinder(DLFileRankFinder dlFileRankFinder) {
370                    this.dlFileRankFinder = dlFileRankFinder;
371            }
372    
373            /**
374             * Returns the counter local service.
375             *
376             * @return the counter local service
377             */
378            public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
379                    return counterLocalService;
380            }
381    
382            /**
383             * Sets the counter local service.
384             *
385             * @param counterLocalService the counter local service
386             */
387            public void setCounterLocalService(
388                    com.liferay.counter.service.CounterLocalService counterLocalService) {
389                    this.counterLocalService = counterLocalService;
390            }
391    
392            /**
393             * Returns the layout local service.
394             *
395             * @return the layout local service
396             */
397            public com.liferay.portal.service.LayoutLocalService getLayoutLocalService() {
398                    return layoutLocalService;
399            }
400    
401            /**
402             * Sets the layout local service.
403             *
404             * @param layoutLocalService the layout local service
405             */
406            public void setLayoutLocalService(
407                    com.liferay.portal.service.LayoutLocalService layoutLocalService) {
408                    this.layoutLocalService = layoutLocalService;
409            }
410    
411            /**
412             * Returns the layout persistence.
413             *
414             * @return the layout persistence
415             */
416            public LayoutPersistence getLayoutPersistence() {
417                    return layoutPersistence;
418            }
419    
420            /**
421             * Sets the layout persistence.
422             *
423             * @param layoutPersistence the layout persistence
424             */
425            public void setLayoutPersistence(LayoutPersistence layoutPersistence) {
426                    this.layoutPersistence = layoutPersistence;
427            }
428    
429            /**
430             * Returns the layout finder.
431             *
432             * @return the layout finder
433             */
434            public LayoutFinder getLayoutFinder() {
435                    return layoutFinder;
436            }
437    
438            /**
439             * Sets the layout finder.
440             *
441             * @param layoutFinder the layout finder
442             */
443            public void setLayoutFinder(LayoutFinder layoutFinder) {
444                    this.layoutFinder = layoutFinder;
445            }
446    
447            /**
448             * Returns the document library folder local service.
449             *
450             * @return the document library folder local service
451             */
452            public com.liferay.portlet.documentlibrary.service.DLFolderLocalService getDLFolderLocalService() {
453                    return dlFolderLocalService;
454            }
455    
456            /**
457             * Sets the document library folder local service.
458             *
459             * @param dlFolderLocalService the document library folder local service
460             */
461            public void setDLFolderLocalService(
462                    com.liferay.portlet.documentlibrary.service.DLFolderLocalService dlFolderLocalService) {
463                    this.dlFolderLocalService = dlFolderLocalService;
464            }
465    
466            /**
467             * Returns the document library folder persistence.
468             *
469             * @return the document library folder persistence
470             */
471            public DLFolderPersistence getDLFolderPersistence() {
472                    return dlFolderPersistence;
473            }
474    
475            /**
476             * Sets the document library folder persistence.
477             *
478             * @param dlFolderPersistence the document library folder persistence
479             */
480            public void setDLFolderPersistence(DLFolderPersistence dlFolderPersistence) {
481                    this.dlFolderPersistence = dlFolderPersistence;
482            }
483    
484            /**
485             * Returns the document library folder finder.
486             *
487             * @return the document library folder finder
488             */
489            public DLFolderFinder getDLFolderFinder() {
490                    return dlFolderFinder;
491            }
492    
493            /**
494             * Sets the document library folder finder.
495             *
496             * @param dlFolderFinder the document library folder finder
497             */
498            public void setDLFolderFinder(DLFolderFinder dlFolderFinder) {
499                    this.dlFolderFinder = dlFolderFinder;
500            }
501    
502            public void afterPropertiesSet() {
503                    persistedModelLocalServiceRegistry.register("com.liferay.portlet.documentlibrary.model.DLFileRank",
504                            dlFileRankLocalService);
505            }
506    
507            public void destroy() {
508                    persistedModelLocalServiceRegistry.unregister(
509                            "com.liferay.portlet.documentlibrary.model.DLFileRank");
510            }
511    
512            /**
513             * Returns the OSGi service identifier.
514             *
515             * @return the OSGi service identifier
516             */
517            @Override
518            public String getOSGiServiceIdentifier() {
519                    return DLFileRankLocalService.class.getName();
520            }
521    
522            protected Class<?> getModelClass() {
523                    return DLFileRank.class;
524            }
525    
526            protected String getModelClassName() {
527                    return DLFileRank.class.getName();
528            }
529    
530            /**
531             * Performs a SQL query.
532             *
533             * @param sql the sql query
534             */
535            protected void runSQL(String sql) {
536                    try {
537                            DataSource dataSource = dlFileRankPersistence.getDataSource();
538    
539                            DB db = DBManagerUtil.getDB();
540    
541                            sql = db.buildSQL(sql);
542                            sql = PortalUtil.transformSQL(sql);
543    
544                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
545                                            sql, new int[0]);
546    
547                            sqlUpdate.update();
548                    }
549                    catch (Exception e) {
550                            throw new SystemException(e);
551                    }
552            }
553    
554            @BeanReference(type = com.liferay.portlet.documentlibrary.service.DLFileRankLocalService.class)
555            protected DLFileRankLocalService dlFileRankLocalService;
556            @BeanReference(type = DLFileRankPersistence.class)
557            protected DLFileRankPersistence dlFileRankPersistence;
558            @BeanReference(type = DLFileRankFinder.class)
559            protected DLFileRankFinder dlFileRankFinder;
560            @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
561            protected com.liferay.counter.service.CounterLocalService counterLocalService;
562            @BeanReference(type = com.liferay.portal.service.LayoutLocalService.class)
563            protected com.liferay.portal.service.LayoutLocalService layoutLocalService;
564            @BeanReference(type = LayoutPersistence.class)
565            protected LayoutPersistence layoutPersistence;
566            @BeanReference(type = LayoutFinder.class)
567            protected LayoutFinder layoutFinder;
568            @BeanReference(type = com.liferay.portlet.documentlibrary.service.DLFolderLocalService.class)
569            protected com.liferay.portlet.documentlibrary.service.DLFolderLocalService dlFolderLocalService;
570            @BeanReference(type = DLFolderPersistence.class)
571            protected DLFolderPersistence dlFolderPersistence;
572            @BeanReference(type = DLFolderFinder.class)
573            protected DLFolderFinder dlFolderFinder;
574            @BeanReference(type = PersistedModelLocalServiceRegistry.class)
575            protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
576    }