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