001    /**
002     * Copyright (c) 2000-2012 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.portlet.social.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 social request local service. This utility wraps {@link com.liferay.portlet.social.service.impl.SocialRequestLocalServiceImpl} 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 SocialRequestLocalService
030     * @see com.liferay.portlet.social.service.base.SocialRequestLocalServiceBaseImpl
031     * @see com.liferay.portlet.social.service.impl.SocialRequestLocalServiceImpl
032     * @generated
033     */
034    public class SocialRequestLocalServiceUtil {
035            /*
036             * NOTE FOR DEVELOPERS:
037             *
038             * Never modify this class directly. Add custom service methods to {@link com.liferay.portlet.social.service.impl.SocialRequestLocalServiceImpl} and rerun ServiceBuilder to regenerate this class.
039             */
040    
041            /**
042            * Adds the social request to the database. Also notifies the appropriate model listeners.
043            *
044            * @param socialRequest the social request
045            * @return the social request that was added
046            * @throws SystemException if a system exception occurred
047            */
048            public static com.liferay.portlet.social.model.SocialRequest addSocialRequest(
049                    com.liferay.portlet.social.model.SocialRequest socialRequest)
050                    throws com.liferay.portal.kernel.exception.SystemException {
051                    return getService().addSocialRequest(socialRequest);
052            }
053    
054            /**
055            * Creates a new social request with the primary key. Does not add the social request to the database.
056            *
057            * @param requestId the primary key for the new social request
058            * @return the new social request
059            */
060            public static com.liferay.portlet.social.model.SocialRequest createSocialRequest(
061                    long requestId) {
062                    return getService().createSocialRequest(requestId);
063            }
064    
065            /**
066            * Deletes the social request with the primary key from the database. Also notifies the appropriate model listeners.
067            *
068            * @param requestId the primary key of the social request
069            * @throws PortalException if a social request with the primary key could not be found
070            * @throws SystemException if a system exception occurred
071            */
072            public static void deleteSocialRequest(long requestId)
073                    throws com.liferay.portal.kernel.exception.PortalException,
074                            com.liferay.portal.kernel.exception.SystemException {
075                    getService().deleteSocialRequest(requestId);
076            }
077    
078            /**
079            * Deletes the social request from the database. Also notifies the appropriate model listeners.
080            *
081            * @param socialRequest the social request
082            * @throws SystemException if a system exception occurred
083            */
084            public static void deleteSocialRequest(
085                    com.liferay.portlet.social.model.SocialRequest socialRequest)
086                    throws com.liferay.portal.kernel.exception.SystemException {
087                    getService().deleteSocialRequest(socialRequest);
088            }
089    
090            /**
091            * Performs a dynamic query on the database and returns the matching rows.
092            *
093            * @param dynamicQuery the dynamic query
094            * @return the matching rows
095            * @throws SystemException if a system exception occurred
096            */
097            @SuppressWarnings("rawtypes")
098            public static java.util.List dynamicQuery(
099                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
100                    throws com.liferay.portal.kernel.exception.SystemException {
101                    return getService().dynamicQuery(dynamicQuery);
102            }
103    
104            /**
105            * Performs a dynamic query on the database and returns a range of the matching rows.
106            *
107            * <p>
108            * 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.
109            * </p>
110            *
111            * @param dynamicQuery the dynamic query
112            * @param start the lower bound of the range of model instances
113            * @param end the upper bound of the range of model instances (not inclusive)
114            * @return the range of matching rows
115            * @throws SystemException if a system exception occurred
116            */
117            @SuppressWarnings("rawtypes")
118            public static java.util.List dynamicQuery(
119                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
120                    int end) throws com.liferay.portal.kernel.exception.SystemException {
121                    return getService().dynamicQuery(dynamicQuery, start, end);
122            }
123    
124            /**
125            * Performs a dynamic query on the database and returns an ordered range of the matching rows.
126            *
127            * <p>
128            * 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.
129            * </p>
130            *
131            * @param dynamicQuery the dynamic query
132            * @param start the lower bound of the range of model instances
133            * @param end the upper bound of the range of model instances (not inclusive)
134            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
135            * @return the ordered range of matching rows
136            * @throws SystemException if a system exception occurred
137            */
138            @SuppressWarnings("rawtypes")
139            public static java.util.List dynamicQuery(
140                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
141                    int end,
142                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
143                    throws com.liferay.portal.kernel.exception.SystemException {
144                    return getService()
145                                       .dynamicQuery(dynamicQuery, start, end, orderByComparator);
146            }
147    
148            /**
149            * Returns the number of rows that match the dynamic query.
150            *
151            * @param dynamicQuery the dynamic query
152            * @return the number of rows that match the dynamic query
153            * @throws SystemException if a system exception occurred
154            */
155            public static long dynamicQueryCount(
156                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
157                    throws com.liferay.portal.kernel.exception.SystemException {
158                    return getService().dynamicQueryCount(dynamicQuery);
159            }
160    
161            public static com.liferay.portlet.social.model.SocialRequest fetchSocialRequest(
162                    long requestId)
163                    throws com.liferay.portal.kernel.exception.SystemException {
164                    return getService().fetchSocialRequest(requestId);
165            }
166    
167            /**
168            * Returns the social request with the primary key.
169            *
170            * @param requestId the primary key of the social request
171            * @return the social request
172            * @throws PortalException if a social request with the primary key could not be found
173            * @throws SystemException if a system exception occurred
174            */
175            public static com.liferay.portlet.social.model.SocialRequest getSocialRequest(
176                    long requestId)
177                    throws com.liferay.portal.kernel.exception.PortalException,
178                            com.liferay.portal.kernel.exception.SystemException {
179                    return getService().getSocialRequest(requestId);
180            }
181    
182            public static com.liferay.portal.model.PersistedModel getPersistedModel(
183                    java.io.Serializable primaryKeyObj)
184                    throws com.liferay.portal.kernel.exception.PortalException,
185                            com.liferay.portal.kernel.exception.SystemException {
186                    return getService().getPersistedModel(primaryKeyObj);
187            }
188    
189            /**
190            * Returns the social request with the UUID in the group.
191            *
192            * @param uuid the UUID of social request
193            * @param groupId the group id of the social request
194            * @return the social request
195            * @throws PortalException if a social request with the UUID in the group could not be found
196            * @throws SystemException if a system exception occurred
197            */
198            public static com.liferay.portlet.social.model.SocialRequest getSocialRequestByUuidAndGroupId(
199                    java.lang.String uuid, long groupId)
200                    throws com.liferay.portal.kernel.exception.PortalException,
201                            com.liferay.portal.kernel.exception.SystemException {
202                    return getService().getSocialRequestByUuidAndGroupId(uuid, groupId);
203            }
204    
205            /**
206            * Returns a range of all the social requests.
207            *
208            * <p>
209            * 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.
210            * </p>
211            *
212            * @param start the lower bound of the range of social requests
213            * @param end the upper bound of the range of social requests (not inclusive)
214            * @return the range of social requests
215            * @throws SystemException if a system exception occurred
216            */
217            public static java.util.List<com.liferay.portlet.social.model.SocialRequest> getSocialRequests(
218                    int start, int end)
219                    throws com.liferay.portal.kernel.exception.SystemException {
220                    return getService().getSocialRequests(start, end);
221            }
222    
223            /**
224            * Returns the number of social requests.
225            *
226            * @return the number of social requests
227            * @throws SystemException if a system exception occurred
228            */
229            public static int getSocialRequestsCount()
230                    throws com.liferay.portal.kernel.exception.SystemException {
231                    return getService().getSocialRequestsCount();
232            }
233    
234            /**
235            * Updates the social request in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
236            *
237            * @param socialRequest the social request
238            * @return the social request that was updated
239            * @throws SystemException if a system exception occurred
240            */
241            public static com.liferay.portlet.social.model.SocialRequest updateSocialRequest(
242                    com.liferay.portlet.social.model.SocialRequest socialRequest)
243                    throws com.liferay.portal.kernel.exception.SystemException {
244                    return getService().updateSocialRequest(socialRequest);
245            }
246    
247            /**
248            * Updates the social request in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
249            *
250            * @param socialRequest the social request
251            * @param merge whether to merge the social request 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.
252            * @return the social request that was updated
253            * @throws SystemException if a system exception occurred
254            */
255            public static com.liferay.portlet.social.model.SocialRequest updateSocialRequest(
256                    com.liferay.portlet.social.model.SocialRequest socialRequest,
257                    boolean merge)
258                    throws com.liferay.portal.kernel.exception.SystemException {
259                    return getService().updateSocialRequest(socialRequest, merge);
260            }
261    
262            /**
263            * Returns the Spring bean ID for this bean.
264            *
265            * @return the Spring bean ID for this bean
266            */
267            public static java.lang.String getBeanIdentifier() {
268                    return getService().getBeanIdentifier();
269            }
270    
271            /**
272            * Sets the Spring bean ID for this bean.
273            *
274            * @param beanIdentifier the Spring bean ID for this bean
275            */
276            public static void setBeanIdentifier(java.lang.String beanIdentifier) {
277                    getService().setBeanIdentifier(beanIdentifier);
278            }
279    
280            /**
281            * Adds a social request to the database.
282            *
283            * <p>
284            * In order to add a social request, both the requesting user and the
285            * receiving user must be from the same company and neither of them can be
286            * the default user.
287            * </p>
288            *
289            * @param userId the primary key of the requesting user
290            * @param groupId the primary key of the group
291            * @param className the class name of the asset that is the subject of the
292            request
293            * @param classPK the primary key of the asset that is the subject of the
294            request
295            * @param type the request's type
296            * @param extraData the extra data regarding the request
297            * @param receiverUserId the primary key of the user receiving the request
298            * @return the social request
299            * @throws PortalException if the users could not be found, if the users
300            were not from the same company, or if either of the users was the
301            default user
302            * @throws SystemException if a system exception occurred
303            */
304            public static com.liferay.portlet.social.model.SocialRequest addRequest(
305                    long userId, long groupId, java.lang.String className, long classPK,
306                    int type, java.lang.String extraData, long receiverUserId)
307                    throws com.liferay.portal.kernel.exception.PortalException,
308                            com.liferay.portal.kernel.exception.SystemException {
309                    return getService()
310                                       .addRequest(userId, groupId, className, classPK, type,
311                            extraData, receiverUserId);
312            }
313    
314            /**
315            * Removes all the social requests for the receiving user.
316            *
317            * @param receiverUserId the primary key of the receiving user
318            * @throws SystemException if a system exception occurred
319            */
320            public static void deleteReceiverUserRequests(long receiverUserId)
321                    throws com.liferay.portal.kernel.exception.SystemException {
322                    getService().deleteReceiverUserRequests(receiverUserId);
323            }
324    
325            /**
326            * Removes the social request identified by its primary key from the
327            * database.
328            *
329            * @param requestId the primary key of the social request
330            * @throws PortalException if the social request could not be found
331            * @throws SystemException if a system exception occurred
332            */
333            public static void deleteRequest(long requestId)
334                    throws com.liferay.portal.kernel.exception.PortalException,
335                            com.liferay.portal.kernel.exception.SystemException {
336                    getService().deleteRequest(requestId);
337            }
338    
339            /**
340            * Removes the social request from the database.
341            *
342            * @param request the social request to be removed
343            * @throws SystemException if a system exception occurred
344            */
345            public static void deleteRequest(
346                    com.liferay.portlet.social.model.SocialRequest request)
347                    throws com.liferay.portal.kernel.exception.SystemException {
348                    getService().deleteRequest(request);
349            }
350    
351            /**
352            * Removes all the social requests for the requesting user.
353            *
354            * @param userId the primary key of the requesting user
355            * @throws SystemException if a system exception occurred
356            */
357            public static void deleteUserRequests(long userId)
358                    throws com.liferay.portal.kernel.exception.SystemException {
359                    getService().deleteUserRequests(userId);
360            }
361    
362            /**
363            * Returns a range of all the social requests for the receiving user.
364            *
365            * <p>
366            * Useful when paginating results. Returns a maximum of <code>end -
367            * start</code> instances. <code>start</code> and <code>end</code> are not
368            * primary keys, they are indexes in the result set. Thus, <code>0</code>
369            * refers to the first result in the set. Setting both <code>start</code>
370            * and <code>end</code> to {@link
371            * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
372            * result set.
373            * </p>
374            *
375            * @param receiverUserId the primary key of the receiving user
376            * @param start the lower bound of the range of results
377            * @param end the upper bound of the range of results (not inclusive)
378            * @return the range of matching social requests
379            * @throws SystemException if a system exception occurred
380            */
381            public static java.util.List<com.liferay.portlet.social.model.SocialRequest> getReceiverUserRequests(
382                    long receiverUserId, int start, int end)
383                    throws com.liferay.portal.kernel.exception.SystemException {
384                    return getService().getReceiverUserRequests(receiverUserId, start, end);
385            }
386    
387            /**
388            * Returns a range of all the social requests with the given status for the
389            * receiving user.
390            *
391            * <p>
392            * Useful when paginating results. Returns a maximum of <code>end -
393            * start</code> instances. <code>start</code> and <code>end</code> are not
394            * primary keys, they are indexes in the result set. Thus, <code>0</code>
395            * refers to the first result in the set. Setting both <code>start</code>
396            * and <code>end</code> to {@link
397            * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
398            * result set.
399            * </p>
400            *
401            * @param receiverUserId the primary key of the receiving user
402            * @param status the social request's status
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            * @return the range of matching social requests
406            * @throws SystemException if a system exception occurred
407            */
408            public static java.util.List<com.liferay.portlet.social.model.SocialRequest> getReceiverUserRequests(
409                    long receiverUserId, int status, int start, int end)
410                    throws com.liferay.portal.kernel.exception.SystemException {
411                    return getService()
412                                       .getReceiverUserRequests(receiverUserId, status, start, end);
413            }
414    
415            /**
416            * Returns the number of social requests for the receiving user.
417            *
418            * @param receiverUserId the primary key of the receiving user
419            * @return the number of matching social requests
420            * @throws SystemException if a system exception occurred
421            */
422            public static int getReceiverUserRequestsCount(long receiverUserId)
423                    throws com.liferay.portal.kernel.exception.SystemException {
424                    return getService().getReceiverUserRequestsCount(receiverUserId);
425            }
426    
427            /**
428            * Returns the number of social requests with the given status for the
429            * receiving user.
430            *
431            * @param receiverUserId the primary key of the receiving user
432            * @param status the social request's status
433            * @return the number of matching social requests
434            * @throws SystemException if a system exception occurred
435            */
436            public static int getReceiverUserRequestsCount(long receiverUserId,
437                    int status) throws com.liferay.portal.kernel.exception.SystemException {
438                    return getService().getReceiverUserRequestsCount(receiverUserId, status);
439            }
440    
441            /**
442            * Returns a range of all the social requests for the requesting user.
443            *
444            * <p>
445            * Useful when paginating results. Returns a maximum of <code>end -
446            * start</code> instances. <code>start</code> and <code>end</code> are not
447            * primary keys, they are indexes in the result set. Thus, <code>0</code>
448            * refers to the first result in the set. Setting both <code>start</code>
449            * and <code>end</code> to {@link
450            * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
451            * result set.
452            * </p>
453            *
454            * @param userId the primary key of the requesting user
455            * @param start the lower bound of the range of results
456            * @param end the upper bound of the range of results (not inclusive)
457            * @return the range of matching social requests
458            * @throws SystemException if a system exception occurred
459            */
460            public static java.util.List<com.liferay.portlet.social.model.SocialRequest> getUserRequests(
461                    long userId, int start, int end)
462                    throws com.liferay.portal.kernel.exception.SystemException {
463                    return getService().getUserRequests(userId, start, end);
464            }
465    
466            /**
467            * Returns a range of all the social requests with the given status for the
468            * requesting user.
469            *
470            * <p>
471            * Useful when paginating results. Returns a maximum of <code>end -
472            * start</code> instances. <code>start</code> and <code>end</code> are not
473            * primary keys, they are indexes in the result set. Thus, <code>0</code>
474            * refers to the first result in the set. Setting both <code>start</code>
475            * and <code>end</code> to {@link
476            * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
477            * result set.
478            * </p>
479            *
480            * @param userId the primary key of the requesting user
481            * @param status the social request's status
482            * @param start the lower bound of the range of results
483            * @param end the upper bound of the range of results (not inclusive)
484            * @return the range of matching social requests
485            * @throws SystemException if a system exception occurred
486            */
487            public static java.util.List<com.liferay.portlet.social.model.SocialRequest> getUserRequests(
488                    long userId, int status, int start, int end)
489                    throws com.liferay.portal.kernel.exception.SystemException {
490                    return getService().getUserRequests(userId, status, start, end);
491            }
492    
493            /**
494            * Returns the number of social requests for the requesting user.
495            *
496            * @param userId the primary key of the requesting user
497            * @return the number of matching social requests
498            * @throws SystemException if a system exception occurred
499            */
500            public static int getUserRequestsCount(long userId)
501                    throws com.liferay.portal.kernel.exception.SystemException {
502                    return getService().getUserRequestsCount(userId);
503            }
504    
505            /**
506            * Returns the number of social requests with the given status for the
507            * requesting user.
508            *
509            * @param userId the primary key of the requesting user
510            * @param status the social request's status
511            * @return the number of matching social request
512            * @throws SystemException if a system exception occurred
513            */
514            public static int getUserRequestsCount(long userId, int status)
515                    throws com.liferay.portal.kernel.exception.SystemException {
516                    return getService().getUserRequestsCount(userId, status);
517            }
518    
519            /**
520            * Returns <code>true</code> if a matching social requests exists in the
521            * database.
522            *
523            * @param userId the primary key of the requesting user
524            * @param className the class name of the asset that is the subject of the
525            request
526            * @param classPK the primary key of the asset that is the subject of the
527            request
528            * @param type the request's type
529            * @param status the social request's status
530            * @return <code>true</code> if the request exists; <code>false</code>
531            otherwise
532            * @throws SystemException if a system exception occurred
533            */
534            public static boolean hasRequest(long userId, java.lang.String className,
535                    long classPK, int type, int status)
536                    throws com.liferay.portal.kernel.exception.SystemException {
537                    return getService().hasRequest(userId, className, classPK, type, status);
538            }
539    
540            /**
541            * Returns <code>true</code> if a matching social request exists in the
542            * database.
543            *
544            * @param userId the primary key of the requesting user
545            * @param className the class name of the asset that is the subject of the
546            request
547            * @param classPK the primary key of the asset that is the subject of the
548            request
549            * @param type the request's type
550            * @param receiverUserId the primary key of the receiving user
551            * @param status the social request's status
552            * @return <code>true</code> if the social request exists;
553            <code>false</code> otherwise
554            * @throws SystemException if a system exception occurred
555            */
556            public static boolean hasRequest(long userId, java.lang.String className,
557                    long classPK, int type, long receiverUserId, int status)
558                    throws com.liferay.portal.kernel.exception.SystemException {
559                    return getService()
560                                       .hasRequest(userId, className, classPK, type,
561                            receiverUserId, status);
562            }
563    
564            /**
565            * Updates the social request replacing its status.
566            *
567            * <p>
568            * If the status is updated to {@link
569            * com.liferay.portlet.social.model.SocialRequestConstants#STATUS_CONFIRM}
570            * then {@link
571            * com.liferay.portlet.social.service.SocialRequestInterpreterLocalService#processConfirmation(
572            * SocialRequest, ThemeDisplay)} is called. If the status is updated to
573            * {@link
574            * com.liferay.portlet.social.model.SocialRequestConstants#STATUS_IGNORE}
575            * then {@link
576            * com.liferay.portlet.social.service.SocialRequestInterpreterLocalService#processRejection(
577            * SocialRequest, ThemeDisplay)} is called.
578            * </p>
579            *
580            * @param requestId the primary key of the social request
581            * @param status the new status
582            * @param themeDisplay the theme display
583            * @return the updated social request
584            * @throws PortalException if the social request could not be found
585            * @throws SystemException if a system exception occurred
586            */
587            public static com.liferay.portlet.social.model.SocialRequest updateRequest(
588                    long requestId, int status,
589                    com.liferay.portal.theme.ThemeDisplay themeDisplay)
590                    throws com.liferay.portal.kernel.exception.PortalException,
591                            com.liferay.portal.kernel.exception.SystemException {
592                    return getService().updateRequest(requestId, status, themeDisplay);
593            }
594    
595            public static SocialRequestLocalService getService() {
596                    if (_service == null) {
597                            _service = (SocialRequestLocalService)PortalBeanLocatorUtil.locate(SocialRequestLocalService.class.getName());
598    
599                            ReferenceRegistry.registerReference(SocialRequestLocalServiceUtil.class,
600                                    "_service");
601                            MethodCache.remove(SocialRequestLocalService.class);
602                    }
603    
604                    return _service;
605            }
606    
607            public void setService(SocialRequestLocalService service) {
608                    MethodCache.remove(SocialRequestLocalService.class);
609    
610                    _service = service;
611    
612                    ReferenceRegistry.registerReference(SocialRequestLocalServiceUtil.class,
613                            "_service");
614                    MethodCache.remove(SocialRequestLocalService.class);
615            }
616    
617            private static SocialRequestLocalService _service;
618    }