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.service.persistence.UserFinder;
040    import com.liferay.portal.service.persistence.UserPersistence;
041    import com.liferay.portal.util.PortalUtil;
042    
043    import com.liferay.portlet.asset.model.AssetCategoryProperty;
044    import com.liferay.portlet.asset.service.AssetCategoryPropertyLocalService;
045    import com.liferay.portlet.asset.service.persistence.AssetCategoryPropertyFinder;
046    import com.liferay.portlet.asset.service.persistence.AssetCategoryPropertyPersistence;
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 category 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.AssetCategoryPropertyLocalServiceImpl}.
059     * </p>
060     *
061     * @author Brian Wing Shun Chan
062     * @see com.liferay.portlet.asset.service.impl.AssetCategoryPropertyLocalServiceImpl
063     * @see com.liferay.portlet.asset.service.AssetCategoryPropertyLocalServiceUtil
064     * @generated
065     */
066    @ProviderType
067    public abstract class AssetCategoryPropertyLocalServiceBaseImpl
068            extends BaseLocalServiceImpl implements AssetCategoryPropertyLocalService,
069                    IdentifiableOSGiService {
070            /*
071             * NOTE FOR DEVELOPERS:
072             *
073             * Never modify or reference this class directly. Always use {@link com.liferay.portlet.asset.service.AssetCategoryPropertyLocalServiceUtil} to access the asset category property local service.
074             */
075    
076            /**
077             * Adds the asset category property to the database. Also notifies the appropriate model listeners.
078             *
079             * @param assetCategoryProperty the asset category property
080             * @return the asset category property that was added
081             */
082            @Indexable(type = IndexableType.REINDEX)
083            @Override
084            public AssetCategoryProperty addAssetCategoryProperty(
085                    AssetCategoryProperty assetCategoryProperty) {
086                    assetCategoryProperty.setNew(true);
087    
088                    return assetCategoryPropertyPersistence.update(assetCategoryProperty);
089            }
090    
091            /**
092             * Creates a new asset category property with the primary key. Does not add the asset category property to the database.
093             *
094             * @param categoryPropertyId the primary key for the new asset category property
095             * @return the new asset category property
096             */
097            @Override
098            public AssetCategoryProperty createAssetCategoryProperty(
099                    long categoryPropertyId) {
100                    return assetCategoryPropertyPersistence.create(categoryPropertyId);
101            }
102    
103            /**
104             * Deletes the asset category property with the primary key from the database. Also notifies the appropriate model listeners.
105             *
106             * @param categoryPropertyId the primary key of the asset category property
107             * @return the asset category property that was removed
108             * @throws PortalException if a asset category property with the primary key could not be found
109             */
110            @Indexable(type = IndexableType.DELETE)
111            @Override
112            public AssetCategoryProperty deleteAssetCategoryProperty(
113                    long categoryPropertyId) throws PortalException {
114                    return assetCategoryPropertyPersistence.remove(categoryPropertyId);
115            }
116    
117            /**
118             * Deletes the asset category property from the database. Also notifies the appropriate model listeners.
119             *
120             * @param assetCategoryProperty the asset category property
121             * @return the asset category property that was removed
122             */
123            @Indexable(type = IndexableType.DELETE)
124            @Override
125            public AssetCategoryProperty deleteAssetCategoryProperty(
126                    AssetCategoryProperty assetCategoryProperty) {
127                    return assetCategoryPropertyPersistence.remove(assetCategoryProperty);
128            }
129    
130            @Override
131            public DynamicQuery dynamicQuery() {
132                    Class<?> clazz = getClass();
133    
134                    return DynamicQueryFactoryUtil.forClass(AssetCategoryProperty.class,
135                            clazz.getClassLoader());
136            }
137    
138            /**
139             * Performs a dynamic query on the database and returns the matching rows.
140             *
141             * @param dynamicQuery the dynamic query
142             * @return the matching rows
143             */
144            @Override
145            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery) {
146                    return assetCategoryPropertyPersistence.findWithDynamicQuery(dynamicQuery);
147            }
148    
149            /**
150             * Performs a dynamic query on the database and returns a range of the matching rows.
151             *
152             * <p>
153             * 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.AssetCategoryPropertyModelImpl}. 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.
154             * </p>
155             *
156             * @param dynamicQuery the dynamic query
157             * @param start the lower bound of the range of model instances
158             * @param end the upper bound of the range of model instances (not inclusive)
159             * @return the range of matching rows
160             */
161            @Override
162            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
163                    int end) {
164                    return assetCategoryPropertyPersistence.findWithDynamicQuery(dynamicQuery,
165                            start, end);
166            }
167    
168            /**
169             * Performs a dynamic query on the database and returns an ordered range of the matching rows.
170             *
171             * <p>
172             * 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.AssetCategoryPropertyModelImpl}. 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.
173             * </p>
174             *
175             * @param dynamicQuery the dynamic query
176             * @param start the lower bound of the range of model instances
177             * @param end the upper bound of the range of model instances (not inclusive)
178             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
179             * @return the ordered range of matching rows
180             */
181            @Override
182            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
183                    int end, OrderByComparator<T> orderByComparator) {
184                    return assetCategoryPropertyPersistence.findWithDynamicQuery(dynamicQuery,
185                            start, end, orderByComparator);
186            }
187    
188            /**
189             * Returns the number of rows matching the dynamic query.
190             *
191             * @param dynamicQuery the dynamic query
192             * @return the number of rows matching the dynamic query
193             */
194            @Override
195            public long dynamicQueryCount(DynamicQuery dynamicQuery) {
196                    return assetCategoryPropertyPersistence.countWithDynamicQuery(dynamicQuery);
197            }
198    
199            /**
200             * Returns the number of rows matching the dynamic query.
201             *
202             * @param dynamicQuery the dynamic query
203             * @param projection the projection to apply to the query
204             * @return the number of rows matching the dynamic query
205             */
206            @Override
207            public long dynamicQueryCount(DynamicQuery dynamicQuery,
208                    Projection projection) {
209                    return assetCategoryPropertyPersistence.countWithDynamicQuery(dynamicQuery,
210                            projection);
211            }
212    
213            @Override
214            public AssetCategoryProperty fetchAssetCategoryProperty(
215                    long categoryPropertyId) {
216                    return assetCategoryPropertyPersistence.fetchByPrimaryKey(categoryPropertyId);
217            }
218    
219            /**
220             * Returns the asset category property with the primary key.
221             *
222             * @param categoryPropertyId the primary key of the asset category property
223             * @return the asset category property
224             * @throws PortalException if a asset category property with the primary key could not be found
225             */
226            @Override
227            public AssetCategoryProperty getAssetCategoryProperty(
228                    long categoryPropertyId) throws PortalException {
229                    return assetCategoryPropertyPersistence.findByPrimaryKey(categoryPropertyId);
230            }
231    
232            @Override
233            public ActionableDynamicQuery getActionableDynamicQuery() {
234                    ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
235    
236                    actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.asset.service.AssetCategoryPropertyLocalServiceUtil.getService());
237                    actionableDynamicQuery.setClassLoader(getClassLoader());
238                    actionableDynamicQuery.setModelClass(AssetCategoryProperty.class);
239    
240                    actionableDynamicQuery.setPrimaryKeyPropertyName("categoryPropertyId");
241    
242                    return actionableDynamicQuery;
243            }
244    
245            @Override
246            public IndexableActionableDynamicQuery getIndexableActionableDynamicQuery() {
247                    IndexableActionableDynamicQuery indexableActionableDynamicQuery = new IndexableActionableDynamicQuery();
248    
249                    indexableActionableDynamicQuery.setBaseLocalService(com.liferay.portlet.asset.service.AssetCategoryPropertyLocalServiceUtil.getService());
250                    indexableActionableDynamicQuery.setClassLoader(getClassLoader());
251                    indexableActionableDynamicQuery.setModelClass(AssetCategoryProperty.class);
252    
253                    indexableActionableDynamicQuery.setPrimaryKeyPropertyName(
254                            "categoryPropertyId");
255    
256                    return indexableActionableDynamicQuery;
257            }
258    
259            protected void initActionableDynamicQuery(
260                    ActionableDynamicQuery actionableDynamicQuery) {
261                    actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.asset.service.AssetCategoryPropertyLocalServiceUtil.getService());
262                    actionableDynamicQuery.setClassLoader(getClassLoader());
263                    actionableDynamicQuery.setModelClass(AssetCategoryProperty.class);
264    
265                    actionableDynamicQuery.setPrimaryKeyPropertyName("categoryPropertyId");
266            }
267    
268            /**
269             * @throws PortalException
270             */
271            @Override
272            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
273                    throws PortalException {
274                    return assetCategoryPropertyLocalService.deleteAssetCategoryProperty((AssetCategoryProperty)persistedModel);
275            }
276    
277            @Override
278            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
279                    throws PortalException {
280                    return assetCategoryPropertyPersistence.findByPrimaryKey(primaryKeyObj);
281            }
282    
283            /**
284             * Returns a range of all the asset category properties.
285             *
286             * <p>
287             * 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.AssetCategoryPropertyModelImpl}. 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.
288             * </p>
289             *
290             * @param start the lower bound of the range of asset category properties
291             * @param end the upper bound of the range of asset category properties (not inclusive)
292             * @return the range of asset category properties
293             */
294            @Override
295            public List<AssetCategoryProperty> getAssetCategoryProperties(int start,
296                    int end) {
297                    return assetCategoryPropertyPersistence.findAll(start, end);
298            }
299    
300            /**
301             * Returns the number of asset category properties.
302             *
303             * @return the number of asset category properties
304             */
305            @Override
306            public int getAssetCategoryPropertiesCount() {
307                    return assetCategoryPropertyPersistence.countAll();
308            }
309    
310            /**
311             * Updates the asset category property in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
312             *
313             * @param assetCategoryProperty the asset category property
314             * @return the asset category property that was updated
315             */
316            @Indexable(type = IndexableType.REINDEX)
317            @Override
318            public AssetCategoryProperty updateAssetCategoryProperty(
319                    AssetCategoryProperty assetCategoryProperty) {
320                    return assetCategoryPropertyPersistence.update(assetCategoryProperty);
321            }
322    
323            /**
324             * Returns the asset category property local service.
325             *
326             * @return the asset category property local service
327             */
328            public AssetCategoryPropertyLocalService getAssetCategoryPropertyLocalService() {
329                    return assetCategoryPropertyLocalService;
330            }
331    
332            /**
333             * Sets the asset category property local service.
334             *
335             * @param assetCategoryPropertyLocalService the asset category property local service
336             */
337            public void setAssetCategoryPropertyLocalService(
338                    AssetCategoryPropertyLocalService assetCategoryPropertyLocalService) {
339                    this.assetCategoryPropertyLocalService = assetCategoryPropertyLocalService;
340            }
341    
342            /**
343             * Returns the asset category property persistence.
344             *
345             * @return the asset category property persistence
346             */
347            public AssetCategoryPropertyPersistence getAssetCategoryPropertyPersistence() {
348                    return assetCategoryPropertyPersistence;
349            }
350    
351            /**
352             * Sets the asset category property persistence.
353             *
354             * @param assetCategoryPropertyPersistence the asset category property persistence
355             */
356            public void setAssetCategoryPropertyPersistence(
357                    AssetCategoryPropertyPersistence assetCategoryPropertyPersistence) {
358                    this.assetCategoryPropertyPersistence = assetCategoryPropertyPersistence;
359            }
360    
361            /**
362             * Returns the asset category property finder.
363             *
364             * @return the asset category property finder
365             */
366            public AssetCategoryPropertyFinder getAssetCategoryPropertyFinder() {
367                    return assetCategoryPropertyFinder;
368            }
369    
370            /**
371             * Sets the asset category property finder.
372             *
373             * @param assetCategoryPropertyFinder the asset category property finder
374             */
375            public void setAssetCategoryPropertyFinder(
376                    AssetCategoryPropertyFinder assetCategoryPropertyFinder) {
377                    this.assetCategoryPropertyFinder = assetCategoryPropertyFinder;
378            }
379    
380            /**
381             * Returns the counter local service.
382             *
383             * @return the counter local service
384             */
385            public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
386                    return counterLocalService;
387            }
388    
389            /**
390             * Sets the counter local service.
391             *
392             * @param counterLocalService the counter local service
393             */
394            public void setCounterLocalService(
395                    com.liferay.counter.service.CounterLocalService counterLocalService) {
396                    this.counterLocalService = counterLocalService;
397            }
398    
399            /**
400             * Returns the user local service.
401             *
402             * @return the user local service
403             */
404            public com.liferay.portal.service.UserLocalService getUserLocalService() {
405                    return userLocalService;
406            }
407    
408            /**
409             * Sets the user local service.
410             *
411             * @param userLocalService the user local service
412             */
413            public void setUserLocalService(
414                    com.liferay.portal.service.UserLocalService userLocalService) {
415                    this.userLocalService = userLocalService;
416            }
417    
418            /**
419             * Returns the user persistence.
420             *
421             * @return the user persistence
422             */
423            public UserPersistence getUserPersistence() {
424                    return userPersistence;
425            }
426    
427            /**
428             * Sets the user persistence.
429             *
430             * @param userPersistence the user persistence
431             */
432            public void setUserPersistence(UserPersistence userPersistence) {
433                    this.userPersistence = userPersistence;
434            }
435    
436            /**
437             * Returns the user finder.
438             *
439             * @return the user finder
440             */
441            public UserFinder getUserFinder() {
442                    return userFinder;
443            }
444    
445            /**
446             * Sets the user finder.
447             *
448             * @param userFinder the user finder
449             */
450            public void setUserFinder(UserFinder userFinder) {
451                    this.userFinder = userFinder;
452            }
453    
454            public void afterPropertiesSet() {
455                    persistedModelLocalServiceRegistry.register("com.liferay.portlet.asset.model.AssetCategoryProperty",
456                            assetCategoryPropertyLocalService);
457            }
458    
459            public void destroy() {
460                    persistedModelLocalServiceRegistry.unregister(
461                            "com.liferay.portlet.asset.model.AssetCategoryProperty");
462            }
463    
464            /**
465             * Returns the OSGi service identifier.
466             *
467             * @return the OSGi service identifier
468             */
469            @Override
470            public String getOSGiServiceIdentifier() {
471                    return AssetCategoryPropertyLocalService.class.getName();
472            }
473    
474            protected Class<?> getModelClass() {
475                    return AssetCategoryProperty.class;
476            }
477    
478            protected String getModelClassName() {
479                    return AssetCategoryProperty.class.getName();
480            }
481    
482            /**
483             * Performs a SQL query.
484             *
485             * @param sql the sql query
486             */
487            protected void runSQL(String sql) {
488                    try {
489                            DataSource dataSource = assetCategoryPropertyPersistence.getDataSource();
490    
491                            DB db = DBManagerUtil.getDB();
492    
493                            sql = db.buildSQL(sql);
494                            sql = PortalUtil.transformSQL(sql);
495    
496                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
497                                            sql, new int[0]);
498    
499                            sqlUpdate.update();
500                    }
501                    catch (Exception e) {
502                            throw new SystemException(e);
503                    }
504            }
505    
506            @BeanReference(type = com.liferay.portlet.asset.service.AssetCategoryPropertyLocalService.class)
507            protected AssetCategoryPropertyLocalService assetCategoryPropertyLocalService;
508            @BeanReference(type = AssetCategoryPropertyPersistence.class)
509            protected AssetCategoryPropertyPersistence assetCategoryPropertyPersistence;
510            @BeanReference(type = AssetCategoryPropertyFinder.class)
511            protected AssetCategoryPropertyFinder assetCategoryPropertyFinder;
512            @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
513            protected com.liferay.counter.service.CounterLocalService counterLocalService;
514            @BeanReference(type = com.liferay.portal.service.UserLocalService.class)
515            protected com.liferay.portal.service.UserLocalService userLocalService;
516            @BeanReference(type = UserPersistence.class)
517            protected UserPersistence userPersistence;
518            @BeanReference(type = UserFinder.class)
519            protected UserFinder userFinder;
520            @BeanReference(type = PersistedModelLocalServiceRegistry.class)
521            protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
522    }