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.model.ClassName;
024    import com.liferay.portal.kernel.module.framework.service.IdentifiableOSGiService;
025    import com.liferay.portal.kernel.service.BaseServiceImpl;
026    import com.liferay.portal.kernel.service.ClassNameService;
027    import com.liferay.portal.kernel.service.persistence.ClassNamePersistence;
028    import com.liferay.portal.kernel.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.kernel.service.ClassNameServiceUtil
042     * @generated
043     */
044    public abstract class ClassNameServiceBaseImpl extends BaseServiceImpl
045            implements ClassNameService, IdentifiableOSGiService {
046            /*
047             * NOTE FOR DEVELOPERS:
048             *
049             * Never modify or reference this class directly. Always use {@link com.liferay.portal.kernel.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.kernel.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.kernel.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 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(ClassNameService classNameService) {
086                    this.classNameService = classNameService;
087            }
088    
089            /**
090             * Returns the class name persistence.
091             *
092             * @return the class name persistence
093             */
094            public ClassNamePersistence getClassNamePersistence() {
095                    return classNamePersistence;
096            }
097    
098            /**
099             * Sets the class name persistence.
100             *
101             * @param classNamePersistence the class name persistence
102             */
103            public void setClassNamePersistence(
104                    ClassNamePersistence classNamePersistence) {
105                    this.classNamePersistence = classNamePersistence;
106            }
107    
108            /**
109             * Returns the counter local service.
110             *
111             * @return the counter local service
112             */
113            public com.liferay.counter.kernel.service.CounterLocalService getCounterLocalService() {
114                    return counterLocalService;
115            }
116    
117            /**
118             * Sets the counter local service.
119             *
120             * @param counterLocalService the counter local service
121             */
122            public void setCounterLocalService(
123                    com.liferay.counter.kernel.service.CounterLocalService counterLocalService) {
124                    this.counterLocalService = counterLocalService;
125            }
126    
127            public void afterPropertiesSet() {
128            }
129    
130            public void destroy() {
131            }
132    
133            /**
134             * Returns the OSGi service identifier.
135             *
136             * @return the OSGi service identifier
137             */
138            @Override
139            public String getOSGiServiceIdentifier() {
140                    return ClassNameService.class.getName();
141            }
142    
143            protected Class<?> getModelClass() {
144                    return ClassName.class;
145            }
146    
147            protected String getModelClassName() {
148                    return ClassName.class.getName();
149            }
150    
151            /**
152             * Performs a SQL query.
153             *
154             * @param sql the sql query
155             */
156            protected void runSQL(String sql) {
157                    try {
158                            DataSource dataSource = classNamePersistence.getDataSource();
159    
160                            DB db = DBManagerUtil.getDB();
161    
162                            sql = db.buildSQL(sql);
163                            sql = PortalUtil.transformSQL(sql);
164    
165                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
166                                            sql);
167    
168                            sqlUpdate.update();
169                    }
170                    catch (Exception e) {
171                            throw new SystemException(e);
172                    }
173            }
174    
175            @BeanReference(type = com.liferay.portal.kernel.service.ClassNameLocalService.class)
176            protected com.liferay.portal.kernel.service.ClassNameLocalService classNameLocalService;
177            @BeanReference(type = ClassNameService.class)
178            protected ClassNameService classNameService;
179            @BeanReference(type = ClassNamePersistence.class)
180            protected ClassNamePersistence classNamePersistence;
181            @BeanReference(type = com.liferay.counter.kernel.service.CounterLocalService.class)
182            protected com.liferay.counter.kernel.service.CounterLocalService counterLocalService;
183    }