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.asset.service.base;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.bean.BeanReference;
020    import com.liferay.portal.kernel.dao.db.DB;
021    import com.liferay.portal.kernel.dao.db.DBManagerUtil;
022    import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
023    import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
024    import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery;
025    import com.liferay.portal.kernel.dao.orm.DefaultActionableDynamicQuery;
026    import com.liferay.portal.kernel.dao.orm.DynamicQuery;
027    import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil;
028    import com.liferay.portal.kernel.dao.orm.IndexableActionableDynamicQuery;
029    import com.liferay.portal.kernel.dao.orm.Projection;
030    import com.liferay.portal.kernel.exception.PortalException;
031    import com.liferay.portal.kernel.exception.SystemException;
032    import com.liferay.portal.kernel.module.framework.service.IdentifiableOSGiService;
033    import com.liferay.portal.kernel.search.Indexable;
034    import com.liferay.portal.kernel.search.IndexableType;
035    import com.liferay.portal.kernel.util.OrderByComparator;
036    import com.liferay.portal.model.PersistedModel;
037    import com.liferay.portal.service.BaseLocalServiceImpl;
038    import com.liferay.portal.service.PersistedModelLocalServiceRegistry;
039    import com.liferay.portal.util.PortalUtil;
040    
041    import com.liferay.portlet.asset.model.AssetTagStats;
042    import com.liferay.portlet.asset.service.AssetTagStatsLocalService;
043    import com.liferay.portlet.asset.service.persistence.AssetTagFinder;
044    import com.liferay.portlet.asset.service.persistence.AssetTagPersistence;
045    import com.liferay.portlet.asset.service.persistence.AssetTagStatsPersistence;
046    
047    import java.io.Serializable;
048    
049    import java.util.List;
050    
051    import javax.sql.DataSource;
052    
053    /**
054     * Provides the base implementation for the asset tag stats local service.
055     *
056     * <p>
057     * 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.asset.service.impl.AssetTagStatsLocalServiceImpl}.
058     * </p>
059     *
060     * @author Brian Wing Shun Chan
061     * @see com.liferay.portlet.asset.service.impl.AssetTagStatsLocalServiceImpl
062     * @see com.liferay.portlet.asset.service.AssetTagStatsLocalServiceUtil
063     * @generated
064     */
065    @ProviderType
066    public abstract class AssetTagStatsLocalServiceBaseImpl
067            extends BaseLocalServiceImpl implements AssetTagStatsLocalService,
068                    IdentifiableOSGiService {
069            /*
070             * NOTE FOR DEVELOPERS:
071             *
072             * Never modify or reference this class directly. Always use {@link com.liferay.portlet.asset.service.AssetTagStatsLocalServiceUtil} to access the asset tag stats local service.
073             */
074    
075            /**
076             * Adds the asset tag stats to the database. Also notifies the appropriate model listeners.
077             *
078             * @param assetTagStats the asset tag stats
079             * @return the asset tag stats that was added
080             */
081            @Indexable(type = IndexableType.REINDEX)
082            @Override
083            public AssetTagStats addAssetTagStats(AssetTagStats assetTagStats) {
084                    assetTagStats.setNew(true);
085    
086                    return assetTagStatsPersistence.update(assetTagStats);
087            }
088    
089            /**
090             * Creates a new asset tag stats with the primary key. Does not add the asset tag stats to the database.
091             *
092             * @param tagStatsId the primary key for the new asset tag stats
093             * @return the new asset tag stats
094             */
095            @Override
096            public AssetTagStats createAssetTagStats(long tagStatsId) {
097                    return assetTagStatsPersistence.create(tagStatsId);
098            }
099    
100            /**
101             * Deletes the asset tag stats with the primary key from the database. Also notifies the appropriate model listeners.
102             *
103             * @param tagStatsId the primary key of the asset tag stats
104             * @return the asset tag stats that was removed
105             * @throws PortalException if a asset tag stats with the primary key could not be found
106             */
107            @Indexable(type = IndexableType.DELETE)
108            @Override
109            public AssetTagStats deleteAssetTagStats(long tagStatsId)
110                    throws PortalException {
111                    return assetTagStatsPersistence.remove(tagStatsId);
112            }
113    
114            /**
115             * Deletes the asset tag stats from the database. Also notifies the appropriate model listeners.
116             *
117             * @param assetTagStats the asset tag stats
118             * @return the asset tag stats that was removed
119             */
120            @Indexable(type = IndexableType.DELETE)
121            @Override
122            public AssetTagStats deleteAssetTagStats(AssetTagStats assetTagStats) {
123                    return assetTagStatsPersistence.remove(assetTagStats);
124            }
125    
126            @Override
127            public DynamicQuery dynamicQuery() {
128                    Class<?> clazz = getClass();
129    
130                    return DynamicQueryFactoryUtil.forClass(AssetTagStats.class,
131                            clazz.getClassLoader());
132            }
133    
134            /**
135             * Performs a dynamic query on the database and returns the matching rows.
136             *
137             * @param dynamicQuery the dynamic query
138             * @return the matching rows
139             */
140            @Override
141            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery) {
142                    return assetTagStatsPersistence.findWithDynamicQuery(dynamicQuery);
143            }
144    
145            /**
146             * Performs a dynamic query on the database and returns a range of the matching rows.
147             *
148             * <p>
149             * 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.asset.model.impl.AssetTagStatsModelImpl}. 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.
150             * </p>
151             *
152             * @param dynamicQuery the dynamic query
153             * @param start the lower bound of the range of model instances
154             * @param end the upper bound of the range of model instances (not inclusive)
155             * @return the range of matching rows
156             */
157            @Override
158            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
159                    int end) {
160                    return assetTagStatsPersistence.findWithDynamicQuery(dynamicQuery,
161                            start, end);
162            }
163    
164            /**
165             * Performs a dynamic query on the database and returns an ordered range of the matching rows.
166             *
167             * <p>
168             * 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.asset.model.impl.AssetTagStatsModelImpl}. 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.
169             * </p>
170             *
171             * @param dynamicQuery the dynamic query
172             * @param start the lower bound of the range of model instances
173             * @param end the upper bound of the range of model instances (not inclusive)
174             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
175             * @return the ordered range of matching rows
176             */
177            @Override
178            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
179                    int end, OrderByComparator<T> orderByComparator) {
180                    return assetTagStatsPersistence.findWithDynamicQuery(dynamicQuery,
181                            start, end, orderByComparator);
182            }
183    
184            /**
185             * Returns the number of rows matching the dynamic query.
186             *
187             * @param dynamicQuery the dynamic query
188             * @return the number of rows matching the dynamic query
189             */
190            @Override
191            public long dynamicQueryCount(DynamicQuery dynamicQuery) {
192                    return assetTagStatsPersistence.countWithDynamicQuery(dynamicQuery);
193            }
194    
195            /**
196             * Returns the number of rows matching the dynamic query.
197             *
198             * @param dynamicQuery the dynamic query
199             * @param projection the projection to apply to the query
200             * @return the number of rows matching the dynamic query
201             */
202            @Override
203            public long dynamicQueryCount(DynamicQuery dynamicQuery,
204                    Projection projection) {
205                    return assetTagStatsPersistence.countWithDynamicQuery(dynamicQuery,
206                            projection);
207            }
208    
209            @Override
210            public AssetTagStats fetchAssetTagStats(long tagStatsId) {
211                    return assetTagStatsPersistence.fetchByPrimaryKey(tagStatsId);
212            }
213    
214            /**
215             * Returns the asset tag stats with the primary key.
216             *
217             * @param tagStatsId the primary key of the asset tag stats
218             * @return the asset tag stats
219             * @throws PortalException if a asset tag stats with the primary key could not be found
220             */
221            @Override
222            public AssetTagStats getAssetTagStats(long tagStatsId)
223                    throws PortalException {
224                    return assetTagStatsPersistence.findByPrimaryKey(tagStatsId);
225            }
226    
227            @Override
228            public ActionableDynamicQuery getActionableDynamicQuery() {
229                    ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
230    
231                    actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.asset.service.AssetTagStatsLocalServiceUtil.getService());
232                    actionableDynamicQuery.setClassLoader(getClassLoader());
233                    actionableDynamicQuery.setModelClass(AssetTagStats.class);
234    
235                    actionableDynamicQuery.setPrimaryKeyPropertyName("tagStatsId");
236    
237                    return actionableDynamicQuery;
238            }
239    
240            @Override
241            public IndexableActionableDynamicQuery getIndexableActionableDynamicQuery() {
242                    IndexableActionableDynamicQuery indexableActionableDynamicQuery = new IndexableActionableDynamicQuery();
243    
244                    indexableActionableDynamicQuery.setBaseLocalService(com.liferay.portlet.asset.service.AssetTagStatsLocalServiceUtil.getService());
245                    indexableActionableDynamicQuery.setClassLoader(getClassLoader());
246                    indexableActionableDynamicQuery.setModelClass(AssetTagStats.class);
247    
248                    indexableActionableDynamicQuery.setPrimaryKeyPropertyName("tagStatsId");
249    
250                    return indexableActionableDynamicQuery;
251            }
252    
253            protected void initActionableDynamicQuery(
254                    ActionableDynamicQuery actionableDynamicQuery) {
255                    actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.asset.service.AssetTagStatsLocalServiceUtil.getService());
256                    actionableDynamicQuery.setClassLoader(getClassLoader());
257                    actionableDynamicQuery.setModelClass(AssetTagStats.class);
258    
259                    actionableDynamicQuery.setPrimaryKeyPropertyName("tagStatsId");
260            }
261    
262            /**
263             * @throws PortalException
264             */
265            @Override
266            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
267                    throws PortalException {
268                    return assetTagStatsLocalService.deleteAssetTagStats((AssetTagStats)persistedModel);
269            }
270    
271            @Override
272            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
273                    throws PortalException {
274                    return assetTagStatsPersistence.findByPrimaryKey(primaryKeyObj);
275            }
276    
277            /**
278             * Returns a range of all the asset tag statses.
279             *
280             * <p>
281             * 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.asset.model.impl.AssetTagStatsModelImpl}. 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.
282             * </p>
283             *
284             * @param start the lower bound of the range of asset tag statses
285             * @param end the upper bound of the range of asset tag statses (not inclusive)
286             * @return the range of asset tag statses
287             */
288            @Override
289            public List<AssetTagStats> getAssetTagStatses(int start, int end) {
290                    return assetTagStatsPersistence.findAll(start, end);
291            }
292    
293            /**
294             * Returns the number of asset tag statses.
295             *
296             * @return the number of asset tag statses
297             */
298            @Override
299            public int getAssetTagStatsesCount() {
300                    return assetTagStatsPersistence.countAll();
301            }
302    
303            /**
304             * Updates the asset tag stats in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
305             *
306             * @param assetTagStats the asset tag stats
307             * @return the asset tag stats that was updated
308             */
309            @Indexable(type = IndexableType.REINDEX)
310            @Override
311            public AssetTagStats updateAssetTagStats(AssetTagStats assetTagStats) {
312                    return assetTagStatsPersistence.update(assetTagStats);
313            }
314    
315            /**
316             * Returns the asset tag stats local service.
317             *
318             * @return the asset tag stats local service
319             */
320            public AssetTagStatsLocalService getAssetTagStatsLocalService() {
321                    return assetTagStatsLocalService;
322            }
323    
324            /**
325             * Sets the asset tag stats local service.
326             *
327             * @param assetTagStatsLocalService the asset tag stats local service
328             */
329            public void setAssetTagStatsLocalService(
330                    AssetTagStatsLocalService assetTagStatsLocalService) {
331                    this.assetTagStatsLocalService = assetTagStatsLocalService;
332            }
333    
334            /**
335             * Returns the asset tag stats persistence.
336             *
337             * @return the asset tag stats persistence
338             */
339            public AssetTagStatsPersistence getAssetTagStatsPersistence() {
340                    return assetTagStatsPersistence;
341            }
342    
343            /**
344             * Sets the asset tag stats persistence.
345             *
346             * @param assetTagStatsPersistence the asset tag stats persistence
347             */
348            public void setAssetTagStatsPersistence(
349                    AssetTagStatsPersistence assetTagStatsPersistence) {
350                    this.assetTagStatsPersistence = assetTagStatsPersistence;
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            /**
373             * Returns the asset tag local service.
374             *
375             * @return the asset tag local service
376             */
377            public com.liferay.portlet.asset.service.AssetTagLocalService getAssetTagLocalService() {
378                    return assetTagLocalService;
379            }
380    
381            /**
382             * Sets the asset tag local service.
383             *
384             * @param assetTagLocalService the asset tag local service
385             */
386            public void setAssetTagLocalService(
387                    com.liferay.portlet.asset.service.AssetTagLocalService assetTagLocalService) {
388                    this.assetTagLocalService = assetTagLocalService;
389            }
390    
391            /**
392             * Returns the asset tag persistence.
393             *
394             * @return the asset tag persistence
395             */
396            public AssetTagPersistence getAssetTagPersistence() {
397                    return assetTagPersistence;
398            }
399    
400            /**
401             * Sets the asset tag persistence.
402             *
403             * @param assetTagPersistence the asset tag persistence
404             */
405            public void setAssetTagPersistence(AssetTagPersistence assetTagPersistence) {
406                    this.assetTagPersistence = assetTagPersistence;
407            }
408    
409            /**
410             * Returns the asset tag finder.
411             *
412             * @return the asset tag finder
413             */
414            public AssetTagFinder getAssetTagFinder() {
415                    return assetTagFinder;
416            }
417    
418            /**
419             * Sets the asset tag finder.
420             *
421             * @param assetTagFinder the asset tag finder
422             */
423            public void setAssetTagFinder(AssetTagFinder assetTagFinder) {
424                    this.assetTagFinder = assetTagFinder;
425            }
426    
427            public void afterPropertiesSet() {
428                    persistedModelLocalServiceRegistry.register("com.liferay.portlet.asset.model.AssetTagStats",
429                            assetTagStatsLocalService);
430            }
431    
432            public void destroy() {
433                    persistedModelLocalServiceRegistry.unregister(
434                            "com.liferay.portlet.asset.model.AssetTagStats");
435            }
436    
437            /**
438             * Returns the OSGi service identifier.
439             *
440             * @return the OSGi service identifier
441             */
442            @Override
443            public String getOSGiServiceIdentifier() {
444                    return AssetTagStatsLocalService.class.getName();
445            }
446    
447            protected Class<?> getModelClass() {
448                    return AssetTagStats.class;
449            }
450    
451            protected String getModelClassName() {
452                    return AssetTagStats.class.getName();
453            }
454    
455            /**
456             * Performs a SQL query.
457             *
458             * @param sql the sql query
459             */
460            protected void runSQL(String sql) {
461                    try {
462                            DataSource dataSource = assetTagStatsPersistence.getDataSource();
463    
464                            DB db = DBManagerUtil.getDB();
465    
466                            sql = db.buildSQL(sql);
467                            sql = PortalUtil.transformSQL(sql);
468    
469                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
470                                            sql, new int[0]);
471    
472                            sqlUpdate.update();
473                    }
474                    catch (Exception e) {
475                            throw new SystemException(e);
476                    }
477            }
478    
479            @BeanReference(type = com.liferay.portlet.asset.service.AssetTagStatsLocalService.class)
480            protected AssetTagStatsLocalService assetTagStatsLocalService;
481            @BeanReference(type = AssetTagStatsPersistence.class)
482            protected AssetTagStatsPersistence assetTagStatsPersistence;
483            @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
484            protected com.liferay.counter.service.CounterLocalService counterLocalService;
485            @BeanReference(type = com.liferay.portlet.asset.service.AssetTagLocalService.class)
486            protected com.liferay.portlet.asset.service.AssetTagLocalService assetTagLocalService;
487            @BeanReference(type = AssetTagPersistence.class)
488            protected AssetTagPersistence assetTagPersistence;
489            @BeanReference(type = AssetTagFinder.class)
490            protected AssetTagFinder assetTagFinder;
491            @BeanReference(type = PersistedModelLocalServiceRegistry.class)
492            protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
493    }