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            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
070            public ActionableDynamicQuery getActionableDynamicQuery();
071    
072            public DynamicQuery dynamicQuery();
073    
074            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
075            public ExportActionableDynamicQuery getExportActionableDynamicQuery(
076                    PortletDataContext portletDataContext);
077    
078            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
079            public IndexableActionableDynamicQuery getIndexableActionableDynamicQuery();
080    
081            /**
082            * @throws PortalException
083            */
084            @Override
085            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
086                    throws PortalException;
087    
088            @Override
089            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
090            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
091                    throws PortalException;
092    
093            /**
094            * Adds the ratings entry to the database. Also notifies the appropriate model listeners.
095            *
096            * @param ratingsEntry the ratings entry
097            * @return the ratings entry that was added
098            */
099            @Indexable(type = IndexableType.REINDEX)
100            public RatingsEntry addRatingsEntry(RatingsEntry ratingsEntry);
101    
102            /**
103            * Creates a new ratings entry with the primary key. Does not add the ratings entry to the database.
104            *
105            * @param entryId the primary key for the new ratings entry
106            * @return the new ratings entry
107            */
108            public RatingsEntry createRatingsEntry(long entryId);
109    
110            /**
111            * Deletes the ratings entry from the database. Also notifies the appropriate model listeners.
112            *
113            * @param ratingsEntry the ratings entry
114            * @return the ratings entry that was removed
115            */
116            @Indexable(type = IndexableType.DELETE)
117            public RatingsEntry deleteRatingsEntry(RatingsEntry ratingsEntry);
118    
119            /**
120            * Deletes the ratings entry with the primary key from the database. Also notifies the appropriate model listeners.
121            *
122            * @param entryId the primary key of the ratings entry
123            * @return the ratings entry that was removed
124            * @throws PortalException if a ratings entry with the primary key could not be found
125            */
126            @Indexable(type = IndexableType.DELETE)
127            public RatingsEntry deleteRatingsEntry(long entryId)
128                    throws PortalException;
129    
130            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
131            public RatingsEntry fetchEntry(long userId, java.lang.String className,
132                    long classPK);
133    
134            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
135            public RatingsEntry fetchRatingsEntry(long entryId);
136    
137            /**
138            * Returns the ratings entry with the matching UUID and company.
139            *
140            * @param uuid the ratings entry's UUID
141            * @param companyId the primary key of the company
142            * @return the matching ratings entry, or <code>null</code> if a matching ratings entry could not be found
143            */
144            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
145            public RatingsEntry fetchRatingsEntryByUuidAndCompanyId(
146                    java.lang.String uuid, long companyId);
147    
148            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
149            public RatingsEntry getEntry(long userId, java.lang.String className,
150                    long classPK) throws PortalException;
151    
152            /**
153            * Returns the ratings entry with the primary key.
154            *
155            * @param entryId the primary key of the ratings entry
156            * @return the ratings entry
157            * @throws PortalException if a ratings entry with the primary key could not be found
158            */
159            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
160            public RatingsEntry getRatingsEntry(long entryId) throws PortalException;
161    
162            /**
163            * Returns the ratings entry with the matching UUID and company.
164            *
165            * @param uuid the ratings entry's UUID
166            * @param companyId the primary key of the company
167            * @return the matching ratings entry
168            * @throws PortalException if a matching ratings entry could not be found
169            */
170            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
171            public RatingsEntry getRatingsEntryByUuidAndCompanyId(
172                    java.lang.String uuid, long companyId) throws PortalException;
173    
174            public RatingsEntry updateEntry(long userId, java.lang.String className,
175                    long classPK, double score, ServiceContext serviceContext)
176                    throws PortalException;
177    
178            /**
179            * Updates the ratings entry in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
180            *
181            * @param ratingsEntry the ratings entry
182            * @return the ratings entry that was updated
183            */
184            @Indexable(type = IndexableType.REINDEX)
185            public RatingsEntry updateRatingsEntry(RatingsEntry ratingsEntry);
186    
187            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
188            public int getEntriesCount(java.lang.String className, long classPK,
189                    double score);
190    
191            /**
192            * Returns the number of ratings entries.
193            *
194            * @return the number of ratings entries
195            */
196            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
197            public int getRatingsEntriesCount();
198    
199            /**
200            * Returns the OSGi service identifier.
201            *
202            * @return the OSGi service identifier
203            */
204            public java.lang.String getOSGiServiceIdentifier();
205    
206            /**
207            * Performs a dynamic query on the database and returns the matching rows.
208            *
209            * @param dynamicQuery the dynamic query
210            * @return the matching rows
211            */
212            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery);
213    
214            /**
215            * Performs a dynamic query on the database and returns a range of the matching rows.
216            *
217            * <p>
218            * 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.
219            * </p>
220            *
221            * @param dynamicQuery the dynamic query
222            * @param start the lower bound of the range of model instances
223            * @param end the upper bound of the range of model instances (not inclusive)
224            * @return the range of matching rows
225            */
226            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
227                    int end);
228    
229            /**
230            * Performs a dynamic query on the database and returns an ordered range of the matching rows.
231            *
232            * <p>
233            * 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.
234            * </p>
235            *
236            * @param dynamicQuery the dynamic query
237            * @param start the lower bound of the range of model instances
238            * @param end the upper bound of the range of model instances (not inclusive)
239            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
240            * @return the ordered range of matching rows
241            */
242            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
243                    int end, OrderByComparator<T> orderByComparator);
244    
245            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
246            public List<RatingsEntry> getEntries(java.lang.String className,
247                    long classPK);
248    
249            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
250            public List<RatingsEntry> getEntries(java.lang.String className,
251                    long classPK, double score);
252    
253            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
254            public List<RatingsEntry> getEntries(long userId,
255                    java.lang.String className, List<java.lang.Long> classPKs);
256    
257            /**
258            * Returns a range of all the ratings entries.
259            *
260            * <p>
261            * 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.
262            * </p>
263            *
264            * @param start the lower bound of the range of ratings entries
265            * @param end the upper bound of the range of ratings entries (not inclusive)
266            * @return the range of ratings entries
267            */
268            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
269            public List<RatingsEntry> getRatingsEntries(int start, int end);
270    
271            /**
272            * Returns the number of rows matching the dynamic query.
273            *
274            * @param dynamicQuery the dynamic query
275            * @return the number of rows matching the dynamic query
276            */
277            public long dynamicQueryCount(DynamicQuery dynamicQuery);
278    
279            /**
280            * Returns the number of rows matching the dynamic query.
281            *
282            * @param dynamicQuery the dynamic query
283            * @param projection the projection to apply to the query
284            * @return the number of rows matching the dynamic query
285            */
286            public long dynamicQueryCount(DynamicQuery dynamicQuery,
287                    Projection projection);
288    
289            @SystemEvent(type = SystemEventConstants.TYPE_DELETE)
290            public void deleteEntry(RatingsEntry entry, long userId,
291                    java.lang.String className, long classPK) throws PortalException;
292    
293            public void deleteEntry(long userId, java.lang.String className,
294                    long classPK) throws PortalException;
295    }