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