ccc.persistence
Class GroupRepositoryImpl

java.lang.Object
  extended by ccc.persistence.GroupRepositoryImpl
All Implemented Interfaces:
GroupRepository

public class GroupRepositoryImpl
extends java.lang.Object
implements GroupRepository

JPA implementation of a group repository.

Author:
Civic Computing Ltd.

Constructor Summary
GroupRepositoryImpl(javax.persistence.EntityManager em)
          Constructor.
GroupRepositoryImpl(ccc.persistence.Repository repo)
          Constructor.
 
Method Summary
 void create(GroupEntity g)
          Create a new group in the repository.
 GroupEntity find(java.util.UUID groupId)
          Look up a group from its Id.
 java.util.Collection<GroupEntity> list(java.lang.String name, int pageNo, int pageSize)
          List groups.
 long totalCount(java.lang.String name)
          Return number of group entities with given filter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroupRepositoryImpl

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

Parameters:
repo - The repository used to perform queries.

GroupRepositoryImpl

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

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

create

public void create(GroupEntity g)
Create a new group in the repository.

Specified by:
create in interface GroupRepository
Parameters:
g - The group to create.

find

public GroupEntity find(java.util.UUID groupId)
Look up a group from its Id.

Specified by:
find in interface GroupRepository
Parameters:
groupId - The UUID for the group.
Returns:
The group corresponding to 'groupId'.

list

public java.util.Collection<GroupEntity> list(java.lang.String name,
                                              int pageNo,
                                              int pageSize)
List groups.

Specified by:
list in interface GroupRepository
Parameters:
name - Filter groups based on name. NULL disables the filter.
pageNo - The page of results to return.
pageSize - The number of results in a page.
Returns:
A list of groups matching the search criteria.

totalCount

public long totalCount(java.lang.String name)
Return number of group entities with given filter.

Specified by:
totalCount in interface GroupRepository
Parameters:
name - Filter groups based on name. NULL disables the filter.
Returns:
The amount of the entities.


Copyright © 2010. All Rights Reserved.