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.dao.db.DB;
019    import com.liferay.portal.kernel.dao.db.DBManagerUtil;
020    import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
021    import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
022    import com.liferay.portal.kernel.exception.SystemException;
023    import com.liferay.portal.kernel.module.framework.service.IdentifiableOSGiService;
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, IdentifiableOSGiService {
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 OSGi service identifier.
153             *
154             * @return the OSGi service identifier
155             */
156            @Override
157            public String getOSGiServiceIdentifier() {
158                    return RegionService.class.getName();
159            }
160    
161            protected Class<?> getModelClass() {
162                    return Region.class;
163            }
164    
165            protected String getModelClassName() {
166                    return Region.class.getName();
167            }
168    
169            /**
170             * Performs a SQL query.
171             *
172             * @param sql the sql query
173             */
174            protected void runSQL(String sql) {
175                    try {
176                            DataSource dataSource = regionPersistence.getDataSource();
177    
178                            DB db = DBManagerUtil.getDB();
179    
180                            sql = db.buildSQL(sql);
181                            sql = PortalUtil.transformSQL(sql);
182    
183                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
184                                            sql, new int[0]);
185    
186                            sqlUpdate.update();
187                    }
188                    catch (Exception e) {
189                            throw new SystemException(e);
190                    }
191            }
192    
193            @BeanReference(type = com.liferay.portal.service.RegionService.class)
194            protected RegionService regionService;
195            @BeanReference(type = RegionPersistence.class)
196            protected RegionPersistence regionPersistence;
197            @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
198            protected com.liferay.counter.service.CounterLocalService counterLocalService;
199            @BeanReference(type = com.liferay.portal.service.CountryService.class)
200            protected com.liferay.portal.service.CountryService countryService;
201            @BeanReference(type = CountryPersistence.class)
202            protected CountryPersistence countryPersistence;
203    }