Liferay 6.2-ce-ga5

com.liferay.portlet.social.service.impl
Class SocialActivityCounterLocalServiceImpl

java.lang.Object
  extended by com.liferay.portal.service.BaseLocalServiceImpl
      extended by com.liferay.portlet.social.service.base.SocialActivityCounterLocalServiceBaseImpl
          extended by com.liferay.portlet.social.service.impl.SocialActivityCounterLocalServiceImpl
All Implemented Interfaces:
IdentifiableBean, BaseLocalService, PersistedModelLocalService, SocialActivityCounterLocalService

public class SocialActivityCounterLocalServiceImpl
extends SocialActivityCounterLocalServiceBaseImpl

The social activity counter local service. This service is responsible for creating and/or incrementing counters in response to an activity. It also provides methods for querying activity counters within a time period.

Under normal circumstances only the addActivityCounters(SocialActivity) should be called directly and even that is usually not necessary as it is automatically called by the social activity service.


Field Summary
 
Fields inherited from class com.liferay.portlet.social.service.base.SocialActivityCounterLocalServiceBaseImpl
assetEntryFinder, assetEntryLocalService, assetEntryPersistence, assetEntryService, counterLocalService, groupFinder, groupLocalService, groupPersistence, groupService, lockFinder, lockLocalService, lockPersistence, persistedModelLocalServiceRegistry, resourceLocalService, socialActivityAchievementLocalService, socialActivityAchievementPersistence, socialActivityCounterFinder, socialActivityCounterLocalService, socialActivityCounterPersistence, socialActivityFinder, socialActivityInterpreterLocalService, socialActivityLimitLocalService, socialActivityLimitPersistence, socialActivityLocalService, socialActivityPersistence, socialActivityService, socialActivitySetFinder, socialActivitySetLocalService, socialActivitySetPersistence, socialActivitySettingLocalService, socialActivitySettingPersistence, socialActivitySettingService, socialRelationLocalService, socialRelationPersistence, socialRequestInterpreterLocalService, socialRequestLocalService, socialRequestPersistence, socialRequestService, userFinder, userLocalService, userPersistence, userService
 
Fields inherited from class com.liferay.portal.service.BaseLocalServiceImpl
layoutPersistence
 
Constructor Summary
SocialActivityCounterLocalServiceImpl()
           
 
Method Summary
 SocialActivityCounter addActivityCounter(long groupId, long classNameId, long classPK, String name, int ownerType, int currentValue, int totalValue, int startPeriod, int endPeriod)
          Deprecated. As of 6.2.0, replaced by addActivityCounter(long, long, long, String, int, int, long, int)
 SocialActivityCounter addActivityCounter(long groupId, long classNameId, long classPK, String name, int ownerType, int currentValue, int totalValue, int startPeriod, int endPeriod, long previousActivityCounterId, int periodLength)
          Deprecated. As of 6.2.0, replaced by addActivityCounter(long, long, long, String, int, int, long, int)
 SocialActivityCounter addActivityCounter(long groupId, long classNameId, long classPK, String name, int ownerType, int totalValue, long previousActivityCounterId, int periodLength)
          Adds an activity counter specifying a previous activity and period length.
protected  SocialActivityCounter addActivityCounter(long groupId, User user, SocialActivity activity, SocialActivityCounterDefinition activityCounterDefinition)
           
 void addActivityCounters(SocialActivity activity)
          Adds or increments activity counters related to an activity.
protected  SocialActivityCounter addAssetActivitiesCounter(SocialActivity activity)
           
protected  SocialActivityCounter addUserActivitiesCounter(SocialActivity activity)
           
protected  void adjustUserContribution(AssetEntry assetEntry, boolean enable)
           
protected  boolean checkActivityLimit(User user, SocialActivity activity, SocialActivityCounterDefinition activityCounterDefinition)
           
