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.ratings.kernel.service; 016 017 import aQute.bnd.annotation.ProviderType; 018 019 import com.liferay.exportimport.kernel.lar.PortletDataContext; 020 021 import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery; 022 import com.liferay.portal.kernel.dao.orm.DynamicQuery; 023 import com.liferay.portal.kernel.dao.orm.ExportActionableDynamicQuery; 024 import com.liferay.portal.kernel.dao.orm.IndexableActionableDynamicQuery; 025 import com.liferay.portal.kernel.dao.orm.Projection; 026 import com.liferay.portal.kernel.exception.PortalException; 027 import com.liferay.portal.kernel.exception.SystemException; 028 import com.liferay.portal.kernel.model.PersistedModel; 029 import com.liferay.portal.kernel.model.SystemEventConstants; 030 import com.liferay.portal.kernel.search.Indexable; 031 import com.liferay.portal.kernel.search.IndexableType; 032 import com.liferay.portal.kernel.service.BaseLocalService; 033 import com.liferay.portal.kernel.service.PersistedModelLocalService; 034 import com.liferay.portal.kernel.service.ServiceContext; 035 import com.liferay.portal.kernel.systemevent.SystemEvent; 036 import com.liferay.portal.kernel.transaction.Isolation; 037 import com.liferay.portal.kernel.transaction.Propagation; 038 import com.liferay.portal.kernel.transaction.Transactional; 039 import com.liferay.portal.kernel.util.OrderByComparator; 040 041 import com.liferay.ratings.kernel.model.RatingsEntry; 042 043 import java.io.Serializable; 044 045 import java.util.List; 046 047 /** 048 * Provides the local service interface for RatingsEntry. Methods of this 049 * service will not have security checks based on the propagated JAAS 050 * credentials because this service can only be accessed from within the same 051 * VM. 052 * 053 * @author Brian Wing Shun Chan 054 * @see RatingsEntryLocalServiceUtil 055 * @see com.liferay.portlet.ratings.service.base.RatingsEntryLocalServiceBaseImpl 056 * @see com.liferay.portlet.ratings.service.impl.RatingsEntryLocalServiceImpl 057 * @generated 058 */ 059 @ProviderType 060 @Transactional(isolation = Isolation.PORTAL, rollbackFor = { 061 PortalException.class, SystemException.class}) 062 public interface RatingsEntryLocalService extends BaseLocalService, 063 PersistedModelLocalService { 064 /* 065 * NOTE FOR DEVELOPERS: 066 * 067 * Never modify or reference this interface directly. Always use {@link RatingsEntryLocalServiceUtil} to access the ratings entry local service. Add custom service methods to {@link com.liferay.portlet.ratings.service.impl.RatingsEntryLocalServiceImpl} and rerun ServiceBuilder to automatically copy the method declarations to this interface. 068 */ 069 070 /** 071 * Adds the ratings entry to the database. Also notifies the appropriate model listeners. 072 * 073 * @param ratingsEntry the ratings entry 074 * @return the ratings entry that was added 075 */ 076 @Indexable(type = IndexableType.REINDEX) 077 public RatingsEntry addRatingsEntry(RatingsEntry ratingsEntry); 078 079 /** 080 * Creates a new ratings entry with the primary key. Does not add the ratings entry to the database. 081 * 082 * @param entryId the primary key for the new ratings entry 083 * @return the new ratings entry 084 */ 085 public RatingsEntry createRatingsEntry(long entryId); 086 087 @SystemEvent(type = SystemEventConstants.TYPE_DELETE) 088 public void deleteEntry(RatingsEntry entry, long userId, 089 java.lang.String className, long classPK) throws PortalException; 090 091 public void deleteEntry(long userId, java.lang.String className, 092 long classPK) throws PortalException; 093 094 /** 095 * @throws PortalException 096 */ 097 @Override 098 public PersistedModel deletePersistedModel(PersistedModel persistedModel) 099 throws PortalException; 100 101 /** 102 * Deletes the ratings entry with the primary key from the database. Also notifies the appropriate model listeners. 103 * 104 * @param entryId the primary key of the ratings entry 105 * @return the ratings entry that was removed 106 * @throws PortalException if a ratings entry with the primary key could not be found 107 */ 108 @Indexable(type = IndexableType.DELETE) 109 public RatingsEntry deleteRatingsEntry(long entryId) 110 throws PortalException; 111 112 /** 113 * Deletes the ratings entry from the database. Also notifies the appropriate model listeners. 114 * 115 * @param ratingsEntry the ratings entry 116 * @return the ratings entry that was removed 117 */ 118 @Indexable(type = IndexableType.DELETE) 119 public RatingsEntry deleteRatingsEntry(RatingsEntry ratingsEntry); 120 121 public DynamicQuery dynamicQuery(); 122 123 /** 124 * Performs a dynamic query on the database and returns the matching rows. 125 * 126 * @param dynamicQuery the dynamic query 127 * @return the matching rows 128 */ 129 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery); 130 131 /** 132 * Performs a dynamic query on the database and returns a range of the matching rows. 133 * 134 * <p> 135 * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.ratings.model.impl.RatingsEntryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. 136 * </p> 137 * 138 * @param dynamicQuery the dynamic query 139 * @param start the lower bound of the range of model instances 140 * @param end the upper bound of the range of model instances (not inclusive) 141 * @return the range of matching rows 142 */ 143 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start, 144 int end); 145 146 /** 147 * Performs a dynamic query on the database and returns an ordered range of the matching rows. 148 * 149 * <p> 150 * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.ratings.model.impl.RatingsEntryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. 151 * </p> 152 * 153 * @param dynamicQuery the dynamic query 154 * @param start the lower bound of the range of model instances 155 * @param end the upper bound of the range of model instances (not inclusive) 156 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 157 * @return the ordered range of matching rows 158 */ 159 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start, 160 int end, OrderByComparator<T> orderByComparator); 161 162 /** 163 * Returns the number of rows matching the dynamic query. 164 * 165 * @param dynamicQuery the dynamic query 166 * @return the number of rows matching the dynamic query 167 */ 168 public long dynamicQueryCount(DynamicQuery dynamicQuery); 169 170 /** 171 * Returns the number of rows matching the dynamic query. 172 * 173 * @param dynamicQuery the dynamic query 174 * @param projection the projection to apply to the query 175 * @return the number of rows matching the dynamic query 176 */ 177 public long dynamicQueryCount(DynamicQuery dynamicQuery, 178 Projection projection); 179 180 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 181 public RatingsEntry fetchEntry(long userId, java.lang.String className, 182 long classPK); 183 184 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 185 public RatingsEntry fetchRatingsEntry(long entryId); 186 187 /** 188 * Returns the ratings entry with the matching UUID and company. 189 * 190 * @param uuid the ratings entry's UUID 191 * @param companyId the primary key of the company 192 * @return the matching ratings entry, or <code>null</code> if a matching ratings entry could not be found 193 */ 194 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 195 public RatingsEntry fetchRatingsEntryByUuidAndCompanyId( 196 java.lang.String uuid, long companyId); 197 198 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 199 public ActionableDynamicQuery getActionableDynamicQuery(); 200 201 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 202 public List<RatingsEntry> getEntries(java.lang.String className, 203 long classPK); 204 205 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 206 public List<RatingsEntry> getEntries(java.lang.String className, 207 long classPK, double score); 208 209 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 210 public List<RatingsEntry> getEntries(long userId, 211 java.lang.String className, List<java.lang.Long> classPKs); 212 213 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 214 public int getEntriesCount(java.lang.String className, long classPK, 215 double score); 216 217 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 218 public RatingsEntry getEntry(long userId, java.lang.String className, 219 long classPK) throws PortalException; 220 221 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 222 public ExportActionableDynamicQuery getExportActionableDynamicQuery( 223 PortletDataContext portletDataContext); 224 225 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 226 public IndexableActionableDynamicQuery getIndexableActionableDynamicQuery(); 227 228 /** 229 * Returns the OSGi service identifier. 230 * 231 * @return the OSGi service identifier 232 */ 233 public java.lang.String getOSGiServiceIdentifier(); 234 235 @Override 236 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 237 public PersistedModel getPersistedModel(Serializable primaryKeyObj) 238 throws PortalException; 239 240 /** 241 * Returns a range of all the ratings entries. 242 * 243 * <p> 244 * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.ratings.model.impl.RatingsEntryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. 245 * </p> 246 * 247 * @param start the lower bound of the range of ratings entries 248 * @param end the upper bound of the range of ratings entries (not inclusive) 249 * @return the range of ratings entries 250 */ 251 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 252 public List<RatingsEntry> getRatingsEntries(int start, int end); 253 254 /** 255 * Returns the number of ratings entries. 256 * 257 * @return the number of ratings entries 258 */ 259 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 260 public int getRatingsEntriesCount(); 261 262 /** 263 * Returns the ratings entry with the primary key. 264 * 265 * @param entryId the primary key of the ratings entry 266 * @return the ratings entry 267 * @throws PortalException if a ratings entry with the primary key could not be found 268 */ 269 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 270 public RatingsEntry getRatingsEntry(long entryId) throws PortalException; 271 272 /** 273 * Returns the ratings entry with the matching UUID and company. 274 * 275 * @param uuid the ratings entry's UUID 276 * @param companyId the primary key of the company 277 * @return the matching ratings entry 278 * @throws PortalException if a matching ratings entry could not be found 279 */ 280 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 281 public RatingsEntry getRatingsEntryByUuidAndCompanyId( 282 java.lang.String uuid, long companyId) throws PortalException; 283 284 public RatingsEntry updateEntry(long userId, java.lang.String className, 285 long classPK, double score, ServiceContext serviceContext) 286 throws PortalException; 287 288 /** 289 * Updates the ratings entry in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 290 * 291 * @param ratingsEntry the ratings entry 292 * @return the ratings entry that was updated 293 */ 294 @Indexable(type = IndexableType.REINDEX) 295 public RatingsEntry updateRatingsEntry(RatingsEntry ratingsEntry); 296 }