Class CommentService
- java.lang.Object
-
- fr.paris.lutece.plugins.extend.modules.comment.service.CommentService
-
- All Implemented Interfaces:
ICommentService
public class CommentService extends Object implements ICommentService
CommentService
-
-
Field Summary
Fields Modifier and Type Field Description static StringBEAN_SERVICEThe Constant BEAN_SERVICE.
-
Constructor Summary
Constructors Constructor Description CommentService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcountByIdParent(int nIdParent, boolean bPublishedOnly)Get the number of comments associated with a given parentvoidcreate(Comment comment)Insert.voidcreate(Comment comment, javax.servlet.http.HttpServletRequest request)Insert.List<Comment>findByIdParent(int nIdParent, boolean bPublishedOnly)Get comments from their parentList<Comment>findByIdParent(int nIdParent, boolean bPublishedOnly, String strSortedAttributeName, boolean bAscSort)Get comments from their parentList<Comment>findByListResource(List<String> listIdExtendableResource, String strExtendableResourceType)Find comment list by resourceCommentfindByPrimaryKey(int nIdComment)Load.List<Comment>findByResource(String strIdExtendableResource, String strExtendableResourceType, boolean bPublishedOnly, boolean bAscSort)Select by resource.List<Comment>findByResource(String strIdExtendableResource, String strExtendableResourceType, boolean bPublishedOnly, String strSortedAttributeName, boolean bAscSort, int nItemsOffset, int nMaxItemsNumber, boolean bLoadSubComments)Get comments of a given resourceList<Comment>findByResource(String strIdExtendableResource, String strExtendableResourceType, CommentFilter commentFilter, int nItemsOffset, int nMaxItemsNumber, boolean bLoadSubComments)Get comments of a given resourceList<Comment>findCommentsByLuteceUser(String strLuteceUserName)Load comments by lutece user name.List<Comment>findCommentsPinned(String strIdExtendableResource, String strExtendableResourceType, int nNbComments, Integer nCommentState, boolean bParentsOnly, boolean bGetNumberSubComments, String strFilterUserName)Load comments pinned.List<Integer>findIdMostCommentedResources(String strExtendableResourceType, boolean bPublishedOnly, int nItemsOffset, int nMaxItemsNumber)Get the ids of resources ordered by their number of commentsList<Integer>findIdsByResource(String strIdExtendableResource, String strExtendableResourceType, boolean bPublishedOnly)Select ids of comments associated with a given resourceList<Comment>findLastComments(String strIdExtendableResource, String strExtendableResourceType, int nNbComments, boolean bPublishedOnly, boolean bParentsOnly, boolean bGetNumberSubComments, boolean bDisplaySubComments, boolean bSortedByDateCreation)Load last comments.intgetCommentNb(String strIdExtendableResource, String strExtendableResourceType, boolean bParentsOnly, boolean bPublishedOnly)Get the number of commentfr.paris.lutece.util.ReferenceListgetRefListCommentStates(Locale locale)return a referenceList of comment statesfr.paris.lutece.util.ReferenceListgetRefListFilterAsImportant(Locale locale)return a referenceList containing the filter on the flag importantfr.paris.lutece.util.ReferenceListgetRefListFilterAsPinned(Locale locale)return a referenceList containing the filter on the flag As PinnedStringgetResourceType(String extendableResourceType)return resource typevoidremove(int nIdComment)Delete.voidremoveByResource(String strIdExtendableResource, String strExtendableResourceType)Delete by resourcevoidupdate(Comment comment)Store.voidupdateCommentPinned(int nIdComment, boolean bPinned)Update flag important.voidupdateCommentStatus(int nIdComment, boolean bPublished)Update comment status.voidupdateFlagImportant(int nIdComment, boolean bImportant)Update flag important.
-
-
-
Field Detail
-
BEAN_SERVICE
public static final String BEAN_SERVICE
The Constant BEAN_SERVICE.- See Also:
- Constant Field Values
-
-
Method Detail
-
create
@Transactional("extend-comment.transactionManager") public void create(Comment comment, javax.servlet.http.HttpServletRequest request)Insert.- Specified by:
createin interfaceICommentService- Parameters:
comment- the commentrequest- the HTTP request
-
create
@Transactional("extend-comment.transactionManager") public void create(Comment comment)Insert.- Specified by:
createin interfaceICommentService- Parameters:
comment- the comment
-
update
@Transactional("extend-comment.transactionManager") public void update(Comment comment)Store.- Specified by:
updatein interfaceICommentService- Parameters:
comment- the comment
-
updateCommentStatus
@Transactional("extend-comment.transactionManager") public void updateCommentStatus(int nIdComment, boolean bPublished)Update comment status.- Specified by:
updateCommentStatusin interfaceICommentService- Parameters:
nIdComment- the n id commentbPublished- the b published
-
remove
@Transactional("extend-comment.transactionManager") public void remove(int nIdComment)Delete.- Specified by:
removein interfaceICommentService- Parameters:
nIdComment- the n id comment
-
removeByResource
@Transactional("extend-comment.transactionManager") public void removeByResource(String strIdExtendableResource, String strExtendableResourceType)Delete by resource- Specified by:
removeByResourcein interfaceICommentService- Parameters:
strIdExtendableResource- the str id extendable resourcestrExtendableResourceType- the str extendable resource type
-
findByPrimaryKey
public Comment findByPrimaryKey(int nIdComment)
Load.- Specified by:
findByPrimaryKeyin interfaceICommentService- Parameters:
nIdComment- the n id comment- Returns:
- the comment
-
findIdsByResource
public List<Integer> findIdsByResource(String strIdExtendableResource, String strExtendableResourceType, boolean bPublishedOnly)
Select ids of comments associated with a given resource- Specified by:
findIdsByResourcein interfaceICommentService- Parameters:
strIdExtendableResource- The id of the extendable resourcestrExtendableResourceType- The extendable resource typebPublishedOnly- True to consider only published comments, false to consider every comment- Returns:
- The list of comment ids, or an empty list if no comment is associated with the given resource
-
findByResource
public List<Comment> findByResource(String strIdExtendableResource, String strExtendableResourceType, boolean bPublishedOnly, boolean bAscSort)
Select by resource.- Specified by:
findByResourcein interfaceICommentService- Parameters:
strIdExtendableResource- the id of the extendable resourcestrExtendableResourceType- the extendable resource typebPublishedOnly- Get only published commentsbAscSort- True if comments should be sorted ascendantly, false otherwise- Returns:
- the list
-
getCommentNb
public int getCommentNb(String strIdExtendableResource, String strExtendableResourceType, boolean bParentsOnly, boolean bPublishedOnly)
Get the number of comment- Specified by:
getCommentNbin interfaceICommentService- Parameters:
strIdExtendableResource- the id of the extendable resourcestrExtendableResourceType- the extendable resource typebParentsOnly- True to consider only comments with no parent, false otherwisebPublishedOnly- True to get only published comments, false to get every comments- Returns:
- the number of comments
-
findLastComments
public List<Comment> findLastComments(String strIdExtendableResource, String strExtendableResourceType, int nNbComments, boolean bPublishedOnly, boolean bParentsOnly, boolean bGetNumberSubComments, boolean bDisplaySubComments, boolean bSortedByDateCreation)
Load last comments.- Specified by:
findLastCommentsin interfaceICommentService- Parameters:
strIdExtendableResource- the id of the extendable resourcestrExtendableResourceType- the extendable resource typenNbComments- the number of commentsbPublishedOnly- True to get only published comments, false to get every commentsbParentsOnly- True to get only parent comments, false to get every comments.bGetNumberSubComments- True to get the number of sub comments of each comment, false otherwisebDisplaySubComments- True if the mod display sub comments is enablebSortedByDateCreation- true if the list is sorted by date creation- Returns:
- the list
-
findByResource
public List<Comment> findByResource(String strIdExtendableResource, String strExtendableResourceType, boolean bPublishedOnly, String strSortedAttributeName, boolean bAscSort, int nItemsOffset, int nMaxItemsNumber, boolean bLoadSubComments)
Get comments of a given resource- Specified by:
findByResourcein interfaceICommentService- Parameters:
strIdExtendableResource- The id of the resourcestrExtendableResourceType- The type of the resourcebPublishedOnly- True to consider only published commentsstrSortedAttributeName- The name of the attribute to sort, or null if no sort should be donebAscSort- True to sort ascendantly, false otherwisenItemsOffset- The offset of the items to get, or 0 to get items from the first onenMaxItemsNumber- The maximum number of items to return, or 0 to get every itemsbLoadSubComments- True if sub comments should be loaded, false if they should be ignored- Returns:
- The list of comments associated with the given resource
-
findByResource
public List<Comment> findByResource(String strIdExtendableResource, String strExtendableResourceType, CommentFilter commentFilter, int nItemsOffset, int nMaxItemsNumber, boolean bLoadSubComments)
Get comments of a given resource- Specified by:
findByResourcein interfaceICommentService- Parameters:
strIdExtendableResource- The id of the resourcestrExtendableResourceType- The type of the resourcecommentFilter- The commentFilter ObjectnItemsOffset- The offset of the items to get, or 0 to get items from the first onenMaxItemsNumber- The maximum number of items to return, or 0 to get every itemsbLoadSubComments- True if sub comments should be loaded, false if they should be ignored- Returns:
- The list of comments associated with the given resource
-
findByIdParent
public List<Comment> findByIdParent(int nIdParent, boolean bPublishedOnly)
Get comments from their parent- Specified by:
findByIdParentin interfaceICommentService- Parameters:
nIdParent- The id of the parent of comments to getbPublishedOnly- True to consider only published comments- Returns:
- The list of comments associated with the given parent
-
findByIdParent
public List<Comment> findByIdParent(int nIdParent, boolean bPublishedOnly, String strSortedAttributeName, boolean bAscSort)
Get comments from their parent- Specified by:
findByIdParentin interfaceICommentService- Parameters:
nIdParent- The id of the parent of comments to getbPublishedOnly- True to consider only published commentsstrSortedAttributeName- The name of the attribute to sort, or null if no sort should be donebAscSort- True to sort ascendantly, false otherwise- Returns:
- The list of comments associated with the given parent
-
countByIdParent
public int countByIdParent(int nIdParent, boolean bPublishedOnly)Get the number of comments associated with a given parent- Specified by:
countByIdParentin interfaceICommentService- Parameters:
nIdParent- The id of the parent of comments to count.bPublishedOnly- True to consider only published comments- Returns:
- The number of comments associated with the given parent
-
findIdMostCommentedResources
public List<Integer> findIdMostCommentedResources(String strExtendableResourceType, boolean bPublishedOnly, int nItemsOffset, int nMaxItemsNumber)
Get the ids of resources ordered by their number of comments- Specified by:
findIdMostCommentedResourcesin interfaceICommentService- Parameters:
strExtendableResourceType- The type of resources to considerbPublishedOnly- True to consider only published comments, false to consider every commentsnItemsOffset- The offset of the items to get, or 0 to get items from the first onenMaxItemsNumber- The maximum number of items to return, or 0 to get every items- Returns:
- The list of ids of resources ordered by the number of associated comments
-
getRefListCommentStates
public fr.paris.lutece.util.ReferenceList getRefListCommentStates(Locale locale)
return a referenceList of comment states- Specified by:
getRefListCommentStatesin interfaceICommentService- Parameters:
locale- the locale- Returns:
- a referenceList of comment states
-
getRefListFilterAsImportant
public fr.paris.lutece.util.ReferenceList getRefListFilterAsImportant(Locale locale)
return a referenceList containing the filter on the flag important- Specified by:
getRefListFilterAsImportantin interfaceICommentService- Parameters:
locale- the locale- Returns:
- a referenceList containing the filter on the flag important
-
getRefListFilterAsPinned
public fr.paris.lutece.util.ReferenceList getRefListFilterAsPinned(Locale locale)
return a referenceList containing the filter on the flag As Pinned- Specified by:
getRefListFilterAsPinnedin interfaceICommentService- Parameters:
locale- the locale- Returns:
- a referenceList containing the filter on the flag As Pinned
-
findCommentsPinned
public List<Comment> findCommentsPinned(String strIdExtendableResource, String strExtendableResourceType, int nNbComments, Integer nCommentState, boolean bParentsOnly, boolean bGetNumberSubComments, String strFilterUserName)
Description copied from interface:ICommentServiceLoad comments pinned.- Specified by:
findCommentsPinnedin interfaceICommentService- Parameters:
strIdExtendableResource- the id of the extendable resourcestrExtendableResourceType- the extendable resource typenNbComments- the number of commentsbParentsOnly- True to get only parent comments, false to get every comments.bGetNumberSubComments- True to get the number of sub comments of each comment, false otherwise- Returns:
- the list of comments pinned
-
updateFlagImportant
@Transactional("extend-comment.transactionManager") public void updateFlagImportant(int nIdComment, boolean bImportant)Description copied from interface:ICommentServiceUpdate flag important.- Specified by:
updateFlagImportantin interfaceICommentService- Parameters:
nIdComment- the n id commentbImportant- true if the comment is important
-
updateCommentPinned
@Transactional("extend-comment.transactionManager") public void updateCommentPinned(int nIdComment, boolean bPinned)Description copied from interface:ICommentServiceUpdate flag important.- Specified by:
updateCommentPinnedin interfaceICommentService- Parameters:
nIdComment- the n id commentbPinned- true if the comment must be pinned
-
getResourceType
public String getResourceType(String extendableResourceType)
Description copied from interface:ICommentServicereturn resource type- Specified by:
getResourceTypein interfaceICommentService- Returns:
-
findByListResource
public List<Comment> findByListResource(List<String> listIdExtendableResource, String strExtendableResourceType)
Description copied from interface:ICommentServiceFind comment list by resource- Specified by:
findByListResourcein interfaceICommentServicestrExtendableResourceType- the extendable resource type- Returns:
- list of comments
-
findCommentsByLuteceUser
public List<Comment> findCommentsByLuteceUser(String strLuteceUserName)
Description copied from interface:ICommentServiceLoad comments by lutece user name.- Specified by:
findCommentsByLuteceUserin interfaceICommentService- Parameters:
strLuteceUserName- the name of the lutece user- Returns:
- the list of comments by lutece user name
-
-