protected  void clearFinderCache()
           
 SocialActivityCounter createActivityCounter(long groupId, long classNameId, long classPK, String name, int ownerType, int currentValue, int totalValue, int startPeriod, int endPeriod)
          Deprecated. As of 6.2.0, replaced by addActivityCounter(long, long, long, String, int, int, long, int)
 SocialActivityCounter createActivityCounter(long groupId, long classNameId, long classPK, String name, int ownerType, int currentValue, int totalValue, int startPeriod, int endPeriod, long previousActivityCounterId, int periodLength)
          Deprecated. As of 6.2.0, replaced by addActivityCounter(long, long, long, String, int, int, long, int)
 void deleteActivityCounters(AssetEntry assetEntry)
          Deletes all activity counters, limits, and settings related to the asset.
 void deleteActivityCounters(long classNameId, long classPK)
          Deletes all activity counters, limits, and settings related to the entity identified by the class name ID and class primary key.
 void deleteActivityCounters(String className, long classPK)
          Deletes all activity counters for the entity identified by the class name and class primary key.
 void disableActivityCounters(long classNameId, long classPK)
          Disables all the counters of an asset identified by the class name ID and class primary key.
 void disableActivityCounters(String className, long classPK)
          Disables all the counters of an asset identified by the class name and class primary key.
 void enableActivityCounters(long classNameId, long classPK)
          Enables all activity counters of an asset identified by the class name ID and class primary key.
 void enableActivityCounters(String className, long classPK)
          Enables all the counters of an asset identified by the class name and class primary key.
 SocialActivityCounter fetchActivityCounterByEndPeriod(long groupId, long classNameId, long classPK, String name, int ownerType, int endPeriod)
          Returns the activity counter with the given name, owner, and end period that belong to the given entity.
 SocialActivityCounter fetchActivityCounterByStartPeriod(long groupId, long classNameId, long classPK, String name, int ownerType, int startPeriod)
          Returns the activity counter with the given name, owner, and start period that belong to the given entity.
 SocialActivityCounter fetchLatestActivityCounter(long groupId, long classNameId, long classPK, String name, int ownerType)
          Returns the latest activity counter with the given name and owner that belong to the given entity.
protected  long getClassNameId(AssetEntry assetEntry, int ownerType)
           
protected  long getClassPK(User user, AssetEntry assetEntry, int ownerType)
           
protected  long getLimitClassPK(SocialActivity activity, SocialActivityCounterDefinition activityCounterDefinition)
           
 List<SocialActivityCounter> getOffsetActivityCounters(long groupId, String name, int startOffset, int endOffset)
          Returns all the activity counters with the given name and period offsets.
 List<SocialActivityCounter> getOffsetDistributionActivityCounters(long groupId, String name, int startOffset, int endOffset)
          Returns the distribution of the activity counters with the given name and period offsets.
 List<SocialActivityCounter> getPeriodActivityCounters(long groupId, String name, int startPeriod, int endPeriod)
          Returns all the activity counters with the given name and time period.
 List<SocialActivityCounter> getPeriodDistributionActivityCounters(long groupId, String name, int startPeriod, int endPeriod)
          Returns the distribution of activity counters with the given name and time period.
 List<Tuple> getUserActivityCounters(long groupId, String[] rankingNames, String[] selectedNames, int start, int end)
          Returns the range of tuples that contain users and a list of activity counters.
 int getUserActivityCountersCount(long groupId, String[] rankingNames)
          Returns the number of users having a rank based on the given counters.
protected  void incrementActivityCounter(SocialActivityCounter activityCounter, SocialActivityCounterDefinition activityCounterDefinition)
           
 void incrementUserAchievementCounter(long userId, long groupId)
          Increments the user.achievements counter for a user.
protected  boolean isAddActivityCounter(User user, User assetEntryUser, AssetEntry assetEntry, SocialActivityCounterDefinition activityCounterDefinition)
           
