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.portal.service.base;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.bean.BeanReference;
020    import com.liferay.portal.kernel.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.model.WebDAVProps;
038    import com.liferay.portal.service.BaseLocalServiceImpl;
039    import com.liferay.portal.service.PersistedModelLocalServiceRegistry;
040    import com.liferay.portal.service.WebDAVPropsLocalService;
041    import com.liferay.portal.service.persistence.ClassNamePersistence;
042    import com.liferay.portal.service.persistence.WebDAVPropsPersistence;
043    import com.liferay.portal.util.PortalUtil;
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 web d a v props 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.portal.service.impl.WebDAVPropsLocalServiceImpl}.
056     * </p>
057     *
058     * @author Brian Wing Shun Chan
059     * @see com.liferay.portal.service.impl.WebDAVPropsLocalServiceImpl
060     * @see com.liferay.portal.service.WebDAVPropsLocalServiceUtil
061     * @generated
062     */
063    @ProviderType
064    public abstract class WebDAVPropsLocalServiceBaseImpl
065            extends BaseLocalServiceImpl implements WebDAVPropsLocalService,
066                    IdentifiableOSGiService {
067            /*
068             * NOTE FOR DEVELOPERS:
069             *
070             * Never modify or reference this class directly. Always use {@link com.liferay.portal.service.WebDAVPropsLocalServiceUtil} to access the web d a v props local service.
071             */
072    
073            /**
074             * Adds the web d a v props to the database. Also notifies the appropriate model listeners.
075             *
076             * @param webDAVProps the web d a v props
077             * @return the web d a v props that was added
078             */
079            @Indexable(type = IndexableType.REINDEX)
080            @Override
081            public WebDAVProps addWebDAVProps(WebDAVProps webDAVProps) {
082                    webDAVProps.setNew(true);
083    
084                    return webDAVPropsPersistence.update(webDAVProps);
085            }
086    
087            /**
088             * Creates a new web d a v props with the primary key. Does not add the web d a v props to the database.
089             *
090             * @param webDavPropsId the primary key for the new web d a v props
091             * @return the new web d a v props
092             */
093            @Override
094            public WebDAVProps createWebDAVProps(long webDavPropsId) {
095                    return webDAVPropsPersistence.create(webDavPropsId);
096            }
097    
098            /**
099             * Deletes the web d a v props with the primary key from the database. Also notifies the appropriate model listeners.
100             *
101             * @param webDavPropsId the primary key of the web d a v props
102             * @return the web d a v props that was removed
103             * @throws PortalException if a web d a v props with the primary key could not be found
104             */
105            @Indexable(type = IndexableType.DELETE)
106            @Override
107            public WebDAVProps deleteWebDAVProps(long webDavPropsId)
108                    throws PortalException {
109                    return webDAVPropsPersistence.remove(webDavPropsId);
110            }
111    
112            /**
113             * Deletes the web d a v props from the database. Also notifies the appropriate model listeners.
114             *
115             * @param webDAVProps the web d a v props
116             * @return the web d a v props that was removed
117             */
118            @Indexable(type = IndexableType.DELETE)
119            @Override
120            public WebDAVProps deleteWebDAVProps(WebDAVProps webDAVProps) {
121                    return webDAVPropsPersistence.remove(webDAVProps);
122            }
123    
124            @Override
125            public DynamicQuery dynamicQuery() {
126                    Class<?> clazz = getClass();
127    
128                    return DynamicQueryFactoryUtil.forClass(WebDAVProps.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 webDAVPropsPersistence.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.portal.model.impl.WebDAVPropsModelImpl}. 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 webDAVPropsPersistence.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.portal.model.impl.WebDAVPropsModelImpl}. 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 webDAVPropsPersistence.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 webDAVPropsPersistence.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 webDAVPropsPersistence.countWithDynamicQuery(dynamicQuery,
204                            projection);
205            }
206    
207            @Override
208            public WebDAVProps fetchWebDAVProps(long webDavPropsId) {
209                    return webDAVPropsPersistence.fetchByPrimaryKey(webDavPropsId);
210            }
211    
212            /**
213             * Returns the web d a v props with the primary key.
214             *
215             * @param webDavPropsId the primary key of the web d a v props
216             * @return the web d a v props
217             * @throws PortalException if a web d a v props with the primary key could not be found
218             */
219            @Override
220            public WebDAVProps getWebDAVProps(long webDavPropsId)
221                    throws PortalException {
222                    return webDAVPropsPersistence.findByPrimaryKey(webDavPropsId);
223            }
224    
225            @Override
226            public ActionableDynamicQuery getActionableDynamicQuery() {
227                    ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
228    
229                    actionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.WebDAVPropsLocalServiceUtil.getService());
230                    actionableDynamicQuery.setClassLoader(getClassLoader());
231                    actionableDynamicQuery.setModelClass(WebDAVProps.class);
232    
233                    actionableDynamicQuery.setPrimaryKeyPropertyName("webDavPropsId");
234    
235                    return actionableDynamicQuery;
236            }
237    
238            @Override
239            public IndexableActionableDynamicQuery getIndexableActionableDynamicQuery() {
240                    IndexableActionableDynamicQuery indexableActionableDynamicQuery = new IndexableActionableDynamicQuery();
241    
242                    indexableActionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.WebDAVPropsLocalServiceUtil.getService());
243                    indexableActionableDynamicQuery.setClassLoader(getClassLoader());
244                    indexableActionableDynamicQuery.setModelClass(WebDAVProps.class);
245    
246                    indexableActionableDynamicQuery.setPrimaryKeyPropertyName(
247                            "webDavPropsId");
248    
249                    return indexableActionableDynamicQuery;
250            }
251    
252            protected void initActionableDynamicQuery(
253                    ActionableDynamicQuery actionableDynamicQuery) {
254                    actionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.WebDAVPropsLocalServiceUtil.getService());
255                    actionableDynamicQuery.setClassLoader(getClassLoader());
256                    actionableDynamicQuery.setModelClass(WebDAVProps.class);
257    
258                    actionableDynamicQuery.setPrimaryKeyPropertyName("webDavPropsId");
259            }
260    
261            /**
262             * @throws PortalException
263             */
264            @Override
265            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
266                    throws PortalException {
267                    return webDAVPropsLocalService.deleteWebDAVProps((WebDAVProps)persistedModel);
268            }
269    
270            @Override
271            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
272                    throws PortalException {
273                    return webDAVPropsPersistence.findByPrimaryKey(primaryKeyObj);
274            }
275    
276            /**
277             * Returns a range of all the web d a v propses.
278             *
279             * <p>
280             * 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.portal.model.impl.WebDAVPropsModelImpl}. 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.
281             * </p>
282             *
283             * @param start the lower bound of the range of web d a v propses
284             * @param end the upper bound of the range of web d a v propses (not inclusive)
285             * @return the range of web d a v propses
286             */
287            @Override
288            public List<WebDAVProps> getWebDAVPropses(int start, int end) {
289                    return webDAVPropsPersistence.findAll(start, end);
290            }
291    
292            /**
293             * Returns the number of web d a v propses.
294             *
295             * @return the number of web d a v propses
296             */
297            @Override
298            public int getWebDAVPropsesCount() {
299                    return webDAVPropsPersistence.countAll();
300            }
301    
302            /**
303             * Updates the web d a v props in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
304             *
305             * @param webDAVProps the web d a v props
306             * @return the web d a v props that was updated
307             */
308            @Indexable(type = IndexableType.REINDEX)
309            @Override
310            public WebDAVProps updateWebDAVProps(WebDAVProps webDAVProps) {
311                    return webDAVPropsPersistence.update(webDAVProps);
312            }
313    
314            /**
315             * Returns the web d a v props local service.
316             *
317             * @return the web d a v props local service
318             */
319            public WebDAVPropsLocalService getWebDAVPropsLocalService() {
320                    return webDAVPropsLocalService;
321            }
322    
323            /**
324             * Sets the web d a v props local service.
325             *
326             * @param webDAVPropsLocalService the web d a v props local service
327             */
328            public void setWebDAVPropsLocalService(
329                    WebDAVPropsLocalService webDAVPropsLocalService) {
330                    this.webDAVPropsLocalService = webDAVPropsLocalService;
331            }
332    
333            /**
334             * Returns the web d a v props persistence.
335             *
336             * @return the web d a v props persistence
337             */
338            public WebDAVPropsPersistence getWebDAVPropsPersistence() {
339                    return webDAVPropsPersistence;
340            }
341    
342            /**
343             * Sets the web d a v props persistence.
344             *
345             * @param webDAVPropsPersistence the web d a v props persistence
346             */
347            public void setWebDAVPropsPersistence(
348                    WebDAVPropsPersistence webDAVPropsPersistence) {
349                    this.webDAVPropsPersistence = webDAVPropsPersistence;
350            }
351    
352            /**
353             * Returns the counter local service.
354             *
355             * @return the counter local service
356             */
357            public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
358                    return counterLocalService;
359            }
360    
361            /**
362             * Sets the counter local service.
363             *
364             * @param counterLocalService the counter local service
365             */
366            public void setCounterLocalService(
367                    com.liferay.counter.service.CounterLocalService counterLocalService) {
368                    this.counterLocalService = counterLocalService;
369            }
370    
371            /**
372             * Returns the class name local service.
373             *
374             * @return the class name local service
375             */
376            public com.liferay.portal.service.ClassNameLocalService getClassNameLocalService() {
377                    return classNameLocalService;
378            }
379    
380            /**
381             * Sets the class name local service.
382             *
383             * @param classNameLocalService the class name local service
384             */
385            public void setClassNameLocalService(
386                    com.liferay.portal.service.ClassNameLocalService classNameLocalService) {
387                    this.classNameLocalService = classNameLocalService;
388            }
389    
390            /**
391             * Returns the class name persistence.
392             *
393             * @return the class name persistence
394             */
395            public ClassNamePersistence getClassNamePersistence() {
396                    return classNamePersistence;
397            }
398    
399            /**
400             * Sets the class name persistence.
401             *
402             * @param classNamePersistence the class name persistence
403             */
404            public void setClassNamePersistence(
405                    ClassNamePersistence classNamePersistence) {
406                    this.classNamePersistence = classNamePersistence;
407            }
408    
409            public void afterPropertiesSet() {
410                    persistedModelLocalServiceRegistry.register("com.liferay.portal.model.WebDAVProps",
411                            webDAVPropsLocalService);
412            }
413    
414            public void destroy() {
415                    persistedModelLocalServiceRegistry.unregister(
416                            "com.liferay.portal.model.WebDAVProps");
417            }
418    
419            /**
420             * Returns the OSGi service identifier.
421             *
422             * @return the OSGi service identifier
423             */
424            @Override
425            public String getOSGiServiceIdentifier() {
426                    return WebDAVPropsLocalService.class.getName();
427            }
428    
429            protected Class<?> getModelClass() {
430                    return WebDAVProps.class;
431            }
432    
433            protected String getModelClassName() {
434                    return WebDAVProps.class.getName();
435            }
436    
437            /**
438             * Performs a SQL query.
439             *
440             * @param sql the sql query
441             */
442            protected void runSQL(String sql) {
443                    try {
444                            DataSource dataSource = webDAVPropsPersistence.getDataSource();
445    
446                            DB db = DBManagerUtil.getDB();
447    
448                            sql = db.buildSQL(sql);
449                            sql = PortalUtil.transformSQL(sql);
450    
451                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
452                                            sql, new int[0]);
453    
454                            sqlUpdate.update();
455                    }
456                    catch (Exception e) {
457                            throw new SystemException(e);
458                    }
459            }
460    
461            @BeanReference(type = com.liferay.portal.service.WebDAVPropsLocalService.class)
462            protected WebDAVPropsLocalService webDAVPropsLocalService;
463            @BeanReference(type = WebDAVPropsPersistence.class)
464            protected WebDAVPropsPersistence webDAVPropsPersistence;
465            @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
466            protected com.liferay.counter.service.CounterLocalService counterLocalService;
467            @BeanReference(type = com.liferay.portal.service.ClassNameLocalService.class)
468            protected com.liferay.portal.service.ClassNameLocalService classNameLocalService;
469            @BeanReference(type = ClassNamePersistence.class)
470            protected ClassNamePersistence classNamePersistence;
471            @BeanReference(type = PersistedModelLocalServiceRegistry.class)
472            protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
473    }