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