protected  SocialActivityCounter lockProtectedAddActivityCounter(long groupId, long classNameId, long classPK, String name, int ownerType, int totalValue, long previousActivityCounterId, int periodLength)
           
protected  void lockProtectedGetActivityLimit(long groupId, User user, SocialActivity activity, SocialActivityCounterDefinition activityCounterDefinition)
           
 
Methods inherited from class com.liferay.portlet.social.service.base.SocialActivityCounterLocalServiceBaseImpl
addSocialActivityCounter, afterPropertiesSet, createSocialActivityCounter, deleteSocialActivityCounter, deleteSocialActivityCounter, destroy, dynamicQuery, dynamicQuery, dynamicQuery, dynamicQuery, dynamicQueryCount, dynamicQueryCount, fetchSocialActivityCounter, getAssetEntryFinder, getAssetEntryLocalService, getAssetEntryPersistence, getAssetEntryService, getBeanIdentifier, getCounterLocalService, getGroupFinder, getGroupLocalService, getGroupPersistence, getGroupService, getLockFinder, getLockLocalService, getLockPersistence, getModelClass, getModelClassName, getPersistedModel, getResourceLocalService, getSocialActivityAchievementLocalService, getSocialActivityAchievementPersistence, getSocialActivityCounter, getSocialActivityCounterFinder, getSocialActivityCounterLocalService, getSocialActivityCounterPersistence, getSocialActivityCounters, getSocialActivityCountersCount, getSocialActivityFinder, getSocialActivityInterpreterLocalService, getSocialActivityLimitLocalService, getSocialActivityLimitPersistence, getSocialActivityLocalService, getSocialActivityPersistence, getSocialActivityService, getSocialActivitySetFinder, getSocialActivitySetLocalService, getSocialActivitySetPersistence, getSocialActivitySettingLocalService, getSocialActivitySettingPersistence, getSocialActivitySettingService, getSocialRelationLocalService, getSocialRelationPersistence, getSocialRequestInterpreterLocalService, getSocialRequestLocalService, getSocialRequestPersistence, getSocialRequestService, getUserFinder, getUserLocalService, getUserPersistence, getUserService, runSQL, setAssetEntryFinder, setAssetEntryLocalService, setAssetEntryPersistence, setAssetEntryService, setBeanIdentifier, setCounterLocalService, setGroupFinder, setGroupLocalService, setGroupPersistence, setGroupService, setLockFinder, setLockLocalService, setLockPersistence, setResourceLocalService, setSocialActivityAchievementLocalService, setSocialActivityAchievementPersistence, setSocialActivityCounterFinder, setSocialActivityCounterLocalService, setSocialActivityCounterPersistence, setSocialActivityFinder, setSocialActivityInterpreterLocalService, setSocialActivityLimitLocalService, setSocialActivityLimitPersistence, setSocialActivityLocalService, setSocialActivityPersistence, setSocialActivityService, setSocialActivitySetFinder, setSocialActivitySetLocalService, setSocialActivitySetPersistence, setSocialActivitySettingLocalService, setSocialActivitySettingPersistence, setSocialActivitySettingService, setSocialRelationLocalService, setSocialRelationPersistence, setSocialRequestInterpreterLocalService, setSocialRequestLocalService, setSocialRequestPersistence, setSocialRequestService, setUserFinder, setUserLocalService, setUserPersistence, setUserService, updateSocialActivityCounter
 
Methods inherited from class com.liferay.portal.service.BaseLocalServiceImpl
getClassLoader, getLayoutURL, getLayoutURL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SocialActivityCounterLocalServiceImpl

public SocialActivityCounterLocalServiceImpl()
Method Detail

addActivityCounter

public SocialActivityCounter addActivityCounter(long groupId,
                                                long classNameId,
                                                long classPK,
                                                String name,
                                                int ownerType,
                                                int currentValue,
                                                int totalValue,
                                                int startPeriod,
                                                int endPeriod)
                                         throws PortalException,
                                                SystemException
