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;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.exception.PortalException;
020    import com.liferay.portal.kernel.exception.SystemException;
021    import com.liferay.portal.kernel.search.IndexableType;
022    import com.liferay.portal.kernel.transaction.Isolation;
023    import com.liferay.portal.kernel.transaction.Propagation;
024    import com.liferay.portal.kernel.transaction.Transactional;
025    
026    /**
027     * Provides the local service interface for Subscription. Methods of this
028     * service will not have security checks based on the propagated JAAS
029     * credentials because this service can only be accessed from within the same
030     * VM.
031     *
032     * @author Brian Wing Shun Chan
033     * @see SubscriptionLocalServiceUtil
034     * @see com.liferay.portal.service.base.SubscriptionLocalServiceBaseImpl
035     * @see com.liferay.portal.service.impl.SubscriptionLocalServiceImpl
036     * @generated
037     */
038    @ProviderType
039    @Transactional(isolation = Isolation.PORTAL, rollbackFor =  {
040            PortalException.class, SystemException.class})
041    public interface SubscriptionLocalService extends BaseLocalService,
042            PersistedModelLocalService {
043            /*
044             * NOTE FOR DEVELOPERS:
045             *
046             * Never modify or reference this interface directly. Always use {@link SubscriptionLocalServiceUtil} to access the subscription local service. Add custom service methods to {@link com.liferay.portal.service.impl.SubscriptionLocalServiceImpl} and rerun ServiceBuilder to automatically copy the method declarations to this interface.
047             */
048    
049            /**
050            * Adds the subscription to the database. Also notifies the appropriate model listeners.
051            *
052            * @param subscription the subscription
053            * @return the subscription that was added
054            */
055            @com.liferay.portal.kernel.search.Indexable(type = IndexableType.REINDEX)
056            public com.liferay.portal.model.Subscription addSubscription(
057                    com.liferay.portal.model.Subscription subscription);
058    
059            /**
060            * Subscribes the user to the entity, notifying him the instant the entity
061            * is created, deleted, or modified.
062            *
063            * <p>
064            * If there is no asset entry with the class name and class PK a new asset
065            * entry is created.
066            * </p>
067            *
068            * <p>
069            * A social activity for the subscription is created using the asset entry
070            * associated with the class name and class PK, or the newly created asset
071            * entry.
072            * </p>
073            *
074            * @param userId the primary key of the user
075            * @param groupId the primary key of the entity's group
076            * @param className the entity's class name
077            * @param classPK the primary key of the entity's instance
078            * @return the subscription
079            * @throws PortalException if a matching user or group could not be found
080            */
081            public com.liferay.portal.model.Subscription addSubscription(long userId,
082                    long groupId, java.lang.String className, long classPK)
083                    throws PortalException;
084    
085            /**
086            * Subscribes the user to the entity, notifying him at the given frequency.
087            *
088            * <p>
089            * If there is no asset entry with the class name and class PK a new asset
090            * entry is created.
091            * </p>
092            *
093            * <p>
094            * A social activity for the subscription is created using the asset entry
095            * associated with the class name and class PK, or the newly created asset
096            * entry.
097            * </p>
098            *
099            * @param userId the primary key of the user
100            * @param groupId the primary key of the entity's group
101            * @param className the entity's class name
102            * @param classPK the primary key of the entity's instance
103            * @param frequency the frequency for notifications
104            * @return the subscription
105            * @throws PortalException if a matching user or group could not be found
106            */
107            public com.liferay.portal.model.Subscription addSubscription(long userId,
108                    long groupId, java.lang.String className, long classPK,
109                    java.lang.String frequency) throws PortalException;
110    
111            /**
112            * Creates a new subscription with the primary key. Does not add the subscription to the database.
113            *
114            * @param subscriptionId the primary key for the new subscription
115            * @return the new subscription
116            */
117            public com.liferay.portal.model.Subscription createSubscription(
118                    long subscriptionId);
119    
120            /**
121            * @throws PortalException
122            */
123            @Override
124            public com.liferay.portal.model.PersistedModel deletePersistedModel(
125                    com.liferay.portal.model.PersistedModel persistedModel)
126                    throws PortalException;
127    
128            /**
129            * Deletes the subscription from the database. Also notifies the appropriate model listeners.
130            *
131            * @param subscription the subscription
132            * @return the subscription that was removed
133            * @throws PortalException
134            */
135            @com.liferay.portal.kernel.search.Indexable(type = IndexableType.DELETE)
136            public com.liferay.portal.model.Subscription deleteSubscription(
137                    com.liferay.portal.model.Subscription subscription)
138                    throws PortalException;
139    
140            /**
141            * Deletes the subscription with the primary key from the database. Also notifies the appropriate model listeners.
142            *
143            * @param subscriptionId the primary key of the subscription
144            * @return the subscription that was removed
145            * @throws PortalException if a subscription with the primary key could not be found
146            */
147            @com.liferay.portal.kernel.search.Indexable(type = IndexableType.DELETE)
148            public com.liferay.portal.model.Subscription deleteSubscription(
149                    long subscriptionId) throws PortalException;
150    
151            /**
152            * Deletes the user's subscription to the entity. A social activity with the
153            * unsubscribe action is created.
154            *
155            * @param userId the primary key of the user
156            * @param className the entity's class name
157            * @param classPK the primary key of the entity's instance
158            * @throws PortalException if a matching user or subscription could not be
159            found
160            */
161            public void deleteSubscription(long userId, java.lang.String className,
162                    long classPK) throws PortalException;
163    
164            /**
165            * Deletes all the subscriptions to the entity.
166            *
167            * @param companyId the primary key of the company
168            * @param className the entity's class name
169            * @param classPK the primary key of the entity's instance
170            * @throws PortalException if a portal exception occurred
171            */
172            public void deleteSubscriptions(long companyId, java.lang.String className,
173                    long classPK) throws PortalException;
174    
175            /**
176            * Deletes all the subscriptions of the user.
177            *
178            * @param userId the primary key of the user
179            * @throws PortalException if a portal exception occurred
180            */
181            public void deleteSubscriptions(long userId) throws PortalException;
182    
183            public void deleteSubscriptions(long userId, long groupId)
184                    throws PortalException;
185    
186            public com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery();
187    
188            /**
189            * Performs a dynamic query on the database and returns the matching rows.
190            *
191            * @param dynamicQuery the dynamic query
192            * @return the matching rows
193            */
194            public <T> java.util.List<T> dynamicQuery(
195                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery);
196    
197            /**
198            * Performs a dynamic query on the database and returns a range of the matching rows.
199            *
200            * <p>
201            * 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.portal.model.impl.SubscriptionModelImpl}. 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.
202            * </p>
203            *
204            * @param dynamicQuery the dynamic query
205            * @param start the lower bound of the range of model instances
206            * @param end the upper bound of the range of model instances (not inclusive)
207            * @return the range of matching rows
208            */
209            public <T> java.util.List<T> dynamicQuery(
210                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
211                    int end);
212    
213            /**
214            * Performs a dynamic query on the database and returns an ordered range of the matching rows.
215            *
216            * <p>
217            * 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.portal.model.impl.SubscriptionModelImpl}. 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.
218            * </p>
219            *
220            * @param dynamicQuery the dynamic query
221            * @param start the lower bound of the range of model instances
222            * @param end the upper bound of the range of model instances (not inclusive)
223            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
224            * @return the ordered range of matching rows
225            */
226            public <T> java.util.List<T> dynamicQuery(
227                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
228                    int end,
229                    com.liferay.portal.kernel.util.OrderByComparator<T> orderByComparator);
230    
231            /**
232            * Returns the number of rows matching the dynamic query.
233            *
234            * @param dynamicQuery the dynamic query
235            * @return the number of rows matching the dynamic query
236            */
237            public long dynamicQueryCount(
238                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery);
239    
240            /**
241            * Returns the number of rows matching the dynamic query.
242            *
243            * @param dynamicQuery the dynamic query
244            * @param projection the projection to apply to the query
245            * @return the number of rows matching the dynamic query
246            */
247            public long dynamicQueryCount(
248                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery,
249                    com.liferay.portal.kernel.dao.orm.Projection projection);
250    
251            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
252            public com.liferay.portal.model.Subscription fetchSubscription(
253                    long companyId, long userId, java.lang.String className, long classPK);
254    
255            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
256            public com.liferay.portal.model.Subscription fetchSubscription(
257                    long subscriptionId);
258    
259            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
260            public com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery getActionableDynamicQuery();
261    
262            /**
263            * Returns the Spring bean ID for this bean.
264            *
265            * @return the Spring bean ID for this bean
266            */
267            public java.lang.String getBeanIdentifier();
268    
269            @Override
270            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
271            public com.liferay.portal.model.PersistedModel getPersistedModel(
272                    java.io.Serializable primaryKeyObj) throws PortalException;
273    
274            /**
275            * Returns the subscription of the user to the entity.
276            *
277            * @param companyId the primary key of the company
278            * @param userId the primary key of the user
279            * @param className the entity's class name
280            * @param classPK the primary key of the entity's instance
281            * @return the subscription of the user to the entity
282            * @throws PortalException if a matching subscription could not be found
283            */
284            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
285            public com.liferay.portal.model.Subscription getSubscription(
286                    long companyId, long userId, java.lang.String className, long classPK)
287                    throws PortalException;
288    
289            /**
290            * Returns the subscription with the primary key.
291            *
292            * @param subscriptionId the primary key of the subscription
293            * @return the subscription
294            * @throws PortalException if a subscription with the primary key could not be found
295            */
296            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
297            public com.liferay.portal.model.Subscription getSubscription(
298                    long subscriptionId) throws PortalException;
299    
300            /**
301            * Returns all the subscriptions to the entity.
302            *
303            * @param companyId the primary key of the company
304            * @param className the entity's class name
305            * @param classPK the primary key of the entity's instance
306            * @return the subscriptions to the entity
307            */
308            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
309            public java.util.List<com.liferay.portal.model.Subscription> getSubscriptions(
310                    long companyId, java.lang.String className, long classPK);
311    
312            /**
313            * Returns all the subscriptions of the user to the entities.
314            *
315            * @param companyId the primary key of the company
316            * @param userId the primary key of the user
317            * @param className the entity's class name
318            * @param classPKs the primary key of the entities
319            * @return the subscriptions of the user to the entities
320            */
321            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
322            public java.util.List<com.liferay.portal.model.Subscription> getSubscriptions(
323                    long companyId, long userId, java.lang.String className, long[] classPKs);
324    
325            /**
326            * Returns a range of all the subscriptions.
327            *
328            * <p>
329            * 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.portal.model.impl.SubscriptionModelImpl}. 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.
330            * </p>
331            *
332            * @param start the lower bound of the range of subscriptions
333            * @param end the upper bound of the range of subscriptions (not inclusive)
334            * @return the range of subscriptions
335            */
336            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
337            public java.util.List<com.liferay.portal.model.Subscription> getSubscriptions(
338                    int start, int end);
339    
340            /**
341            * Returns the number of subscriptions.
342            *
343            * @return the number of subscriptions
344            */
345            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
346            public int getSubscriptionsCount();
347    
348            /**
349            * Returns all the subscriptions of the user to the entities with the class
350            * name.
351            *
352            * @param userId the primary key of the user
353            * @param className the entity's class name
354            * @return the subscriptions of the user to the entities with the class name
355            */
356            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
357            public java.util.List<com.liferay.portal.model.Subscription> getUserSubscriptions(
358                    long userId, java.lang.String className);
359    
360            /**
361            * Returns an ordered range of all the subscriptions of the user.
362            *
363            * @param userId the primary key of the user
364            * @param start the lower bound of the range of results
365            * @param end the upper bound of the range of results (not inclusive)
366            * @param orderByComparator the comparator to order the subscriptions
367            * @return the range of subscriptions of the user
368            */
369            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
370            public java.util.List<com.liferay.portal.model.Subscription> getUserSubscriptions(
371                    long userId, int start, int end,
372                    com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.model.Subscription> orderByComparator);
373    
374            /**
375            * Returns the number of subscriptions of the user.
376            *
377            * @param userId the primary key of the user
378            * @return the number of subscriptions of the user
379            */
380            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
381            public int getUserSubscriptionsCount(long userId);
382    
383            /**
384            * Returns <code>true</code> if the user is subscribed to the entity.
385            *
386            * @param companyId the primary key of the company
387            * @param userId the primary key of the user
388            * @param className the entity's class name
389            * @param classPK the primary key of the entity's instance
390            * @return <code>true</code> if the user is subscribed to the entity;
391            <code>false</code> otherwise
392            */
393            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
394            public boolean isSubscribed(long companyId, long userId,
395                    java.lang.String className, long classPK);
396    
397            /**
398            * Returns <code>true</code> if the user is subscribed to any of the
399            * entities.
400            *
401            * @param companyId the primary key of the company
402            * @param userId the primary key of the user
403            * @param className the entity's class name
404            * @param classPKs the primary key of the entities
405            * @return <code>true</code> if the user is subscribed to any of the
406            entities; <code>false</code> otherwise
407            */
408            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
409            public boolean isSubscribed(long companyId, long userId,
410                    java.lang.String className, long[] classPKs);
411    
412            /**
413            * Sets the Spring bean ID for this bean.
414            *
415            * @param beanIdentifier the Spring bean ID for this bean
416            */
417            public void setBeanIdentifier(java.lang.String beanIdentifier);
418    
419            /**
420            * Updates the subscription in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
421            *
422            * @param subscription the subscription
423            * @return the subscription that was updated
424            */
425            @com.liferay.portal.kernel.search.Indexable(type = IndexableType.REINDEX)
426            public com.liferay.portal.model.Subscription updateSubscription(
427                    com.liferay.portal.model.Subscription subscription);
428    }