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