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