public class CommentService extends Object implements ICommentService
| Modifier and Type | Field and Description |
|---|---|
static String |
BEAN_SERVICE
The Constant BEAN_SERVICE.
|
| Constructor and Description |
|---|
CommentService() |
| Modifier and Type | Method and Description |
|---|---|
int |
countByIdParent(int nIdParent,
boolean bPublishedOnly)
Get the number of comments associated with a given parent
|
void |
create(Comment comment)
Insert.
|
void |
create(Comment comment,
javax.servlet.http.HttpServletRequest request)
Insert.
|
List<Comment> |
findByIdParent(int nIdParent,
boolean bPublishedOnly)
Get comments from their parent
|
List<Comment> |
findByIdParent(int nIdParent,
boolean bPublishedOnly,
String strSortedAttributeName,
boolean bAscSort)
Get comments from their parent
|
Comment |
findByPrimaryKey(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 resource
|
List<Comment> |
findByResource(String strIdExtendableResource,
String strExtendableResourceType,
CommentFilter commentFilter,
int nItemsOffset,
int nMaxItemsNumber,
boolean bLoadSubComments)
Get comments of a given resource
|
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 comments
|
List<Integer> |
findIdsByResource(String strIdExtendableResource,
String strExtendableResourceType,
boolean bPublishedOnly)
Select ids of comments associated with a given resource
|
List<Comment> |
findLastComments(String strIdExtendableResource,
String strExtendableResourceType,
int nNbComments,
boolean bPublishedOnly,
boolean bParentsOnly,
boolean bGetNumberSubComments,
boolean bDisplaySubComments,
boolean bSortedByDateCreation)
Load last comments.
|
int |
getCommentNb(String strIdExtendableResource,
String strExtendableResourceType,
boolean bParentsOnly,
boolean bPublishedOnly)
Get the number of comment
|
fr.paris.lutece.util.ReferenceList |
getRefListCommentStates(Locale locale)
return a referenceList of comment states
|
fr.paris.lutece.util.ReferenceList |
getRefListFilterAsImportant(Locale locale)
return a referenceList containing the filter on the flag important
|
fr.paris.lutece.util.ReferenceList |
getRefListFilterAsPinned(Locale locale)
return a referenceList containing the filter on the flag As Pinned
|
void |
remove(int nIdComment)
Delete.
|
void |
removeByResource(String strIdExtendableResource,
String strExtendableResourceType)
Delete by resource
|
void |
update(Comment comment)
Store.
|
void |
updateCommentPinned(int nIdComment,
boolean bPinned)
Update flag important.
|
void |
updateCommentStatus(int nIdComment,
boolean bPublished)
Update comment status.
|
void |
updateFlagImportant(int nIdComment,
boolean bImportant)
Update flag important.
|
public static final String BEAN_SERVICE
@Transactional(value="extend-comment.transactionManager") public void create(Comment comment, javax.servlet.http.HttpServletRequest request)
create in interface ICommentServicecomment - the commentrequest - the HTTP request@Transactional(value="extend-comment.transactionManager") public void create(Comment comment)
create in interface ICommentServicecomment - the comment@Transactional(value="extend-comment.transactionManager") public void update(Comment comment)
update in interface ICommentServicecomment - the comment@Transactional(value="extend-comment.transactionManager")
public void updateCommentStatus(int nIdComment,
boolean bPublished)
updateCommentStatus in interface ICommentServicenIdComment - the n id commentbPublished - the b published@Transactional(value="extend-comment.transactionManager") public void remove(int nIdComment)
remove in interface ICommentServicenIdComment - the n id comment@Transactional(value="extend-comment.transactionManager") public void removeByResource(String strIdExtendableResource, String strExtendableResourceType)
removeByResource in interface ICommentServicestrIdExtendableResource - the str id extendable resourcestrExtendableResourceType - the str extendable resource typepublic Comment findByPrimaryKey(int nIdComment)
findByPrimaryKey in interface ICommentServicenIdComment - the n id commentpublic List<Integer> findIdsByResource(String strIdExtendableResource, String strExtendableResourceType, boolean bPublishedOnly)
findIdsByResource in interface ICommentServicestrIdExtendableResource - The id of the extendable resourcestrExtendableResourceType - The extendable resource typebPublishedOnly - True to consider only published comments, false to
consider every commentpublic List<Comment> findByResource(String strIdExtendableResource, String strExtendableResourceType, boolean bPublishedOnly, boolean bAscSort)
findByResource in interface ICommentServicestrIdExtendableResource - the id of the extendable resourcestrExtendableResourceType - the extendable resource typebPublishedOnly - Get only published commentsbAscSort - True if comments should be sorted ascendantly, false
otherwisepublic int getCommentNb(String strIdExtendableResource, String strExtendableResourceType, boolean bParentsOnly, boolean bPublishedOnly)
getCommentNb in interface ICommentServicestrIdExtendableResource - 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 commentspublic List<Comment> findLastComments(String strIdExtendableResource, String strExtendableResourceType, int nNbComments, boolean bPublishedOnly, boolean bParentsOnly, boolean bGetNumberSubComments, boolean bDisplaySubComments, boolean bSortedByDateCreation)
findLastComments in interface ICommentServicestrIdExtendableResource - 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 creationpublic List<Comment> findByResource(String strIdExtendableResource, String strExtendableResourceType, boolean bPublishedOnly, String strSortedAttributeName, boolean bAscSort, int nItemsOffset, int nMaxItemsNumber, boolean bLoadSubComments)
findByResource in interface ICommentServicestrIdExtendableResource - 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 ignoredpublic List<Comment> findByResource(String strIdExtendableResource, String strExtendableResourceType, CommentFilter commentFilter, int nItemsOffset, int nMaxItemsNumber, boolean bLoadSubComments)
findByResource in interface ICommentServicestrIdExtendableResource - 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 ignoredpublic List<Comment> findByIdParent(int nIdParent, boolean bPublishedOnly)
findByIdParent in interface ICommentServicenIdParent - The id of the parent of comments to getbPublishedOnly - True to consider only published commentspublic List<Comment> findByIdParent(int nIdParent, boolean bPublishedOnly, String strSortedAttributeName, boolean bAscSort)
findByIdParent in interface ICommentServicenIdParent - 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 otherwisepublic int countByIdParent(int nIdParent,
boolean bPublishedOnly)
countByIdParent in interface ICommentServicenIdParent - The id of the parent of comments to count.bPublishedOnly - True to consider only published commentspublic List<Integer> findIdMostCommentedResources(String strExtendableResourceType, boolean bPublishedOnly, int nItemsOffset, int nMaxItemsNumber)
findIdMostCommentedResources in interface ICommentServicestrExtendableResourceType - 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 itemspublic fr.paris.lutece.util.ReferenceList getRefListCommentStates(Locale locale)
getRefListCommentStates in interface ICommentServicelocale - the localepublic fr.paris.lutece.util.ReferenceList getRefListFilterAsImportant(Locale locale)
getRefListFilterAsImportant in interface ICommentServicelocale - the localepublic fr.paris.lutece.util.ReferenceList getRefListFilterAsPinned(Locale locale)
getRefListFilterAsPinned in interface ICommentServicelocale - the localepublic List<Comment> findCommentsPinned(String strIdExtendableResource, String strExtendableResourceType, int nNbComments, Integer nCommentState, boolean bParentsOnly, boolean bGetNumberSubComments, String strFilterUserName)
ICommentServicefindCommentsPinned in interface ICommentServicestrIdExtendableResource - 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@Transactional(value="extend-comment.transactionManager")
public void updateFlagImportant(int nIdComment,
boolean bImportant)
ICommentServiceupdateFlagImportant in interface ICommentServicenIdComment - the n id commentbImportant - true if the comment is important@Transactional(value="extend-comment.transactionManager")
public void updateCommentPinned(int nIdComment,
boolean bPinned)
ICommentServiceupdateCommentPinned in interface ICommentServicenIdComment - the n id commentbPinned - true if the comment must be pinnedCopyright © 2019 City of Paris. All rights reserved.