001    /**
002     * Copyright (c) 2000-2011 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.MethodCache;
019    import com.liferay.portal.kernel.util.ReferenceRegistry;
020    
021    /**
022     * 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.
023     *
024     * <p>
025     * 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.
026     * </p>
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            * @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 void deleteSubscription(long subscriptionId)
073                    throws com.liferay.portal.kernel.exception.PortalException,
074                            com.liferay.portal.kernel.exception.SystemException {
075                    getService().deleteSubscription(subscriptionId);
076            }
077    
078            /**
079            * Deletes the subscription from the database. Also notifies the appropriate model listeners.
080            *
081            * @param subscription the subscription
082            * @throws PortalException
083            * @throws SystemException if a system exception occurred
084            */
085            public static void deleteSubscription(
086                    com.liferay.portal.model.Subscription subscription)
087                    throws com.liferay.portal.kernel.exception.PortalException,
088                            com.liferay.portal.kernel.exception.SystemException {
089                    getService().deleteSubscription(subscription);
090            }
091    
092            /**
093            * Performs a dynamic query on the database and returns the matching rows.
094            *
095            * @param dynamicQuery the dynamic query
096            * @return the matching rows
097            * @throws SystemException if a system exception occurred
098            */
099            @SuppressWarnings("rawtypes")
100            public static java.util.List dynamicQuery(
101                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
102                    throws com.liferay.portal.kernel.exception.SystemException {
103                    return getService().dynamicQuery(dynamicQuery);
104            }
105    
106            /**
107            * Performs a dynamic query on the database and returns a range of the matching rows.
108            *
109            * <p>
110            * 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.
111            * </p>
112            *
113            * @param dynamicQuery the dynamic query
114            * @param start the lower bound of the range of model instances
115            * @param end the upper bound of the range of model instances (not inclusive)
116            * @return the range of matching rows
117            * @throws SystemException if a system exception occurred
118            */
119            @SuppressWarnings("rawtypes")
120            public static java.util.List dynamicQuery(
121                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
122                    int end) throws com.liferay.portal.kernel.exception.SystemException {
123                    return getService().dynamicQuery(dynamicQuery, start, end);
124            }
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.
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 static 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                    return getService()
147                                       .dynamicQuery(dynamicQuery, start, end, orderByComparator);
148            }
149    
150            /**
151            * Returns the number of rows that match the dynamic query.
152            *
153            * @param dynamicQuery the dynamic query
154            * @return the number of rows that match the dynamic query
155            * @throws SystemException if a system exception occurred
156            */
157            public static long dynamicQueryCount(
158                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
159                    throws com.liferay.portal.kernel.exception.SystemException {
160                    return getService().dynamicQueryCount(dynamicQuery);
161            }
162    
163            /**
164            * Returns the subscription with the primary key.
165            *
166            * @param subscriptionId the primary key of the subscription
167            * @return the subscription
168            * @throws PortalException if a subscription with the primary key could not be found
169            * @throws SystemException if a system exception occurred
170            */
171            public static com.liferay.portal.model.Subscription getSubscription(
172                    long subscriptionId)
173                    throws com.liferay.portal.kernel.exception.PortalException,
174                            com.liferay.portal.kernel.exception.SystemException {
175                    return getService().getSubscription(subscriptionId);
176            }
177    
178            public static com.liferay.portal.model.PersistedModel getPersistedModel(
179                    java.io.Serializable primaryKeyObj)
180                    throws com.liferay.portal.kernel.exception.PortalException,
181                            com.liferay.portal.kernel.exception.SystemException {
182                    return getService().getPersistedModel(primaryKeyObj);
183            }
184    
185            /**
186            * Returns a range of all the subscriptions.
187            *
188            * <p>
189            * 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.
190            * </p>
191            *
192            * @param start the lower bound of the range of subscriptions
193            * @param end the upper bound of the range of subscriptions (not inclusive)
194            * @return the range of subscriptions
195            * @throws SystemException if a system exception occurred
196            */
197            public static java.util.List<com.liferay.portal.model.Subscription> getSubscriptions(
198                    int start, int end)
199                    throws com.liferay.portal.kernel.exception.SystemException {
200                    return getService().getSubscriptions(start, end);
201            }
202    
203            /**
204            * Returns the number of subscriptions.
205            *
206            * @return the number of subscriptions
207            * @throws SystemException if a system exception occurred
208            */
209            public static int getSubscriptionsCount()
210                    throws com.liferay.portal.kernel.exception.SystemException {
211                    return getService().getSubscriptionsCount();
212            }
213    
214            /**
215            * Updates the subscription in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
216            *
217            * @param subscription the subscription
218            * @return the subscription that was updated
219            * @throws SystemException if a system exception occurred
220            */
221            public static com.liferay.portal.model.Subscription updateSubscription(
222                    com.liferay.portal.model.Subscription subscription)
223                    throws com.liferay.portal.kernel.exception.SystemException {
224                    return getService().updateSubscription(subscription);
225            }
226    
227            /**
228            * Updates the subscription in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
229            *
230            * @param subscription the subscription
231            * @param merge whether to merge the subscription with the current session. See {@link com.liferay.portal.service.persistence.BatchSession#update(com.liferay.portal.kernel.dao.orm.Session, com.liferay.portal.model.BaseModel, boolean)} for an explanation.
232            * @return the subscription that was updated
233            * @throws SystemException if a system exception occurred
234            */
235            public static com.liferay.portal.model.Subscription updateSubscription(
236                    com.liferay.portal.model.Subscription subscription, boolean merge)
237                    throws com.liferay.portal.kernel.exception.SystemException {
238                    return getService().updateSubscription(subscription, merge);
239            }
240    
241            /**
242            * Returns the Spring bean ID for this bean.
243            *
244            * @return the Spring bean ID for this bean
245            */
246            public static java.lang.String getBeanIdentifier() {
247                    return getService().getBeanIdentifier();
248            }
249    
250            /**
251            * Sets the Spring bean ID for this bean.
252            *
253            * @param beanIdentifier the Spring bean ID for this bean
254            */
255            public static void setBeanIdentifier(java.lang.String beanIdentifier) {
256                    getService().setBeanIdentifier(beanIdentifier);
257            }
258    
259            public static com.liferay.portal.model.Subscription addSubscription(
260                    long userId, long groupId, java.lang.String className, long classPK)
261                    throws com.liferay.portal.kernel.exception.PortalException,
262                            com.liferay.portal.kernel.exception.SystemException {
263                    return getService().addSubscription(userId, groupId, className, classPK);
264            }
265    
266            public static com.liferay.portal.model.Subscription addSubscription(
267                    long userId, long groupId, java.lang.String className, long classPK,
268                    java.lang.String frequency)
269                    throws com.liferay.portal.kernel.exception.PortalException,
270                            com.liferay.portal.kernel.exception.SystemException {
271                    return getService()
272                                       .addSubscription(userId, groupId, className, classPK,
273                            frequency);
274            }
275    
276            public static void deleteSubscription(long userId,
277                    java.lang.String className, long classPK)
278                    throws com.liferay.portal.kernel.exception.PortalException,
279                            com.liferay.portal.kernel.exception.SystemException {
280                    getService().deleteSubscription(userId, className, classPK);
281            }
282    
283            public static void deleteSubscriptions(long userId)
284                    throws com.liferay.portal.kernel.exception.PortalException,
285                            com.liferay.portal.kernel.exception.SystemException {
286                    getService().deleteSubscriptions(userId);
287            }
288    
289            public static void deleteSubscriptions(long companyId,
290                    java.lang.String className, long classPK)
291                    throws com.liferay.portal.kernel.exception.PortalException,
292                            com.liferay.portal.kernel.exception.SystemException {
293                    getService().deleteSubscriptions(companyId, className, classPK);
294            }
295    
296            public static com.liferay.portal.model.Subscription getSubscription(
297                    long companyId, long userId, java.lang.String className, long classPK)
298                    throws com.liferay.portal.kernel.exception.PortalException,
299                            com.liferay.portal.kernel.exception.SystemException {
300                    return getService()
301                                       .getSubscription(companyId, userId, className, classPK);
302            }
303    
304            public static java.util.List<com.liferay.portal.model.Subscription> getSubscriptions(
305                    long companyId, java.lang.String className, long classPK)
306                    throws com.liferay.portal.kernel.exception.SystemException {
307                    return getService().getSubscriptions(companyId, className, classPK);
308            }
309    
310            public static java.util.List<com.liferay.portal.model.Subscription> getUserSubscriptions(
311                    long userId, int start, int end,
312                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
313                    throws com.liferay.portal.kernel.exception.SystemException {
314                    return getService()
315                                       .getUserSubscriptions(userId, start, end, orderByComparator);
316            }
317    
318            public static java.util.List<com.liferay.portal.model.Subscription> getUserSubscriptions(
319                    long userId, java.lang.String className)
320                    throws com.liferay.portal.kernel.exception.SystemException {
321                    return getService().getUserSubscriptions(userId, className);
322            }
323    
324            public static int getUserSubscriptionsCount(long userId)
325                    throws com.liferay.portal.kernel.exception.SystemException {
326                    return getService().getUserSubscriptionsCount(userId);
327            }
328    
329            public static boolean isSubscribed(long companyId, long userId,
330                    java.lang.String className, long classPK)
331                    throws com.liferay.portal.kernel.exception.SystemException {
332                    return getService().isSubscribed(companyId, userId, className, classPK);
333            }
334    
335            public static SubscriptionLocalService getService() {
336                    if (_service == null) {
337                            _service = (SubscriptionLocalService)PortalBeanLocatorUtil.locate(SubscriptionLocalService.class.getName());
338    
339                            ReferenceRegistry.registerReference(SubscriptionLocalServiceUtil.class,
340                                    "_service");
341                            MethodCache.remove(SubscriptionLocalService.class);
342                    }
343    
344                    return _service;
345            }
346    
347            public void setService(SubscriptionLocalService service) {
348                    MethodCache.remove(SubscriptionLocalService.class);
349    
350                    _service = service;
351    
352                    ReferenceRegistry.registerReference(SubscriptionLocalServiceUtil.class,
353                            "_service");
354                    MethodCache.remove(SubscriptionLocalService.class);
355            }
356    
357            private static SubscriptionLocalService _service;
358    }