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