Deprecated. As of 6.2.0, replaced by addActivityCounter(long, long, long, String, int, int, long, int)

Adds an activity counter with a default period length.

This method uses the lock service to guard against multiple threads trying to insert the same counter because this service is called asynchronously from the social activity service.

Parameters:
groupId - the primary key of the group
classNameId - the primary key of the entity's class this counter belongs to
classPK - the primary key of the entity this counter belongs to
name - the counter's name
ownerType - the counter's owner type. Acceptable values are TYPE_ACTOR, TYPE_ASSET and TYPE_CREATOR defined in SocialActivityCounterConstants.
currentValue - the counter's current value (optionally 0)
totalValue - the counter's total value (optionally 0)
startPeriod - the counter's start period
endPeriod - the counter's end period
Returns:
the added activity counter
Throws:
PortalException - if the group or the previous activity counter could not be found
SystemException - if a system exception occurred

addActivityCounter

public SocialActivityCounter addActivityCounter(long groupId,
                                                long classNameId,
                                                long classPK,
                                                String name,
                                                int ownerType,
                                                int currentValue,
                                                int totalValue,
                                                int startPeriod,
                                                int endPeriod,
                                                long previousActivityCounterId,
                                                int periodLength)
                                         throws PortalException,
                                                SystemException
Deprecated. As of 6.2.0, replaced by addActivityCounter(long, long, long, String, int, int, long, int)

Adds an activity counter specifying a previous activity and period length.

This method uses the lock service to guard against multiple threads trying to insert the same counter because this service is called asynchronously from the social activity service.

Parameters:
groupId - the primary key of the group
classNameId - the primary key of the entity's class this counter belongs to
classPK - the primary key of the entity this counter belongs to
name - the counter name
ownerType - the counter's owner type. Acceptable values are TYPE_ACTOR, TYPE_ASSET and TYPE_CREATOR defined in SocialActivityCounterConstants.
currentValue - the current value of the counter (optionally 0)
totalValue - the counter's total value (optionally 0)
startPeriod - the counter's start period
endPeriod - the counter's end period
previousActivityCounterId - the primary key of the activity counter for the previous time period (optionally 0, if this is the first)
periodLength - the period length in days, PERIOD_LENGTH_INFINITE for never ending counters or PERIOD_LENGTH_SYSTEM for the period length defined in portal-ext.properties. For more information see SocialActivityCounterConstants.
Returns:
the added activity counter
Throws:
PortalException - if the group or the previous activity counter could not be found
SystemException - if a system exception occurred

addActivityCounter

@Transactional(propagation=REQUIRES_NEW)
public SocialActivityCounter addActivityCounter(long groupId,
                                                                                     long classNameId,
                                                                                     long classPK,
                                                                                     String name,
                                                                                     int ownerType,
                                                                                     int totalValue,
                                                                                     long previousActivityCounterId,
                                                                                     int periodLength)
                                         throws PortalException,
                                                SystemException
Adds an activity counter specifying a previous activity and period length.

This method uses the lock service to guard against multiple threads trying to insert the same counter because this service is called asynchronously from the social activity service.

Parameters:
groupId - the primary key of the group
classNameId - the primary key of the entity's class this counter belongs to
classPK - the primary key of the entity this counter belongs to
name - the counter name
ownerType - the counter's owner type. Acceptable values are TYPE_ACTOR, TYPE_ASSET and TYPE_CREATOR defined in SocialActivityCounterConstants.
totalValue - the counter's total value (optionally 0)
previousActivityCounterId - the primary key of the activity counter for the previous time period (optionally 0, if this is the first)
periodLength - the period length in days, PERIOD_LENGTH_INFINITE for never ending counters or PERIOD_LENGTH_SYSTEM for the period length defined in portal-ext.properties. For more information see SocialActivityCounterConstants.
Returns:
the added activity counter
Throws:
PortalException - if the group or the previous activity counter could not be found
SystemException - if a system exception occurred

