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.UserTrackerPath;
038    import com.liferay.portal.service.BaseLocalServiceImpl;
039    import com.liferay.portal.service.PersistedModelLocalServiceRegistry;
040    import com.liferay.portal.service.UserTrackerPathLocalService;
041    import com.liferay.portal.service.persistence.UserTrackerPathPersistence;
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 user tracker path 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.UserTrackerPathLocalServiceImpl}.
055     * </p>
056     *
057     * @author Brian Wing Shun Chan
058     * @see com.liferay.portal.service.impl.UserTrackerPathLocalServiceImpl
059     * @see com.liferay.portal.service.UserTrackerPathLocalServiceUtil
060     * @generated
061     */
062    @ProviderType
063    public abstract class UserTrackerPathLocalServiceBaseImpl
064            extends BaseLocalServiceImpl implements UserTrackerPathLocalService,
065                    IdentifiableOSGiService {
066            /*
067             * NOTE FOR DEVELOPERS:
068             *
069             * Never modify or reference this class directly. Always use {@link com.liferay.portal.service.UserTrackerPathLocalServiceUtil} to access the user tracker path local service.
070             */
071    
072            /**
073             * Adds the user tracker path to the database. Also notifies the appropriate model listeners.
074             *
075             * @param userTrackerPath the user tracker path
076             * @return the user tracker path that was added
077             */
078            @Indexable(type = IndexableType.REINDEX)
079            @Override
080            public UserTrackerPath addUserTrackerPath(UserTrackerPath userTrackerPath) {
081                    userTrackerPath.setNew(true);
082    
083                    return userTrackerPathPersistence.update(userTrackerPath);
084            }
085    
086            /**
087             * Creates a new user tracker path with the primary key. Does not add the user tracker path to the database.
088             *
089             * @param userTrackerPathId the primary key for the new user tracker path
090             * @return the new user tracker path
091             */
092            @Override
093            public UserTrackerPath createUserTrackerPath(long userTrackerPathId) {
094                    return userTrackerPathPersistence.create(userTrackerPathId);
095            }
096    
097            /**
098             * Deletes the user tracker path with the primary key from the database. Also notifies the appropriate model listeners.
099             *
100             * @param userTrackerPathId the primary key of the user tracker path
101             * @return the user tracker path that was removed
102             * @throws PortalException if a user tracker path with the primary key could not be found
103             */
104            @Indexable(type = IndexableType.DELETE)
105            @Override
106            public UserTrackerPath deleteUserTrackerPath(long userTrackerPathId)
107                    throws PortalException {
108                    return userTrackerPathPersistence.remove(userTrackerPathId);
109            }
110    
111            /**
112             * Deletes the user tracker path from the database. Also notifies the appropriate model listeners.
113             *
114             * @param userTrackerPath the user tracker path
115             * @return the user tracker path that was removed
116             */
117            @Indexable(type = IndexableType.DELETE)
118            @Override
119            public UserTrackerPath deleteUserTrackerPath(
120                    UserTrackerPath userTrackerPath) {
121                    return userTrackerPathPersistence.remove(userTrackerPath);
122            }
123    
124            @Override
125            public DynamicQuery dynamicQuery() {
126                    Class<?> clazz = getClass();
127    
128                    return DynamicQueryFactoryUtil.forClass(UserTrackerPath.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 userTrackerPathPersistence.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.UserTrackerPathModelImpl}. 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 userTrackerPathPersistence.findWithDynamicQuery(dynamicQuery,
159                            start, 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.UserTrackerPathModelImpl}. 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 userTrackerPathPersistence.findWithDynamicQuery(dynamicQuery,
179                            start, 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 userTrackerPathPersistence.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 userTrackerPathPersistence.countWithDynamicQuery(dynamicQuery,
204                            projection);
205            }
206    
207            @Override
208            public UserTrackerPath fetchUserTrackerPath(long userTrackerPathId) {
209                    return userTrackerPathPersistence.fetchByPrimaryKey(userTrackerPathId);
210            }
211    
212            /**
213             * Returns the user tracker path with the primary key.
214             *
215             * @param userTrackerPathId the primary key of the user tracker path
216             * @return the user tracker path
217             * @throws PortalException if a user tracker path with the primary key could not be found
218             */
219            @Override
220            public UserTrackerPath getUserTrackerPath(long userTrackerPathId)
221                    throws PortalException {
222                    return userTrackerPathPersistence.findByPrimaryKey(userTrackerPathId);
223            }
224    
225            @Override
226            public ActionableDynamicQuery getActionableDynamicQuery() {
227                    ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
228    
229                    actionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.UserTrackerPathLocalServiceUtil.getService());
230                    actionableDynamicQuery.setClassLoader(getClassLoader());
231                    actionableDynamicQuery.setModelClass(UserTrackerPath.class);
232    
233                    actionableDynamicQuery.setPrimaryKeyPropertyName("userTrackerPathId");
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.UserTrackerPathLocalServiceUtil.getService());
243                    indexableActionableDynamicQuery.setClassLoader(getClassLoader());
244                    indexableActionableDynamicQuery.setModelClass(UserTrackerPath.class);
245    
246                    indexableActionableDynamicQuery.setPrimaryKeyPropertyName(
247                            "userTrackerPathId");
248    
249                    return indexableActionableDynamicQuery;
250            }
251    
252            protected void initActionableDynamicQuery(
253                    ActionableDynamicQuery actionableDynamicQuery) {
254                    actionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.UserTrackerPathLocalServiceUtil.getService());
255                    actionableDynamicQuery.setClassLoader(getClassLoader());
256                    actionableDynamicQuery.setModelClass(UserTrackerPath.class);
257    
258                    actionableDynamicQuery.setPrimaryKeyPropertyName("userTrackerPathId");
259            }
260    
261            /**
262             * @throws PortalException
263             */
264            @Override
265            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
266                    throws PortalException {
267                    return userTrackerPathLocalService.deleteUserTrackerPath((UserTrackerPath)persistedModel);
268            }
269    
270            @Override
271            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
272                    throws PortalException {
273                    return userTrackerPathPersistence.findByPrimaryKey(primaryKeyObj);
274            }
275    
276            /**
277             * Returns a range of all the user tracker paths.
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.UserTrackerPathModelImpl}. 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 user tracker paths
284             * @param end the upper bound of the range of user tracker paths (not inclusive)
285             * @return the range of user tracker paths
286             */
287            @Override
288            public List<UserTrackerPath> getUserTrackerPaths(int start, int end) {
289                    return userTrackerPathPersistence.findAll(start, end);
290            }
291    
292            /**
293             * Returns the number of user tracker paths.
294             *
295             * @return the number of user tracker paths
296             */
297            @Override
298            public int getUserTrackerPathsCount() {
299                    return userTrackerPathPersistence.countAll();
300            }
301    
302            /**
303             * Updates the user tracker path in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
304             *
305             * @param userTrackerPath the user tracker path
306             * @return the user tracker path that was updated
307             */
308            @Indexable(type = IndexableType.REINDEX)
309            @Override
310            public UserTrackerPath updateUserTrackerPath(
311                    UserTrackerPath userTrackerPath) {
312                    return userTrackerPathPersistence.update(userTrackerPath);
313            }
314    
315            /**
316             * Returns the user tracker path local service.
317             *
318             * @return the user tracker path local service
319             */
320            public UserTrackerPathLocalService getUserTrackerPathLocalService() {
321                    return userTrackerPathLocalService;
322            }
323    
324            /**
325             * Sets the user tracker path local service.
326             *
327             * @param userTrackerPathLocalService the user tracker path local service
328             */
329            public void setUserTrackerPathLocalService(
330                    UserTrackerPathLocalService userTrackerPathLocalService) {
331                    this.userTrackerPathLocalService = userTrackerPathLocalService;
332            }
333    
334            /**
335             * Returns the user tracker path persistence.
336             *
337             * @return the user tracker path persistence
338             */
339            public UserTrackerPathPersistence getUserTrackerPathPersistence() {
340                    return userTrackerPathPersistence;
341            }
342    
343            /**
344             * Sets the user tracker path persistence.
345             *
346             * @param userTrackerPathPersistence the user tracker path persistence
347             */
348            public void setUserTrackerPathPersistence(
349                    UserTrackerPathPersistence userTrackerPathPersistence) {
350                    this.userTrackerPathPersistence = userTrackerPathPersistence;
351            }
352    
353            /**
354             * Returns the counter local service.
355             *
356             * @return the counter local service
357             */
358            public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
359                    return counterLocalService;
360            }
361    
362            /**
363             * Sets the counter local service.
364             *
365             * @param counterLocalService the counter local service
366             */
367            public void setCounterLocalService(
368                    com.liferay.counter.service.CounterLocalService counterLocalService) {
369                    this.counterLocalService = counterLocalService;
370            }
371    
372            public void afterPropertiesSet() {
373                    persistedModelLocalServiceRegistry.register("com.liferay.portal.model.UserTrackerPath",
374                            userTrackerPathLocalService);
375            }
376    
377            public void destroy() {
378                    persistedModelLocalServiceRegistry.unregister(
379                            "com.liferay.portal.model.UserTrackerPath");
380            }
381    
382            /**
383             * Returns the OSGi service identifier.
384             *
385             * @return the OSGi service identifier
386             */
387            @Override
388            public String getOSGiServiceIdentifier() {
389                    return UserTrackerPathLocalService.class.getName();
390            }
391    
392            protected Class<?> getModelClass() {
393                    return UserTrackerPath.class;
394            }
395    
396            protected String getModelClassName() {
397                    return UserTrackerPath.class.getName();
398            }
399    
400            /**
401             * Performs a SQL query.
402             *
403             * @param sql the sql query
404             */
405            protected void runSQL(String sql) {
406                    try {
407                            DataSource dataSource = userTrackerPathPersistence.getDataSource();
408    
409                            DB db = DBManagerUtil.getDB();
410    
411                            sql = db.buildSQL(sql);
412                            sql = PortalUtil.transformSQL(sql);
413    
414                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
415                                            sql, new int[0]);
416    
417                            sqlUpdate.update();
418                    }
419                    catch (Exception e) {
420                            throw new SystemException(e);
421                    }
422            }
423    
424            @BeanReference(type = com.liferay.portal.service.UserTrackerPathLocalService.class)
425            protected UserTrackerPathLocalService userTrackerPathLocalService;
426            @BeanReference(type = UserTrackerPathPersistence.class)
427            protected UserTrackerPathPersistence userTrackerPathPersistence;
428            @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
429            protected com.liferay.counter.service.CounterLocalService counterLocalService;
430            @BeanReference(type = PersistedModelLocalServiceRegistry.class)
431            protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
432    }