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