addActivityCounters

public void addActivityCounters(SocialActivity activity)
                         throws PortalException,
                                SystemException
Adds or increments activity counters related to an activity.

This method is called asynchronously from the social activity service when the user performs an activity defined in liferay-social.xml.

This method first calls the activity processor class, if there is one defined for the activity, checks for limits and increments all the counters that belong to the activity. Afterwards, it processes the activity with respect to achievement classes, if any. Lastly it increments the built-in user.activities and asset.activities counters.

Parameters:
activity - the social activity
Throws:
PortalException - if an expected group or expected previous activity counters could not be found
SystemException - if a system exception occurred

createActivityCounter

@Transactional(propagation=REQUIRES_NEW)
public SocialActivityCounter createActivityCounter(long groupId,
                                                                                        long classNameId,
                                                                                        long classPK,
                                                                                        String name,
                                                                                        int ownerType,
                                                                                        int currentValue,
                                                                                        int totalValue,
                                                                                        int startPeriod,
                                                                                        int endPeriod)
                                            throws PortalException,
                                                   SystemException
Deprecated. As of 6.2.0, replaced by addActivityCounter(long, long, long, String, int, int, long, int)

Creates an activity counter with a default period length, adding it into the database.

Parameters:
groupId - the primary key of the group
classNameId - the primary key of the entity's class this counter belongs to
classPK - the primary key of the entity this counter belongs to
name - the counter's name
ownerType - the counter's owner type. Acceptable values are TYPE_ACTOR, TYPE_ASSET and TYPE_CREATOR defined in SocialActivityCounterConstants.
currentValue - the counter's current value (optionally 0)
totalValue - the counter's total value (optionally 0)
startPeriod - the counter's start period
endPeriod - the counter's end period
Returns:
the created activity counter
Throws:
PortalException - if the group or a previous activity counter could not be found
SystemException - if a system exception occurred

createActivityCounter

@Transactional(propagation=REQUIRES_NEW)
public SocialActivityCounter createActivityCounter(long groupId,
                                                                                        long classNameId,
                                                                                        long classPK,
                                                                                        String name,
                                                                                        int ownerType,
                                                                                        int currentValue,
                                                                                        int totalValue,
                                                                                        int startPeriod,
                                                                                        int endPeriod,
                                                                                        long previousActivityCounterId,
                                                                                        int periodLength)
                                            throws PortalException,
                                                   SystemException
Deprecated. As of 6.2.0, replaced by addActivityCounter(long, long, long, String, int, int, long, int)

Creates an activity counter, adding it into the database.

This method actually creates the counter in the database. It requires a new transaction so that other threads can find the new counter when the lock in the calling method is released.

Parameters:
groupId - the primary key of the group
classNameId - the primary key of the entity's class this counter belongs to
classPK - the primary key of the entity this counter belongs to
name - the counter's name
ownerType - the counter's owner type. Acceptable values are TYPE_ACTOR, TYPE_ASSET and TYPE_CREATOR defined in SocialActivityCounterConstants.
currentValue - the counter's current value (optionally 0)
totalValue - the counter's total value of the counter (optionally 0)
startPeriod - the counter's start period
endPeriod - the counter's end period
previousActivityCounterId - the primary key of the activity counter for the previous time period (optionally 0, if this is the first)
periodLength - the period length in days, PERIOD_LENGTH_INFINITE for never ending counters or PERIOD_LENGTH_SYSTEM for the period length defined in portal-ext.properties. For more information see SocialActivityConstants.
Returns:
the created activity counter
Throws:
PortalException - if the group or the previous activity counter could not be found
SystemException - if a system exception occurred

deleteActivityCounters

public void deleteActivityCounters(AssetEntry assetEntry)
                            throws PortalException,
                                   SystemException
