Package org.ametys.cms.repository
Class ReactionableObjectHelper
- java.lang.Object
-
- org.ametys.cms.repository.ReactionableObjectHelper
-
- All Implemented Interfaces:
Component
,Serviceable
public final class ReactionableObjectHelper extends Object implements Serviceable, Component
Helper class which provides methods to manage reactions on a object
-
-
Constructor Summary
Constructors Constructor Description ReactionableObjectHelper()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
addReaction(ModifiableModelLessDataHolder unversionedDataHolder, UserIdentity user, ReactionableObject.ReactionType reactionType)
Add a user reactionstatic List<UserIdentity>
getReactionUsers(ModifiableModelLessDataHolder unversionedDataHolder, ReactionableObject.ReactionType reactionType)
Get the issuers of a reactionList<Map<String,Object>>
reactionsToJson(ReactionableObject reactionable)
Get the reactions to JSON formatstatic void
removeReaction(ModifiableModelLessDataHolder unversionedDataHolder, UserIdentity user, ReactionableObject.ReactionType reactionType)
Remove a user reactionvoid
saxReactions(ReactionableObject reactionable, ContentHandler contentHandler)
Generates SAX events for the given object's reactions.void
service(ServiceManager smanager)
-
-
-
Constructor Detail
-
ReactionableObjectHelper
public ReactionableObjectHelper()
-
-
Method Detail
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
addReaction
public static void addReaction(ModifiableModelLessDataHolder unversionedDataHolder, UserIdentity user, ReactionableObject.ReactionType reactionType)
Add a user reaction- Parameters:
unversionedDataHolder
- the unversioned data holderuser
- the issuer of reactionreactionType
- the reaction type
-
removeReaction
public static void removeReaction(ModifiableModelLessDataHolder unversionedDataHolder, UserIdentity user, ReactionableObject.ReactionType reactionType)
Remove a user reaction- Parameters:
unversionedDataHolder
- the unversioned data holderuser
- the issuer of reaction to removereactionType
- the reaction type
-
getReactionUsers
public static List<UserIdentity> getReactionUsers(ModifiableModelLessDataHolder unversionedDataHolder, ReactionableObject.ReactionType reactionType)
Get the issuers of a reaction- Parameters:
unversionedDataHolder
- the unversioned data holderreactionType
- the reaction type- Returns:
- the issuers of a reaction as a List
-
saxReactions
public void saxReactions(ReactionableObject reactionable, ContentHandler contentHandler) throws SAXException
Generates SAX events for the given object's reactions.- Parameters:
reactionable
- theReactionableObject
.contentHandler
- the ContentHandler receiving SAX events.- Throws:
SAXException
- if an error occurs during the SAX events generation.
-
reactionsToJson
public List<Map<String,Object>> reactionsToJson(ReactionableObject reactionable)
Get the reactions to JSON format- Parameters:
reactionable
- the reactionable object- Returns:
- the reactions as JSON
-
-