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.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.model.WebDAVProps;
037    import com.liferay.portal.service.BaseLocalServiceImpl;
038    import com.liferay.portal.service.PersistedModelLocalServiceRegistry;
039    import com.liferay.portal.service.WebDAVPropsLocalService;
040    import com.liferay.portal.service.persistence.ClassNamePersistence;
041    import com.liferay.portal.service.persistence.WebDAVPropsPersistence;
042    import com.liferay.portal.util.PortalUtil;
043    
044    import java.io.Serializable;
045    
046    import java.util.List;
047    
048    import javax.sql.DataSource;
049    
050    /**
051     * Provides the base implementation for the web d a v props local service.
052     *
053     * <p>
054     * This implementation exists only as a container for the default service methods generated by ServiceBuilder. All custom service methods should be put in {@link com.liferay.portal.service.impl.WebDAVPropsLocalServiceImpl}.
055     * </p>
056     *
057     * @author Brian Wing Shun Chan
058     * @see com.liferay.portal.service.impl.WebDAVPropsLocalServiceImpl
059     * @see com.liferay.portal.service.WebDAVPropsLocalServiceUtil
060     * @generated
061     */
062    @ProviderType
063    public abstract class WebDAVPropsLocalServiceBaseImpl
064            extends BaseLocalServiceImpl implements WebDAVPropsLocalService,
065                    IdentifiableBean {
066            /*
067             * NOTE FOR DEVELOPERS:
068             *
069             * 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.
070             */
071    
072            /**
073             * Adds the web d a v props to the database. Also notifies the appropriate model listeners.
074             *
075             * @param webDAVProps the web d a v props
076             * @return the web d a v props that was added
077             */
078            @Indexable(type = IndexableType.REINDEX)
079            @Override
080            public WebDAVProps addWebDAVProps(WebDAVProps webDAVProps) {
081                    webDAVProps.setNew(true);
082    
083                    return webDAVPropsPersistence.update(webDAVProps);
084            }
085    
086            /**
087             * Creates a new web d a v props with the primary key. Does not add the web d a v props to the database.
088             *
089             * @param webDavPropsId the primary key for the new web d a v props
090             * @return the new web d a v props
091             */
092            @Override
093            public WebDAVProps createWebDAVProps(long webDavPropsId) {
094                    return webDAVPropsPersistence.create(webDavPropsId);
095            }
096    
097            /**
098             * Deletes the web d a v props with the primary key from the database. Also notifies the appropriate model listeners.
099             *
100             * @param webDavPropsId the primary key of the web d a v props
101             * @return the web d a v props that was removed
102             * @throws PortalException if a web d a v props with the primary key could not be found
103             */
104            @Indexable(type = IndexableType.DELETE)
105            @Override
106            public WebDAVProps deleteWebDAVProps(long webDavPropsId)
107                    throws PortalException {
108                    return webDAVPropsPersistence.remove(webDavPropsId);
109            }
110    
111            /**
112             * Deletes the web d a v props from the database. Also notifies the appropriate model listeners.
113             *
114             * @param webDAVProps the web d a v props
115             * @return the web d a v props that was removed
116             */
117            @Indexable(type = IndexableType.DELETE)
118            @Override
119            public WebDAVProps deleteWebDAVProps(WebDAVProps webDAVProps) {
120                    return webDAVPropsPersistence.remove(webDAVProps);
121            }
122    
123            @Override
124            public DynamicQuery dynamicQuery() {
125                    Class<?> clazz = getClass();
126    
127                    return DynamicQueryFactoryUtil.forClass(WebDAVProps.class,
128                            clazz.getClassLoader());
129            }
130    
131            /**
132             * Performs a dynamic query on the database and returns the matching rows.
133             *
134             * @param dynamicQuery the dynamic query
135             * @return the matching rows
136             */
137            @Override
138            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery) {
139                    return webDAVPropsPersistence.findWithDynamicQuery(dynamicQuery);
140            }
141    
142            /**
143             * Performs a dynamic query on the database and returns a range of the matching rows.
144             *
145             * <p>
146             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.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.
147             * </p>
148             *
149             * @param dynamicQuery the dynamic query
150             * @param start the lower bound of the range of model instances
151             * @param end the upper bound of the range of model instances (not inclusive)
152             * @return the range of matching rows
153             */
154            @Override
155            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
156                    int end) {
157                    return webDAVPropsPersistence.findWithDynamicQuery(dynamicQuery, start,
158                            end);
159            }
160    
161            /**
162             * Performs a dynamic query on the database and returns an ordered range of the matching rows.
163             *
164             * <p>
165             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.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.
166             * </p>
167             *
168             * @param dynamicQuery the dynamic query
169             * @param start the lower bound of the range of model instances
170             * @param end the upper bound of the range of model instances (not inclusive)
171             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
172             * @return the ordered range of matching rows
173             */
174            @Override
175            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
176                    int end, OrderByComparator<T> orderByComparator) {
177                    return webDAVPropsPersistence.findWithDynamicQuery(dynamicQuery, start,
178                            end, orderByComparator);
179            }
180    
181            /**
182             * Returns the number of rows matching the dynamic query.
183             *
184             * @param dynamicQuery the dynamic query
185             * @return the number of rows matching the dynamic query
186             */
187            @Override
188            public long dynamicQueryCount(DynamicQuery dynamicQuery) {
189                    return webDAVPropsPersistence.countWithDynamicQuery(dynamicQuery);
190            }
191    
192            /**
193             * Returns the number of rows matching the dynamic query.
194             *
195             * @param dynamicQuery the dynamic query
196             * @param projection the projection to apply to the query
197             * @return the number of rows matching the dynamic query
198             */
199            @Override
200            public long dynamicQueryCount(DynamicQuery dynamicQuery,
201                    Projection projection) {
202                    return webDAVPropsPersistence.countWithDynamicQuery(dynamicQuery,
203                            projection);
204            }
205    
206            @Override
207            public WebDAVProps fetchWebDAVProps(long webDavPropsId) {
208                    return webDAVPropsPersistence.fetchByPrimaryKey(webDavPropsId);
209            }
210    
211            /**
212             * Returns the web d a v props with the primary key.
213             *
214             * @param webDavPropsId the primary key of the web d a v props
215             * @return the web d a v props
216             * @throws PortalException if a web d a v props with the primary key could not be found
217             */
218            @Override
219            public WebDAVProps getWebDAVProps(long webDavPropsId)
220                    throws PortalException {
221                    return webDAVPropsPersistence.findByPrimaryKey(webDavPropsId);
222            }
223    
224            @Override
225            public ActionableDynamicQuery getActionableDynamicQuery() {
226                    ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
227    
228                    actionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.WebDAVPropsLocalServiceUtil.getService());
229                    actionableDynamicQuery.setClass(WebDAVProps.class);
230                    actionableDynamicQuery.setClassLoader(getClassLoader());
231    
232                    actionableDynamicQuery.setPrimaryKeyPropertyName("webDavPropsId");
233    
234                    return actionableDynamicQuery;
235            }
236    
237            protected void initActionableDynamicQuery(
238                    ActionableDynamicQuery actionableDynamicQuery) {
239                    actionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.WebDAVPropsLocalServiceUtil.getService());
240                    actionableDynamicQuery.setClass(WebDAVProps.class);
241                    actionableDynamicQuery.setClassLoader(getClassLoader());
242    
243                    actionableDynamicQuery.setPrimaryKeyPropertyName("webDavPropsId");
244            }
245    
246            /**
247             * @throws PortalException
248             */
249            @Override
250            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
251                    throws PortalException {
252                    return webDAVPropsLocalService.deleteWebDAVProps((WebDAVProps)persistedModel);
253            }
254    
255            @Override
256            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
257                    throws PortalException {
258                    return webDAVPropsPersistence.findByPrimaryKey(primaryKeyObj);
259            }
260    
261            /**
262             * Returns a range of all the web d a v propses.
263             *
264             * <p>
265             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.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.
266             * </p>
267             *
268             * @param start the lower bound of the range of web d a v propses
269             * @param end the upper bound of the range of web d a v propses (not inclusive)
270             * @return the range of web d a v propses
271             */
272            @Override
273            public List<WebDAVProps> getWebDAVPropses(int start, int end) {
274                    return webDAVPropsPersistence.findAll(start, end);
275            }
276    
277            /**
278             * Returns the number of web d a v propses.
279             *
280             * @return the number of web d a v propses
281             */
282            @Override
283            public int getWebDAVPropsesCount() {
284                    return webDAVPropsPersistence.countAll();
285            }
286    
287            /**
288             * 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.
289             *
290             * @param webDAVProps the web d a v props
291             * @return the web d a v props that was updated
292             */
293            @Indexable(type = IndexableType.REINDEX)
294            @Override
295            public WebDAVProps updateWebDAVProps(WebDAVProps webDAVProps) {
296                    return webDAVPropsPersistence.update(webDAVProps);
297            }
298    
299            /**
300             * Returns the web d a v props local service.
301             *
302             * @return the web d a v props local service
303             */
304            public WebDAVPropsLocalService getWebDAVPropsLocalService() {
305                    return webDAVPropsLocalService;
306            }
307    
308            /**
309             * Sets the web d a v props local service.
310             *
311             * @param webDAVPropsLocalService the web d a v props local service
312             */
313            public void setWebDAVPropsLocalService(
314                    WebDAVPropsLocalService webDAVPropsLocalService) {
315                    this.webDAVPropsLocalService = webDAVPropsLocalService;
316            }
317    
318            /**
319             * Returns the web d a v props persistence.
320             *
321             * @return the web d a v props persistence
322             */
323            public WebDAVPropsPersistence getWebDAVPropsPersistence() {
324                    return webDAVPropsPersistence;
325            }
326    
327            /**
328             * Sets the web d a v props persistence.
329             *
330             * @param webDAVPropsPersistence the web d a v props persistence
331             */
332            public void setWebDAVPropsPersistence(
333                    WebDAVPropsPersistence webDAVPropsPersistence) {
334                    this.webDAVPropsPersistence = webDAVPropsPersistence;
335            }
336    
337            /**
338             * Returns the counter local service.
339             *
340             * @return the counter local service
341             */
342            public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
343                    return counterLocalService;
344            }
345    
346            /**
347             * Sets the counter local service.
348             *
349             * @param counterLocalService the counter local service
350             */
351            public void setCounterLocalService(
352                    com.liferay.counter.service.CounterLocalService counterLocalService) {
353                    this.counterLocalService = counterLocalService;
354            }
355    
356            /**
357             * Returns the class name local service.
358             *
359             * @return the class name local service
360             */
361            public com.liferay.portal.service.ClassNameLocalService getClassNameLocalService() {
362                    return classNameLocalService;
363            }
364    
365            /**
366             * Sets the class name local service.
367             *
368             * @param classNameLocalService the class name local service
369             */
370            public void setClassNameLocalService(
371                    com.liferay.portal.service.ClassNameLocalService classNameLocalService) {
372                    this.classNameLocalService = classNameLocalService;
373            }
374    
375            /**
376             * Returns the class name remote service.
377             *
378             * @return the class name remote service
379             */
380            public com.liferay.portal.service.ClassNameService getClassNameService() {
381                    return classNameService;
382            }
383    
384            /**
385             * Sets the class name remote service.
386             *
387             * @param classNameService the class name remote service
388             */
389            public void setClassNameService(
390                    com.liferay.portal.service.ClassNameService classNameService) {
391                    this.classNameService = classNameService;
392            }
393    
394            /**
395             * Returns the class name persistence.
396             *
397             * @return the class name persistence
398             */
399            public ClassNamePersistence getClassNamePersistence() {
400                    return classNamePersistence;
401            }
402    
403            /**
404             * Sets the class name persistence.
405             *
406             * @param classNamePersistence the class name persistence
407             */
408            public void setClassNamePersistence(
409                    ClassNamePersistence classNamePersistence) {
410                    this.classNamePersistence = classNamePersistence;
411            }
412    
413            public void afterPropertiesSet() {
414                    persistedModelLocalServiceRegistry.register("com.liferay.portal.model.WebDAVProps",
415                            webDAVPropsLocalService);
416            }
417    
418            public void destroy() {
419                    persistedModelLocalServiceRegistry.unregister(
420                            "com.liferay.portal.model.WebDAVProps");
421            }
422    
423            /**
424             * Returns the Spring bean ID for this bean.
425             *
426             * @return the Spring bean ID for this bean
427             */
428            @Override
429            public String getBeanIdentifier() {
430                    return _beanIdentifier;
431            }
432    
433            /**
434             * Sets the Spring bean ID for this bean.
435             *
436             * @param beanIdentifier the Spring bean ID for this bean
437             */
438            @Override
439            public void setBeanIdentifier(String beanIdentifier) {
440                    _beanIdentifier = beanIdentifier;
441            }
442    
443            protected Class<?> getModelClass() {
444                    return WebDAVProps.class;
445            }
446    
447            protected String getModelClassName() {
448                    return WebDAVProps.class.getName();
449            }
450    
451            /**
452             * Performs a SQL query.
453             *
454             * @param sql the sql query
455             */
456            protected void runSQL(String sql) {
457                    try {
458                            DataSource dataSource = webDAVPropsPersistence.getDataSource();
459    
460                            DB db = DBFactoryUtil.getDB();
461    
462                            sql = db.buildSQL(sql);
463                            sql = PortalUtil.transformSQL(sql);
464    
465                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
466                                            sql, new int[0]);
467    
468                            sqlUpdate.update();
469                    }
470                    catch (Exception e) {
471                            throw new SystemException(e);
472                    }
473            }
474    
475            @BeanReference(type = WebDAVPropsLocalService.class)
476            protected WebDAVPropsLocalService webDAVPropsLocalService;
477            @BeanReference(type = WebDAVPropsPersistence.class)
478            protected WebDAVPropsPersistence webDAVPropsPersistence;
479            @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
480            protected com.liferay.counter.service.CounterLocalService counterLocalService;
481            @BeanReference(type = com.liferay.portal.service.ClassNameLocalService.class)
482            protected com.liferay.portal.service.ClassNameLocalService classNameLocalService;
483            @BeanReference(type = com.liferay.portal.service.ClassNameService.class)
484            protected com.liferay.portal.service.ClassNameService classNameService;
485            @BeanReference(type = ClassNamePersistence.class)
486            protected ClassNamePersistence classNamePersistence;
487            @BeanReference(type = PersistedModelLocalServiceRegistry.class)
488            protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
489            private String _beanIdentifier;
490    }