Deletes all activity counters, limits, and settings related to the asset.

This method subtracts the asset's popularity from the owner's contribution points. It also creates a new contribution period if the latest one does not belong to the current period.

Parameters:
assetEntry - the asset entry
Throws:
PortalException - if the new contribution counter could not be created
SystemException - if a system exception occurred

deleteActivityCounters

public void deleteActivityCounters(long classNameId,
                                   long classPK)
                            throws PortalException,
                                   SystemException
Deletes all activity counters, limits, and settings related to the entity identified by the class name ID and class primary key.

Parameters:
classNameId - the primary key of the entity's class
classPK - the primary key of the entity
Throws:
PortalException - if the entity is an asset and its owner's contribution counter could not be updated
SystemException - if a system exception occurred

deleteActivityCounters

public void deleteActivityCounters(String className,
                                   long classPK)
                            throws PortalException,
                                   SystemException
Deletes all activity counters for the entity identified by the class name and class primary key.

Parameters:
className - the entity's class name
classPK - the primary key of the entity
Throws:
PortalException - if the entity is an asset and its owner's contribution counter could not be updated
SystemException - if a system exception occurred

disableActivityCounters

public void disableActivityCounters(long classNameId,
                                    long classPK)
                             throws PortalException,
                                    SystemException
Disables all the counters of an asset identified by the class name ID and class primary key.

This method is used by the recycle bin to disable all counters of assets put into the recycle bin. It adjusts the owner's contribution score.

Parameters:
classNameId - the primary key of the asset's class
classPK - the primary key of the asset
Throws:
PortalException - if the asset owner's contribution counter could not be updated
SystemException - if a system exception occurred

disableActivityCounters

public void disableActivityCounters(String className,
                                    long classPK)
                             throws PortalException,
                                    SystemException
Disables all the counters of an asset identified by the class name and class primary key.

This method is used by the recycle bin to disable all counters of assets put into the recycle bin. It adjusts the owner's contribution score.

Parameters:
className - the asset's class name
classPK - the primary key of the asset
Throws:
PortalException - if the asset owner's contribution counter could not be updated
SystemException - if a system exception occurred

enableActivityCounters

public void enableActivityCounters(long classNameId,
                                   long classPK)
                            throws PortalException,
                                   SystemException
Enables all activity counters of an asset identified by the class name ID and class primary key.

This method is used by the recycle bin to enable all counters of assets restored from the recycle bin. It adjusts the owner's contribution score.

Parameters:
classNameId - the primary key of the asset's class
classPK - the primary key of the asset
Throws:
PortalException - if the asset owner's contribution counter could not be updated
SystemException - if a system exception occurred

enableActivityCounters

public void enableActivityCounters(String className,
                                   long classPK)
                            throws PortalException,
                                   SystemException
Enables all the counters of an asset identified by the class name and class primary key.

This method is used by the recycle bin to enable all counters of assets restored from the recycle bin. It adjusts the owner's contribution score.

Parameters:
className - the asset's class name
classPK - the primary key of the asset
Throws:
PortalException - if the asset owner's contribution counter could not be updated
SystemException - if a system exception occurred

fetchActivityCounterByEndPeriod

public SocialActivityCounter fetchActivityCounterByEndPeriod(long groupId,
                                                             long classNameId,
                                                             long classPK,
                                                             String name,
                                                             int ownerType,
                                                             int endPeriod)
                                                      throws SystemException
Returns the activity counter with the given name, owner, and end period that belong to the given entity.

Parameters:
groupId - the primary key of the group
classNameId - the primary key of the entity's class
classPK - the primary key of the entity
name - the counter name
ownerType - the owner type
endPeriod - the end period, -1 for the latest one
Returns:
the matching activity counter
Throws:
SystemException - if a system exception occurred

fetchActivityCounterByStartPeriod

