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