/** * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ package com.ese.ils.beta.service.base; import com.ese.ils.beta.model.Favorite; import com.ese.ils.beta.service.FavoriteLocalService; import com.ese.ils.beta.service.ModuleLocalService; import com.ese.ils.beta.service.PanicButtonLocalService; import com.ese.ils.beta.service.QuestionLocalService; import com.ese.ils.beta.service.SlideLocalService; import com.ese.ils.beta.service.UserInfoLocalService; import com.ese.ils.beta.service.persistence.FavoritePersistence; import com.ese.ils.beta.service.persistence.ModulePersistence; import com.ese.ils.beta.service.persistence.PanicButtonPersistence; import com.ese.ils.beta.service.persistence.QuestionPersistence; import com.ese.ils.beta.service.persistence.SlidePersistence; import com.ese.ils.beta.service.persistence.UserInfoPersistence; import com.liferay.counter.service.CounterLocalService; 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.dao.orm.DynamicQuery; import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil; import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.search.Indexable; import com.liferay.portal.kernel.search.IndexableType; import com.liferay.portal.kernel.util.OrderByComparator; import com.liferay.portal.model.PersistedModel; import com.liferay.portal.service.BaseLocalServiceImpl; import com.liferay.portal.service.PersistedModelLocalServiceRegistryUtil; import com.liferay.portal.service.ResourceLocalService; import com.liferay.portal.service.ResourceService; import com.liferay.portal.service.UserLocalService; import com.liferay.portal.service.UserService; import com.liferay.portal.service.persistence.ResourcePersistence; import com.liferay.portal.service.persistence.UserPersistence; import java.io.Serializable; import java.util.List; import javax.sql.DataSource; /** * The base implementation of the favorite local 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.ese.ils.beta.service.impl.FavoriteLocalServiceImpl}. * </p> * * @author edik * @see com.ese.ils.beta.service.impl.FavoriteLocalServiceImpl * @see com.ese.ils.beta.service.FavoriteLocalServiceUtil * @generated */ public abstract class FavoriteLocalServiceBaseImpl extends BaseLocalServiceImpl implements FavoriteLocalService, IdentifiableBean { /* * NOTE FOR DEVELOPERS: * * Never modify or reference this class directly. Always use {@link com.ese.ils.beta.service.FavoriteLocalServiceUtil} to access the favorite local service. */ /** * Adds the favorite to the database. Also notifies the appropriate model listeners. * * @param favorite the favorite * @return the favorite that was added * @throws SystemException if a system exception occurred */ @Indexable(type = IndexableType.REINDEX) public Favorite addFavorite(Favorite favorite) throws SystemException { favorite.setNew(true); return favoritePersistence.update(favorite, false); } /** * Creates a new favorite with the primary key. Does not add the favorite to the database. * * @param favoriteId the primary key for the new favorite * @return the new favorite */ public Favorite createFavorite(long favoriteId) { return favoritePersistence.create(favoriteId); } /** * Deletes the favorite with the primary key from the database. Also notifies the appropriate model listeners. * * @param favoriteId the primary key of the favorite * @return the favorite that was removed * @throws PortalException if a favorite with the primary key could not be found * @throws SystemException if a system exception occurred */ @Indexable(type = IndexableType.DELETE) public Favorite deleteFavorite(long favoriteId) throws PortalException, SystemException { return favoritePersistence.remove(favoriteId); } /** * Deletes the favorite from the database. Also notifies the appropriate model listeners. * * @param favorite the favorite * @return the favorite that was removed * @throws SystemException if a system exception occurred */ @Indexable(type = IndexableType.DELETE) public Favorite deleteFavorite(Favorite favorite) throws SystemException { return favoritePersistence.remove(favorite); } public DynamicQuery dynamicQuery() { Class<?> clazz = getClass(); return DynamicQueryFactoryUtil.forClass(Favorite.class, clazz.getClassLoader()); } /** * Performs a dynamic query on the database and returns the matching rows. * * @param dynamicQuery the dynamic query * @return the matching rows * @throws SystemException if a system exception occurred */ @SuppressWarnings("rawtypes") public List dynamicQuery(DynamicQuery dynamicQuery) throws SystemException { return favoritePersistence.findWithDynamicQuery(dynamicQuery); } /** * Performs a dynamic query on the database and returns a range of the matching rows. * * <p> * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. * </p> * * @param dynamicQuery the dynamic query * @param start the lower bound of the range of model instances * @param end the upper bound of the range of model instances (not inclusive) * @return the range of matching rows * @throws SystemException if a system exception occurred */ @SuppressWarnings("rawtypes") public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end) throws SystemException { return favoritePersistence.findWithDynamicQuery(dynamicQuery, start, end); } /** * Performs a dynamic query on the database and returns an ordered range of the matching rows. * * <p> * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. * </p> * * @param dynamicQuery the dynamic query * @param start the lower bound of the range of model instances * @param end the upper bound of the range of model instances (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching rows * @throws SystemException if a system exception occurred */ @SuppressWarnings("rawtypes") public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end, OrderByComparator orderByComparator) throws SystemException { return favoritePersistence.findWithDynamicQuery(dynamicQuery, start, end, orderByComparator); } /** * Returns the number of rows that match the dynamic query. * * @param dynamicQuery the dynamic query * @return the number of rows that match the dynamic query * @throws SystemException if a system exception occurred */ public long dynamicQueryCount(DynamicQuery dynamicQuery) throws SystemException { return favoritePersistence.countWithDynamicQuery(dynamicQuery); } public Favorite fetchFavorite(long favoriteId) throws SystemException { return favoritePersistence.fetchByPrimaryKey(favoriteId); } /** * Returns the favorite with the primary key. * * @param favoriteId the primary key of the favorite * @return the favorite * @throws PortalException if a favorite with the primary key could not be found * @throws SystemException if a system exception occurred */ public Favorite getFavorite(long favoriteId) throws PortalException, SystemException { return favoritePersistence.findByPrimaryKey(favoriteId); } public PersistedModel getPersistedModel(Serializable primaryKeyObj) throws PortalException, SystemException { return favoritePersistence.findByPrimaryKey(primaryKeyObj); } /** * Returns a range of all the favorites. * * <p> * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. * </p> * * @param start the lower bound of the range of favorites * @param end the upper bound of the range of favorites (not inclusive) * @return the range of favorites * @throws SystemException if a system exception occurred */ public List<Favorite> getFavorites(int start, int end) throws SystemException { return favoritePersistence.findAll(start, end); } /** * Returns the number of favorites. * * @return the number of favorites * @throws SystemException if a system exception occurred */ public int getFavoritesCount() throws SystemException { return favoritePersistence.countAll(); } /** * Updates the favorite in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. * * @param favorite the favorite * @return the favorite that was updated * @throws SystemException if a system exception occurred */ @Indexable(type = IndexableType.REINDEX) public Favorite updateFavorite(Favorite favorite) throws SystemException { return updateFavorite(favorite, true); } /** * Updates the favorite in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. * * @param favorite the favorite * @param merge whether to merge the favorite with the current session. See {@link com.liferay.portal.service.persistence.BatchSession#update(com.liferay.portal.kernel.dao.orm.Session, com.liferay.portal.model.BaseModel, boolean)} for an explanation. * @return the favorite that was updated * @throws SystemException if a system exception occurred */ @Indexable(type = IndexableType.REINDEX) public Favorite updateFavorite(Favorite favorite, boolean merge) throws SystemException { favorite.setNew(false); return favoritePersistence.update(favorite, merge); } /** * Returns the favorite local service. * * @return the favorite local service */ public FavoriteLocalService getFavoriteLocalService() { return favoriteLocalService; } /** * Sets the favorite local service. * * @param favoriteLocalService the favorite local service */ public void setFavoriteLocalService( FavoriteLocalService favoriteLocalService) { this.favoriteLocalService = favoriteLocalService; } /** * Returns the favorite persistence. * * @return the favorite persistence */ public FavoritePersistence getFavoritePersistence() { return favoritePersistence; } /** * Sets the favorite persistence. * * @param favoritePersistence the favorite persistence */ public void setFavoritePersistence(FavoritePersistence favoritePersistence) { this.favoritePersistence = favoritePersistence; } /** * Returns the module local service. * * @return the module local service */ public ModuleLocalService getModuleLocalService() { return moduleLocalService; } /** * Sets the module local service. * * @param moduleLocalService the module local service */ public void setModuleLocalService(ModuleLocalService moduleLocalService) { this.moduleLocalService = moduleLocalService; } /** * Returns the module persistence. * * @return the module persistence */ public ModulePersistence getModulePersistence() { return modulePersistence; } /** * Sets the module persistence. * * @param modulePersistence the module persistence */ public void setModulePersistence(ModulePersistence modulePersistence) { this.modulePersistence = modulePersistence; } /** * Returns the panic button local service. * * @return the panic button local service */ public PanicButtonLocalService getPanicButtonLocalService() { return panicButtonLocalService; } /** * Sets the panic button local service. * * @param panicButtonLocalService the panic button local service */ public void setPanicButtonLocalService( PanicButtonLocalService panicButtonLocalService) { this.panicButtonLocalService = panicButtonLocalService; } /** * Returns the panic button persistence. * * @return the panic button persistence */ public PanicButtonPersistence getPanicButtonPersistence() { return panicButtonPersistence; } /** * Sets the panic button persistence. * * @param panicButtonPersistence the panic button persistence */ public void setPanicButtonPersistence( PanicButtonPersistence panicButtonPersistence) { this.panicButtonPersistence = panicButtonPersistence; } /** * Returns the question local service. * * @return the question local service */ public QuestionLocalService getQuestionLocalService() { return questionLocalService; } /** * Sets the question local service. * * @param questionLocalService the question local service */ public void setQuestionLocalService( QuestionLocalService questionLocalService) { this.questionLocalService = questionLocalService; } /** * Returns the question persistence. * * @return the question persistence */ public QuestionPersistence getQuestionPersistence() { return questionPersistence; } /** * Sets the question persistence. * * @param questionPersistence the question persistence */ public void setQuestionPersistence(QuestionPersistence questionPersistence) { this.questionPersistence = questionPersistence; } /** * Returns the slide local service. * * @return the slide local service */ public SlideLocalService getSlideLocalService() { return slideLocalService; } /** * Sets the slide local service. * * @param slideLocalService the slide local service */ public void setSlideLocalService(SlideLocalService slideLocalService) { this.slideLocalService = slideLocalService; } /** * Returns the slide persistence. * * @return the slide persistence */ public SlidePersistence getSlidePersistence() { return slidePersistence; } /** * Sets the slide persistence. * * @param slidePersistence the slide persistence */ public void setSlidePersistence(SlidePersistence slidePersistence) { this.slidePersistence = slidePersistence; } /** * Returns the user info local service. * * @return the user info local service */ public UserInfoLocalService getUserInfoLocalService() { return userInfoLocalService; } /** * Sets the user info local service. * * @param userInfoLocalService the user info local service */ public void setUserInfoLocalService( UserInfoLocalService userInfoLocalService) { this.userInfoLocalService = userInfoLocalService; } /** * Returns the user info persistence. * * @return the user info persistence */ public UserInfoPersistence getUserInfoPersistence() { return userInfoPersistence; } /** * Sets the user info persistence. * * @param userInfoPersistence the user info persistence */ public void setUserInfoPersistence(UserInfoPersistence userInfoPersistence) { this.userInfoPersistence = userInfoPersistence; } /** * Returns the counter local service. * * @return the counter local service */ public CounterLocalService getCounterLocalService() { return counterLocalService; } /** * Sets the counter local service. * * @param counterLocalService the counter local service */ public void setCounterLocalService(CounterLocalService counterLocalService) { this.counterLocalService = counterLocalService; } /** * Returns the resource local service. * * @return the resource local service */ public ResourceLocalService getResourceLocalService() { return resourceLocalService; } /** * Sets the resource local service. * * @param resourceLocalService the resource local service */ public void setResourceLocalService( ResourceLocalService resourceLocalService) { this.resourceLocalService = resourceLocalService; } /** * Returns the resource remote service. * * @return the resource remote service */ public ResourceService getResourceService() { return resourceService; } /** * Sets the resource remote service. * * @param resourceService the resource remote service */ public void setResourceService(ResourceService resourceService) { this.resourceService = resourceService; } /** * Returns the resource persistence. * * @return the resource persistence */ public ResourcePersistence getResourcePersistence() { return resourcePersistence; } /** * Sets the resource persistence. * * @param resourcePersistence the resource persistence */ public void setResourcePersistence(ResourcePersistence resourcePersistence) { this.resourcePersistence = resourcePersistence; } /** * Returns the user local service. * * @return the user local service */ public UserLocalService getUserLocalService() { return userLocalService; } /** * Sets the user local service. * * @param userLocalService the user local service */ public void setUserLocalService(UserLocalService userLocalService) { this.userLocalService = userLocalService; } /** * Returns the user remote service. * * @return the user remote service */ public UserService getUserService() { return userService; } /** * Sets the user remote service. * * @param userService the user remote service */ public void setUserService(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() { PersistedModelLocalServiceRegistryUtil.register("com.ese.ils.beta.model.Favorite", favoriteLocalService); } public void destroy() { PersistedModelLocalServiceRegistryUtil.unregister( "com.ese.ils.beta.model.Favorite"); } /** * Returns the Spring bean ID for this bean. * * @return the Spring bean ID for this bean */ public String getBeanIdentifier() { return _beanIdentifier; } /** * Sets the Spring bean ID for this bean. * * @param beanIdentifier the Spring bean ID for this bean */ public void setBeanIdentifier(String beanIdentifier) { _beanIdentifier = beanIdentifier; } public Object invokeMethod(String name, String[] parameterTypes, Object[] arguments) throws Throwable { return _clpInvoker.invokeMethod(name, parameterTypes, arguments); } protected Class<?> getModelClass() { return Favorite.class; } protected String getModelClassName() { return Favorite.class.getName(); } /** * Performs an SQL query. * * @param sql the sql query */ protected void runSQL(String sql) throws SystemException { try { DataSource dataSource = favoritePersistence.getDataSource(); SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource, sql, new int[0]); sqlUpdate.update(); } catch (Exception e) { throw new SystemException(e); } } @BeanReference(type = FavoriteLocalService.class) protected FavoriteLocalService favoriteLocalService; @BeanReference(type = FavoritePersistence.class) protected FavoritePersistence favoritePersistence; @BeanReference(type = ModuleLocalService.class) protected ModuleLocalService moduleLocalService; @BeanReference(type = ModulePersistence.class) protected ModulePersistence modulePersistence; @BeanReference(type = PanicButtonLocalService.class) protected PanicButtonLocalService panicButtonLocalService; @BeanReference(type = PanicButtonPersistence.class) protected PanicButtonPersistence panicButtonPersistence; @BeanReference(type = QuestionLocalService.class) protected QuestionLocalService questionLocalService; @BeanReference(type = QuestionPersistence.class) protected QuestionPersistence questionPersistence; @BeanReference(type = SlideLocalService.class) protected SlideLocalService slideLocalService; @BeanReference(type = SlidePersistence.class) protected SlidePersistence slidePersistence; @BeanReference(type = UserInfoLocalService.class) protected UserInfoLocalService userInfoLocalService; @BeanReference(type = UserInfoPersistence.class) protected UserInfoPersistence userInfoPersistence; @BeanReference(type = CounterLocalService.class) protected CounterLocalService counterLocalService; @BeanReference(type = ResourceLocalService.class) protected ResourceLocalService resourceLocalService; @BeanReference(type = ResourceService.class) protected ResourceService resourceService; @BeanReference(type = ResourcePersistence.class) protected ResourcePersistence resourcePersistence; @BeanReference(type = UserLocalService.class) protected UserLocalService userLocalService; @BeanReference(type = UserService.class) protected UserService userService; @BeanReference(type = UserPersistence.class) protected UserPersistence userPersistence; private String _beanIdentifier; private FavoriteLocalServiceClpInvoker _clpInvoker = new FavoriteLocalServiceClpInvoker(); }