package com.liferay.pushnotifications.service.base;

import com.liferay.portal.kernel.bean.BeanReference;
import com.liferay.portal.kernel.bean.IdentifiableBean;
import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.service.BaseServiceImpl;
import com.liferay.portal.service.persistence.UserPersistence;

import com.liferay.pushnotifications.model.PushNotificationsDevice;
import com.liferay.pushnotifications.service.PushNotificationsDeviceService;
import com.liferay.pushnotifications.service.persistence.AppVersionPersistence;
import com.liferay.pushnotifications.service.persistence.ApplicationPersistence;
import com.liferay.pushnotifications.service.persistence.ApplicationPreferencesPersistence;
import com.liferay.pushnotifications.service.persistence.PushNotificationsDevicePersistence;

import javax.sql.DataSource;

/**
 * Provides the base implementation for the push notifications device remote service.
 *
 * <p>
 * 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.pushnotifications.service.impl.PushNotificationsDeviceServiceImpl}.
 * </p>
 *
 * @author Bruno Farache
 * @see com.liferay.pushnotifications.service.impl.PushNotificationsDeviceServiceImpl
 * @see com.liferay.pushnotifications.service.PushNotificationsDeviceServiceUtil
 * @generated
 */
public abstract class PushNotificationsDeviceServiceBaseImpl
    extends BaseServiceImpl implements PushNotificationsDeviceService,
        IdentifiableBean {
    @BeanReference(type = com.liferay.pushnotifications.service.ApplicationLocalService.class)
    protected com.liferay.pushnotifications.service.ApplicationLocalService applicationLocalService;
    @BeanReference(type = ApplicationPersistence.class)
    protected ApplicationPersistence applicationPersistence;
    @BeanReference(type = com.liferay.pushnotifications.service.ApplicationPreferencesLocalService.class)
    protected com.liferay.pushnotifications.service.ApplicationPreferencesLocalService applicationPreferencesLocalService;
    @BeanReference(type = ApplicationPreferencesPersistence.class)
    protected ApplicationPreferencesPersistence applicationPreferencesPersistence;
    @BeanReference(type = com.liferay.pushnotifications.service.AppVersionLocalService.class)
    protected com.liferay.pushnotifications.service.AppVersionLocalService appVersionLocalService;
    @BeanReference(type = AppVersionPersistence.class)
    protected AppVersionPersistence appVersionPersistence;
    @BeanReference(type = com.liferay.pushnotifications.service.PushNotificationsDeviceLocalService.class)
    protected com.liferay.pushnotifications.service.PushNotificationsDeviceLocalService pushNotificationsDeviceLocalService;
    @BeanReference(type = com.liferay.pushnotifications.service.PushNotificationsDeviceService.class)
    protected com.liferay.pushnotifications.service.PushNotificationsDeviceService pushNotificationsDeviceService;
    @BeanReference(type = PushNotificationsDevicePersistence.class)
    protected PushNotificationsDevicePersistence pushNotificationsDevicePersistence;
    @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
    protected com.liferay.counter.service.CounterLocalService counterLocalService;
    @BeanReference(type = com.liferay.portal.service.ResourceLocalService.class)
    protected com.liferay.portal.service.ResourceLocalService resourceLocalService;
    @BeanReference(type = com.liferay.portal.service.UserLocalService.class)
    protected com.liferay.portal.service.UserLocalService userLocalService;
    @BeanReference(type = com.liferay.portal.service.UserService.class)
    protected com.liferay.portal.service.UserService userService;
    @BeanReference(type = UserPersistence.class)
    protected UserPersistence userPersistence;
    private String _beanIdentifier;
    private ClassLoader _classLoader;
    private PushNotificationsDeviceServiceClpInvoker _clpInvoker = new PushNotificationsDeviceServiceClpInvoker();

    /*
     * NOTE FOR DEVELOPERS:
     *
     * Never modify or reference this class directly. Always use {@link com.liferay.pushnotifications.service.PushNotificationsDeviceServiceUtil} to access the push notifications device remote service.
     */

    /**
     * Returns the application local service.
     *
     * @return the application local service
     */
    public com.liferay.pushnotifications.service.ApplicationLocalService getApplicationLocalService() {
        return applicationLocalService;
    }

    /**
     * Sets the application local service.
     *
     * @param applicationLocalService the application local service
     */
    public void setApplicationLocalService(
        com.liferay.pushnotifications.service.ApplicationLocalService applicationLocalService) {
        this.applicationLocalService = applicationLocalService;
    }

    /**
     * Returns the application persistence.
     *
     * @return the application persistence
     */
    public ApplicationPersistence getApplicationPersistence() {
        return applicationPersistence;
    }

    /**
     * Sets the application persistence.
     *
     * @param applicationPersistence the application persistence
     */
    public void setApplicationPersistence(
        ApplicationPersistence applicationPersistence) {
        this.applicationPersistence = applicationPersistence;
    }

    /**
     * Returns the application preferences local service.
     *
     * @return the application preferences local service
     */
    public com.liferay.pushnotifications.service.ApplicationPreferencesLocalService getApplicationPreferencesLocalService() {
        return applicationPreferencesLocalService;
    }

    /**
     * Sets the application preferences local service.
     *
     * @param applicationPreferencesLocalService the application preferences local service
     */
    public void setApplicationPreferencesLocalService(
        com.liferay.pushnotifications.service.ApplicationPreferencesLocalService applicationPreferencesLocalService) {
        this.applicationPreferencesLocalService = applicationPreferencesLocalService;
    }

    /**
     * Returns the application preferences persistence.
     *
     * @return the application preferences persistence
     */
    public ApplicationPreferencesPersistence getApplicationPreferencesPersistence() {
        return applicationPreferencesPersistence;
    }

    /**
     * Sets the application preferences persistence.
     *
     * @param applicationPreferencesPersistence the application preferences persistence
     */
    public void setApplicationPreferencesPersistence(
        ApplicationPreferencesPersistence applicationPreferencesPersistence) {
        this.applicationPreferencesPersistence = applicationPreferencesPersistence;
    }

    /**
     * Returns the app version local service.
     *
     * @return the app version local service
     */
    public com.liferay.pushnotifications.service.AppVersionLocalService getAppVersionLocalService() {
        return appVersionLocalService;
    }

    /**
     * Sets the app version local service.
     *
     * @param appVersionLocalService the app version local service
     */
    public void setAppVersionLocalService(
        com.liferay.pushnotifications.service.AppVersionLocalService appVersionLocalService) {
        this.appVersionLocalService = appVersionLocalService;
    }

    /**
     * Returns the app version persistence.
     *
     * @return the app version persistence
     */
    public AppVersionPersistence getAppVersionPersistence() {
        return appVersionPersistence;
    }

    /**
     * Sets the app version persistence.
     *
     * @param appVersionPersistence the app version persistence
     */
    public void setAppVersionPersistence(
        AppVersionPersistence appVersionPersistence) {
        this.appVersionPersistence = appVersionPersistence;
    }

    /**
     * Returns the push notifications device local service.
     *
     * @return the push notifications device local service
     */
    public com.liferay.pushnotifications.service.PushNotificationsDeviceLocalService getPushNotificationsDeviceLocalService() {
        return pushNotificationsDeviceLocalService;
    }

    /**
     * Sets the push notifications device local service.
     *
     * @param pushNotificationsDeviceLocalService the push notifications device local service
     */
    public void setPushNotificationsDeviceLocalService(
        com.liferay.pushnotifications.service.PushNotificationsDeviceLocalService pushNotificationsDeviceLocalService) {
        this.pushNotificationsDeviceLocalService = pushNotificationsDeviceLocalService;
    }

    /**
     * Returns the push notifications device remote service.
     *
     * @return the push notifications device remote service
     */
    public com.liferay.pushnotifications.service.PushNotificationsDeviceService getPushNotificationsDeviceService() {
        return pushNotificationsDeviceService;
    }

    /**
     * Sets the push notifications device remote service.
     *
     * @param pushNotificationsDeviceService the push notifications device remote service
     */
    public void setPushNotificationsDeviceService(
        com.liferay.pushnotifications.service.PushNotificationsDeviceService pushNotificationsDeviceService) {
        this.pushNotificationsDeviceService = pushNotificationsDeviceService;
    }

    /**
     * Returns the push notifications device persistence.
     *
     * @return the push notifications device persistence
     */
    public PushNotificationsDevicePersistence getPushNotificationsDevicePersistence() {
        return pushNotificationsDevicePersistence;
    }

    /**
     * Sets the push notifications device persistence.
     *
     * @param pushNotificationsDevicePersistence the push notifications device persistence
     */
    public void setPushNotificationsDevicePersistence(
        PushNotificationsDevicePersistence pushNotificationsDevicePersistence) {
        this.pushNotificationsDevicePersistence = pushNotificationsDevicePersistence;
    }

    /**
     * Returns the counter local service.
     *
     * @return the counter local service
     */
    public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
        return counterLocalService;
    }

    /**
     * Sets the counter local service.
     *
     * @param counterLocalService the counter local service
     */
    public void setCounterLocalService(
        com.liferay.counter.service.CounterLocalService counterLocalService) {
        this.counterLocalService = counterLocalService;
    }

    /**
     * Returns the resource local service.
     *
     * @return the resource local service
     */
    public com.liferay.portal.service.ResourceLocalService getResourceLocalService() {
        return resourceLocalService;
    }

    /**
     * Sets the resource local service.
     *
     * @param resourceLocalService the resource local service
     */
    public void setResourceLocalService(
        com.liferay.portal.service.ResourceLocalService resourceLocalService) {
        this.resourceLocalService = resourceLocalService;
    }

    /**
     * Returns the user local service.
     *
     * @return the user local service
     */
    public com.liferay.portal.service.UserLocalService getUserLocalService() {
        return userLocalService;
    }

    /**
     * Sets the user local service.
     *
     * @param userLocalService the user local service
     */
    public void setUserLocalService(
        com.liferay.portal.service.UserLocalService userLocalService) {
        this.userLocalService = userLocalService;
    }

    /**
     * Returns the user remote service.
     *
     * @return the user remote service
     */
    public com.liferay.portal.service.UserService getUserService() {
        return userService;
    }

    /**
     * Sets the user remote service.
     *
     * @param userService the user remote service
     */
    public void setUserService(
        com.liferay.portal.service.UserService userService) {
        this.userService = userService;
    }

    /**
     * Returns the user persistence.
     *
     * @return the user persistence
     */
    public UserPersistence getUserPersistence() {
        return userPersistence;
    }

    /**
     * Sets the user persistence.
     *
     * @param userPersistence the user persistence
     */
    public void setUserPersistence(UserPersistence userPersistence) {
        this.userPersistence = userPersistence;
    }

    public void afterPropertiesSet() {
        Class<?> clazz = getClass();

        _classLoader = clazz.getClassLoader();
    }

    public void destroy() {
    }

    /**
     * Returns the Spring bean ID for this bean.
     *
     * @return the Spring bean ID for this bean
     */
    @Override
    public String getBeanIdentifier() {
        return _beanIdentifier;
    }

    /**
     * Sets the Spring bean ID for this bean.
     *
     * @param beanIdentifier the Spring bean ID for this bean
     */
    @Override
    public void setBeanIdentifier(String beanIdentifier) {
        _beanIdentifier = beanIdentifier;
    }

    @Override
    public Object invokeMethod(String name, String[] parameterTypes,
        Object[] arguments) throws Throwable {
        Thread currentThread = Thread.currentThread();

        ClassLoader contextClassLoader = currentThread.getContextClassLoader();

        if (contextClassLoader != _classLoader) {
            currentThread.setContextClassLoader(_classLoader);
        }

        try {
            return _clpInvoker.invokeMethod(name, parameterTypes, arguments);
        } finally {
            if (contextClassLoader != _classLoader) {
                currentThread.setContextClassLoader(contextClassLoader);
            }
        }
    }

    protected Class<?> getModelClass() {
        return PushNotificationsDevice.class;
    }

    protected String getModelClassName() {
        return PushNotificationsDevice.class.getName();
    }

    /**
     * Performs an SQL query.
     *
     * @param sql the sql query
     */
    protected void runSQL(String sql) throws SystemException {
        try {
            DataSource dataSource = pushNotificationsDevicePersistence.getDataSource();

            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
                    sql, new int[0]);

            sqlUpdate.update();
        } catch (Exception e) {
            throw new SystemException(e);
        }
    }
}
