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.exportimport.kernel.lar.ExportImportHelperUtil;
020    import com.liferay.exportimport.kernel.lar.ManifestSummary;
021    import com.liferay.exportimport.kernel.lar.PortletDataContext;
022    import com.liferay.exportimport.kernel.lar.StagedModelDataHandlerUtil;
023    import com.liferay.exportimport.kernel.lar.StagedModelType;
024    
025    import com.liferay.portal.kernel.bean.BeanReference;
026    import com.liferay.portal.kernel.dao.db.DB;
027    import com.liferay.portal.kernel.dao.db.DBManagerUtil;
028    import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
029    import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
030    import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery;
031    import com.liferay.portal.kernel.dao.orm.DefaultActionableDynamicQuery;
032    import com.liferay.portal.kernel.dao.orm.DynamicQuery;
033    import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil;
034    import com.liferay.portal.kernel.dao.orm.ExportActionableDynamicQuery;
035    import com.liferay.portal.kernel.dao.orm.IndexableActionableDynamicQuery;
036    import com.liferay.portal.kernel.dao.orm.Projection;
037    import com.liferay.portal.kernel.exception.PortalException;
038    import com.liferay.portal.kernel.exception.SystemException;
039    import com.liferay.portal.kernel.model.PasswordPolicy;
040    import com.liferay.portal.kernel.model.PersistedModel;
041    import com.liferay.portal.kernel.module.framework.service.IdentifiableOSGiService;
042    import com.liferay.portal.kernel.search.Indexable;
043    import com.liferay.portal.kernel.search.IndexableType;
044    import com.liferay.portal.kernel.service.BaseLocalServiceImpl;
045    import com.liferay.portal.kernel.service.PasswordPolicyLocalService;
046    import com.liferay.portal.kernel.service.PersistedModelLocalServiceRegistry;
047    import com.liferay.portal.kernel.service.persistence.ClassNamePersistence;
048    import com.liferay.portal.kernel.service.persistence.PasswordPolicyFinder;
049    import com.liferay.portal.kernel.service.persistence.PasswordPolicyPersistence;
050    import com.liferay.portal.kernel.service.persistence.PasswordPolicyRelPersistence;
051    import com.liferay.portal.kernel.service.persistence.UserFinder;
052    import com.liferay.portal.kernel.service.persistence.UserPersistence;
053    import com.liferay.portal.kernel.util.OrderByComparator;
054    import com.liferay.portal.kernel.util.PortalUtil;
055    
056    import java.io.Serializable;
057    
058    import java.util.List;
059    
060    import javax.sql.DataSource;
061    
062    /**
063     * Provides the base implementation for the password policy local service.
064     *
065     * <p>
066     * 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.PasswordPolicyLocalServiceImpl}.
067     * </p>
068     *
069     * @author Brian Wing Shun Chan
070     * @see com.liferay.portal.service.impl.PasswordPolicyLocalServiceImpl
071     * @see com.liferay.portal.kernel.service.PasswordPolicyLocalServiceUtil
072     * @generated
073     */
074    @ProviderType
075    public abstract class PasswordPolicyLocalServiceBaseImpl
076            extends BaseLocalServiceImpl implements PasswordPolicyLocalService,
077                    IdentifiableOSGiService {
078            /*
079             * NOTE FOR DEVELOPERS:
080             *
081             * Never modify or reference this class directly. Always use {@link com.liferay.portal.kernel.service.PasswordPolicyLocalServiceUtil} to access the password policy local service.
082             */
083    
084            /**
085             * Adds the password policy to the database. Also notifies the appropriate model listeners.
086             *
087             * @param passwordPolicy the password policy
088             * @return the password policy that was added
089             */
090            @Indexable(type = IndexableType.REINDEX)
091            @Override
092            public PasswordPolicy addPasswordPolicy(PasswordPolicy passwordPolicy) {
093                    passwordPolicy.setNew(true);
094    
095                    return passwordPolicyPersistence.update(passwordPolicy);
096            }
097    
098            /**
099             * Creates a new password policy with the primary key. Does not add the password policy to the database.
100             *
101             * @param passwordPolicyId the primary key for the new password policy
102             * @return the new password policy
103             */
104            @Override
105            public PasswordPolicy createPasswordPolicy(long passwordPolicyId) {
106                    return passwordPolicyPersistence.create(passwordPolicyId);
107            }
108    
109            /**
110             * Deletes the password policy with the primary key from the database. Also notifies the appropriate model listeners.
111             *
112             * @param passwordPolicyId the primary key of the password policy
113             * @return the password policy that was removed
114             * @throws PortalException if a password policy with the primary key could not be found
115             */
116            @Indexable(type = IndexableType.DELETE)
117            @Override
118            public PasswordPolicy deletePasswordPolicy(long passwordPolicyId)
119                    throws PortalException {
120                    return passwordPolicyPersistence.remove(passwordPolicyId);
121            }
122    
123            /**
124             * Deletes the password policy from the database. Also notifies the appropriate model listeners.
125             *
126             * @param passwordPolicy the password policy
127             * @return the password policy that was removed
128             * @throws PortalException
129             */
130            @Indexable(type = IndexableType.DELETE)
131            @Override
132            public PasswordPolicy deletePasswordPolicy(PasswordPolicy passwordPolicy)
133                    throws PortalException {
134                    return passwordPolicyPersistence.remove(passwordPolicy);
135            }
136    
137            @Override
138            public DynamicQuery dynamicQuery() {
139                    Class<?> clazz = getClass();
140    
141                    return DynamicQueryFactoryUtil.forClass(PasswordPolicy.class,
142                            clazz.getClassLoader());
143            }
144    
145            /**
146             * Performs a dynamic query on the database and returns the matching rows.
147             *
148             * @param dynamicQuery the dynamic query
149             * @return the matching rows
150             */
151            @Override
152            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery) {
153                    return passwordPolicyPersistence.findWithDynamicQuery(dynamicQuery);
154            }
155    
156            /**
157             * Performs a dynamic query on the database and returns a range of the matching rows.
158             *
159             * <p>
160             * 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.PasswordPolicyModelImpl}. 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.
161             * </p>
162             *
163             * @param dynamicQuery the dynamic query
164             * @param start the lower bound of the range of model instances
165             * @param end the upper bound of the range of model instances (not inclusive)
166             * @return the range of matching rows
167             */
168            @Override
169            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
170                    int end) {
171                    return passwordPolicyPersistence.findWithDynamicQuery(dynamicQuery,
172                            start, end);
173            }
174    
175            /**
176             * Performs a dynamic query on the database and returns an ordered range of the matching rows.
177             *
178             * <p>
179             * 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.PasswordPolicyModelImpl}. 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.
180             * </p>
181             *
182             * @param dynamicQuery the dynamic query
183             * @param start the lower bound of the range of model instances
184             * @param end the upper bound of the range of model instances (not inclusive)
185             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
186             * @return the ordered range of matching rows
187             */
188            @Override
189            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
190                    int end, OrderByComparator<T> orderByComparator) {
191                    return passwordPolicyPersistence.findWithDynamicQuery(dynamicQuery,
192                            start, end, orderByComparator);
193            }
194    
195            /**
196             * Returns the number of rows matching the dynamic query.
197             *
198             * @param dynamicQuery the dynamic query
199             * @return the number of rows matching the dynamic query
200             */
201            @Override
202            public long dynamicQueryCount(DynamicQuery dynamicQuery) {
203                    return passwordPolicyPersistence.countWithDynamicQuery(dynamicQuery);
204            }
205    
206            /**
207             * Returns the number of rows matching the dynamic query.
208             *
209             * @param dynamicQuery the dynamic query
210             * @param projection the projection to apply to the query
211             * @return the number of rows matching the dynamic query
212             */
213            @Override
214            public long dynamicQueryCount(DynamicQuery dynamicQuery,
215                    Projection projection) {
216                    return passwordPolicyPersistence.countWithDynamicQuery(dynamicQuery,
217                            projection);
218            }
219    
220            @Override
221            public PasswordPolicy fetchPasswordPolicy(long passwordPolicyId) {
222                    return passwordPolicyPersistence.fetchByPrimaryKey(passwordPolicyId);
223            }
224    
225            /**
226             * Returns the password policy with the matching UUID and company.
227             *
228             * @param uuid the password policy's UUID
229             * @param companyId the primary key of the company
230             * @return the matching password policy, or <code>null</code> if a matching password policy could not be found
231             */
232            @Override
233            public PasswordPolicy fetchPasswordPolicyByUuidAndCompanyId(String uuid,
234                    long companyId) {
235                    return passwordPolicyPersistence.fetchByUuid_C_First(uuid, companyId,
236                            null);
237            }
238    
239            /**
240             * Returns the password policy with the primary key.
241             *
242             * @param passwordPolicyId the primary key of the password policy
243             * @return the password policy
244             * @throws PortalException if a password policy with the primary key could not be found
245             */
246            @Override
247            public PasswordPolicy getPasswordPolicy(long passwordPolicyId)
248                    throws PortalException {
249                    return passwordPolicyPersistence.findByPrimaryKey(passwordPolicyId);
250            }
251    
252            @Override
253            public ActionableDynamicQuery getActionableDynamicQuery() {
254                    ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
255    
256                    actionableDynamicQuery.setBaseLocalService(passwordPolicyLocalService);
257                    actionableDynamicQuery.setClassLoader(getClassLoader());
258                    actionableDynamicQuery.setModelClass(PasswordPolicy.class);
259    
260                    actionableDynamicQuery.setPrimaryKeyPropertyName("passwordPolicyId");
261    
262                    return actionableDynamicQuery;
263            }
264    
265            @Override
266            public IndexableActionableDynamicQuery getIndexableActionableDynamicQuery() {
267                    IndexableActionableDynamicQuery indexableActionableDynamicQuery = new IndexableActionableDynamicQuery();
268    
269                    indexableActionableDynamicQuery.setBaseLocalService(passwordPolicyLocalService);
270                    indexableActionableDynamicQuery.setClassLoader(getClassLoader());
271                    indexableActionableDynamicQuery.setModelClass(PasswordPolicy.class);
272    
273                    indexableActionableDynamicQuery.setPrimaryKeyPropertyName(
274                            "passwordPolicyId");
275    
276                    return indexableActionableDynamicQuery;
277            }
278    
279            protected void initActionableDynamicQuery(
280                    ActionableDynamicQuery actionableDynamicQuery) {
281                    actionableDynamicQuery.setBaseLocalService(passwordPolicyLocalService);
282                    actionableDynamicQuery.setClassLoader(getClassLoader());
283                    actionableDynamicQuery.setModelClass(PasswordPolicy.class);
284    
285                    actionableDynamicQuery.setPrimaryKeyPropertyName("passwordPolicyId");
286            }
287    
288            @Override
289            public ExportActionableDynamicQuery getExportActionableDynamicQuery(
290                    final PortletDataContext portletDataContext) {
291                    final ExportActionableDynamicQuery exportActionableDynamicQuery = new ExportActionableDynamicQuery() {
292                                    @Override
293                                    public long performCount() throws PortalException {
294                                            ManifestSummary manifestSummary = portletDataContext.getManifestSummary();
295    
296                                            StagedModelType stagedModelType = getStagedModelType();
297    
298                                            long modelAdditionCount = super.performCount();
299    
300                                            manifestSummary.addModelAdditionCount(stagedModelType,
301                                                    modelAdditionCount);
302    
303                                            long modelDeletionCount = ExportImportHelperUtil.getModelDeletionCount(portletDataContext,
304                                                            stagedModelType);
305    
306                                            manifestSummary.addModelDeletionCount(stagedModelType,
307                                                    modelDeletionCount);
308    
309                                            return modelAdditionCount;
310                                    }
311                            };
312    
313                    initActionableDynamicQuery(exportActionableDynamicQuery);
314    
315                    exportActionableDynamicQuery.setAddCriteriaMethod(new ActionableDynamicQuery.AddCriteriaMethod() {
316                                    @Override
317                                    public void addCriteria(DynamicQuery dynamicQuery) {
318                                            portletDataContext.addDateRangeCriteria(dynamicQuery,
319                                                    "modifiedDate");
320                                    }
321                            });
322    
323                    exportActionableDynamicQuery.setCompanyId(portletDataContext.getCompanyId());
324    
325                    exportActionableDynamicQuery.setPerformActionMethod(new ActionableDynamicQuery.PerformActionMethod<PasswordPolicy>() {
326                                    @Override
327                                    public void performAction(PasswordPolicy passwordPolicy)
328                                            throws PortalException {
329                                            StagedModelDataHandlerUtil.exportStagedModel(portletDataContext,
330                                                    passwordPolicy);
331                                    }
332                            });
333                    exportActionableDynamicQuery.setStagedModelType(new StagedModelType(
334                                    PortalUtil.getClassNameId(PasswordPolicy.class.getName())));
335    
336                    return exportActionableDynamicQuery;
337            }
338    
339            /**
340             * @throws PortalException
341             */
342            @Override
343            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
344                    throws PortalException {
345                    return passwordPolicyLocalService.deletePasswordPolicy((PasswordPolicy)persistedModel);
346            }
347    
348            @Override
349            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
350                    throws PortalException {
351                    return passwordPolicyPersistence.findByPrimaryKey(primaryKeyObj);
352            }
353    
354            /**
355             * Returns the password policy with the matching UUID and company.
356             *
357             * @param uuid the password policy's UUID
358             * @param companyId the primary key of the company
359             * @return the matching password policy
360             * @throws PortalException if a matching password policy could not be found
361             */
362            @Override
363            public PasswordPolicy getPasswordPolicyByUuidAndCompanyId(String uuid,
364                    long companyId) throws PortalException {
365                    return passwordPolicyPersistence.findByUuid_C_First(uuid, companyId,
366                            null);
367            }
368    
369            /**
370             * Returns a range of all the password policies.
371             *
372             * <p>
373             * 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.PasswordPolicyModelImpl}. 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.
374             * </p>
375             *
376             * @param start the lower bound of the range of password policies
377             * @param end the upper bound of the range of password policies (not inclusive)
378             * @return the range of password policies
379             */
380            @Override
381            public List<PasswordPolicy> getPasswordPolicies(int start, int end) {
382                    return passwordPolicyPersistence.findAll(start, end);
383            }
384    
385            /**
386             * Returns the number of password policies.
387             *
388             * @return the number of password policies
389             */
390            @Override
391            public int getPasswordPoliciesCount() {
392                    return passwordPolicyPersistence.countAll();
393            }
394    
395            /**
396             * Updates the password policy in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
397             *
398             * @param passwordPolicy the password policy
399             * @return the password policy that was updated
400             */
401            @Indexable(type = IndexableType.REINDEX)
402            @Override
403            public PasswordPolicy updatePasswordPolicy(PasswordPolicy passwordPolicy) {
404                    return passwordPolicyPersistence.update(passwordPolicy);
405            }
406    
407            /**
408             * Returns the password policy local service.
409             *
410             * @return the password policy local service
411             */
412            public PasswordPolicyLocalService getPasswordPolicyLocalService() {
413                    return passwordPolicyLocalService;
414            }
415    
416            /**
417             * Sets the password policy local service.
418             *
419             * @param passwordPolicyLocalService the password policy local service
420             */
421            public void setPasswordPolicyLocalService(
422                    PasswordPolicyLocalService passwordPolicyLocalService) {
423                    this.passwordPolicyLocalService = passwordPolicyLocalService;
424            }
425    
426            /**
427             * Returns the password policy persistence.
428             *
429             * @return the password policy persistence
430             */
431            public PasswordPolicyPersistence getPasswordPolicyPersistence() {
432                    return passwordPolicyPersistence;
433            }
434    
435            /**
436             * Sets the password policy persistence.
437             *
438             * @param passwordPolicyPersistence the password policy persistence
439             */
440            public void setPasswordPolicyPersistence(
441                    PasswordPolicyPersistence passwordPolicyPersistence) {
442                    this.passwordPolicyPersistence = passwordPolicyPersistence;
443            }
444    
445            /**
446             * Returns the password policy finder.
447             *
448             * @return the password policy finder
449             */
450            public PasswordPolicyFinder getPasswordPolicyFinder() {
451                    return passwordPolicyFinder;
452            }
453    
454            /**
455             * Sets the password policy finder.
456             *
457             * @param passwordPolicyFinder the password policy finder
458             */
459            public void setPasswordPolicyFinder(
460                    PasswordPolicyFinder passwordPolicyFinder) {
461                    this.passwordPolicyFinder = passwordPolicyFinder;
462            }
463    
464            /**
465             * Returns the counter local service.
466             *
467             * @return the counter local service
468             */
469            public com.liferay.counter.kernel.service.CounterLocalService getCounterLocalService() {
470                    return counterLocalService;
471            }
472    
473            /**
474             * Sets the counter local service.
475             *
476             * @param counterLocalService the counter local service
477             */
478            public void setCounterLocalService(
479                    com.liferay.counter.kernel.service.CounterLocalService counterLocalService) {
480                    this.counterLocalService = counterLocalService;
481            }
482    
483            /**
484             * Returns the class name local service.
485             *
486             * @return the class name local service
487             */
488            public com.liferay.portal.kernel.service.ClassNameLocalService getClassNameLocalService() {
489                    return classNameLocalService;
490            }
491    
492            /**
493             * Sets the class name local service.
494             *
495             * @param classNameLocalService the class name local service
496             */
497            public void setClassNameLocalService(
498                    com.liferay.portal.kernel.service.ClassNameLocalService classNameLocalService) {
499                    this.classNameLocalService = classNameLocalService;
500            }
501    
502            /**
503             * Returns the class name persistence.
504             *
505             * @return the class name persistence
506             */
507            public ClassNamePersistence getClassNamePersistence() {
508                    return classNamePersistence;
509            }
510    
511            /**
512             * Sets the class name persistence.
513             *
514             * @param classNamePersistence the class name persistence
515             */
516            public void setClassNamePersistence(
517                    ClassNamePersistence classNamePersistence) {
518                    this.classNamePersistence = classNamePersistence;
519            }
520    
521            /**
522             * Returns the password policy rel local service.
523             *
524             * @return the password policy rel local service
525             */
526            public com.liferay.portal.kernel.service.PasswordPolicyRelLocalService getPasswordPolicyRelLocalService() {
527                    return passwordPolicyRelLocalService;
528            }
529    
530            /**
531             * Sets the password policy rel local service.
532             *
533             * @param passwordPolicyRelLocalService the password policy rel local service
534             */
535            public void setPasswordPolicyRelLocalService(
536                    com.liferay.portal.kernel.service.PasswordPolicyRelLocalService passwordPolicyRelLocalService) {
537                    this.passwordPolicyRelLocalService = passwordPolicyRelLocalService;
538            }
539    
540            /**
541             * Returns the password policy rel persistence.
542             *
543             * @return the password policy rel persistence
544             */
545            public PasswordPolicyRelPersistence getPasswordPolicyRelPersistence() {
546                    return passwordPolicyRelPersistence;
547            }
548    
549            /**
550             * Sets the password policy rel persistence.
551             *
552             * @param passwordPolicyRelPersistence the password policy rel persistence
553             */
554            public void setPasswordPolicyRelPersistence(
555                    PasswordPolicyRelPersistence passwordPolicyRelPersistence) {
556                    this.passwordPolicyRelPersistence = passwordPolicyRelPersistence;
557            }
558    
559            /**
560             * Returns the resource local service.
561             *
562             * @return the resource local service
563             */
564            public com.liferay.portal.kernel.service.ResourceLocalService getResourceLocalService() {
565                    return resourceLocalService;
566            }
567    
568            /**
569             * Sets the resource local service.
570             *
571             * @param resourceLocalService the resource local service
572             */
573            public void setResourceLocalService(
574                    com.liferay.portal.kernel.service.ResourceLocalService resourceLocalService) {
575                    this.resourceLocalService = resourceLocalService;
576            }
577    
578            /**
579             * Returns the user local service.
580             *
581             * @return the user local service
582             */
583            public com.liferay.portal.kernel.service.UserLocalService getUserLocalService() {
584                    return userLocalService;
585            }
586    
587            /**
588             * Sets the user local service.
589             *
590             * @param userLocalService the user local service
591             */
592            public void setUserLocalService(
593                    com.liferay.portal.kernel.service.UserLocalService userLocalService) {
594                    this.userLocalService = userLocalService;
595            }
596    
597            /**
598             * Returns the user persistence.
599             *
600             * @return the user persistence
601             */
602            public UserPersistence getUserPersistence() {
603                    return userPersistence;
604            }
605    
606            /**
607             * Sets the user persistence.
608             *
609             * @param userPersistence the user persistence
610             */
611            public void setUserPersistence(UserPersistence userPersistence) {
612                    this.userPersistence = userPersistence;
613            }
614    
615            /**
616             * Returns the user finder.
617             *
618             * @return the user finder
619             */
620            public UserFinder getUserFinder() {
621                    return userFinder;
622            }
623    
624            /**
625             * Sets the user finder.
626             *
627             * @param userFinder the user finder
628             */
629            public void setUserFinder(UserFinder userFinder) {
630                    this.userFinder = userFinder;
631            }
632    
633            public void afterPropertiesSet() {
634                    persistedModelLocalServiceRegistry.register("com.liferay.portal.kernel.model.PasswordPolicy",
635                            passwordPolicyLocalService);
636            }
637    
638            public void destroy() {
639                    persistedModelLocalServiceRegistry.unregister(
640                            "com.liferay.portal.kernel.model.PasswordPolicy");
641            }
642    
643            /**
644             * Returns the OSGi service identifier.
645             *
646             * @return the OSGi service identifier
647             */
648            @Override
649            public String getOSGiServiceIdentifier() {
650                    return PasswordPolicyLocalService.class.getName();
651            }
652    
653            protected Class<?> getModelClass() {
654                    return PasswordPolicy.class;
655            }
656    
657            protected String getModelClassName() {
658                    return PasswordPolicy.class.getName();
659            }
660    
661            /**
662             * Performs a SQL query.
663             *
664             * @param sql the sql query
665             */
666            protected void runSQL(String sql) {
667                    try {
668                            DataSource dataSource = passwordPolicyPersistence.getDataSource();
669    
670                            DB db = DBManagerUtil.getDB();
671    
672                            sql = db.buildSQL(sql);
673                            sql = PortalUtil.transformSQL(sql);
674    
675                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
676                                            sql);
677    
678                            sqlUpdate.update();
679                    }
680                    catch (Exception e) {
681                            throw new SystemException(e);
682                    }
683            }
684    
685            @BeanReference(type = PasswordPolicyLocalService.class)
686            protected PasswordPolicyLocalService passwordPolicyLocalService;
687            @BeanReference(type = PasswordPolicyPersistence.class)
688            protected PasswordPolicyPersistence passwordPolicyPersistence;
689            @BeanReference(type = PasswordPolicyFinder.class)
690            protected PasswordPolicyFinder passwordPolicyFinder;
691            @BeanReference(type = com.liferay.counter.kernel.service.CounterLocalService.class)
692            protected com.liferay.counter.kernel.service.CounterLocalService counterLocalService;
693            @BeanReference(type = com.liferay.portal.kernel.service.ClassNameLocalService.class)
694            protected com.liferay.portal.kernel.service.ClassNameLocalService classNameLocalService;
695            @BeanReference(type = ClassNamePersistence.class)
696            protected ClassNamePersistence classNamePersistence;
697            @BeanReference(type = com.liferay.portal.kernel.service.PasswordPolicyRelLocalService.class)
698            protected com.liferay.portal.kernel.service.PasswordPolicyRelLocalService passwordPolicyRelLocalService;
699            @BeanReference(type = PasswordPolicyRelPersistence.class)
700            protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
701            @BeanReference(type = com.liferay.portal.kernel.service.ResourceLocalService.class)
702            protected com.liferay.portal.kernel.service.ResourceLocalService resourceLocalService;
703            @BeanReference(type = com.liferay.portal.kernel.service.UserLocalService.class)
704            protected com.liferay.portal.kernel.service.UserLocalService userLocalService;
705            @BeanReference(type = UserPersistence.class)
706            protected UserPersistence userPersistence;
707            @BeanReference(type = UserFinder.class)
708            protected UserFinder userFinder;
709            @BeanReference(type = PersistedModelLocalServiceRegistry.class)
710            protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
711    }