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 com.liferay.portal.kernel.bean.BeanReference;
018    import com.liferay.portal.kernel.bean.IdentifiableBean;
019    import com.liferay.portal.kernel.dao.db.DB;
020    import com.liferay.portal.kernel.dao.db.DBFactoryUtil;
021    import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
022    import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
023    import com.liferay.portal.kernel.exception.SystemException;
024    import com.liferay.portal.model.Region;
025    import com.liferay.portal.service.BaseServiceImpl;
026    import com.liferay.portal.service.RegionService;
027    import com.liferay.portal.service.persistence.CountryPersistence;
028    import com.liferay.portal.service.persistence.RegionPersistence;
029    import com.liferay.portal.util.PortalUtil;
030    
031    import javax.sql.DataSource;
032    
033    /**
034     * Provides the base implementation for the region remote service.
035     *
036     * <p>
037     * 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.RegionServiceImpl}.
038     * </p>
039     *
040     * @author Brian Wing Shun Chan
041     * @see com.liferay.portal.service.impl.RegionServiceImpl
042     * @see com.liferay.portal.service.RegionServiceUtil
043     * @generated
044     */
045    public abstract class RegionServiceBaseImpl extends BaseServiceImpl
046            implements RegionService, IdentifiableBean {
047            /*
048             * NOTE FOR DEVELOPERS:
049             *
050             * Never modify or reference this class directly. Always use {@link com.liferay.portal.service.RegionServiceUtil} to access the region remote service.
051             */
052    
053            /**
054             * Returns the region remote service.
055             *
056             * @return the region remote service
057             */
058            public RegionService getRegionService() {
059                    return regionService;
060            }
061    
062            /**
063             * Sets the region remote service.
064             *
065             * @param regionService the region remote service
066             */
067            public void setRegionService(RegionService regionService) {
068                    this.regionService = regionService;
069            }
070    
071            /**
072             * Returns the region persistence.
073             *
074             * @return the region persistence
075             */
076            public RegionPersistence getRegionPersistence() {
077                    return regionPersistence;
078            }
079    
080            /**
081             * Sets the region persistence.
082             *
083             * @param regionPersistence the region persistence
084             */
085            public void setRegionPersistence(RegionPersistence regionPersistence) {
086                    this.regionPersistence = regionPersistence;
087            }
088    
089            /**
090             * Returns the counter local service.
091             *
092             * @return the counter local service
093             */
094            public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
095                    return counterLocalService;
096            }
097    
098            /**
099             * Sets the counter local service.
100             *
101             * @param counterLocalService the counter local service
102             */
103            public void setCounterLocalService(
104                    com.liferay.counter.service.CounterLocalService counterLocalService) {
105                    this.counterLocalService = counterLocalService;
106            }
107    
108            /**
109             * Returns the country remote service.
110             *
111             * @return the country remote service
112             */
113            public com.liferay.portal.service.CountryService getCountryService() {
114                    return countryService;
115            }
116    
117            /**
118             * Sets the country remote service.
119             *
120             * @param countryService the country remote service
121             */
122            public void setCountryService(
123                    com.liferay.portal.service.CountryService countryService) {
124                    this.countryService = countryService;
125            }
126    
127            /**
128             * Returns the country persistence.
129             *
130             * @return the country persistence
131             */
132            public CountryPersistence getCountryPersistence() {
133                    return countryPersistence;
134            }
135    
136            /**
137             * Sets the country persistence.
138             *
139             * @param countryPersistence the country persistence
140             */
141            public void setCountryPersistence(CountryPersistence countryPersistence) {
142                    this.countryPersistence = countryPersistence;
143            }
144    
145            public void afterPropertiesSet() {
146            }
147    
148            public void destroy() {
149            }
150    
151            /**
152             * Returns the Spring bean ID for this bean.
153             *
154             * @return the Spring bean ID for this bean
155             */
156            @Override
157            public String getBeanIdentifier() {
158                    return _beanIdentifier;
159            }
160    
161            /**
162             * Sets the Spring bean ID for this bean.
163             *
164             * @param beanIdentifier the Spring bean ID for this bean
165             */
166            @Override
167            public void setBeanIdentifier(String beanIdentifier) {
168                    _beanIdentifier = beanIdentifier;
169            }
170    
171            protected Class<?> getModelClass() {
172                    return Region.class;
173            }
174    
175            protected String getModelClassName() {
176                    return Region.class.getName();
177            }
178    
179            /**
180             * Performs a SQL query.
181             *
182             * @param sql the sql query
183             */
184            protected void runSQL(String sql) {
185                    try {
186                            DataSource dataSource = regionPersistence.getDataSource();
187    
188                            DB db = DBFactoryUtil.getDB();
189    
190                            sql = db.buildSQL(sql);
191                            sql = PortalUtil.transformSQL(sql);
192    
193                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
194                                            sql, new int[0]);
195    
196                            sqlUpdate.update();
197                    }
198                    catch (Exception e) {
199                            throw new SystemException(e);
200                    }
201            }
202    
203            @BeanReference(type = com.liferay.portal.service.RegionService.class)
204            protected RegionService regionService;
205            @BeanReference(type = RegionPersistence.class)
206            protected RegionPersistence regionPersistence;
207            @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
208            protected com.liferay.counter.service.CounterLocalService counterLocalService;
209            @BeanReference(type = com.liferay.portal.service.CountryService.class)
210            protected com.liferay.portal.service.CountryService countryService;
211            @BeanReference(type = CountryPersistence.class)
212            protected CountryPersistence countryPersistence;
213            private String _beanIdentifier;
214    }