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 com.liferay.portal.service.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(
068                    com.liferay.portal.service.RegionService regionService) {
069                    this.regionService = regionService;
070            }
071    
072            /**
073             * Returns the region persistence.
074             *
075             * @return the region persistence
076             */
077            public RegionPersistence getRegionPersistence() {
078                    return regionPersistence;
079            }
080    
081            /**
082             * Sets the region persistence.
083             *
084             * @param regionPersistence the region persistence
085             */
086            public void setRegionPersistence(RegionPersistence regionPersistence) {
087                    this.regionPersistence = regionPersistence;
088            }
089    
090            /**
091             * Returns the counter local service.
092             *
093             * @return the counter local service
094             */
095            public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
096                    return counterLocalService;
097            }
098    
099            /**
100             * Sets the counter local service.
101             *
102             * @param counterLocalService the counter local service
103             */
104            public void setCounterLocalService(
105                    com.liferay.counter.service.CounterLocalService counterLocalService) {
106                    this.counterLocalService = counterLocalService;
107            }
108    
109            /**
110             * Returns the country remote service.
111             *
112             * @return the country remote service
113             */
114            public com.liferay.portal.service.CountryService getCountryService() {
115                    return countryService;
116            }
117    
118            /**
119             * Sets the country remote service.
120             *
121             * @param countryService the country remote service
122             */
123            public void setCountryService(
124                    com.liferay.portal.service.CountryService countryService) {
125                    this.countryService = countryService;
126            }
127    
128            /**
129             * Returns the country persistence.
130             *
131             * @return the country persistence
132             */
133            public CountryPersistence getCountryPersistence() {
134                    return countryPersistence;
135            }
136    
137            /**
138             * Sets the country persistence.
139             *
140             * @param countryPersistence the country persistence
141             */
142            public void setCountryPersistence(CountryPersistence countryPersistence) {
143                    this.countryPersistence = countryPersistence;
144            }
145    
146            public void afterPropertiesSet() {
147            }
148    
149            public void destroy() {
150            }
151    
152            /**
153             * Returns the Spring bean ID for this bean.
154             *
155             * @return the Spring bean ID for this bean
156             */
157            @Override
158            public String getBeanIdentifier() {
159                    return _beanIdentifier;
160            }
161    
162            /**
163             * Sets the Spring bean ID for this bean.
164             *
165             * @param beanIdentifier the Spring bean ID for this bean
166             */
167            @Override
168            public void setBeanIdentifier(String beanIdentifier) {
169                    _beanIdentifier = beanIdentifier;
170            }
171    
172            protected Class<?> getModelClass() {
173                    return Region.class;
174            }
175    
176            protected String getModelClassName() {
177                    return Region.class.getName();
178            }
179    
180            /**
181             * Performs a SQL query.
182             *
183             * @param sql the sql query
184             */
185            protected void runSQL(String sql) {
186                    try {
187                            DataSource dataSource = regionPersistence.getDataSource();
188    
189                            DB db = DBFactoryUtil.getDB();
190    
191                            sql = db.buildSQL(sql);
192                            sql = PortalUtil.transformSQL(sql);
193    
194                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
195                                            sql, new int[0]);
196    
197                            sqlUpdate.update();
198                    }
199                    catch (Exception e) {
200                            throw new SystemException(e);
201                    }
202            }
203    
204            @BeanReference(type = com.liferay.portal.service.RegionService.class)
205            protected com.liferay.portal.service.RegionService regionService;
206            @BeanReference(type = RegionPersistence.class)
207            protected RegionPersistence regionPersistence;
208            @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
209            protected com.liferay.counter.service.CounterLocalService counterLocalService;
210            @BeanReference(type = com.liferay.portal.service.CountryService.class)
211            protected com.liferay.portal.service.CountryService countryService;
212            @BeanReference(type = CountryPersistence.class)
213            protected CountryPersistence countryPersistence;
214            private String _beanIdentifier;
215    }