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