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.toString(),
284                                                    modelAdditionCount);
285    
286                                            long modelDeletionCount = ExportImportHelperUtil.getModelDeletionCount(portletDataContext,
287                                                            stagedModelType);
288    
289                                            manifestSummary.addModelDeletionCount(stagedModelType.toString(),
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                                            if (stagedModelType.getReferrerClassNameId() >= 0) {
307                                                    Property classNameIdProperty = PropertyFactoryUtil.forName(
308                                                                    "classNameId");
309    
310                                                    dynamicQuery.add(classNameIdProperty.eq(
311                                                                    stagedModelType.getReferrerClassNameId()));
312                                            }
313                                    }
314                            });
315    
316                    exportActionableDynamicQuery.setCompanyId(portletDataContext.getCompanyId());
317    
318                    exportActionableDynamicQuery.setPerformActionMethod(new ActionableDynamicQuery.PerformActionMethod() {
319                                    @Override
320                                    public void performAction(Object object)
321                                            throws PortalException {
322                                            EmailAddress stagedModel = (EmailAddress)object;
323    
324                                            StagedModelDataHandlerUtil.exportStagedModel(portletDataContext,
325                                                    stagedModel);
326                                    }
327                            });
328                    exportActionableDynamicQuery.setStagedModelType(new StagedModelType(
329                                    PortalUtil.getClassNameId(EmailAddress.class.getName())));
330    
331                    return exportActionableDynamicQuery;
332            }
333    
334            /**
335             * @throws PortalException
336             */
337            @Override
338            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
339                    throws PortalException {
340                    return emailAddressLocalService.deleteEmailAddress((EmailAddress)persistedModel);
341            }
342    
343            @Override
344            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
345                    throws PortalException {
346                    return emailAddressPersistence.findByPrimaryKey(primaryKeyObj);
347            }
348    
349            /**
350             * Returns the email address with the matching UUID and company.
351             *
352             * @param uuid the email address's UUID
353             * @param companyId the primary key of the company
354             * @return the matching email address
355             * @throws PortalException if a matching email address could not be found
356             */
357            @Override
358            public EmailAddress getEmailAddressByUuidAndCompanyId(String uuid,
359                    long companyId) throws PortalException {
360                    return emailAddressPersistence.findByUuid_C_First(uuid, companyId, null);
361            }
362    
363            /**
364             * Returns a range of all the email addresses.
365             *
366             * <p>
367             * 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.
368             * </p>
369             *
370             * @param start the lower bound of the range of email addresses
371             * @param end the upper bound of the range of email addresses (not inclusive)
372             * @return the range of email addresses
373             */
374            @Override
375            public List<EmailAddress> getEmailAddresses(int start, int end) {
376                    return emailAddressPersistence.findAll(start, end);
377            }
378    
379            /**
380             * Returns the number of email addresses.
381             *
382             * @return the number of email addresses
383             */
384            @Override
385            public int getEmailAddressesCount() {
386                    return emailAddressPersistence.countAll();
387            }
388    
389            /**
390             * Updates the email address in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
391             *
392             * @param emailAddress the email address
393             * @return the email address that was updated
394             */
395            @Indexable(type = IndexableType.REINDEX)
396            @Override
397            public EmailAddress updateEmailAddress(EmailAddress emailAddress) {
398                    return emailAddressPersistence.update(emailAddress);
399            }
400    
401            /**
402             * Returns the email address local service.
403             *
404             * @return the email address local service
405             */
406            public EmailAddressLocalService getEmailAddressLocalService() {
407                    return emailAddressLocalService;
408            }
409    
410            /**
411             * Sets the email address local service.
412             *
413             * @param emailAddressLocalService the email address local service
414             */
415            public void setEmailAddressLocalService(
416                    EmailAddressLocalService emailAddressLocalService) {
417                    this.emailAddressLocalService = emailAddressLocalService;
418            }
419    
420            /**
421             * Returns the email address remote service.
422             *
423             * @return the email address remote service
424             */
425            public com.liferay.portal.service.EmailAddressService getEmailAddressService() {
426                    return emailAddressService;
427            }
428    
429            /**
430             * Sets the email address remote service.
431             *
432             * @param emailAddressService the email address remote service
433             */
434            public void setEmailAddressService(
435                    com.liferay.portal.service.EmailAddressService emailAddressService) {
436                    this.emailAddressService = emailAddressService;
437            }
438    
439            /**
440             * Returns the email address persistence.
441             *
442             * @return the email address persistence
443             */
444            public EmailAddressPersistence getEmailAddressPersistence() {
445                    return emailAddressPersistence;
446            }
447    
448            /**
449             * Sets the email address persistence.
450             *
451             * @param emailAddressPersistence the email address persistence
452             */
453            public void setEmailAddressPersistence(
454                    EmailAddressPersistence emailAddressPersistence) {
455                    this.emailAddressPersistence = emailAddressPersistence;
456            }
457    
458            /**
459             * Returns the counter local service.
460             *
461             * @return the counter local service
462             */
463            public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
464                    return counterLocalService;
465            }
466    
467            /**
468             * Sets the counter local service.
469             *
470             * @param counterLocalService the counter local service
471             */
472            public void setCounterLocalService(
473                    com.liferay.counter.service.CounterLocalService counterLocalService) {
474                    this.counterLocalService = counterLocalService;
475            }
476    
477            /**
478             * Returns the class name local service.
479             *
480             * @return the class name local service
481             */
482            public com.liferay.portal.service.ClassNameLocalService getClassNameLocalService() {
483                    return classNameLocalService;
484            }
485    
486            /**
487             * Sets the class name local service.
488             *
489             * @param classNameLocalService the class name local service
490             */
491            public void setClassNameLocalService(
492                    com.liferay.portal.service.ClassNameLocalService classNameLocalService) {
493                    this.classNameLocalService = classNameLocalService;
494            }
495    
496            /**
497             * Returns the class name remote service.
498             *
499             * @return the class name remote service
500             */
501            public com.liferay.portal.service.ClassNameService getClassNameService() {
502                    return classNameService;
503            }
504    
505            /**
506             * Sets the class name remote service.
507             *
508             * @param classNameService the class name remote service
509             */
510            public void setClassNameService(
511                    com.liferay.portal.service.ClassNameService classNameService) {
512                    this.classNameService = classNameService;
513            }
514    
515            /**
516             * Returns the class name persistence.
517             *
518             * @return the class name persistence
519             */
520            public ClassNamePersistence getClassNamePersistence() {
521                    return classNamePersistence;
522            }
523    
524            /**
525             * Sets the class name persistence.
526             *
527             * @param classNamePersistence the class name persistence
528             */
529            public void setClassNamePersistence(
530                    ClassNamePersistence classNamePersistence) {
531                    this.classNamePersistence = classNamePersistence;
532            }
533    
534            /**
535             * Returns the list type local service.
536             *
537             * @return the list type local service
538             */
539            public com.liferay.portal.service.ListTypeLocalService getListTypeLocalService() {
540                    return listTypeLocalService;
541            }
542    
543            /**
544             * Sets the list type local service.
545             *
546             * @param listTypeLocalService the list type local service
547             */
548            public void setListTypeLocalService(
549                    com.liferay.portal.service.ListTypeLocalService listTypeLocalService) {
550                    this.listTypeLocalService = listTypeLocalService;
551            }
552    
553            /**
554             * Returns the list type remote service.
555             *
556             * @return the list type remote service
557             */
558            public com.liferay.portal.service.ListTypeService getListTypeService() {
559                    return listTypeService;
560            }
561    
562            /**
563             * Sets the list type remote service.
564             *
565             * @param listTypeService the list type remote service
566             */
567            public void setListTypeService(
568                    com.liferay.portal.service.ListTypeService listTypeService) {
569                    this.listTypeService = listTypeService;
570            }
571    
572            /**
573             * Returns the list type persistence.
574             *
575             * @return the list type persistence
576             */
577            public ListTypePersistence getListTypePersistence() {
578                    return listTypePersistence;
579            }
580    
581            /**
582             * Sets the list type persistence.
583             *
584             * @param listTypePersistence the list type persistence
585             */
586            public void setListTypePersistence(ListTypePersistence listTypePersistence) {
587                    this.listTypePersistence = listTypePersistence;
588            }
589    
590            /**
591             * Returns the user local service.
592             *
593             * @return the user local service
594             */
595            public com.liferay.portal.service.UserLocalService getUserLocalService() {
596                    return userLocalService;
597            }
598    
599            /**
600             * Sets the user local service.
601             *
602             * @param userLocalService the user local service
603             */
604            public void setUserLocalService(
605                    com.liferay.portal.service.UserLocalService userLocalService) {
606                    this.userLocalService = userLocalService;
607            }
608    
609            /**
610             * Returns the user remote service.
611             *
612             * @return the user remote service
613             */
614            public com.liferay.portal.service.UserService getUserService() {
615                    return userService;
616            }
617    
618            /**
619             * Sets the user remote service.
620             *
621             * @param userService the user remote service
622             */
623            public void setUserService(
624                    com.liferay.portal.service.UserService userService) {
625                    this.userService = userService;
626            }
627    
628            /**
629             * Returns the user persistence.
630             *
631             * @return the user persistence
632             */
633            public UserPersistence getUserPersistence() {
634                    return userPersistence;
635            }
636    
637            /**
638             * Sets the user persistence.
639             *
640             * @param userPersistence the user persistence
641             */
642            public void setUserPersistence(UserPersistence userPersistence) {
643                    this.userPersistence = userPersistence;
644            }
645    
646            /**
647             * Returns the user finder.
648             *
649             * @return the user finder
650             */
651            public UserFinder getUserFinder() {
652                    return userFinder;
653            }
654    
655            /**
656             * Sets the user finder.
657             *
658             * @param userFinder the user finder
659             */
660            public void setUserFinder(UserFinder userFinder) {
661                    this.userFinder = userFinder;
662            }
663    
664            public void afterPropertiesSet() {
665                    persistedModelLocalServiceRegistry.register("com.liferay.portal.model.EmailAddress",
666                            emailAddressLocalService);
667            }
668    
669            public void destroy() {
670                    persistedModelLocalServiceRegistry.unregister(
671                            "com.liferay.portal.model.EmailAddress");
672            }
673    
674            /**
675             * Returns the Spring bean ID for this bean.
676             *
677             * @return the Spring bean ID for this bean
678             */
679            @Override
680            public String getBeanIdentifier() {
681                    return _beanIdentifier;
682            }
683    
684            /**
685             * Sets the Spring bean ID for this bean.
686             *
687             * @param beanIdentifier the Spring bean ID for this bean
688             */
689            @Override
690            public void setBeanIdentifier(String beanIdentifier) {
691                    _beanIdentifier = beanIdentifier;
692            }
693    
694            protected Class<?> getModelClass() {
695                    return EmailAddress.class;
696            }
697    
698            protected String getModelClassName() {
699                    return EmailAddress.class.getName();
700            }
701    
702            /**
703             * Performs a SQL query.
704             *
705             * @param sql the sql query
706             */
707            protected void runSQL(String sql) {
708                    try {
709                            DataSource dataSource = emailAddressPersistence.getDataSource();
710    
711                            DB db = DBFactoryUtil.getDB();
712    
713                            sql = db.buildSQL(sql);
714                            sql = PortalUtil.transformSQL(sql);
715    
716                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
717                                            sql, new int[0]);
718    
719                            sqlUpdate.update();
720                    }
721                    catch (Exception e) {
722                            throw new SystemException(e);
723                    }
724            }
725    
726            @BeanReference(type = EmailAddressLocalService.class)
727            protected EmailAddressLocalService emailAddressLocalService;
728            @BeanReference(type = com.liferay.portal.service.EmailAddressService.class)
729            protected com.liferay.portal.service.EmailAddressService emailAddressService;
730            @BeanReference(type = EmailAddressPersistence.class)
731            protected EmailAddressPersistence emailAddressPersistence;
732            @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
733            protected com.liferay.counter.service.CounterLocalService counterLocalService;
734            @BeanReference(type = com.liferay.portal.service.ClassNameLocalService.class)
735            protected com.liferay.portal.service.ClassNameLocalService classNameLocalService;
736            @BeanReference(type = com.liferay.portal.service.ClassNameService.class)
737            protected com.liferay.portal.service.ClassNameService classNameService;
738            @BeanReference(type = ClassNamePersistence.class)
739            protected ClassNamePersistence classNamePersistence;
740            @BeanReference(type = com.liferay.portal.service.ListTypeLocalService.class)
741            protected com.liferay.portal.service.ListTypeLocalService listTypeLocalService;
742            @BeanReference(type = com.liferay.portal.service.ListTypeService.class)
743            protected com.liferay.portal.service.ListTypeService listTypeService;
744            @BeanReference(type = ListTypePersistence.class)
745            protected ListTypePersistence listTypePersistence;
746            @BeanReference(type = com.liferay.portal.service.UserLocalService.class)
747            protected com.liferay.portal.service.UserLocalService userLocalService;
748            @BeanReference(type = com.liferay.portal.service.UserService.class)
749            protected com.liferay.portal.service.UserService userService;
750            @BeanReference(type = UserPersistence.class)
751            protected UserPersistence userPersistence;
752            @BeanReference(type = UserFinder.class)
753            protected UserFinder userFinder;
754            @BeanReference(type = PersistedModelLocalServiceRegistry.class)
755            protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
756            private String _beanIdentifier;
757    }