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