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