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.AssetCategoryProperty;
043    import com.liferay.portlet.asset.service.AssetCategoryPropertyLocalService;
044    import com.liferay.portlet.asset.service.persistence.AssetCategoryPropertyFinder;
045    import com.liferay.portlet.asset.service.persistence.AssetCategoryPropertyPersistence;
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 category property 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.AssetCategoryPropertyLocalServiceImpl}.
058     * </p>
059     *
060     * @author Brian Wing Shun Chan
061     * @see com.liferay.portlet.asset.service.impl.AssetCategoryPropertyLocalServiceImpl
062     * @see com.liferay.portlet.asset.service.AssetCategoryPropertyLocalServiceUtil
063     * @generated
064     */
065    @ProviderType
066    public abstract class AssetCategoryPropertyLocalServiceBaseImpl
067            extends BaseLocalServiceImpl implements AssetCategoryPropertyLocalService,
068                    IdentifiableBean {
069            /*
070             * NOTE FOR DEVELOPERS:
071             *
072             * Never modify or reference this class directly. Always use {@link com.liferay.portlet.asset.service.AssetCategoryPropertyLocalServiceUtil} to access the asset category property local service.
073             */
074    
075            /**
076             * Adds the asset category property to the database. Also notifies the appropriate model listeners.
077             *
078             * @param assetCategoryProperty the asset category property
079             * @return the asset category property that was added
080             */
081            @Indexable(type = IndexableType.REINDEX)
082            @Override
083            public AssetCategoryProperty addAssetCategoryProperty(
084                    AssetCategoryProperty assetCategoryProperty) {
085                    assetCategoryProperty.setNew(true);
086    
087                    return assetCategoryPropertyPersistence.update(assetCategoryProperty);
088            }
089    
090            /**
091             * Creates a new asset category property with the primary key. Does not add the asset category property to the database.
092             *
093             * @param categoryPropertyId the primary key for the new asset category property
094             * @return the new asset category property
095             */
096            @Override
097            public AssetCategoryProperty createAssetCategoryProperty(
098                    long categoryPropertyId) {
099                    return assetCategoryPropertyPersistence.create(categoryPropertyId);
100            }
101    
102            /**
103             * Deletes the asset category property with the primary key from the database. Also notifies the appropriate model listeners.
104             *
105             * @param categoryPropertyId the primary key of the asset category property
106             * @return the asset category property that was removed
107             * @throws PortalException if a asset category property with the primary key could not be found
108             */
109            @Indexable(type = IndexableType.DELETE)
110            @Override
111            public AssetCategoryProperty deleteAssetCategoryProperty(
112                    long categoryPropertyId) throws PortalException {
113                    return assetCategoryPropertyPersistence.remove(categoryPropertyId);
114            }
115    
116            /**
117             * Deletes the asset category property from the database. Also notifies the appropriate model listeners.
118             *
119             * @param assetCategoryProperty the asset category property
120             * @return the asset category property that was removed
121             */
122            @Indexable(type = IndexableType.DELETE)
123            @Override
124            public AssetCategoryProperty deleteAssetCategoryProperty(
125                    AssetCategoryProperty assetCategoryProperty) {
126                    return assetCategoryPropertyPersistence.remove(assetCategoryProperty);
127            }
128    
129            @Override
130            public DynamicQuery dynamicQuery() {
131                    Class<?> clazz = getClass();
132    
133                    return DynamicQueryFactoryUtil.forClass(AssetCategoryProperty.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 assetCategoryPropertyPersistence.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.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.
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 assetCategoryPropertyPersistence.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.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.
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 assetCategoryPropertyPersistence.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 assetCategoryPropertyPersistence.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 assetCategoryPropertyPersistence.countWithDynamicQuery(dynamicQuery,
209                            projection);
210            }
211    
212            @Override
213            public AssetCategoryProperty fetchAssetCategoryProperty(
214                    long categoryPropertyId) {
215                    return assetCategoryPropertyPersistence.fetchByPrimaryKey(categoryPropertyId);
216            }
217    
218            /**
219             * Returns the asset category property with the primary key.
220             *
221             * @param categoryPropertyId the primary key of the asset category property
222             * @return the asset category property
223             * @throws PortalException if a asset category property with the primary key could not be found
224             */
225            @Override
226            public AssetCategoryProperty getAssetCategoryProperty(
227                    long categoryPropertyId) throws PortalException {
228                    return assetCategoryPropertyPersistence.findByPrimaryKey(categoryPropertyId);
229            }
230    
231            @Override
232            public ActionableDynamicQuery getActionableDynamicQuery() {
233                    ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
234    
235                    actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.asset.service.AssetCategoryPropertyLocalServiceUtil.getService());
236                    actionableDynamicQuery.setClass(AssetCategoryProperty.class);
237                    actionableDynamicQuery.setClassLoader(getClassLoader());
238    
239                    actionableDynamicQuery.setPrimaryKeyPropertyName("categoryPropertyId");
240    
241                    return actionableDynamicQuery;
242            }
243    
244            protected void initActionableDynamicQuery(
245                    ActionableDynamicQuery actionableDynamicQuery) {
246                    actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.asset.service.AssetCategoryPropertyLocalServiceUtil.getService());
247                    actionableDynamicQuery.setClass(AssetCategoryProperty.class);
248                    actionableDynamicQuery.setClassLoader(getClassLoader());
249    
250                    actionableDynamicQuery.setPrimaryKeyPropertyName("categoryPropertyId");
251            }
252    
253            /**
254             * @throws PortalException
255             */
256            @Override
257            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
258                    throws PortalException {
259                    return assetCategoryPropertyLocalService.deleteAssetCategoryProperty((AssetCategoryProperty)persistedModel);
260            }
261    
262            @Override
263            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
264                    throws PortalException {
265                    return assetCategoryPropertyPersistence.findByPrimaryKey(primaryKeyObj);
266            }
267    
268            /**
269             * Returns a range of all the asset category properties.
270             *
271             * <p>
272             * 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.
273             * </p>
274             *
275             * @param start the lower bound of the range of asset category properties
276             * @param end the upper bound of the range of asset category properties (not inclusive)
277             * @return the range of asset category properties
278             */
279            @Override
280            public List<AssetCategoryProperty> getAssetCategoryProperties(int start,
281                    int end) {
282                    return assetCategoryPropertyPersistence.findAll(start, end);
283            }
284    
285            /**
286             * Returns the number of asset category properties.
287             *
288             * @return the number of asset category properties
289             */
290            @Override
291            public int getAssetCategoryPropertiesCount() {
292                    return assetCategoryPropertyPersistence.countAll();
293            }
294    
295            /**
296             * Updates the asset category property in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
297             *
298             * @param assetCategoryProperty the asset category property
299             * @return the asset category property that was updated
300             */
301            @Indexable(type = IndexableType.REINDEX)
302            @Override
303            public AssetCategoryProperty updateAssetCategoryProperty(
304                    AssetCategoryProperty assetCategoryProperty) {
305                    return assetCategoryPropertyPersistence.update(assetCategoryProperty);
306            }
307    
308            /**
309             * Returns the asset category property local service.
310             *
311             * @return the asset category property local service
312             */
313            public com.liferay.portlet.asset.service.AssetCategoryPropertyLocalService getAssetCategoryPropertyLocalService() {
314                    return assetCategoryPropertyLocalService;
315            }
316    
317            /**
318             * Sets the asset category property local service.
319             *
320             * @param assetCategoryPropertyLocalService the asset category property local service
321             */
322            public void setAssetCategoryPropertyLocalService(
323                    com.liferay.portlet.asset.service.AssetCategoryPropertyLocalService assetCategoryPropertyLocalService) {
324                    this.assetCategoryPropertyLocalService = assetCategoryPropertyLocalService;
325            }
326    
327            /**
328             * Returns the asset category property remote service.
329             *
330             * @return the asset category property remote service
331             */
332            public com.liferay.portlet.asset.service.AssetCategoryPropertyService getAssetCategoryPropertyService() {
333                    return assetCategoryPropertyService;
334            }
335    
336            /**
337             * Sets the asset category property remote service.
338             *
339             * @param assetCategoryPropertyService the asset category property remote service
340             */
341            public void setAssetCategoryPropertyService(
342                    com.liferay.portlet.asset.service.AssetCategoryPropertyService assetCategoryPropertyService) {
343                    this.assetCategoryPropertyService = assetCategoryPropertyService;
344            }
345    
346            /**
347             * Returns the asset category property persistence.
348             *
349             * @return the asset category property persistence
350             */
351            public AssetCategoryPropertyPersistence getAssetCategoryPropertyPersistence() {
352                    return assetCategoryPropertyPersistence;
353            }
354    
355            /**
356             * Sets the asset category property persistence.
357             *
358             * @param assetCategoryPropertyPersistence the asset category property persistence
359             */
360            public void setAssetCategoryPropertyPersistence(
361                    AssetCategoryPropertyPersistence assetCategoryPropertyPersistence) {
362                    this.assetCategoryPropertyPersistence = assetCategoryPropertyPersistence;
363            }
364    
365            /**
366             * Returns the asset category property finder.
367             *
368             * @return the asset category property finder
369             */
370            public AssetCategoryPropertyFinder getAssetCategoryPropertyFinder() {
371                    return assetCategoryPropertyFinder;
372            }
373    
374            /**
375             * Sets the asset category property finder.
376             *
377             * @param assetCategoryPropertyFinder the asset category property finder
378             */
379            public void setAssetCategoryPropertyFinder(
380                    AssetCategoryPropertyFinder assetCategoryPropertyFinder) {
381                    this.assetCategoryPropertyFinder = assetCategoryPropertyFinder;
382            }
383    
384            /**
385             * Returns the counter local service.
386             *
387             * @return the counter local service
388             */
389            public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
390                    return counterLocalService;
391            }
392    
393            /**
394             * Sets the counter local service.
395             *
396             * @param counterLocalService the counter local service
397             */
398            public void setCounterLocalService(
399                    com.liferay.counter.service.CounterLocalService counterLocalService) {
400                    this.counterLocalService = counterLocalService;
401            }
402    
403            /**
404             * Returns the user local service.
405             *
406             * @return the user local service
407             */
408            public com.liferay.portal.service.UserLocalService getUserLocalService() {
409                    return userLocalService;
410            }
411    
412            /**
413             * Sets the user local service.
414             *
415             * @param userLocalService the user local service
416             */
417            public void setUserLocalService(
418                    com.liferay.portal.service.UserLocalService userLocalService) {
419                    this.userLocalService = userLocalService;
420            }
421    
422            /**
423             * Returns the user remote service.
424             *
425             * @return the user remote service
426             */
427            public com.liferay.portal.service.UserService getUserService() {
428                    return userService;
429            }
430    
431            /**
432             * Sets the user remote service.
433             *
434             * @param userService the user remote service
435             */
436            public void setUserService(
437                    com.liferay.portal.service.UserService userService) {
438                    this.userService = userService;
439            }
440    
441            /**
442             * Returns the user persistence.
443             *
444             * @return the user persistence
445             */
446            public UserPersistence getUserPersistence() {
447                    return userPersistence;
448            }
449    
450            /**
451             * Sets the user persistence.
452             *
453             * @param userPersistence the user persistence
454             */
455            public void setUserPersistence(UserPersistence userPersistence) {
456                    this.userPersistence = userPersistence;
457            }
458    
459            /**
460             * Returns the user finder.
461             *
462             * @return the user finder
463             */
464            public UserFinder getUserFinder() {
465                    return userFinder;
466            }
467    
468            /**
469             * Sets the user finder.
470             *
471             * @param userFinder the user finder
472             */
473            public void setUserFinder(UserFinder userFinder) {
474                    this.userFinder = userFinder;
475            }
476    
477            public void afterPropertiesSet() {
478                    persistedModelLocalServiceRegistry.register("com.liferay.portlet.asset.model.AssetCategoryProperty",
479                            assetCategoryPropertyLocalService);
480            }
481    
482            public void destroy() {
483                    persistedModelLocalServiceRegistry.unregister(
484                            "com.liferay.portlet.asset.model.AssetCategoryProperty");
485            }
486    
487            /**
488             * Returns the Spring bean ID for this bean.
489             *
490             * @return the Spring bean ID for this bean
491             */
492            @Override
493            public String getBeanIdentifier() {
494                    return _beanIdentifier;
495            }
496    
497            /**
498             * Sets the Spring bean ID for this bean.
499             *
500             * @param beanIdentifier the Spring bean ID for this bean
501             */
502            @Override
503            public void setBeanIdentifier(String beanIdentifier) {
504                    _beanIdentifier = beanIdentifier;
505            }
506    
507            protected Class<?> getModelClass() {
508                    return AssetCategoryProperty.class;
509            }
510    
511            protected String getModelClassName() {
512                    return AssetCategoryProperty.class.getName();
513            }
514    
515            /**
516             * Performs a SQL query.
517             *
518             * @param sql the sql query
519             */
520            protected void runSQL(String sql) {
521                    try {
522                            DataSource dataSource = assetCategoryPropertyPersistence.getDataSource();
523    
524                            DB db = DBFactoryUtil.getDB();
525    
526                            sql = db.buildSQL(sql);
527                            sql = PortalUtil.transformSQL(sql);
528    
529                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
530                                            sql, new int[0]);
531    
532                            sqlUpdate.update();
533                    }
534                    catch (Exception e) {
535                            throw new SystemException(e);
536                    }
537            }
538    
539            @BeanReference(type = com.liferay.portlet.asset.service.AssetCategoryPropertyLocalService.class)
540            protected com.liferay.portlet.asset.service.AssetCategoryPropertyLocalService assetCategoryPropertyLocalService;
541            @BeanReference(type = com.liferay.portlet.asset.service.AssetCategoryPropertyService.class)
542            protected com.liferay.portlet.asset.service.AssetCategoryPropertyService assetCategoryPropertyService;
543            @BeanReference(type = AssetCategoryPropertyPersistence.class)
544            protected AssetCategoryPropertyPersistence assetCategoryPropertyPersistence;
545            @BeanReference(type = AssetCategoryPropertyFinder.class)
546            protected AssetCategoryPropertyFinder assetCategoryPropertyFinder;
547            @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
548            protected com.liferay.counter.service.CounterLocalService counterLocalService;
549            @BeanReference(type = com.liferay.portal.service.UserLocalService.class)
550            protected com.liferay.portal.service.UserLocalService userLocalService;
551            @BeanReference(type = com.liferay.portal.service.UserService.class)
552            protected com.liferay.portal.service.UserService userService;
553            @BeanReference(type = UserPersistence.class)
554            protected UserPersistence userPersistence;
555            @BeanReference(type = UserFinder.class)
556            protected UserFinder userFinder;
557            @BeanReference(type = PersistedModelLocalServiceRegistry.class)
558            protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
559            private String _beanIdentifier;
560    }