Package org.ametys.cms.repository
Class ReactionableObjectHelper
java.lang.Object
org.ametys.cms.repository.ReactionableObjectHelper
- All Implemented Interfaces:
Component
,Serviceable
Helper class which provides methods to manage reactions on a object
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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 reactionreactionsToJson
(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)
-
Field Details
-
ROLE
The Avalon role
-
-
Constructor Details
-
ReactionableObjectHelper
public ReactionableObjectHelper()
-
-
Method Details
-
service
- 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
Get the reactions to JSON format- Parameters:
reactionable
- the reactionable object- Returns:
- the reactions as JSON
-