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 com.liferay.portal.kernel.exception.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)
110                    throws com.liferay.portal.kernel.exception.PortalException;
111    
112            /**
113            * Creates a new subscription with the primary key. Does not add the subscription to the database.
114            *
115            * @param subscriptionId the primary key for the new subscription
116            * @return the new subscription
117            */
118            public com.liferay.portal.model.Subscription createSubscription(
119                    long subscriptionId);
120    
121            /**
122            * @throws PortalException
123            */
124            @Override
125            public com.liferay.portal.model.PersistedModel deletePersistedModel(
126                    com.liferay.portal.model.PersistedModel persistedModel)
127                    throws com.liferay.portal.kernel.exception.PortalException;
128    
129            /**
130            * Deletes the subscription from the database. Also notifies the appropriate model listeners.
131            *
132            * @param subscription the subscription
133            * @return the subscription that was removed
134            * @throws PortalException
135            */
136            @com.liferay.portal.kernel.search.Indexable(type = IndexableType.DELETE)
137            public com.liferay.portal.model.Subscription deleteSubscription(
138                    com.liferay.portal.model.Subscription subscription)
139                    throws com.liferay.portal.kernel.exception.PortalException;
140    
141            /**
142            * Deletes the subscription with the primary key from the database. Also notifies the appropriate model listeners.
143            *
144            * @param subscriptionId the primary key of the subscription
145            * @return the subscription that was removed
146            * @throws PortalException if a subscription with the primary key could not be found
147            */
148            @com.liferay.portal.kernel.search.Indexable(type = IndexableType.DELETE)
149            public com.liferay.portal.model.Subscription deleteSubscription(
150                    long subscriptionId)
151                    throws com.liferay.portal.kernel.exception.PortalException;
152    
153            /**
154            * Deletes the user's subscription to the entity. A social activity with the
155            * unsubscribe action is created.
156            *
157            * @param userId the primary key of the user
158            * @param className the entity's class name
159            * @param classPK the primary key of the entity's instance
160            * @throws PortalException if a matching user or subscription could not be
161            found
162            */
163            public void deleteSubscription(long userId, java.lang.String className,
164                    long classPK)
165                    throws com.liferay.portal.kernel.exception.PortalException;
166    
167            /**
168            * Deletes all the subscriptions to the entity.
169            *
170            * @param companyId the primary key of the company
171            * @param className the entity's class name
172            * @param classPK the primary key of the entity's instance
173            * @throws PortalException if a portal exception occurred
174            */
175            public void deleteSubscriptions(long companyId, java.lang.String className,
176                    long classPK)
177                    throws com.liferay.portal.kernel.exception.PortalException;
178    
179            /**
180            * Deletes all the subscriptions of the user.
181            *
182            * @param userId the primary key of the user
183            * @throws PortalException if a portal exception occurred
184            */
185            public void deleteSubscriptions(long userId)
186                    throws com.liferay.portal.kernel.exception.PortalException;
187    
188            public com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery();
189    
190            /**
191            * Performs a dynamic query on the database and returns the matching rows.
192            *
193            * @param dynamicQuery the dynamic query
194            * @return the matching rows
195            */
196            public <T> java.util.List<T> dynamicQuery(
197                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery);
198    
199            /**
200            * Performs a dynamic query on the database and returns a range of the matching rows.
201            *
202            * <p>
203            * 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.
204            * </p>
205            *
206            * @param dynamicQuery the dynamic query
207            * @param start the lower bound of the range of model instances
208            * @param end the upper bound of the range of model instances (not inclusive)
209            * @return the range of matching rows
210            */
211            public <T> java.util.List<T> dynamicQuery(
212                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
213                    int end);
214    
215            /**
216            * Performs a dynamic query on the database and returns an ordered range of the matching rows.
217            *
218            * <p>
219            * 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.
220            * </p>
221            *
222            * @param dynamicQuery the dynamic query
223            * @param start the lower bound of the range of model instances
224            * @param end the upper bound of the range of model instances (not inclusive)
225            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
226            * @return the ordered range of matching rows
227            */
228            public <T> java.util.List<T> dynamicQuery(
229                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
230                    int end,
231                    com.liferay.portal.kernel.util.OrderByComparator<T> orderByComparator);
232    
233            /**
234            * Returns the number of rows matching the dynamic query.
235            *
236            * @param dynamicQuery the dynamic query
237            * @return the number of rows matching the dynamic query
238            */
239            public long dynamicQueryCount(
240                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery);
241    
242            /**
243            * Returns the number of rows matching the dynamic query.
244            *
245            * @param dynamicQuery the dynamic query
246            * @param projection the projection to apply to the query
247            * @return the number of rows matching the dynamic query
248            */
249            public long dynamicQueryCount(
250                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery,
251                    com.liferay.portal.kernel.dao.orm.Projection projection);
252    
253            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
254            public com.liferay.portal.model.Subscription fetchSubscription(
255                    long subscriptionId);
256    
257            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
258            public com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery getActionableDynamicQuery();
259    
260            /**
261            * Returns the Spring bean ID for this bean.
262            *
263            * @return the Spring bean ID for this bean
264            */
265            public java.lang.String getBeanIdentifier();
266    
267            @Override
268            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
269            public com.liferay.portal.model.PersistedModel getPersistedModel(
270                    java.io.Serializable primaryKeyObj)
271                    throws com.liferay.portal.kernel.exception.PortalException;
272    
273            /**
274            * Returns the subscription of the user to the entity.
275            *
276            * @param companyId the primary key of the company
277            * @param userId the primary key of the user
278            * @param className the entity's class name
279            * @param classPK the primary key of the entity's instance
280            * @return the subscription of the user to the entity
281            * @throws PortalException if a matching subscription could not be found
282            */
283            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
284            public com.liferay.portal.model.Subscription getSubscription(
285                    long companyId, long userId, java.lang.String className, long classPK)
286                    throws com.liferay.portal.kernel.exception.PortalException;
287    
288            /**
289            * Returns the subscription with the primary key.
290            *
291            * @param subscriptionId the primary key of the subscription
292            * @return the subscription
293            * @throws PortalException if a subscription with the primary key could not be found
294            */
295            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
296            public com.liferay.portal.model.Subscription getSubscription(
297                    long subscriptionId)
298                    throws com.liferay.portal.kernel.exception.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    }