001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.service.base;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.bean.BeanReference;
020    import com.liferay.portal.kernel.dao.db.DB;
021    import com.liferay.portal.kernel.dao.db.DBFactoryUtil;
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.Projection;
029    import com.liferay.portal.kernel.exception.PortalException;
030    import com.liferay.portal.kernel.exception.SystemException;
031    import com.liferay.portal.kernel.module.framework.service.IdentifiableOSGiService;
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.PasswordPolicyRel;
036    import com.liferay.portal.model.PersistedModel;
037    import com.liferay.portal.service.BaseLocalServiceImpl;
038    import com.liferay.portal.service.PasswordPolicyRelLocalService;
039    import com.liferay.portal.service.PersistedModelLocalServiceRegistry;
040    import com.liferay.portal.service.persistence.ClassNamePersistence;
041    import com.liferay.portal.service.persistence.PasswordPolicyRelPersistence;
042    import com.liferay.portal.util.PortalUtil;
043    
044    import java.io.Serializable;
045    
046    import java.util.List;
047    
048    import javax.sql.DataSource;
049    
050    /**
051     * Provides the base implementation for the password policy rel local service.
052     *
053     * <p>
054     * This implementation exists only as a container for the default service methods generated by ServiceBuilder. All custom service methods should be put in {@link com.liferay.portal.service.impl.PasswordPolicyRelLocalServiceImpl}.
055     * </p>
056     *
057     * @author Brian Wing Shun Chan
058     * @see com.liferay.portal.service.impl.PasswordPolicyRelLocalServiceImpl
059     * @see com.liferay.portal.service.PasswordPolicyRelLocalServiceUtil
060     * @generated
061     */
062    @ProviderType
063    public abstract class PasswordPolicyRelLocalServiceBaseImpl
064            extends BaseLocalServiceImpl implements PasswordPolicyRelLocalService,
065                    IdentifiableOSGiService {
066            /*
067             * NOTE FOR DEVELOPERS:
068             *
069             * Never modify or reference this class directly. Always use {@link com.liferay.portal.service.PasswordPolicyRelLocalServiceUtil} to access the password policy rel local service.
070             */
071    
072            /**
073             * Adds the password policy rel to the database. Also notifies the appropriate model listeners.
074             *
075             * @param passwordPolicyRel the password policy rel
076             * @return the password policy rel that was added
077             */
078            @Indexable(type = IndexableType.REINDEX)
079            @Override
080            public PasswordPolicyRel addPasswordPolicyRel(
081                    PasswordPolicyRel passwordPolicyRel) {
082                    passwordPolicyRel.setNew(true);
083    
084                    return passwordPolicyRelPersistence.update(passwordPolicyRel);
085            }
086    
087            /**
088             * Creates a new password policy rel with the primary key. Does not add the password policy rel to the database.
089             *
090             * @param passwordPolicyRelId the primary key for the new password policy rel
091             * @return the new password policy rel
092             */
093            @Override
094            public PasswordPolicyRel createPasswordPolicyRel(long passwordPolicyRelId) {
095                    return passwordPolicyRelPersistence.create(passwordPolicyRelId);
096            }
097    
098            /**
099             * Deletes the password policy rel with the primary key from the database. Also notifies the appropriate model listeners.
100             *
101             * @param passwordPolicyRelId the primary key of the password policy rel
102             * @return the password policy rel that was removed
103             * @throws PortalException if a password policy rel with the primary key could not be found
104             */
105            @Indexable(type = IndexableType.DELETE)
106            @Override
107            public PasswordPolicyRel deletePasswordPolicyRel(long passwordPolicyRelId)
108                    throws PortalException {
109                    return passwordPolicyRelPersistence.remove(passwordPolicyRelId);
110            }
111    
112            /**
113             * Deletes the password policy rel from the database. Also notifies the appropriate model listeners.
114             *
115             * @param passwordPolicyRel the password policy rel
116             * @return the password policy rel that was removed
117             */
118            @Indexable(type = IndexableType.DELETE)
119            @Override
120            public PasswordPolicyRel deletePasswordPolicyRel(
121                    PasswordPolicyRel passwordPolicyRel) {
122                    return passwordPolicyRelPersistence.remove(passwordPolicyRel);
123            }
124    
125            @Override
126            public DynamicQuery dynamicQuery() {
127                    Class<?> clazz = getClass();
128    
129                    return DynamicQueryFactoryUtil.forClass(PasswordPolicyRel.class,
130                            clazz.getClassLoader());
131            }
132    
133            /**
134             * Performs a dynamic query on the database and returns the matching rows.
135             *
136             * @param dynamicQuery the dynamic query
137             * @return the matching rows
138             */
139            @Override
140            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery) {
141                    return passwordPolicyRelPersistence.findWithDynamicQuery(dynamicQuery);
142            }
143    
144            /**
145             * Performs a dynamic query on the database and returns a range of the matching rows.
146             *
147             * <p>
148             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.PasswordPolicyRelModelImpl}. 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.
149             * </p>
150             *
151             * @param dynamicQuery the dynamic query
152             * @param start the lower bound of the range of model instances
153             * @param end the upper bound of the range of model instances (not inclusive)
154             * @return the range of matching rows
155             */
156            @Override
157            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
158                    int end) {
159                    return passwordPolicyRelPersistence.findWithDynamicQuery(dynamicQuery,
160                            start, end);
161            }
162    
163            /**
164             * Performs a dynamic query on the database and returns an ordered range of the matching rows.
165             *
166             * <p>
167             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.PasswordPolicyRelModelImpl}. 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.
168             * </p>
169             *
170             * @param dynamicQuery the dynamic query
171             * @param start the lower bound of the range of model instances
172             * @param end the upper bound of the range of model instances (not inclusive)
173             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
174             * @return the ordered range of matching rows
175             */
176            @Override
177            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
178                    int end, OrderByComparator<T> orderByComparator) {
179                    return passwordPolicyRelPersistence.findWithDynamicQuery(dynamicQuery,
180                            start, end, orderByComparator);
181            }
182    
183            /**
184             * Returns the number of rows matching the dynamic query.
185             *
186             * @param dynamicQuery the dynamic query
187             * @return the number of rows matching the dynamic query
188             */
189            @Override
190            public long dynamicQueryCount(DynamicQuery dynamicQuery) {
191                    return passwordPolicyRelPersistence.countWithDynamicQuery(dynamicQuery);
192            }
193    
194            /**
195             * Returns the number of rows matching the dynamic query.
196             *
197             * @param dynamicQuery the dynamic query
198             * @param projection the projection to apply to the query
199             * @return the number of rows matching the dynamic query
200             */
201            @Override
202            public long dynamicQueryCount(DynamicQuery dynamicQuery,
203                    Projection projection) {
204                    return passwordPolicyRelPersistence.countWithDynamicQuery(dynamicQuery,
205                            projection);
206            }
207    
208            @Override
209            public PasswordPolicyRel fetchPasswordPolicyRel(long passwordPolicyRelId) {
210                    return passwordPolicyRelPersistence.fetchByPrimaryKey(passwordPolicyRelId);
211            }
212    
213            /**
214             * Returns the password policy rel with the primary key.
215             *
216             * @param passwordPolicyRelId the primary key of the password policy rel
217             * @return the password policy rel
218             * @throws PortalException if a password policy rel with the primary key could not be found
219             */
220            @Override
221            public PasswordPolicyRel getPasswordPolicyRel(long passwordPolicyRelId)
222                    throws PortalException {
223                    return passwordPolicyRelPersistence.findByPrimaryKey(passwordPolicyRelId);
224            }
225    
226            @Override
227            public ActionableDynamicQuery getActionableDynamicQuery() {
228                    ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
229    
230                    actionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.PasswordPolicyRelLocalServiceUtil.getService());
231                    actionableDynamicQuery.setClass(PasswordPolicyRel.class);
232                    actionableDynamicQuery.setClassLoader(getClassLoader());
233    
234                    actionableDynamicQuery.setPrimaryKeyPropertyName("passwordPolicyRelId");
235    
236                    return actionableDynamicQuery;
237            }
238    
239            protected void initActionableDynamicQuery(
240                    ActionableDynamicQuery actionableDynamicQuery) {
241                    actionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.PasswordPolicyRelLocalServiceUtil.getService());
242                    actionableDynamicQuery.setClass(PasswordPolicyRel.class);
243                    actionableDynamicQuery.setClassLoader(getClassLoader());
244    
245                    actionableDynamicQuery.setPrimaryKeyPropertyName("passwordPolicyRelId");
246            }
247    
248            /**
249             * @throws PortalException
250             */
251            @Override
252            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
253                    throws PortalException {
254                    return passwordPolicyRelLocalService.deletePasswordPolicyRel((PasswordPolicyRel)persistedModel);
255            }
256    
257            @Override
258            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
259                    throws PortalException {
260                    return passwordPolicyRelPersistence.findByPrimaryKey(primaryKeyObj);
261            }
262    
263            /**
264             * Returns a range of all the password policy rels.
265             *
266             * <p>
267             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.PasswordPolicyRelModelImpl}. 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.
268             * </p>
269             *
270             * @param start the lower bound of the range of password policy rels
271             * @param end the upper bound of the range of password policy rels (not inclusive)
272             * @return the range of password policy rels
273             */
274            @Override
275            public List<PasswordPolicyRel> getPasswordPolicyRels(int start, int end) {
276                    return passwordPolicyRelPersistence.findAll(start, end);
277            }
278    
279            /**
280             * Returns the number of password policy rels.
281             *
282             * @return the number of password policy rels
283             */
284            @Override
285            public int getPasswordPolicyRelsCount() {
286                    return passwordPolicyRelPersistence.countAll();
287            }
288    
289            /**
290             * Updates the password policy rel in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
291             *
292             * @param passwordPolicyRel the password policy rel
293             * @return the password policy rel that was updated
294             */
295            @Indexable(type = IndexableType.REINDEX)
296            @Override
297            public PasswordPolicyRel updatePasswordPolicyRel(
298                    PasswordPolicyRel passwordPolicyRel) {
299                    return passwordPolicyRelPersistence.update(passwordPolicyRel);
300            }
301    
302            /**
303             * Returns the password policy rel local service.
304             *
305             * @return the password policy rel local service
306             */
307            public PasswordPolicyRelLocalService getPasswordPolicyRelLocalService() {
308                    return passwordPolicyRelLocalService;
309            }
310    
311            /**
312             * Sets the password policy rel local service.
313             *
314             * @param passwordPolicyRelLocalService the password policy rel local service
315             */
316            public void setPasswordPolicyRelLocalService(
317                    PasswordPolicyRelLocalService passwordPolicyRelLocalService) {
318                    this.passwordPolicyRelLocalService = passwordPolicyRelLocalService;
319            }
320    
321            /**
322             * Returns the password policy rel persistence.
323             *
324             * @return the password policy rel persistence
325             */
326            public PasswordPolicyRelPersistence getPasswordPolicyRelPersistence() {
327                    return passwordPolicyRelPersistence;
328            }
329    
330            /**
331             * Sets the password policy rel persistence.
332             *
333             * @param passwordPolicyRelPersistence the password policy rel persistence
334             */
335            public void setPasswordPolicyRelPersistence(
336                    PasswordPolicyRelPersistence passwordPolicyRelPersistence) {
337                    this.passwordPolicyRelPersistence = passwordPolicyRelPersistence;
338            }
339    
340            /**
341             * Returns the counter local service.
342             *
343             * @return the counter local service
344             */
345            public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
346                    return counterLocalService;
347            }
348    
349            /**
350             * Sets the counter local service.
351             *
352             * @param counterLocalService the counter local service
353             */
354            public void setCounterLocalService(
355                    com.liferay.counter.service.CounterLocalService counterLocalService) {
356                    this.counterLocalService = counterLocalService;
357            }
358    
359            /**
360             * Returns the class name local service.
361             *
362             * @return the class name local service
363             */
364            public com.liferay.portal.service.ClassNameLocalService getClassNameLocalService() {
365                    return classNameLocalService;
366            }
367    
368            /**
369             * Sets the class name local service.
370             *
371             * @param classNameLocalService the class name local service
372             */
373            public void setClassNameLocalService(
374                    com.liferay.portal.service.ClassNameLocalService classNameLocalService) {
375                    this.classNameLocalService = classNameLocalService;
376            }
377    
378            /**
379             * Returns the class name remote service.
380             *
381             * @return the class name remote service
382             */
383            public com.liferay.portal.service.ClassNameService getClassNameService() {
384                    return classNameService;
385            }
386    
387            /**
388             * Sets the class name remote service.
389             *
390             * @param classNameService the class name remote service
391             */
392            public void setClassNameService(
393                    com.liferay.portal.service.ClassNameService classNameService) {
394                    this.classNameService = classNameService;
395            }
396    
397            /**
398             * Returns the class name persistence.
399             *
400             * @return the class name persistence
401             */
402            public ClassNamePersistence getClassNamePersistence() {
403                    return classNamePersistence;
404            }
405    
406            /**
407             * Sets the class name persistence.
408             *
409             * @param classNamePersistence the class name persistence
410             */
411            public void setClassNamePersistence(
412                    ClassNamePersistence classNamePersistence) {
413                    this.classNamePersistence = classNamePersistence;
414            }
415    
416            public void afterPropertiesSet() {
417                    persistedModelLocalServiceRegistry.register("com.liferay.portal.model.PasswordPolicyRel",
418                            passwordPolicyRelLocalService);
419            }
420    
421            public void destroy() {
422                    persistedModelLocalServiceRegistry.unregister(
423                            "com.liferay.portal.model.PasswordPolicyRel");
424            }
425    
426            /**
427             * Returns the OSGi service identifier.
428             *
429             * @return the OSGi service identifier
430             */
431            @Override
432            public String getOSGiServiceIdentifier() {
433                    return PasswordPolicyRelLocalService.class.getName();
434            }
435    
436            protected Class<?> getModelClass() {
437                    return PasswordPolicyRel.class;
438            }
439    
440            protected String getModelClassName() {
441                    return PasswordPolicyRel.class.getName();
442            }
443    
444            /**
445             * Performs a SQL query.
446             *
447             * @param sql the sql query
448             */
449            protected void runSQL(String sql) {
450                    try {
451                            DataSource dataSource = passwordPolicyRelPersistence.getDataSource();
452    
453                            DB db = DBFactoryUtil.getDB();
454    
455                            sql = db.buildSQL(sql);
456                            sql = PortalUtil.transformSQL(sql);
457    
458                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
459                                            sql, new int[0]);
460    
461                            sqlUpdate.update();
462                    }
463                    catch (Exception e) {
464                            throw new SystemException(e);
465                    }
466            }
467    
468            @BeanReference(type = com.liferay.portal.service.PasswordPolicyRelLocalService.class)
469            protected PasswordPolicyRelLocalService passwordPolicyRelLocalService;
470            @BeanReference(type = PasswordPolicyRelPersistence.class)
471            protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
472            @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
473            protected com.liferay.counter.service.CounterLocalService counterLocalService;
474            @BeanReference(type = com.liferay.portal.service.ClassNameLocalService.class)
475            protected com.liferay.portal.service.ClassNameLocalService classNameLocalService;
476            @BeanReference(type = com.liferay.portal.service.ClassNameService.class)
477            protected com.liferay.portal.service.ClassNameService classNameService;
478            @BeanReference(type = ClassNamePersistence.class)
479            protected ClassNamePersistence classNamePersistence;
480            @BeanReference(type = PersistedModelLocalServiceRegistry.class)
481            protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
482    }