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