public SocialActivityCounter fetchActivityCounterByStartPeriod(long groupId,
                                                               long classNameId,
                                                               long classPK,
                                                               String name,
                                                               int ownerType,
                                                               int startPeriod)
                                                        throws SystemException
Returns the activity counter with the given name, owner, and start period that belong to the given entity.

Parameters:
groupId - the primary key of the group
classNameId - the primary key of the entity's class
classPK - the primary key of the entity
name - the counter name
ownerType - the owner type
startPeriod - the start period
Returns:
the matching activity counter
Throws:
SystemException - if a system exception occurred

fetchLatestActivityCounter

public SocialActivityCounter fetchLatestActivityCounter(long groupId,
                                                        long classNameId,
                                                        long classPK,
                                                        String name,
                                                        int ownerType)
                                                 throws SystemException
Returns the latest activity counter with the given name and owner that belong to the given entity.

Parameters:
groupId - the primary key of the group
classNameId - the primary key of the entity's class
classPK - the primary key of the entity
name - the counter name
ownerType - the owner type
Returns:
the matching activity counter
Throws:
SystemException - if a system exception occurred

getOffsetActivityCounters

public List<SocialActivityCounter> getOffsetActivityCounters(long groupId,
                                                             String name,
                                                             int startOffset,
                                                             int endOffset)
                                                      throws SystemException
Returns all the activity counters with the given name and period offsets.

The start and end offsets can belong to different periods. This method groups the counters by name and returns the sum of their current values.

Parameters:
groupId - the primary key of the group
name - the counter name
startOffset - the offset for the start period
endOffset - the offset for the end period
Returns:
the matching activity counters
Throws:
SystemException - if a system exception occurred

getOffsetDistributionActivityCounters

public List<SocialActivityCounter> getOffsetDistributionActivityCounters(long groupId,
                                                                         String name,
                                                                         int startOffset,
                                                                         int endOffset)
                                                                  throws SystemException
Returns the distribution of the activity counters with the given name and period offsets.

The start and end offsets can belong to different periods. This method groups the counters by their owner entity (usually some asset) and returns a counter for each entity class with the sum of the counters' current values.

Parameters:
groupId - the primary key of the group
name - the counter name
startOffset - the offset for the start period
endOffset - the offset for the end period
Returns:
the distribution of matching activity counters
Throws:
SystemException - if a system exception occurred

getPeriodActivityCounters

public List<SocialActivityCounter> getPeriodActivityCounters(long groupId,
                                                             String name,
                                                             int startPeriod,
                                                             int endPeriod)
                                                      throws SystemException
Returns all the activity counters with the given name and time period.

The start and end period values can belong to different periods. This method groups the counters by name and returns the sum of their current values.

Parameters:
groupId - the primary key of the group
name - the counter name
startPeriod - the start period
endPeriod - the end period
Returns:
the matching activity counters
Throws:
SystemException - if a system exception occurred

getPeriodDistributionActivityCounters

public List<SocialActivityCounter> getPeriodDistributionActivityCounters(long groupId,
                                                                         String name,
                                                                         int startPeriod,
                                                                         int endPeriod)
                                                                  throws SystemException
Returns the distribution of activity counters with the given name and time period.

The start and end period values can belong to different periods. This method groups the counters by their owner entity (usually some asset) and returns a counter for each entity class with the sum of the counters' current values.

Parameters:
groupId - the primary key of the group
name - the counter name
startPeriod - the start period
endPeriod - the end period
Returns:
the distribution of matching activity counters
Throws:
SystemException - if a system exception occurred

getUserActivityCounters

public List<Tuple> getUserActivityCounters(long groupId,
                                           String[] rankingNames,
                                           String[] selectedNames,
                                           int start,
                                           int end)
                                    throws SystemException
Returns the range of tuples that contain users and a list of activity counters.

The counters returned for each user are passed to this method in the selectedNames array. The method also accepts an array of counter names that are used to rank the users.

Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil.ALL_POS will return the full result set.

