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