fr.paris.lutece.plugins.extend.modules.comment.service
Interface ICommentService

All Known Implementing Classes:
CommentService

public interface ICommentService

ICommentService.


Method Summary
 int countByIdParent(int nIdParent, boolean bPublishedOnly)
          Get the number of comments associated with a given parent
 void create(Comment comment)
          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<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)
          Load last comments.
 int getCommentNb(String strIdExtendableResource, String strExtendableResourceType, boolean bParentsOnly, boolean bPublishedOnly)
          Get the number of comment
 void remove(int nIdComment)
          Delete.
 void removeByResource(String strIdExtendableResource, String strExtendableResourceType)
          Delete by resource
 void update(Comment comment)
          Store.
 void updateCommentStatus(int nIdComment, boolean bPublished)
          Update comment status.
 

Method Detail

remove

@Transactional(value="extend-comment.transactionManager")
void remove(int nIdComment)
Delete.

Parameters:
nIdComment - the n id comment

removeByResource

@Transactional(value="extend-comment.transactionManager")
void removeByResource(String strIdExtendableResource,
                                    String strExtendableResourceType)
Delete by resource

Parameters:
strIdExtendableResource - the str id extendable resource
strExtendableResourceType - the str extendable resource type

create

@Transactional(value="extend-comment.transactionManager")
void create(Comment comment)
Insert.

Parameters:
comment - the comment

update

@Transactional(value="extend-comment.transactionManager")
void update(Comment comment)
Store.

Parameters:
comment - the comment

updateCommentStatus

@Transactional(value="extend-comment.transactionManager")
void updateCommentStatus(int nIdComment,
                                       boolean bPublished)
Update comment status.

Parameters:
nIdComment - the n id comment
bPublished - the b published

findByPrimaryKey

Comment findByPrimaryKey(int nIdComment)
Load.

Parameters:
nIdComment - the n id comment
Returns:
the comment

findIdsByResource

List<Integer> findIdsByResource(String strIdExtendableResource,
                                String strExtendableResourceType,
                                boolean bPublishedOnly)
Select ids of comments associated with a given resource

Parameters:
strIdExtendableResource - The id of the extendable resource
strExtendableResourceType - The extendable resource type
bPublishedOnly - 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

List<Comment> findByResource(String strIdExtendableResource,
                             String strExtendableResourceType,
                             boolean bPublishedOnly,
                             boolean bAscSort)
Select by resource.

Parameters:
strIdExtendableResource - the id of the extendable resource
strExtendableResourceType - the extendable resource type
bPublishedOnly - Get only published comments
bAscSort - True if comments should be sorted ascendantly, false otherwise
Returns:
the list

getCommentNb

int getCommentNb(String strIdExtendableResource,
                 String strExtendableResourceType,
                 boolean bParentsOnly,
                 boolean bPublishedOnly)
Get the number of comment

Parameters:
strIdExtendableResource - the id of the extendable resource
strExtendableResourceType - the extendable resource type
bParentsOnly - True to consider only comments with no parent, false otherwise
bPublishedOnly - True to get only published comments, false to get every comments
Returns:
the number of comments

findLastComments

List<Comment> findLastComments(String strIdExtendableResource,
                               String strExtendableResourceType,
                               int nNbComments,
                               boolean bPublishedOnly,
                               boolean bParentsOnly,
                               boolean bGetNumberSubComments)
Load last comments.

Parameters:
strIdExtendableResource - the id of the extendable resource
strExtendableResourceType - the extendable resource type
nNbComments - the number of comments
bPublishedOnly - True to get only published comments, false to get every comments
bParentsOnly - 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

findByResource

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

Parameters:
strIdExtendableResource - The id of the resource
strExtendableResourceType - The type of the resource
bPublishedOnly - True to consider only published comments
strSortedAttributeName - The name of the attribute to sort, or null if no sort should be done
bAscSort - True to sort ascendantly, false otherwise
nItemsOffset - The offset of the items to get, or 0 to get items from the first one
nMaxItemsNumber - The maximum number of items to return, or 0 to get every items
bLoadSubComments - True if sub comments should be loaded, false if they should be ignored
Returns:
The list of comments associated with the given resource

findByIdParent

List<Comment> findByIdParent(int nIdParent,
                             boolean bPublishedOnly)
Get comments from their parent

Parameters:
nIdParent - The id of the parent of comments to get
bPublishedOnly - True to consider only published comments
Returns:
The list of comments associated with the given parent

findByIdParent

List<Comment> findByIdParent(int nIdParent,
                             boolean bPublishedOnly,
                             String strSortedAttributeName,
                             boolean bAscSort)
Get comments from their parent

Parameters:
nIdParent - The id of the parent of comments to get
bPublishedOnly - True to consider only published comments
strSortedAttributeName - The name of the attribute to sort, or null if no sort should be done
bAscSort - True to sort ascendantly, false otherwise
Returns:
The list of comments associated with the given parent

countByIdParent

int countByIdParent(int nIdParent,
                    boolean bPublishedOnly)
Get the number of comments associated with a given parent

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

List<Integer> findIdMostCommentedResources(String strExtendableResourceType,
                                           boolean bPublishedOnly,
                                           int nItemsOffset,
                                           int nMaxItemsNumber)
Get the ids of resources ordered by their number of comments

Parameters:
strExtendableResourceType - The type of resources to consider
bPublishedOnly - True to consider only published comments, false to consider every comments
nItemsOffset - The offset of the items to get, or 0 to get items from the first one
nMaxItemsNumber - 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


Copyright © 2014 Mairie de Paris. All Rights Reserved.