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.bean.PortalBeanLocatorUtil;
020    import com.liferay.portal.kernel.util.ReferenceRegistry;
021    
022    /**
023     * Provides the local service utility for Subscription. This utility wraps
024     * {@link com.liferay.portal.service.impl.SubscriptionLocalServiceImpl} and is the
025     * primary access point for service operations in application layer code running
026     * on the local server. Methods of this service will not have security checks
027     * based on the propagated JAAS credentials because this service can only be
028     * accessed from within the same VM.
029     *
030     * @author Brian Wing Shun Chan
031     * @see SubscriptionLocalService
032     * @see com.liferay.portal.service.base.SubscriptionLocalServiceBaseImpl
033     * @see com.liferay.portal.service.impl.SubscriptionLocalServiceImpl
034     * @generated
035     */
036    @ProviderType
037    public class SubscriptionLocalServiceUtil {
038            /*
039             * NOTE FOR DEVELOPERS:
040             *
041             * Never modify this class directly. Add custom service methods to {@link com.liferay.portal.service.impl.SubscriptionLocalServiceImpl} and rerun ServiceBuilder to regenerate this class.
042             */
043    
044            /**
045            * Adds the subscription to the database. Also notifies the appropriate model listeners.
046            *
047            * @param subscription the subscription
048            * @return the subscription that was added
049            * @throws SystemException if a system exception occurred
050            */
051            public static com.liferay.portal.model.Subscription addSubscription(
052                    com.liferay.portal.model.Subscription subscription)
053                    throws com.liferay.portal.kernel.exception.SystemException {
054                    return getService().addSubscription(subscription);
055            }
056    
057            /**
058            * Creates a new subscription with the primary key. Does not add the subscription to the database.
059            *
060            * @param subscriptionId the primary key for the new subscription
061            * @return the new subscription
062            */
063            public static com.liferay.portal.model.Subscription createSubscription(
064                    long subscriptionId) {
065                    return getService().createSubscription(subscriptionId);
066            }
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 static 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                    return getService().deleteSubscription(subscriptionId);
081            }
082    
083            /**
084            * Deletes the subscription from the database. Also notifies the appropriate model listeners.
085            *
086            * @param subscription the subscription
087            * @return the subscription that was removed
088            * @throws PortalException
089            * @throws SystemException if a system exception occurred
090            */
091            public static com.liferay.portal.model.Subscription deleteSubscription(
092                    com.liferay.portal.model.Subscription subscription)
093                    throws com.liferay.portal.kernel.exception.PortalException,
094                            com.liferay.portal.kernel.exception.SystemException {
095                    return getService().deleteSubscription(subscription);
096            }
097    
098            public static com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery() {
099                    return getService().dynamicQuery();
100            }
101    
102            /**
103            * Performs a dynamic query on the database and returns the matching rows.
104            *
105            * @param dynamicQuery the dynamic query
106            * @return the matching rows
107            * @throws SystemException if a system exception occurred
108            */
109            @SuppressWarnings("rawtypes")
110            public static java.util.List dynamicQuery(
111                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
112                    throws com.liferay.portal.kernel.exception.SystemException {
113                    return getService().dynamicQuery(dynamicQuery);
114            }
115    
116            /**
117            * Performs a dynamic query on the database and returns a range of the matching rows.
118            *
119            * <p>
120            * 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.
121            * </p>
122            *
123            * @param dynamicQuery the dynamic query
124            * @param start the lower bound of the range of model instances
125            * @param end the upper bound of the range of model instances (not inclusive)
126            * @return the range of matching rows
127            * @throws SystemException if a system exception occurred
128            */
129            @SuppressWarnings("rawtypes")
130            public static java.util.List dynamicQuery(
131                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
132                    int end) throws com.liferay.portal.kernel.exception.SystemException {
133                    return getService().dynamicQuery(dynamicQuery, start, end);
134            }
135    
136            /**
137            * Performs a dynamic query on the database and returns an ordered range of the matching rows.
138            *
139            * <p>
140            * 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.
141            * </p>
142            *
143            * @param dynamicQuery the dynamic query
144            * @param start the lower bound of the range of model instances
145            * @param end the upper bound of the range of model instances (not inclusive)
146            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
147            * @return the ordered range of matching rows
148            * @throws SystemException if a system exception occurred
149            */
150            @SuppressWarnings("rawtypes")
151            public static java.util.List dynamicQuery(
152                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
153                    int end,
154                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
155                    throws com.liferay.portal.kernel.exception.SystemException {
156                    return getService()
157                                       .dynamicQuery(dynamicQuery, start, end, orderByComparator);
158            }
159    
160            /**
161            * Returns the number of rows that match the dynamic query.
162            *
163            * @param dynamicQuery the dynamic query
164            * @return the number of rows that match the dynamic query
165            * @throws SystemException if a system exception occurred
166            */
167            public static long dynamicQueryCount(
168                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
169                    throws com.liferay.portal.kernel.exception.SystemException {
170                    return getService().dynamicQueryCount(dynamicQuery);
171            }
172    
173            /**
174            * Returns the number of rows that match the dynamic query.
175            *
176            * @param dynamicQuery the dynamic query
177            * @param projection the projection to apply to the query
178            * @return the number of rows that match the dynamic query
179            * @throws SystemException if a system exception occurred
180            */
181            public static long dynamicQueryCount(
182                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery,
183                    com.liferay.portal.kernel.dao.orm.Projection projection)
184                    throws com.liferay.portal.kernel.exception.SystemException {
185                    return getService().dynamicQueryCount(dynamicQuery, projection);
186            }
187    
188            public static com.liferay.portal.model.Subscription fetchSubscription(
189                    long subscriptionId)
190                    throws com.liferay.portal.kernel.exception.SystemException {
191                    return getService().fetchSubscription(subscriptionId);
192            }
193    
194            /**
195            * Returns the subscription with the primary key.
196            *
197            * @param subscriptionId the primary key of the subscription
198            * @return the subscription
199            * @throws PortalException if a subscription with the primary key could not be found
200            * @throws SystemException if a system exception occurred
201            */
202            public static com.liferay.portal.model.Subscription getSubscription(
203                    long subscriptionId)
204                    throws com.liferay.portal.kernel.exception.PortalException,
205                            com.liferay.portal.kernel.exception.SystemException {
206                    return getService().getSubscription(subscriptionId);
207            }
208    
209            public static com.liferay.portal.model.PersistedModel getPersistedModel(
210                    java.io.Serializable primaryKeyObj)
211                    throws com.liferay.portal.kernel.exception.PortalException,
212                            com.liferay.portal.kernel.exception.SystemException {
213                    return getService().getPersistedModel(primaryKeyObj);
214            }
215    
216            /**
217            * Returns a range of all the subscriptions.
218            *
219            * <p>
220            * 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.
221            * </p>
222            *
223            * @param start the lower bound of the range of subscriptions
224            * @param end the upper bound of the range of subscriptions (not inclusive)
225            * @return the range of subscriptions
226            * @throws SystemException if a system exception occurred
227            */
228            public static java.util.List<com.liferay.portal.model.Subscription> getSubscriptions(
229                    int start, int end)
230                    throws com.liferay.portal.kernel.exception.SystemException {
231                    return getService().getSubscriptions(start, end);
232            }
233    
234            /**
235            * Returns the number of subscriptions.
236            *
237            * @return the number of subscriptions
238            * @throws SystemException if a system exception occurred
239            */
240            public static int getSubscriptionsCount()
241                    throws com.liferay.portal.kernel.exception.SystemException {
242                    return getService().getSubscriptionsCount();
243            }
244    
245            /**
246            * Updates the subscription in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
247            *
248            * @param subscription the subscription
249            * @return the subscription that was updated
250            * @throws SystemException if a system exception occurred
251            */
252            public static com.liferay.portal.model.Subscription updateSubscription(
253                    com.liferay.portal.model.Subscription subscription)
254                    throws com.liferay.portal.kernel.exception.SystemException {
255                    return getService().updateSubscription(subscription);
256            }
257    
258            /**
259            * Returns the Spring bean ID for this bean.
260            *
261            * @return the Spring bean ID for this bean
262            */
263            public static java.lang.String getBeanIdentifier() {
264                    return getService().getBeanIdentifier();
265            }
266    
267            /**
268            * Sets the Spring bean ID for this bean.
269            *
270            * @param beanIdentifier the Spring bean ID for this bean
271            */
272            public static void setBeanIdentifier(java.lang.String beanIdentifier) {
273                    getService().setBeanIdentifier(beanIdentifier);
274            }
275    
276            /**
277            * Subscribes the user to the entity, notifying him the instant the entity
278            * is created, deleted, or modified.
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            * @return the subscription
296            * @throws PortalException if a matching user or group could not be found
297            * @throws SystemException if a system exception occurred
298            */
299            public static com.liferay.portal.model.Subscription addSubscription(
300                    long userId, long groupId, java.lang.String className, long classPK)
301                    throws com.liferay.portal.kernel.exception.PortalException,
302                            com.liferay.portal.kernel.exception.SystemException {
303                    return getService().addSubscription(userId, groupId, className, classPK);
304            }
305    
306            /**
307            * Subscribes the user to the entity, notifying him at the given frequency.
308            *
309            * <p>
310            * If there is no asset entry with the class name and class PK a new asset
311            * entry is created.
312            * </p>
313            *
314            * <p>
315            * A social activity for the subscription is created using the asset entry
316            * associated with the class name and class PK, or the newly created asset
317            * entry.
318            * </p>
319            *
320            * @param userId the primary key of the user
321            * @param groupId the primary key of the entity's group
322            * @param className the entity's class name
323            * @param classPK the primary key of the entity's instance
324            * @param frequency the frequency for notifications
325            * @return the subscription
326            * @throws PortalException if a matching user or group could not be found
327            * @throws SystemException if a system exception occurred
328            */
329            public static com.liferay.portal.model.Subscription addSubscription(
330                    long userId, long groupId, java.lang.String className, long classPK,
331                    java.lang.String frequency)
332                    throws com.liferay.portal.kernel.exception.PortalException,
333                            com.liferay.portal.kernel.exception.SystemException {
334                    return getService()
335                                       .addSubscription(userId, groupId, className, classPK,
336                            frequency);
337            }
338    
339            /**
340            * Deletes the user's subscription to the entity. A social activity with the
341            * unsubscribe action is created.
342            *
343            * @param userId the primary key of the user
344            * @param className the entity's class name
345            * @param classPK the primary key of the entity's instance
346            * @throws PortalException if a matching user or subscription could not be
347            found
348            * @throws SystemException if a system exception occurred
349            */
350            public static void deleteSubscription(long userId,
351                    java.lang.String className, long classPK)
352                    throws com.liferay.portal.kernel.exception.PortalException,
353                            com.liferay.portal.kernel.exception.SystemException {
354                    getService().deleteSubscription(userId, className, classPK);
355            }
356    
357            /**
358            * Deletes all the subscriptions of the user.
359            *
360            * @param userId the primary key of the user
361            * @throws PortalException if a portal exception occurred
362            * @throws SystemException if a system exception occurred
363            */
364            public static void deleteSubscriptions(long userId)
365                    throws com.liferay.portal.kernel.exception.PortalException,
366                            com.liferay.portal.kernel.exception.SystemException {
367                    getService().deleteSubscriptions(userId);
368            }
369    
370            /**
371            * Deletes all the subscriptions to the entity.
372            *
373            * @param companyId the primary key of the company
374            * @param className the entity's class name
375            * @param classPK the primary key of the entity's instance
376            * @throws PortalException if a portal exception occurred
377            * @throws SystemException if a system exception occurred
378            */
379            public static void deleteSubscriptions(long companyId,
380                    java.lang.String className, long classPK)
381                    throws com.liferay.portal.kernel.exception.PortalException,
382                            com.liferay.portal.kernel.exception.SystemException {
383                    getService().deleteSubscriptions(companyId, className, classPK);
384            }
385    
386            /**
387            * Returns the subscription of the user to the entity.
388            *
389            * @param companyId the primary key of the company
390            * @param userId the primary key of the user
391            * @param className the entity's class name
392            * @param classPK the primary key of the entity's instance
393            * @return the subscription of the user to the entity
394            * @throws PortalException if a matching subscription could not be found
395            * @throws SystemException if a system exception occurred
396            */
397            public static com.liferay.portal.model.Subscription getSubscription(
398                    long companyId, long userId, java.lang.String className, long classPK)
399                    throws com.liferay.portal.kernel.exception.PortalException,
400                            com.liferay.portal.kernel.exception.SystemException {
401                    return getService()
402                                       .getSubscription(companyId, userId, className, classPK);
403            }
404    
405            /**
406            * Returns all the subscriptions of the user to the entities.
407            *
408            * @param companyId the primary key of the company
409            * @param userId the primary key of the user
410            * @param className the entity's class name
411            * @param classPKs the primary key of the entities
412            * @return the subscriptions of the user to the entities
413            * @throws SystemException if a system exception occurred
414            */
415            public static java.util.List<com.liferay.portal.model.Subscription> getSubscriptions(
416                    long companyId, long userId, java.lang.String className, long[] classPKs)
417                    throws com.liferay.portal.kernel.exception.SystemException {
418                    return getService()
419                                       .getSubscriptions(companyId, userId, className, classPKs);
420            }
421    
422            /**
423            * Returns all the subscriptions to the entity.
424            *
425            * @param companyId the primary key of the company
426            * @param className the entity's class name
427            * @param classPK the primary key of the entity's instance
428            * @return the subscriptions to the entity
429            * @throws SystemException if a system exception occurred
430            */
431            public static java.util.List<com.liferay.portal.model.Subscription> getSubscriptions(
432                    long companyId, java.lang.String className, long classPK)
433                    throws com.liferay.portal.kernel.exception.SystemException {
434                    return getService().getSubscriptions(companyId, className, classPK);
435            }
436    
437            /**
438            * Returns an ordered range of all the subscriptions of the user.
439            *
440            * @param userId the primary key of the user
441            * @param start the lower bound of the range of results
442            * @param end the upper bound of the range of results (not inclusive)
443            * @param orderByComparator the comparator to order the subscriptions
444            * @return the range of subscriptions of the user
445            * @throws SystemException if a system exception occurred
446            */
447            public static java.util.List<com.liferay.portal.model.Subscription> getUserSubscriptions(
448                    long userId, int start, int end,
449                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
450                    throws com.liferay.portal.kernel.exception.SystemException {
451                    return getService()
452                                       .getUserSubscriptions(userId, start, end, orderByComparator);
453            }
454    
455            /**
456            * Returns all the subscriptions of the user to the entities with the class
457            * name.
458            *
459            * @param userId the primary key of the user
460            * @param className the entity's class name
461            * @return the subscriptions of the user to the entities with the class name
462            * @throws SystemException if a system exception occurred
463            */
464            public static java.util.List<com.liferay.portal.model.Subscription> getUserSubscriptions(
465                    long userId, java.lang.String className)
466                    throws com.liferay.portal.kernel.exception.SystemException {
467                    return getService().getUserSubscriptions(userId, className);
468            }
469    
470            /**
471            * Returns the number of subscriptions of the user.
472            *
473            * @param userId the primary key of the user
474            * @return the number of subscriptions of the user
475            * @throws SystemException if a system exception occurred
476            */
477            public static int getUserSubscriptionsCount(long userId)
478                    throws com.liferay.portal.kernel.exception.SystemException {
479                    return getService().getUserSubscriptionsCount(userId);
480            }
481    
482            /**
483            * Returns <code>true</code> if the user is subscribed to the entity.
484            *
485            * @param companyId the primary key of the company
486            * @param userId the primary key of the user
487            * @param className the entity's class name
488            * @param classPK the primary key of the entity's instance
489            * @return <code>true</code> if the user is subscribed to the entity;
490            <code>false</code> otherwise
491            * @throws SystemException if a system exception occurred
492            */
493            public static boolean isSubscribed(long companyId, long userId,
494                    java.lang.String className, long classPK)
495                    throws com.liferay.portal.kernel.exception.SystemException {
496                    return getService().isSubscribed(companyId, userId, className, classPK);
497            }
498    
499            /**
500            * Returns <code>true</code> if the user is subscribed to any of the
501            * entities.
502            *
503            * @param companyId the primary key of the company
504            * @param userId the primary key of the user
505            * @param className the entity's class name
506            * @param classPKs the primary key of the entities
507            * @return <code>true</code> if the user is subscribed to any of the
508            entities; <code>false</code> otherwise
509            * @throws SystemException if a system exception occurred
510            */
511            public static boolean isSubscribed(long companyId, long userId,
512                    java.lang.String className, long[] classPKs)
513                    throws com.liferay.portal.kernel.exception.SystemException {
514                    return getService().isSubscribed(companyId, userId, className, classPKs);
515            }
516    
517            public static SubscriptionLocalService getService() {
518                    if (_service == null) {
519                            _service = (SubscriptionLocalService)PortalBeanLocatorUtil.locate(SubscriptionLocalService.class.getName());
520    
521                            ReferenceRegistry.registerReference(SubscriptionLocalServiceUtil.class,
522                                    "_service");
523                    }
524    
525                    return _service;
526            }
527    
528            /**
529             * @deprecated As of 6.2.0
530             */
531            public void setService(SubscriptionLocalService service) {
532            }
533    
534            private static SubscriptionLocalService _service;
535    }