ccc.persistence
Class CommentRepositoryImpl

java.lang.Object
  extended by ccc.persistence.CommentRepositoryImpl
All Implemented Interfaces:
CommentRepository

public class CommentRepositoryImpl
extends java.lang.Object
implements CommentRepository

JPA implementation of a comment repository.

Author:
Civic Computing Ltd.

Constructor Summary
CommentRepositoryImpl(javax.persistence.EntityManager em)
          Constructor.
CommentRepositoryImpl(ccc.persistence.Repository repo)
          Constructor.
 
Method Summary
 long count(ResourceEntity resource, CommentStatus status)
          Count existing comments.
 void create(CommentEntity comment)
          Persist a newly created comment.
 void delete(java.util.UUID commentId)
          Delete a comment.
 java.util.List<CommentEntity> list(ResourceEntity resource, CommentStatus status, java.lang.String sort, SortOrder sortOrder, int pageNo, int pageSize)
          List existing comments.
 CommentEntity retrieve(java.util.UUID commentId)
          Retrieve a single comment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommentRepositoryImpl

public CommentRepositoryImpl(ccc.persistence.Repository repo)
Constructor.

Parameters:
repo - The repository used to perform queries.

CommentRepositoryImpl

public CommentRepositoryImpl(javax.persistence.EntityManager em)
Constructor.

Parameters:
em - The JPA entity manager for this repository.
Method Detail

create

public void create(CommentEntity comment)
Persist a newly created comment.

Specified by:
create in interface CommentRepository
Parameters:
comment - The comment to persist.

delete

public void delete(java.util.UUID commentId)
Delete a comment.

Specified by:
delete in interface CommentRepository
Parameters:
commentId - The ID of the comment to delete.

retrieve

public CommentEntity retrieve(java.util.UUID commentId)
Retrieve a single comment.

Specified by:
retrieve in interface CommentRepository
Parameters:
commentId - The ID of the comment to retrieve.
Returns:
The corresponding comment.

list

public java.util.List<CommentEntity> list(ResourceEntity resource,
                                          CommentStatus status,
                                          java.lang.String sort,
                                          SortOrder sortOrder,
                                          int pageNo,
                                          int pageSize)
List existing comments.

Specified by:
list in interface CommentRepository
Parameters:
resource - Filter comments by resource. NULL will return all.
status - Filter comments based on status. NULL will return all.
sort - The field to sort on.
sortOrder - The order results be sorted in.
pageNo - The page of results to return.
pageSize - The number of results in a page.
Returns:
A list of comments.

count

public long count(ResourceEntity resource,
                  CommentStatus status)
Count existing comments.

Specified by:
count in interface CommentRepository
Parameters:
resource - Filter comments by resource. NULL will return all.
status - Filter comments based on status. NULL will return all.
Returns:
The number of comments.


Copyright © 2010. All Rights Reserved.