001
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
044 public abstract class CountryServiceBaseImpl extends BaseServiceImpl
045 implements CountryService, IdentifiableOSGiService {
046
051
052
057 public CountryService getCountryService() {
058 return countryService;
059 }
060
061
066 public void setCountryService(CountryService countryService) {
067 this.countryService = countryService;
068 }
069
070
075 public CountryPersistence getCountryPersistence() {
076 return countryPersistence;
077 }
078
079
084 public void setCountryPersistence(CountryPersistence countryPersistence) {
085 this.countryPersistence = countryPersistence;
086 }
087
088
093 public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
094 return counterLocalService;
095 }
096
097
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
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
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 }