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