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