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.dao.orm.ActionableDynamicQuery;
020    import com.liferay.portal.kernel.dao.orm.DynamicQuery;
021    import com.liferay.portal.kernel.dao.orm.IndexableActionableDynamicQuery;
022    import com.liferay.portal.kernel.dao.orm.Projection;
023    import com.liferay.portal.kernel.exception.PortalException;
024    import com.liferay.portal.kernel.exception.SystemException;
025    import com.liferay.portal.kernel.messaging.async.Async;
026    import com.liferay.portal.kernel.search.Indexable;
027    import com.liferay.portal.kernel.search.IndexableType;
028    import com.liferay.portal.kernel.transaction.Isolation;
029    import com.liferay.portal.kernel.transaction.Propagation;
030    import com.liferay.portal.kernel.transaction.Transactional;
031    import com.liferay.portal.kernel.util.OrderByComparator;
032    import com.liferay.portal.model.PersistedModel;
033    import com.liferay.portal.service.BaseLocalService;
034    import com.liferay.portal.service.PersistedModelLocalService;
035    
036    import com.liferay.portlet.asset.model.AssetEntry;
037    import com.liferay.portlet.social.model.SocialActivity;
038    
039    import java.io.Serializable;
040    
041    import java.util.Date;
042    import java.util.List;
043    
044    /**
045     * Provides the local service interface for SocialActivity. Methods of this
046     * service will not have security checks based on the propagated JAAS
047     * credentials because this service can only be accessed from within the same
048     * VM.
049     *
050     * @author Brian Wing Shun Chan
051     * @see SocialActivityLocalServiceUtil
052     * @see com.liferay.portlet.social.service.base.SocialActivityLocalServiceBaseImpl
053     * @see com.liferay.portlet.social.service.impl.SocialActivityLocalServiceImpl
054     * @generated
055     */
056    @ProviderType
057    @Transactional(isolation = Isolation.PORTAL, rollbackFor =  {
058            PortalException.class, SystemException.class})
059    public interface SocialActivityLocalService extends BaseLocalService,
060            PersistedModelLocalService {
061            /*
062             * NOTE FOR DEVELOPERS:
063             *
064             * Never modify or reference this interface directly. Always use {@link SocialActivityLocalServiceUtil} to access the social activity local service. Add custom service methods to {@link com.liferay.portlet.social.service.impl.SocialActivityLocalServiceImpl} and rerun ServiceBuilder to automatically copy the method declarations to this interface.
065             */
066            @Async
067            public void addActivity(SocialActivity activity,
068                    SocialActivity mirrorActivity) throws PortalException;
069    
070            /**
071            * Records an activity in the database, using a time based on the current
072            * time in an attempt to make the activity's time unique.
073            *
074            * @param userId the primary key of the acting user
075            * @param groupId the primary key of the group
076            * @param className the target asset's class name
077            * @param classPK the primary key of the target asset
078            * @param type the activity's type
079            * @param extraData any extra data regarding the activity
080            * @param receiverUserId the primary key of the receiving user
081            */
082            public void addActivity(long userId, long groupId,
083                    java.lang.String className, long classPK, int type,
084                    java.lang.String extraData, long receiverUserId)
085                    throws PortalException;
086    
087            /**
088            * Records an activity with the given time in the database.
089            *
090            * <p>
091            * This method records a social activity done on an asset, identified by its
092            * class name and class primary key, in the database. Additional information
093            * (such as the original message ID for a reply to a forum post) is passed
094            * in via the <code>extraData</code> in JSON format. For activities
095            * affecting another user, a mirror activity is generated that describes the
096            * action from the user's point of view. The target user's ID is passed in
097            * via the <code>receiverUserId</code>.
098            * </p>
099            *
100            * <p>
101            * Example for a mirrored activity:<br> When a user replies to a message
102            * boards post, the reply action is stored in the database with the
103            * <code>receiverUserId</code> being the ID of the author of the original
104            * message. The <code>extraData</code> contains the ID of the original
105            * message in JSON format. A mirror activity is generated with the values of
106            * the <code>userId</code> and the <code>receiverUserId</code> swapped. This
107            * mirror activity basically describes a "replied to" event.
108            * </p>
109            *
110            * <p>
111            * Mirror activities are most often used in relation to friend requests and
112            * activities.
113            * </p>
114            *
115            * @param userId the primary key of the acting user
116            * @param groupId the primary key of the group
117            * @param createDate the activity's date
118            * @param className the target asset's class name
119            * @param classPK the primary key of the target asset
120            * @param type the activity's type
121            * @param extraData any extra data regarding the activity
122            * @param receiverUserId the primary key of the receiving user
123            */
124            public void addActivity(long userId, long groupId, Date createDate,
125                    java.lang.String className, long classPK, int type,
126                    java.lang.String extraData, long receiverUserId)
127                    throws PortalException;
128    
129            /**
130            * Adds the social activity to the database. Also notifies the appropriate model listeners.
131            *
132            * @param socialActivity the social activity
133            * @return the social activity that was added
134            */
135            @Indexable(type = IndexableType.REINDEX)
136            public SocialActivity addSocialActivity(SocialActivity socialActivity);
137    
138            /**
139            * Records an activity with the current time in the database, but only if
140            * there isn't one with the same parameters.
141            *
142            * <p>
143            * For the main functionality see {@link #addActivity(long, long, Date,
144            * String, long, int, String, long)}
145            * </p>
146            *
147            * @param userId the primary key of the acting user
148            * @param groupId the primary key of the group
149            * @param className the target asset's class name
150            * @param classPK the primary key of the target asset
151            * @param type the activity's type
152            * @param extraData any extra data regarding the activity
153            * @param receiverUserId the primary key of the receiving user
154            */
155            public void addUniqueActivity(long userId, long groupId,
156                    java.lang.String className, long classPK, int type,
157                    java.lang.String extraData, long receiverUserId)
158                    throws PortalException;
159    
160            /**
161            * Records an activity in the database, but only if there isn't already an
162            * activity with the same parameters.
163            *
164            * <p>
165            * For the main functionality see {@link #addActivity(long, long, Date,
166            * String, long, int, String, long)}
167            * </p>
168            *
169            * @param userId the primary key of the acting user
170            * @param groupId the primary key of the group
171            * @param createDate the activity's date
172            * @param className the target asset's class name
173            * @param classPK the primary key of the target asset
174            * @param type the activity's type
175            * @param extraData any extra data regarding the activity
176            * @param receiverUserId the primary key of the receiving user
177            */
178            public void addUniqueActivity(long userId, long groupId, Date createDate,
179                    java.lang.String className, long classPK, int type,
180                    java.lang.String extraData, long receiverUserId)
181                    throws PortalException;
182    
183            /**
184            * Creates a new social activity with the primary key. Does not add the social activity to the database.
185            *
186            * @param activityId the primary key for the new social activity
187            * @return the new social activity
188            */
189            public SocialActivity createSocialActivity(long activityId);
190    
191            /**
192            * Removes stored activities for the asset.
193            *
194            * @param assetEntry the asset from which to remove stored activities
195            */
196            public void deleteActivities(AssetEntry assetEntry)
197                    throws PortalException;
198    
199            /**
200            * Removes stored activities for the asset identified by the class name and
201            * class primary key.
202            *
203            * @param className the target asset's class name
204            * @param classPK the primary key of the target asset
205            */
206            public void deleteActivities(java.lang.String className, long classPK)
207                    throws PortalException;
208    
209            public void deleteActivities(long groupId);
210    
211            /**
212            * Removes the stored activity and its mirror activity from the database.
213            *
214            * @param activity the activity to be removed
215            */
216            public void deleteActivity(SocialActivity activity)
217                    throws PortalException;
218    
219            /**
220            * Removes the stored activity from the database.
221            *
222            * @param activityId the primary key of the stored activity
223            */
224            public void deleteActivity(long activityId) throws PortalException;
225    
226            /**
227            * @throws PortalException
228            */
229            @Override
230            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
231                    throws PortalException;
232    
233            /**
234            * Deletes the social activity with the primary key from the database. Also notifies the appropriate model listeners.
235            *
236            * @param activityId the primary key of the social activity
237            * @return the social activity that was removed
238            * @throws PortalException if a social activity with the primary key could not be found
239            */
240            @Indexable(type = IndexableType.DELETE)
241            public SocialActivity deleteSocialActivity(long activityId)
242                    throws PortalException;
243    
244            /**
245            * Deletes the social activity from the database. Also notifies the appropriate model listeners.
246            *
247            * @param socialActivity the social activity
248            * @return the social activity that was removed
249            */
250            @Indexable(type = IndexableType.DELETE)
251            public SocialActivity deleteSocialActivity(SocialActivity socialActivity);
252    
253            /**
254            * Removes the user's stored activities from the database.
255            *
256            * <p>
257            * This method removes all activities where the user is either the actor or
258            * the receiver.
259            * </p>
260            *
261            * @param userId the primary key of the user
262            */
263            public void deleteUserActivities(long userId) throws PortalException;
264    
265            public DynamicQuery dynamicQuery();
266    
267            /**
268            * Performs a dynamic query on the database and returns the matching rows.
269            *
270            * @param dynamicQuery the dynamic query
271            * @return the matching rows
272            */
273            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery);
274    
275            /**
276            * Performs a dynamic query on the database and returns a range of the matching rows.
277            *
278            * <p>
279            * 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.SocialActivityModelImpl}. 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.
280            * </p>
281            *
282            * @param dynamicQuery the dynamic query
283            * @param start the lower bound of the range of model instances
284            * @param end the upper bound of the range of model instances (not inclusive)
285            * @return the range of matching rows
286            */
287            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
288                    int end);
289    
290            /**
291            * Performs a dynamic query on the database and returns an ordered range of the matching rows.
292            *
293            * <p>
294            * 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.SocialActivityModelImpl}. 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.
295            * </p>
296            *
297            * @param dynamicQuery the dynamic query
298            * @param start the lower bound of the range of model instances
299            * @param end the upper bound of the range of model instances (not inclusive)
300            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
301            * @return the ordered range of matching rows
302            */
303            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
304                    int end, OrderByComparator<T> orderByComparator);
305    
306            /**
307            * Returns the number of rows matching the dynamic query.
308            *
309            * @param dynamicQuery the dynamic query
310            * @return the number of rows matching the dynamic query
311            */
312            public long dynamicQueryCount(DynamicQuery dynamicQuery);
313    
314            /**
315            * Returns the number of rows matching the dynamic query.
316            *
317            * @param dynamicQuery the dynamic query
318            * @param projection the projection to apply to the query
319            * @return the number of rows matching the dynamic query
320            */
321            public long dynamicQueryCount(DynamicQuery dynamicQuery,
322                    Projection projection);
323    
324            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
325            public SocialActivity fetchFirstActivity(java.lang.String className,
326                    long classPK, int type);
327    
328            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
329            public SocialActivity fetchSocialActivity(long activityId);
330    
331            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
332            public ActionableDynamicQuery getActionableDynamicQuery();
333    
334            /**
335            * Returns a range of all the activities done on assets identified by the
336            * class name.
337            *
338            * <p>
339            * Useful when paginating results. Returns a maximum of <code>end -
340            * start</code> instances. <code>start</code> and <code>end</code> are not
341            * primary keys, they are indexes in the result set. Thus, <code>0</code>
342            * refers to the first result in the set. Setting both <code>start</code>
343            * and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full
344            * result set.
345            * </p>
346            *
347            * @param className the target asset's class name
348            * @param start the lower bound of the range of results
349            * @param end the upper bound of the range of results (not inclusive)
350            * @return the range of matching activities
351            */
352            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
353            public List<SocialActivity> getActivities(java.lang.String className,
354                    int start, int end);
355    
356            /**
357            * Returns a range of all the activities done on assets identified by the
358            * class name ID.
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 QueryUtil#ALL_POS} will return the full
366            * result set.
367            * </p>
368            *
369            * @param classNameId the target asset's class name ID
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 activities
373            */
374            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
375            public List<SocialActivity> getActivities(long classNameId, int start,
376                    int end);
377    
378            /**
379            * Returns a range of all the activities done on the asset identified by the
380            * class name and the class primary key that are mirrors of the activity
381            * identified by the mirror activity ID.
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 QueryUtil#ALL_POS} will return the full
389            * result set.
390            * </p>
391            *
392            * @param mirrorActivityId the primary key of the mirror activity
393            * @param className the target asset's class name
394            * @param classPK the primary key of the target asset
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 matching activities
398            */
399            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
400            public List<SocialActivity> getActivities(long mirrorActivityId,
401                    java.lang.String className, long classPK, int start, int end);
402    
403            /**
404            * Returns a range of all the activities done on the asset identified by the
405            * class name ID and class primary key that are mirrors of the activity
406            * identified by the mirror activity ID.
407            *
408            * <p>
409            * Useful when paginating results. Returns a maximum of <code>end -
410            * start</code> instances. <code>start</code> and <code>end</code> are not
411            * primary keys, they are indexes in the result set. Thus, <code>0</code>
412            * refers to the first result in the set. Setting both <code>start</code>
413            * and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full
414            * result set.
415            * </p>
416            *
417            * @param mirrorActivityId the primary key of the mirror activity
418            * @param classNameId the target asset's class name ID
419            * @param classPK the primary key of the target asset
420            * @param start the lower bound of the range of results
421            * @param end the upper bound of the range of results (not inclusive)
422            * @return the range of matching activities
423            */
424            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
425            public List<SocialActivity> getActivities(long mirrorActivityId,
426                    long classNameId, long classPK, int start, int end);
427    
428            /**
429            * Returns the number of activities done on assets identified by class name.
430            *
431            * @param className the target asset's class name
432            * @return the number of matching activities
433            */
434            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
435            public int getActivitiesCount(java.lang.String className);
436    
437            /**
438            * Returns the number of activities done on assets identified by the class
439            * name ID.
440            *
441            * @param classNameId the target asset's class name ID
442            * @return the number of matching activities
443            */
444            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
445            public int getActivitiesCount(long classNameId);
446    
447            /**
448            * Returns the number of activities done on the asset identified by the
449            * class name and class primary key that are mirrors of the activity
450            * identified by the mirror activity ID.
451            *
452            * @param mirrorActivityId the primary key of the mirror activity
453            * @param className the target asset's class name
454            * @param classPK the primary key of the target asset
455            * @return the number of matching activities
456            */
457            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
458            public int getActivitiesCount(long mirrorActivityId,
459                    java.lang.String className, long classPK);
460    
461            /**
462            * Returns the number of activities done on the asset identified by the
463            * class name ID and class primary key that are mirrors of the activity
464            * identified by the mirror activity ID.
465            *
466            * @param mirrorActivityId the primary key of the mirror activity
467            * @param classNameId the target asset's class name ID
468            * @param classPK the primary key of the target asset
469            * @return the number of matching activities
470            */
471            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
472            public int getActivitiesCount(long mirrorActivityId, long classNameId,
473                    long classPK);
474    
475            /**
476            * Returns the activity identified by its primary key.
477            *
478            * @param activityId the primary key of the activity
479            * @return Returns the activity
480            */
481            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
482            public SocialActivity getActivity(long activityId)
483                    throws PortalException;
484    
485            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
486            public List<SocialActivity> getActivitySetActivities(long activitySetId,
487                    int start, int end);
488    
489            /**
490            * Returns a range of all the activities done in the group.
491            *
492            * <p>
493            * This method only finds activities without mirrors.
494            * </p>
495            *
496            * <p>
497            * Useful when paginating results. Returns a maximum of <code>end -
498            * start</code> instances. <code>start</code> and <code>end</code> are not
499            * primary keys, they are indexes in the result set. Thus, <code>0</code>
500            * refers to the first result in the set. Setting both <code>start</code>
501            * and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full
502            * result set.
503            * </p>
504            *
505            * @param groupId the primary key of the group
506            * @param start the lower bound of the range of results
507            * @param end the upper bound of the range of results (not inclusive)
508            * @return the range of matching activities
509            */
510            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
511            public List<SocialActivity> getGroupActivities(long groupId, int start,
512                    int end);
513    
514            /**
515            * Returns the number of activities done in the group.
516            *
517            * <p>
518            * This method only counts activities without mirrors.
519            * </p>
520            *
521            * @param groupId the primary key of the group
522            * @return the number of matching activities
523            */
524            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
525            public int getGroupActivitiesCount(long groupId);
526    
527            /**
528            * Returns a range of activities done by users that are members of the
529            * group.
530            *
531            * <p>
532            * This method only finds activities without mirrors.
533            * </p>
534            *
535            * <p>
536            * Useful when paginating results. Returns a maximum of <code>end -
537            * start</code> instances. <code>start</code> and <code>end</code> are not
538            * primary keys, they are indexes in the result set. Thus, <code>0</code>
539            * refers to the first result in the set. Setting both <code>start</code>
540            * and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full
541            * result set.
542            * </p>
543            *
544            * @param groupId the primary key of the group
545            * @param start the lower bound of the range of results
546            * @param end the upper bound of the range of results (not inclusive)
547            * @return the range of matching activities
548            */
549            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
550            public List<SocialActivity> getGroupUsersActivities(long groupId,
551                    int start, int end);
552    
553            /**
554            * Returns the number of activities done by users that are members of the
555            * group.
556            *
557            * <p>
558            * This method only counts activities without mirrors.
559            * </p>
560            *
561            * @param groupId the primary key of the group
562            * @return the number of matching activities
563            */
564            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
565            public int getGroupUsersActivitiesCount(long groupId);
566    
567            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
568            public IndexableActionableDynamicQuery getIndexableActionableDynamicQuery();
569    
570            /**
571            * Returns the activity that has the mirror activity.
572            *
573            * @param mirrorActivityId the primary key of the mirror activity
574            * @return Returns the mirror activity
575            */
576            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
577            public SocialActivity getMirrorActivity(long mirrorActivityId)
578                    throws PortalException;
579    
580            /**
581            * Returns the OSGi service identifier.
582            *
583            * @return the OSGi service identifier
584            */
585            public java.lang.String getOSGiServiceIdentifier();
586    
587            /**
588            * Returns a range of all the activities done in the organization. This
589            * method only finds activities without mirrors.
590            *
591            * <p>
592            * Useful when paginating results. Returns a maximum of <code>end -
593            * start</code> instances. <code>start</code> and <code>end</code> are not
594            * primary keys, they are indexes in the result set. Thus, <code>0</code>
595            * refers to the first result in the set. Setting both <code>start</code>
596            * and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full
597            * result set.
598            * </p>
599            *
600            * @param organizationId the primary key of the organization
601            * @param start the lower bound of the range of results
602            * @param end the upper bound of the range of results (not inclusive)
603            * @return the range of matching activities
604            */
605            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
606            public List<SocialActivity> getOrganizationActivities(long organizationId,
607                    int start, int end);
608    
609            /**
610            * Returns the number of activities done in the organization. This method
611            * only counts activities without mirrors.
612            *
613            * @param organizationId the primary key of the organization
614            * @return the number of matching activities
615            */
616            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
617            public int getOrganizationActivitiesCount(long organizationId);
618    
619            /**
620            * Returns a range of all the activities done by users of the organization.
621            * This method only finds activities without mirrors.
622            *
623            * <p>
624            * Useful when paginating results. Returns a maximum of <code>end -
625            * start</code> instances. <code>start</code> and <code>end</code> are not
626            * primary keys, they are indexes in the result set. Thus, <code>0</code>
627            * refers to the first result in the set. Setting both <code>start</code>
628            * and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full
629            * result set.
630            * </p>
631            *
632            * @param organizationId the primary key of the organization
633            * @param start the lower bound of the range of results
634            * @param end the upper bound of the range of results (not inclusive)
635            * @return the range of matching activities
636            */
637            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
638            public List<SocialActivity> getOrganizationUsersActivities(
639                    long organizationId, int start, int end);
640    
641            /**
642            * Returns the number of activities done by users of the organization. This
643            * method only counts activities without mirrors.
644            *
645            * @param organizationId the primary key of the organization
646            * @return the number of matching activities
647            */
648            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
649            public int getOrganizationUsersActivitiesCount(long organizationId);
650    
651            @Override
652            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
653            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
654                    throws PortalException;
655    
656            /**
657            * Returns a range of all the activities done by users in a relationship
658            * with the user identified by the user ID.
659            *
660            * <p>
661            * Useful when paginating results. Returns a maximum of <code>end -
662            * start</code> instances. <code>start</code> and <code>end</code> are not
663            * primary keys, they are indexes in the result set. Thus, <>0</code> refers
664            * to the first result in the set. Setting both <code>start</code> and
665            * <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result
666            * set.
667            * </p>
668            *
669            * @param userId the primary key of the user
670            * @param start the lower bound of the range of results
671            * @param end the upper bound of the range of results (not inclusive)
672            * @return the range of matching activities
673            */
674            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
675            public List<SocialActivity> getRelationActivities(long userId, int start,
676                    int end);
677    
678            /**
679            * Returns a range of all the activities done by users in a relationship of
680            * type <code>type</code> with the user identified by <code>userId</code>.
681            * This method only finds activities without mirrors.
682            *
683            * <p>
684            * Useful when paginating results. Returns a maximum of <code>end -
685            * start</code> instances. <code>start</code> and <code>end</code> are not
686            * primary keys, they are indexes in the result set. Thus, <code>0</code>
687            * refers to the first result in the set. Setting both <code>start</code>
688            * and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full
689            * result set.
690            * </p>
691            *
692            * @param userId the primary key of the user
693            * @param type the relationship type
694            * @param start the lower bound of the range of results
695            * @param end the upper bound of the range of results (not inclusive)
696            * @return the range of matching activities
697            */
698            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
699            public List<SocialActivity> getRelationActivities(long userId, int type,
700                    int start, int end);
701    
702            /**
703            * Returns the number of activities done by users in a relationship with the
704            * user identified by userId.
705            *
706            * @param userId the primary key of the user
707            * @return the number of matching activities
708            */
709            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
710            public int getRelationActivitiesCount(long userId);
711    
712            /**
713            * Returns the number of activities done by users in a relationship of type
714            * <code>type</code> with the user identified by <code>userId</code>. This
715            * method only counts activities without mirrors.
716            *
717            * @param userId the primary key of the user
718            * @param type the relationship type
719            * @return the number of matching activities
720            */
721            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
722            public int getRelationActivitiesCount(long userId, int type);
723    
724            /**
725            * Returns a range of all the social activities.
726            *
727            * <p>
728            * 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.SocialActivityModelImpl}. 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.
729            * </p>
730            *
731            * @param start the lower bound of the range of social activities
732            * @param end the upper bound of the range of social activities (not inclusive)
733            * @return the range of social activities
734            */
735            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
736            public List<SocialActivity> getSocialActivities(int start, int end);
737    
738            /**
739            * Returns the number of social activities.
740            *
741            * @return the number of social activities
742            */
743            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
744            public int getSocialActivitiesCount();
745    
746            /**
747            * Returns the social activity with the primary key.
748            *
749            * @param activityId the primary key of the social activity
750            * @return the social activity
751            * @throws PortalException if a social activity with the primary key could not be found
752            */
753            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
754            public SocialActivity getSocialActivity(long activityId)
755                    throws PortalException;
756    
757            /**
758            * Returns a range of all the activities done by the user.
759            *
760            * <p>
761            * Useful when paginating results. Returns a maximum of <code>end -
762            * start</code> instances. <code>start</code> and <code>end</code> are not
763            * primary keys, they are indexes in the result set. Thus, <code>0</code>
764            * refers to the first result in the set. Setting both <code>start</code>
765            * and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full
766            * result set.
767            * </p>
768            *
769            * @param userId the primary key of the user
770            * @param start the lower bound of the range of results
771            * @param end the upper bound of the range of results (not inclusive)
772            * @return the range of matching activities
773            */
774            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
775            public List<SocialActivity> getUserActivities(long userId, int start,
776                    int end);
777    
778            /**
779            * Returns the number of activities done by the user.
780            *
781            * @param userId the primary key of the user
782            * @return the number of matching activities
783            */
784            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
785            public int getUserActivitiesCount(long userId);
786    
787            /**
788            * Returns a range of all the activities done in the user's groups. This
789            * method only finds activities without mirrors.
790            *
791            * <p>
792            * Useful when paginating results. Returns a maximum of <code>end -
793            * start</code> instances. <code>start</code> and <code>end</code> are not
794            * primary keys, they are indexes in the result set. Thus, <code>0</code>
795            * refers to the first result in the set. Setting both <code>start</code>
796            * and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full
797            * result set.
798            * </p>
799            *
800            * @param userId the primary key of the user
801            * @param start the lower bound of the range of results
802            * @param end the upper bound of the range of results (not inclusive)
803            * @return the range of matching activities
804            */
805            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
806            public List<SocialActivity> getUserGroupsActivities(long userId, int start,
807                    int end);
808    
809            /**
810            * Returns the number of activities done in user's groups. This method only
811            * counts activities without mirrors.
812            *
813            * @param userId the primary key of the user
814            * @return the number of matching activities
815            */
816            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
817            public int getUserGroupsActivitiesCount(long userId);
818    
819            /**
820            * Returns a range of all the activities done in the user's groups and
821            * organizations. This method only finds activities without mirrors.
822            *
823            * <p>
824            * Useful when paginating results. Returns a maximum of <code>end -
825            * start</code> instances. <code>start</code> and <code>end</code> are not
826            * primary keys, they are indexes in the result set. Thus, <code>0</code>
827            * refers to the first result in the set. Setting both <code>start</code>
828            * and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full
829            * result set.
830            * </p>
831            *
832            * @param userId the primary key of the user
833            * @param start the lower bound of the range of results
834            * @param end the upper bound of the range of results (not inclusive)
835            * @return the range of matching activities
836            */
837            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
838            public List<SocialActivity> getUserGroupsAndOrganizationsActivities(
839                    long userId, int start, int end);
840    
841            /**
842            * Returns the number of activities done in user's groups and organizations.
843            * This method only counts activities without mirrors.
844            *
845            * @param userId the primary key of the user
846            * @return the number of matching activities
847            */
848            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
849            public int getUserGroupsAndOrganizationsActivitiesCount(long userId);
850    
851            /**
852            * Returns a range of all activities done in the user's organizations. This
853            * method only finds activities without mirrors.
854            *
855            * <p>
856            * Useful when paginating results. Returns a maximum of <code>end -
857            * start</code> instances. <code>start</code> and <code>end</code> are not
858            * primary keys, they are indexes in the result set. Thus, <code>0</code>
859            * refers to the first result in the set. Setting both <code>start</code>
860            * and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full
861            * result set.
862            * </p>
863            *
864            * @param userId the primary key of the user
865            * @param start the lower bound of the range of results
866            * @param end the upper bound of the range of results (not inclusive)
867            * @return the range of matching activities
868            */
869            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
870            public List<SocialActivity> getUserOrganizationsActivities(long userId,
871                    int start, int end);
872    
873            /**
874            * Returns the number of activities done in the user's organizations. This
875            * method only counts activities without mirrors.
876            *
877            * @param userId the primary key of the user
878            * @return the number of matching activities
879            */
880            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
881            public int getUserOrganizationsActivitiesCount(long userId);
882    
883            /**
884            * Updates the social activity in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
885            *
886            * @param socialActivity the social activity
887            * @return the social activity that was updated
888            */
889            @Indexable(type = IndexableType.REINDEX)
890            public SocialActivity updateSocialActivity(SocialActivity socialActivity);
891    }