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