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