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