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.Country;
025    import com.liferay.portal.service.BaseServiceImpl;
026    import com.liferay.portal.service.CountryService;
027    import com.liferay.portal.service.persistence.CountryPersistence;
028    import com.liferay.portal.util.PortalUtil;
029    
030    import javax.sql.DataSource;
031    
032    /**
033     * Provides the base implementation for the country remote service.
034     *
035     * <p>
036     * 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.CountryServiceImpl}.
037     * </p>
038     *
039     * @author Brian Wing Shun Chan
040     * @see com.liferay.portal.service.impl.CountryServiceImpl
041     * @see com.liferay.portal.service.CountryServiceUtil
042     * @generated
043     */
044    public abstract class CountryServiceBaseImpl extends BaseServiceImpl
045            implements CountryService, IdentifiableOSGiService {
046            /*
047             * NOTE FOR DEVELOPERS:
048             *
049             * Never modify or reference this class directly. Always use {@link com.liferay.portal.service.CountryServiceUtil} to access the country remote service.
050             */
051    
052            /**
053             * Returns the country remote service.
054             *
055             * @return the country remote service
056             */
057            public CountryService getCountryService() {
058                    return countryService;
059            }
060    
061            /**
062             * Sets the country remote service.
063             *
064             * @param countryService the country remote service
065             */
066            public void setCountryService(CountryService countryService) {
067                    this.countryService = countryService;
068            }
069    
070            /**
071             * Returns the country persistence.
072             *
073             * @return the country persistence
074             */
075            public CountryPersistence getCountryPersistence() {
076                    return countryPersistence;
077            }
078    
079            /**
080             * Sets the country persistence.
081             *
082             * @param countryPersistence the country persistence
083             */
084            public void setCountryPersistence(CountryPersistence countryPersistence) {
085                    this.countryPersistence = countryPersistence;
086            }
087    
088            /**
089             * Returns the counter local service.
090             *
091             * @return the counter local service
092             */
093            public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
094                    return counterLocalService;
095            }
096    
097            /**
098             * Sets the counter local service.
099             *
100             * @param counterLocalService the counter local service
101             */
102            public void setCounterLocalService(
103                    com.liferay.counter.service.CounterLocalService counterLocalService) {
104                    this.counterLocalService = counterLocalService;
105            }
106    
107            public void afterPropertiesSet() {
108            }
109    
110            public void destroy() {
111            }
112    
113            /**
114             * Returns the OSGi service identifier.
115             *
116             * @return the OSGi service identifier
117             */
118            @Override
119            public String getOSGiServiceIdentifier() {
120                    return CountryService.class.getName();
121            }
122    
123            protected Class<?> getModelClass() {
124                    return Country.class;
125            }
126    
127            protected String getModelClassName() {
128                    return Country.class.getName();
129            }
130    
131            /**
132             * Performs a SQL query.
133             *
134             * @param sql the sql query
135             */
136            protected void runSQL(String sql) {
137                    try {
138                            DataSource dataSource = countryPersistence.getDataSource();
139    
140                            DB db = DBManagerUtil.getDB();
141    
142                            sql = db.buildSQL(sql);
143                            sql = PortalUtil.transformSQL(sql);
144    
145                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
146                                            sql, new int[0]);
147    
148                            sqlUpdate.update();
149                    }
150                    catch (Exception e) {
151                            throw new SystemException(e);
152                    }
153            }
154    
155            @BeanReference(type = com.liferay.portal.service.CountryService.class)
156            protected CountryService countryService;
157            @BeanReference(type = CountryPersistence.class)
158            protected CountryPersistence countryPersistence;
159            @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
160            protected com.liferay.counter.service.CounterLocalService counterLocalService;
161    }