001 /** 002 * Copyright (c) 2000-present Liferay, Inc. All rights reserved. 003 * 004 * This library is free software; you can redistribute it and/or modify it under 005 * the terms of the GNU Lesser General Public License as published by the Free 006 * Software Foundation; either version 2.1 of the License, or (at your option) 007 * any later version. 008 * 009 * This library is distributed in the hope that it will be useful, but WITHOUT 010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 011 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 012 * details. 013 */ 014 015 package com.liferay.portlet.social.service; 016 017 import aQute.bnd.annotation.ProviderType; 018 019 import com.liferay.portal.kernel.exception.PortalException; 020 import com.liferay.portal.kernel.exception.SystemException; 021 import com.liferay.portal.kernel.search.IndexableType; 022 import com.liferay.portal.kernel.transaction.Isolation; 023 import com.liferay.portal.kernel.transaction.Propagation; 024 import com.liferay.portal.kernel.transaction.Transactional; 025 import com.liferay.portal.service.BaseLocalService; 026 import com.liferay.portal.service.PersistedModelLocalService; 027 028 /** 029 * Provides the local service interface for SocialActivityCounter. Methods of this 030 * service will not have security checks based on the propagated JAAS 031 * credentials because this service can only be accessed from within the same 032 * VM. 033 * 034 * @author Brian Wing Shun Chan 035 * @see SocialActivityCounterLocalServiceUtil 036 * @see com.liferay.portlet.social.service.base.SocialActivityCounterLocalServiceBaseImpl 037 * @see com.liferay.portlet.social.service.impl.SocialActivityCounterLocalServiceImpl 038 * @generated 039 */ 040 @ProviderType 041 @Transactional(isolation = Isolation.PORTAL, rollbackFor = { 042 PortalException.class, SystemException.class}) 043 public interface SocialActivityCounterLocalService extends BaseLocalService, 044 PersistedModelLocalService { 045 /* 046 * NOTE FOR DEVELOPERS: 047 * 048 * Never modify or reference this interface directly. Always use {@link SocialActivityCounterLocalServiceUtil} to access the social activity counter local service. Add custom service methods to {@link com.liferay.portlet.social.service.impl.SocialActivityCounterLocalServiceImpl} and rerun ServiceBuilder to automatically copy the method declarations to this interface. 049 */ 050 051 /** 052 * Adds an activity counter with a default period length. 053 * 054 * <p> 055 * This method uses the lock service to guard against multiple threads 056 * trying to insert the same counter because this service is called 057 * asynchronously from the social activity service. 058 * </p> 059 * 060 * @param groupId the primary key of the group 061 * @param classNameId the primary key of the entity's class this 062 counter belongs to 063 * @param classPK the primary key of the entity this counter belongs to 064 * @param name the counter's name 065 * @param ownerType the counter's owner type. Acceptable values are 066 <code>TYPE_ACTOR</code>, <code>TYPE_ASSET</code> and 067 <code>TYPE_CREATOR</code> defined in {@link 068 SocialActivityCounterConstants}. 069 * @param currentValue the counter's current value (optionally 070 <code>0</code>) 071 * @param totalValue the counter's total value (optionally 072 <code>0</code>) 073 * @param startPeriod the counter's start period 074 * @param endPeriod the counter's end period 075 * @return the added activity counter 076 * @throws PortalException if the group or the previous activity counter 077 could not be found 078 * @deprecated As of 6.2.0, replaced by {@link #addActivityCounter(long, 079 long, long, String, int, int, long, int)} 080 */ 081 @java.lang.Deprecated 082 public com.liferay.portlet.social.model.SocialActivityCounter addActivityCounter( 083 long groupId, long classNameId, long classPK, java.lang.String name, 084 int ownerType, int currentValue, int totalValue, int startPeriod, 085 int endPeriod) throws PortalException; 086 087 /** 088 * Adds an activity counter specifying a previous activity and period 089 * length. 090 * 091 * <p> 092 * This method uses the lock service to guard against multiple threads 093 * trying to insert the same counter because this service is called 094 * asynchronously from the social activity service. 095 * </p> 096 * 097 * @param groupId the primary key of the group 098 * @param classNameId the primary key of the entity's class this 099 counter belongs to 100 * @param classPK the primary key of the entity this counter belongs to 101 * @param name the counter name 102 * @param ownerType the counter's owner type. Acceptable values are 103 <code>TYPE_ACTOR</code>, <code>TYPE_ASSET</code> and 104 <code>TYPE_CREATOR</code> defined in {@link 105 SocialActivityCounterConstants}. 106 * @param currentValue the current value of the counter (optionally 107 <code>0</code>) 108 * @param totalValue the counter's total value (optionally 109 <code>0</code>) 110 * @param startPeriod the counter's start period 111 * @param endPeriod the counter's end period 112 * @param previousActivityCounterId the primary key of the activity 113 counter for the previous time period (optionally 114 <code>0</code>, if this is the first) 115 * @param periodLength the period length in days, 116 <code>PERIOD_LENGTH_INFINITE</code> for never ending counters 117 or <code>PERIOD_LENGTH_SYSTEM</code> for the period length 118 defined in <code>portal-ext.properties</code>. For more 119 information see {@link SocialActivityCounterConstants}. 120 * @return the added activity counter 121 * @throws PortalException if the group or the previous activity counter 122 could not be found 123 * @deprecated As of 6.2.0, replaced by {@link #addActivityCounter(long, 124 long, long, String, int, int, long, int)} 125 */ 126 @java.lang.Deprecated 127 public com.liferay.portlet.social.model.SocialActivityCounter addActivityCounter( 128 long groupId, long classNameId, long classPK, java.lang.String name, 129 int ownerType, int currentValue, int totalValue, int startPeriod, 130 int endPeriod, long previousActivityCounterId, int periodLength) 131 throws PortalException; 132 133 /** 134 * Adds an activity counter specifying a previous activity and period 135 * length. 136 * 137 * <p> 138 * This method uses the lock service to guard against multiple threads 139 * trying to insert the same counter because this service is called 140 * asynchronously from the social activity service. 141 * </p> 142 * 143 * @param groupId the primary key of the group 144 * @param classNameId the primary key of the entity's class this counter 145 belongs to 146 * @param classPK the primary key of the entity this counter belongs to 147 * @param name the counter name 148 * @param ownerType the counter's owner type. Acceptable values are 149 <code>TYPE_ACTOR</code>, <code>TYPE_ASSET</code> and 150 <code>TYPE_CREATOR</code> defined in {@link 151 SocialActivityCounterConstants}. 152 * @param totalValue the counter's total value (optionally <code>0</code>) 153 * @param previousActivityCounterId the primary key of the activity counter 154 for the previous time period (optionally <code>0</code>, if this 155 is the first) 156 * @param periodLength the period length in days, 157 <code>PERIOD_LENGTH_INFINITE</code> for never ending counters or 158 <code>PERIOD_LENGTH_SYSTEM</code> for the period length defined 159 in <code>portal-ext.properties</code>. For more information see 160 {@link SocialActivityCounterConstants}. 161 * @return the added activity counter 162 * @throws PortalException if the group or the previous activity counter 163 could not be found 164 */ 165 @Transactional(propagation = Propagation.REQUIRES_NEW) 166 public com.liferay.portlet.social.model.SocialActivityCounter addActivityCounter( 167 long groupId, long classNameId, long classPK, java.lang.String name, 168 int ownerType, int totalValue, long previousActivityCounterId, 169 int periodLength) throws PortalException; 170 171 /** 172 * Adds or increments activity counters related to an activity. 173 * 174 * </p> 175 * This method is called asynchronously from the social activity service 176 * when the user performs an activity defined in 177 * </code>liferay-social.xml</code>. 178 * </p> 179 * 180 * <p> 181 * This method first calls the activity processor class, if there is one 182 * defined for the activity, checks for limits and increments all the 183 * counters that belong to the activity. Afterwards, it processes the 184 * activity with respect to achievement classes, if any. Lastly it 185 * increments the built-in <code>user.activities</code> and 186 * <code>asset.activities</code> counters. 187 * </p> 188 * 189 * @param activity the social activity 190 * @throws PortalException if an expected group or expected previous 191 activity counters could not be found 192 */ 193 public void addActivityCounters( 194 com.liferay.portlet.social.model.SocialActivity activity) 195 throws PortalException; 196 197 /** 198 * Adds the social activity counter to the database. Also notifies the appropriate model listeners. 199 * 200 * @param socialActivityCounter the social activity counter 201 * @return the social activity counter that was added 202 */ 203 @com.liferay.portal.kernel.search.Indexable(type = IndexableType.REINDEX) 204 public com.liferay.portlet.social.model.SocialActivityCounter addSocialActivityCounter( 205 com.liferay.portlet.social.model.SocialActivityCounter socialActivityCounter); 206 207 /** 208 * Creates an activity counter with a default period length, adding it into 209 * the database. 210 * 211 * @param groupId the primary key of the group 212 * @param classNameId the primary key of the entity's class this 213 counter belongs to 214 * @param classPK the primary key of the entity this counter belongs to 215 * @param name the counter's name 216 * @param ownerType the counter's owner type. Acceptable values are 217 <code>TYPE_ACTOR</code>, <code>TYPE_ASSET</code> and 218 <code>TYPE_CREATOR</code> defined in {@link 219 SocialActivityCounterConstants}. 220 * @param currentValue the counter's current value (optionally 221 <code>0</code>) 222 * @param totalValue the counter's total value (optionally 223 <code>0</code>) 224 * @param startPeriod the counter's start period 225 * @param endPeriod the counter's end period 226 * @return the created activity counter 227 * @throws PortalException if the group or a previous activity counter 228 could not be found 229 * @deprecated As of 6.2.0, replaced by {@link #addActivityCounter(long, 230 long, long, String, int, int, long, int)} 231 */ 232 @java.lang.Deprecated 233 @Transactional(propagation = Propagation.REQUIRES_NEW) 234 public com.liferay.portlet.social.model.SocialActivityCounter createActivityCounter( 235 long groupId, long classNameId, long classPK, java.lang.String name, 236 int ownerType, int currentValue, int totalValue, int startPeriod, 237 int endPeriod) throws PortalException; 238 239 /** 240 * Creates an activity counter, adding it into the database. 241 * 242 * <p> 243 * This method actually creates the counter in the database. It requires a 244 * new transaction so that other threads can find the new counter when the 245 * lock in the calling method is released. 246 * </p> 247 * 248 * @param groupId the primary key of the group 249 * @param classNameId the primary key of the entity's class this 250 counter belongs to 251 * @param classPK the primary key of the entity this counter belongs to 252 * @param name the counter's name 253 * @param ownerType the counter's owner type. Acceptable values are 254 <code>TYPE_ACTOR</code>, <code>TYPE_ASSET</code> and 255 <code>TYPE_CREATOR</code> defined in {@link 256 SocialActivityCounterConstants}. 257 * @param currentValue the counter's current value (optionally 258 <code>0</code>) 259 * @param totalValue the counter's total value of the counter 260 (optionally <code>0</code>) 261 * @param startPeriod the counter's start period 262 * @param endPeriod the counter's end period 263 * @param previousActivityCounterId the primary key of the activity 264 counter for the previous time period (optionally 265 <code>0</code>, if this is the first) 266 * @param periodLength the period length in days, 267 <code>PERIOD_LENGTH_INFINITE</code> for never ending counters 268 or <code>PERIOD_LENGTH_SYSTEM</code> for the period length 269 defined in <code>portal-ext.properties</code>. For more 270 information see {@link SocialActivityConstants}. 271 * @return the created activity counter 272 * @throws PortalException if the group or the previous activity counter 273 could not be found 274 * @deprecated As of 6.2.0, replaced by {@link #addActivityCounter(long, 275 long, long, String, int, int, long, int)} 276 */ 277 @java.lang.Deprecated 278 @Transactional(propagation = Propagation.REQUIRES_NEW) 279 public com.liferay.portlet.social.model.SocialActivityCounter createActivityCounter( 280 long groupId, long classNameId, long classPK, java.lang.String name, 281 int ownerType, int currentValue, int totalValue, int startPeriod, 282 int endPeriod, long previousActivityCounterId, int periodLength) 283 throws PortalException; 284 285 /** 286 * Creates a new social activity counter with the primary key. Does not add the social activity counter to the database. 287 * 288 * @param activityCounterId the primary key for the new social activity counter 289 * @return the new social activity counter 290 */ 291 public com.liferay.portlet.social.model.SocialActivityCounter createSocialActivityCounter( 292 long activityCounterId); 293 294 /** 295 * Deletes all activity counters, limits, and settings related to the asset. 296 * 297 * <p> 298 * This method subtracts the asset's popularity from the owner's 299 * contribution points. It also creates a new contribution period if the 300 * latest one does not belong to the current period. 301 * </p> 302 * 303 * @param assetEntry the asset entry 304 * @throws PortalException if the new contribution counter could not be 305 created 306 */ 307 public void deleteActivityCounters( 308 com.liferay.portlet.asset.model.AssetEntry assetEntry) 309 throws PortalException; 310 311 /** 312 * Deletes all activity counters for the entity identified by the class name 313 * and class primary key. 314 * 315 * @param className the entity's class name 316 * @param classPK the primary key of the entity 317 * @throws PortalException if the entity is an asset and its owner's 318 contribution counter could not be updated 319 */ 320 public void deleteActivityCounters(java.lang.String className, long classPK) 321 throws PortalException; 322 323 /** 324 * Deletes all activity counters, limits, and settings related to the entity 325 * identified by the class name ID and class primary key. 326 * 327 * @param classNameId the primary key of the entity's class 328 * @param classPK the primary key of the entity 329 * @throws PortalException if the entity is an asset and its owner's 330 contribution counter could not be updated 331 */ 332 public void deleteActivityCounters(long classNameId, long classPK) 333 throws PortalException; 334 335 /** 336 * @throws PortalException 337 */ 338 @Override 339 public com.liferay.portal.model.PersistedModel deletePersistedModel( 340 com.liferay.portal.model.PersistedModel persistedModel) 341 throws PortalException; 342 343 /** 344 * Deletes the social activity counter with the primary key from the database. Also notifies the appropriate model listeners. 345 * 346 * @param activityCounterId the primary key of the social activity counter 347 * @return the social activity counter that was removed 348 * @throws PortalException if a social activity counter with the primary key could not be found 349 */ 350 @com.liferay.portal.kernel.search.Indexable(type = IndexableType.DELETE) 351 public com.liferay.portlet.social.model.SocialActivityCounter deleteSocialActivityCounter( 352 long activityCounterId) throws PortalException; 353 354 /** 355 * Deletes the social activity counter from the database. Also notifies the appropriate model listeners. 356 * 357 * @param socialActivityCounter the social activity counter 358 * @return the social activity counter that was removed 359 */ 360 @com.liferay.portal.kernel.search.Indexable(type = IndexableType.DELETE) 361 public com.liferay.portlet.social.model.SocialActivityCounter deleteSocialActivityCounter( 362 com.liferay.portlet.social.model.SocialActivityCounter socialActivityCounter); 363 364 /** 365 * Disables all the counters of an asset identified by the class name and 366 * class primary key. 367 * 368 * <p> 369 * This method is used by the recycle bin to disable all counters of assets 370 * put into the recycle bin. It adjusts the owner's contribution score. 371 * </p> 372 * 373 * @param className the asset's class name 374 * @param classPK the primary key of the asset 375 * @throws PortalException if the asset owner's contribution counter could 376 not be updated 377 */ 378 public void disableActivityCounters(java.lang.String className, long classPK) 379 throws PortalException; 380 381 /** 382 * Disables all the counters of an asset identified by the class name ID and 383 * class primary key. 384 * 385 * <p> 386 * This method is used by the recycle bin to disable all counters of assets 387 * put into the recycle bin. It adjusts the owner's contribution score. 388 * </p> 389 * 390 * @param classNameId the primary key of the asset's class 391 * @param classPK the primary key of the asset 392 * @throws PortalException if the asset owner's contribution counter could 393 not be updated 394 */ 395 public void disableActivityCounters(long classNameId, long classPK) 396 throws PortalException; 397 398 public com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery(); 399 400 /** 401 * Performs a dynamic query on the database and returns the matching rows. 402 * 403 * @param dynamicQuery the dynamic query 404 * @return the matching rows 405 */ 406 public <T> java.util.List<T> dynamicQuery( 407 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery); 408 409 /** 410 * Performs a dynamic query on the database and returns a range of the matching rows. 411 * 412 * <p> 413 * 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.SocialActivityCounterModelImpl}. 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. 414 * </p> 415 * 416 * @param dynamicQuery the dynamic query 417 * @param start the lower bound of the range of model instances 418 * @param end the upper bound of the range of model instances (not inclusive) 419 * @return the range of matching rows 420 */ 421 public <T> java.util.List<T> dynamicQuery( 422 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, 423 int end); 424 425 /** 426 * Performs a dynamic query on the database and returns an ordered range of the matching rows. 427 * 428 * <p> 429 * 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.SocialActivityCounterModelImpl}. 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. 430 * </p> 431 * 432 * @param dynamicQuery the dynamic query 433 * @param start the lower bound of the range of model instances 434 * @param end the upper bound of the range of model instances (not inclusive) 435 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 436 * @return the ordered range of matching rows 437 */ 438 public <T> java.util.List<T> dynamicQuery( 439 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, 440 int end, 441 com.liferay.portal.kernel.util.OrderByComparator<T> orderByComparator); 442 443 /** 444 * Returns the number of rows matching the dynamic query. 445 * 446 * @param dynamicQuery the dynamic query 447 * @return the number of rows matching the dynamic query 448 */ 449 public long dynamicQueryCount( 450 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery); 451 452 /** 453 * Returns the number of rows matching the dynamic query. 454 * 455 * @param dynamicQuery the dynamic query 456 * @param projection the projection to apply to the query 457 * @return the number of rows matching the dynamic query 458 */ 459 public long dynamicQueryCount( 460 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, 461 com.liferay.portal.kernel.dao.orm.Projection projection); 462 463 /** 464 * Enables all the counters of an asset identified by the class name and 465 * class primary key. 466 * 467 * <p> 468 * This method is used by the recycle bin to enable all counters of assets 469 * restored from the recycle bin. It adjusts the owner's contribution score. 470 * </p> 471 * 472 * @param className the asset's class name 473 * @param classPK the primary key of the asset 474 * @throws PortalException if the asset owner's contribution counter could 475 not be updated 476 */ 477 public void enableActivityCounters(java.lang.String className, long classPK) 478 throws PortalException; 479 480 /** 481 * Enables all activity counters of an asset identified by the class name ID 482 * and class primary key. 483 * 484 * <p> 485 * This method is used by the recycle bin to enable all counters of assets 486 * restored from the recycle bin. It adjusts the owner's contribution score. 487 * </p> 488 * 489 * @param classNameId the primary key of the asset's class 490 * @param classPK the primary key of the asset 491 * @throws PortalException if the asset owner's contribution counter could 492 not be updated 493 */ 494 public void enableActivityCounters(long classNameId, long classPK) 495 throws PortalException; 496 497 /** 498 * Returns the activity counter with the given name, owner, and end period 499 * that belong to the given entity. 500 * 501 * @param groupId the primary key of the group 502 * @param classNameId the primary key of the entity's class 503 * @param classPK the primary key of the entity 504 * @param name the counter name 505 * @param ownerType the owner type 506 * @param endPeriod the end period, <code>-1</code> for the latest one 507 * @return the matching activity counter 508 */ 509 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 510 public com.liferay.portlet.social.model.SocialActivityCounter fetchActivityCounterByEndPeriod( 511 long groupId, long classNameId, long classPK, java.lang.String name, 512 int ownerType, int endPeriod); 513 514 /** 515 * Returns the activity counter with the given name, owner, and start period 516 * that belong to the given entity. 517 * 518 * @param groupId the primary key of the group 519 * @param classNameId the primary key of the entity's class 520 * @param classPK the primary key of the entity 521 * @param name the counter name 522 * @param ownerType the owner type 523 * @param startPeriod the start period 524 * @return the matching activity counter 525 */ 526 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 527 public com.liferay.portlet.social.model.SocialActivityCounter fetchActivityCounterByStartPeriod( 528 long groupId, long classNameId, long classPK, java.lang.String name, 529 int ownerType, int startPeriod); 530 531 /** 532 * Returns the latest activity counter with the given name and owner that 533 * belong to the given entity. 534 * 535 * @param groupId the primary key of the group 536 * @param classNameId the primary key of the entity's class 537 * @param classPK the primary key of the entity 538 * @param name the counter name 539 * @param ownerType the owner type 540 * @return the matching activity counter 541 */ 542 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 543 public com.liferay.portlet.social.model.SocialActivityCounter fetchLatestActivityCounter( 544 long groupId, long classNameId, long classPK, java.lang.String name, 545 int ownerType); 546 547 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 548 public com.liferay.portlet.social.model.SocialActivityCounter fetchSocialActivityCounter( 549 long activityCounterId); 550 551 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 552 public com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery getActionableDynamicQuery(); 553 554 /** 555 * Returns the Spring bean ID for this bean. 556 * 557 * @return the Spring bean ID for this bean 558 */ 559 public java.lang.String getBeanIdentifier(); 560 561 /** 562 * Returns all the activity counters with the given name and period offsets. 563 * 564 * <p> 565 * The start and end offsets can belong to different periods. This method 566 * groups the counters by name and returns the sum of their current values. 567 * </p> 568 * 569 * @param groupId the primary key of the group 570 * @param name the counter name 571 * @param startOffset the offset for the start period 572 * @param endOffset the offset for the end period 573 * @return the matching activity counters 574 */ 575 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 576 public java.util.List<com.liferay.portlet.social.model.SocialActivityCounter> getOffsetActivityCounters( 577 long groupId, java.lang.String name, int startOffset, int endOffset); 578 579 /** 580 * Returns the distribution of the activity counters with the given name and 581 * period offsets. 582 * 583 * <p> 584 * The start and end offsets can belong to different periods. This method 585 * groups the counters by their owner entity (usually some asset) and 586 * returns a counter for each entity class with the sum of the counters' 587 * current values. 588 * </p> 589 * 590 * @param groupId the primary key of the group 591 * @param name the counter name 592 * @param startOffset the offset for the start period 593 * @param endOffset the offset for the end period 594 * @return the distribution of matching activity counters 595 */ 596 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 597 public java.util.List<com.liferay.portlet.social.model.SocialActivityCounter> getOffsetDistributionActivityCounters( 598 long groupId, java.lang.String name, int startOffset, int endOffset); 599 600 /** 601 * Returns all the activity counters with the given name and time period. 602 * 603 * <p> 604 * The start and end period values can belong to different periods. This 605 * method groups the counters by name and returns the sum of their current 606 * values. 607 * </p> 608 * 609 * @param groupId the primary key of the group 610 * @param name the counter name 611 * @param startPeriod the start period 612 * @param endPeriod the end period 613 * @return the matching activity counters 614 */ 615 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 616 public java.util.List<com.liferay.portlet.social.model.SocialActivityCounter> getPeriodActivityCounters( 617 long groupId, java.lang.String name, int startPeriod, int endPeriod); 618 619 /** 620 * Returns the distribution of activity counters with the given name and 621 * time period. 622 * 623 * <p> 624 * The start and end period values can belong to different periods. This 625 * method groups the counters by their owner entity (usually some asset) and 626 * returns a counter for each entity class with the sum of the counters' 627 * current values. 628 * </p> 629 * 630 * @param groupId the primary key of the group 631 * @param name the counter name 632 * @param startPeriod the start period 633 * @param endPeriod the end period 634 * @return the distribution of matching activity counters 635 */ 636 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 637 public java.util.List<com.liferay.portlet.social.model.SocialActivityCounter> getPeriodDistributionActivityCounters( 638 long groupId, java.lang.String name, int startPeriod, int endPeriod); 639 640 @Override 641 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 642 public com.liferay.portal.model.PersistedModel getPersistedModel( 643 java.io.Serializable primaryKeyObj) throws PortalException; 644 645 /** 646 * Returns the social activity counter with the primary key. 647 * 648 * @param activityCounterId the primary key of the social activity counter 649 * @return the social activity counter 650 * @throws PortalException if a social activity counter with the primary key could not be found 651 */ 652 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 653 public com.liferay.portlet.social.model.SocialActivityCounter getSocialActivityCounter( 654 long activityCounterId) throws PortalException; 655 656 /** 657 * Returns a range of all the social activity counters. 658 * 659 * <p> 660 * 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.SocialActivityCounterModelImpl}. 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. 661 * </p> 662 * 663 * @param start the lower bound of the range of social activity counters 664 * @param end the upper bound of the range of social activity counters (not inclusive) 665 * @return the range of social activity counters 666 */ 667 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 668 public java.util.List<com.liferay.portlet.social.model.SocialActivityCounter> getSocialActivityCounters( 669 int start, int end); 670 671 /** 672 * Returns the number of social activity counters. 673 * 674 * @return the number of social activity counters 675 */ 676 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 677 public int getSocialActivityCountersCount(); 678 679 /** 680 * Returns the range of tuples that contain users and a list of activity 681 * counters. 682 * 683 * <p> 684 * The counters returned for each user are passed to this method in the 685 * selectedNames array. The method also accepts an array of counter names 686 * that are used to rank the users. 687 * </p> 688 * 689 * <p> 690 * Useful when paginating results. Returns a maximum of <code>end - 691 * start</code> instances. <code>start</code> and <code>end</code> are not 692 * primary keys, they are indexes in the result set. Thus, <code>0</code> 693 * refers to the first result in the set. Setting both <code>start</code> 694 * and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full 695 * result set. 696 * </p> 697 * 698 * @param groupId the primary key of the group 699 * @param rankingNames the ranking counter names 700 * @param selectedNames the counter names that will be returned with each 701 user 702 * @param start the lower bound of the range of results 703 * @param end the upper bound of the range of results (not inclusive) 704 * @return the range of matching tuples 705 */ 706 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 707 public java.util.List<com.liferay.portal.kernel.util.Tuple> getUserActivityCounters( 708 long groupId, java.lang.String[] rankingNames, 709 java.lang.String[] selectedNames, int start, int end); 710 711 /** 712 * Returns the number of users having a rank based on the given counters. 713 * 714 * @param groupId the primary key of the group 715 * @param rankingNames the ranking counter names 716 * @return the number of matching users 717 */ 718 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 719 public int getUserActivityCountersCount(long groupId, 720 java.lang.String[] rankingNames); 721 722 /** 723 * Increments the <code>user.achievements</code> counter for a user. 724 * 725 * <p> 726 * This method should be used by an external achievement class when the 727 * users unlocks an achievement. 728 * </p> 729 * 730 * @param userId the primary key of the user 731 * @param groupId the primary key of the group 732 * @throws PortalException if the group or an expected previous activity 733 counter could not be found 734 */ 735 public void incrementUserAchievementCounter(long userId, long groupId) 736 throws PortalException; 737 738 /** 739 * Sets the Spring bean ID for this bean. 740 * 741 * @param beanIdentifier the Spring bean ID for this bean 742 */ 743 public void setBeanIdentifier(java.lang.String beanIdentifier); 744 745 /** 746 * Updates the social activity counter in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 747 * 748 * @param socialActivityCounter the social activity counter 749 * @return the social activity counter that was updated 750 */ 751 @com.liferay.portal.kernel.search.Indexable(type = IndexableType.REINDEX) 752 public com.liferay.portlet.social.model.SocialActivityCounter updateSocialActivityCounter( 753 com.liferay.portlet.social.model.SocialActivityCounter socialActivityCounter); 754 }