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