ccc.persistence
Interface ResourceRepository


public interface ResourceRepository

API for resource repositories.

Author:
Civic Computing Ltd.

Method Summary
 void create(ResourceEntity newResource)
          Create a new resource.
 java.util.List<FileEntity> files()
          List all files.
<T extends ResourceEntity>
T
find(java.lang.Class<T> type, java.util.UUID id)
          Find a resource using its unique id.
 java.util.Map<java.lang.Integer,? extends RevisionEntity<?>> history(java.util.UUID resourceId)
          Retrieve the history of a resource.
 java.util.List<FileEntity> images(java.util.UUID folderId, int pageNo, int pageSize)
          List all image files.
 long imagesCount(java.util.UUID folderId)
          Return count of images in the folder.
 java.util.List<PageEntity> list(PageCriteria criteria, int pageNo, int pageSize)
          List resources with given criteria.
 java.util.List<ResourceEntity> list(ResourceCriteria criteria, FolderEntity f, java.lang.String sort, SortOrder sortOrder, int pageNo, int pageSize)
          List resources with given criteria.
 ResourceEntity lookup(ResourcePath contentPath)
          Look up a resource.
 ResourceEntity lookupWithLegacyId(java.lang.String legacyId)
          Look up a resource, given its CCC6 id.
 java.util.List<ResourceEntity> lookupWithMetadataKey(java.lang.String key)
          Look up a resource, given its metadata key.
 java.util.List<PageEntity> pages()
          List all pages.
 FolderEntity root(java.lang.String name)
          Lookup a root folder by name.
 java.util.List<FolderEntity> roots()
          List all root folders.
 TemplateEntity template(java.lang.String name)
          Find a template, given its name.
 long templateCount()
          Return count of templates.
 java.util.List<TemplateEntity> templates(int pageNo, int pageSize)
          List all templates.
 long totalCount(PageCriteria criteria)
          Return count of pages with given criteria.
 long totalCount(ResourceCriteria criteria, FolderEntity f)
          Return count of resources with given criteria.
 

Method Detail

history

java.util.Map<java.lang.Integer,? extends RevisionEntity<?>> history(java.util.UUID resourceId)
Retrieve the history of a resource.

Parameters:
resourceId - The id of the resource whose history we will look up.
Returns:
The revisions for the resource.

find

<T extends ResourceEntity> T find(java.lang.Class<T> type,
                                  java.util.UUID id)
Find a resource using its unique id.

Type Parameters:
T - The type of the resource to return.
Parameters:
type - A class representing the type of the resource to return.
id - The id of the resource to find.
Returns:
The resource for the specified id.

lookup

ResourceEntity lookup(ResourcePath contentPath)
Look up a resource.

Parameters:
contentPath - ResourcePath The path to the resource.
Returns:
Resource The resource at the specified path, or NULL if it doesn't exist.

lookupWithLegacyId

ResourceEntity lookupWithLegacyId(java.lang.String legacyId)
Look up a resource, given its CCC6 id.

Parameters:
legacyId - The CCC6 id.
Returns:
The corresponding resource in CCC7.

lookupWithMetadataKey

java.util.List<ResourceEntity> lookupWithMetadataKey(java.lang.String key)
Look up a resource, given its metadata key.

Parameters:
key - The metadata key.
Returns:
The corresponding resources in CCC7.

root

FolderEntity root(java.lang.String name)
Lookup a root folder by name.

Parameters:
name - The name of the root folder.
Returns:
The corresponding folder

create

void create(ResourceEntity newResource)
Create a new resource.

Parameters:
newResource - The new resource to add.

images

java.util.List<FileEntity> images(java.util.UUID folderId,
                                  int pageNo,
                                  int pageSize)
List all image files.

Parameters:
folderId - The id of the folder whose images we will look up.
pageNo - The page of results to return.
pageSize - The number of results in a page.
Returns:
A list of files.

roots

java.util.List<FolderEntity> roots()
List all root folders.

Returns:
A list of folders.

templates

java.util.List<TemplateEntity> templates(int pageNo,
                                         int pageSize)
List all templates.

Parameters:
pageNo - The page of results to return.
pageSize - The number of results in a page.
Returns:
A list of templates

files

java.util.List<FileEntity> files()
List all files.

Returns:
A list of files.

pages

java.util.List<PageEntity> pages()
List all pages.

Returns:
a list of pages.

template

TemplateEntity template(java.lang.String name)
Find a template, given its name.

Parameters:
name - The name of the template.
Returns:
The template with the specified name.

list

java.util.List<ResourceEntity> list(ResourceCriteria criteria,
                                    FolderEntity f,
                                    java.lang.String sort,
                                    SortOrder sortOrder,
                                    int pageNo,
                                    int pageSize)
List resources with given criteria.

Parameters:
criteria - Search criteria.
f - Filter resources by parent. NULL will return all.
sort - The sort results be sorted in.
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.

list

java.util.List<PageEntity> list(PageCriteria criteria,
                                int pageNo,
                                int pageSize)
List resources with given criteria.

Parameters:
criteria - Search criteria.
pageNo - The page of results to return.
pageSize - The number of results in a page.
Returns:
A list of comments.

imagesCount

long imagesCount(java.util.UUID folderId)
Return count of images in the folder.

Parameters:
folderId - The id of the folder whose images we will look up.
Returns:
The count.

totalCount

long totalCount(ResourceCriteria criteria,
                FolderEntity f)
Return count of resources with given criteria.

Parameters:
criteria - Search criteria.
f - Filter resources by parent. NULL will return all.
Returns:
The count, as a long.

totalCount

long totalCount(PageCriteria criteria)
Return count of pages with given criteria.

Parameters:
criteria - Search criteria.
Returns:
The count, as a long.

templateCount

long templateCount()
Return count of templates.

Returns:
The count.


Copyright © 2010. All Rights Reserved.