Parameters:
groupId - the primary key of the group
rankingNames - the ranking counter names
selectedNames - the counter names that will be returned with each user
start - the lower bound of the range of results
end - the upper bound of the range of results (not inclusive)
Returns:
the range of matching tuples
Throws:
SystemException - if a system exception occurred

getUserActivityCountersCount

public int getUserActivityCountersCount(long groupId,
                                        String[] rankingNames)
                                 throws SystemException
Returns the number of users having a rank based on the given counters.

Parameters:
groupId - the primary key of the group
rankingNames - the ranking counter names
Returns:
the number of matching users
Throws:
SystemException - if a system exception occurred

incrementUserAchievementCounter

public void incrementUserAchievementCounter(long userId,
                                            long groupId)
                                     throws PortalException,
                                            SystemException
Increments the user.achievements counter for a user.

This method should be used by an external achievement class when the users unlocks an achievement.

Parameters:
userId - the primary key of the user
groupId - the primary key of the group
Throws:
PortalException - if the group or an expected previous activity counter could not be found
SystemException - if a system exception occurred

addActivityCounter

protected SocialActivityCounter addActivityCounter(long groupId,
                                                   User user,
                                                   SocialActivity activity,
                                                   SocialActivityCounterDefinition activityCounterDefinition)
                                            throws PortalException,
                                                   SystemException
Throws:
PortalException
SystemException

addAssetActivitiesCounter

protected SocialActivityCounter addAssetActivitiesCounter(SocialActivity activity)
                                                   throws PortalException,
                                                          SystemException
Throws:
PortalException
SystemException

addUserActivitiesCounter

protected SocialActivityCounter addUserActivitiesCounter(SocialActivity activity)
                                                  throws PortalException,
                                                         SystemException
Throws:
PortalException
SystemException

adjustUserContribution

protected void adjustUserContribution(AssetEntry assetEntry,
                                      boolean enable)
                               throws PortalException,
                                      SystemException
Throws:
PortalException
SystemException

checkActivityLimit

protected boolean checkActivityLimit(User user,
                                     SocialActivity activity,
                                     SocialActivityCounterDefinition activityCounterDefinition)
                              throws PortalException,
                                     SystemException
Throws:
PortalException
SystemException

clearFinderCache

protected void clearFinderCache()

getClassNameId

protected long getClassNameId(AssetEntry assetEntry,
                              int ownerType)

getClassPK

protected long getClassPK(User user,
                          AssetEntry assetEntry,
                          int ownerType)

getLimitClassPK

protected long getLimitClassPK(SocialActivity activity,
                               SocialActivityCounterDefinition activityCounterDefinition)

incrementActivityCounter

protected void incrementActivityCounter(SocialActivityCounter activityCounter,
                                        SocialActivityCounterDefinition activityCounterDefinition)
                                 throws SystemException
Throws:
SystemException

isAddActivityCounter

protected boolean isAddActivityCounter(User user,
                                       User assetEntryUser,
                                       AssetEntry assetEntry,
                                       SocialActivityCounterDefinition activityCounterDefinition)

lockProtectedAddActivityCounter

protected SocialActivityCounter lockProtectedAddActivityCounter(long groupId,
                                                                long classNameId,
                                                                long classPK,
                                                                String name,
                                                                int ownerType,
                                                                int totalValue,
                                                                long previousActivityCounterId,
                                                                int periodLength)
                                                         throws PortalException,
                                                                SystemException
Throws:
PortalException
SystemException

lockProtectedGetActivityLimit

protected void lockProtectedGetActivityLimit(long groupId,
                                             User user,
                                             SocialActivity activity,
                                             SocialActivityCounterDefinition activityCounterDefinition)
                                      throws PortalException,
                                             SystemException
Throws:
PortalException
SystemException

Liferay 6.2-ce-ga5