Class CommentListenerService
java.lang.Object
fr.paris.lutece.plugins.extend.modules.comment.service.CommentListenerService
Service to manage listeners over comments
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringConstant that represents every extendable resource type -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancanComment(fr.paris.lutece.portal.service.security.LuteceUser user, String strIdExtendableResource, String strExtendableResourceType) Check if a user can comment.static StringcheckComment(String comment, String strExtendableResourceType, String uidUser) Notify the check commentstatic StringcheckComment(String comment, String strExtendableResourceType, String strResourceId, String uidUser) Notify the check commentstatic voidcreateComment(String strExtendableResourceType, String strIdExtendableResource, boolean bPublished) Notify to listeners the creation of a comment.static voidcreateComment(String strExtendableResourceType, String strIdExtendableResource, boolean bPublished, javax.servlet.http.HttpServletRequest request) Notify to listeners the creation of a comment.static voiddeleteComment(String strExtendableResourceType, String strIdExtendableResource, List<Integer> listIdRemovedComment) Notify to listeners the modification of a comment.static booleanCheck if there is listeners to notifystatic voidpublishComment(int nIdComment, boolean bPublished) Notify to listeners the modification of a comment.static voidpublishComment(String strExtendableResourceType, String strIdExtendableResource, boolean bPublished) Notify to listeners the modification of a comment.static voidregisterListener(String strExtendableResourceType, ICommentListener listener) Register a comment listener.
-
Field Details
-
CONSTANT_EVERY_EXTENDABLE_RESOURCE_TYPE
Constant that represents every extendable resource type- See Also:
-
-
Method Details
-
registerListener
Register a comment listener.- Parameters:
strExtendableResourceType- The extendable resource type associated with the listener. UseCONSTANT_EVERY_EXTENDABLE_RESOURCE_TYPEto associated the listener with every resource type.listener- The listener to register
-
hasListener
public static boolean hasListener()Check if there is listeners to notify- Returns:
- True if there is at last one listener, false otherwise
-
createComment
public static void createComment(String strExtendableResourceType, String strIdExtendableResource, boolean bPublished) Notify to listeners the creation of a comment. Only listeners associated with the extendable resource type of the comment are notified.- Parameters:
strExtendableResourceType- The extendable resource type of the created commentstrIdExtendableResource- The extendable resource id of the commentbPublished- True if the comment is published, false otherwise
-
createComment
public static void createComment(String strExtendableResourceType, String strIdExtendableResource, boolean bPublished, javax.servlet.http.HttpServletRequest request) Notify to listeners the creation of a comment. Only listeners associated with the extendable resource type of the comment are notified.- Parameters:
strExtendableResourceType- The extendable resource type of the created commentstrIdExtendableResource- The extendable resource id of the commentbPublished- True if the comment is published, false otherwiserequest- the HTTP request
-
publishComment
public static void publishComment(int nIdComment, boolean bPublished) Notify to listeners the modification of a comment. Only listeners associated with the extendable resource type of the comment are notified.- Parameters:
nIdComment- The id of the updated commentbPublished- True if the comment was published, false if it was unpublished
-
publishComment
public static void publishComment(String strExtendableResourceType, String strIdExtendableResource, boolean bPublished) Notify to listeners the modification of a comment. Only listeners associated with the extendable resource type of the comment are notified.- Parameters:
strExtendableResourceType- The extendable resource type of the updated commentstrIdExtendableResource- The extendable resource id of the commentbPublished- True if the comment was published, false if it was unpublished
-
deleteComment
public static void deleteComment(String strExtendableResourceType, String strIdExtendableResource, List<Integer> listIdRemovedComment) Notify to listeners the modification of a comment. Only listeners associated with the extendable resource type of the comment are notified.- Parameters:
strExtendableResourceType- The extendable resource type of the removed commentstrIdExtendableResource- The extendable resource id of the commentlistIdRemovedComment- The list of ids of removed comments
-
checkComment
Notify the check comment- Parameters:
listErrors-- Returns:
-
checkComment
public static String checkComment(String comment, String strExtendableResourceType, String strResourceId, String uidUser) Notify the check comment- Parameters:
listErrors-- Returns:
-
canComment
public static boolean canComment(fr.paris.lutece.portal.service.security.LuteceUser user, String strIdExtendableResource, String strExtendableResourceType) Check if a user can comment. Call listeners.- Parameters:
user- The lutece userstrIdExtendableResource- The id of the extendable resourcestrExtendableResourceType- The type of the resource- Returns:
- true when the user has the rights, otherwise false
-