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