ccc.api.core
Interface Resources

All Known Implementing Classes:
ResourcesEJB, ResourcesImpl

public interface Resources

Basic API for manipulating resources.

Author:
Civic Computing Ltd.

Field Summary
static java.lang.String NAME
          NAME : String.
 
Method Summary
 ACL acl(java.util.UUID resourceId)
          Get the access control list for a resource.
 void applyWorkingCopy(java.util.UUID resourceId)
          Apply a resource's working copy.
 Duration cacheDuration(java.util.UUID resourceId)
          Retrieve resource's cache duration.
 void changeAcl(java.util.UUID resourceId, ACL acl)
          Change the access control list for a resource.
 void clearWorkingCopy(java.util.UUID pageId)
          Delete the working copy for a page.
 Template computeTemplate(java.util.UUID resourceId)
          Returns summary of the template assigned for a resource.
 void createLogEntry(java.util.UUID resourceId, java.lang.String action, java.lang.String detail)
          Create a new log entry for the resource.
 ResourceSummary createSearch(java.util.UUID parentId, java.lang.String title)
          Creates a new search.
 void createWorkingCopy(java.util.UUID resourceId, Resource dto)
          Create a working copy for the specified resource, using the specified revision.
 void delete(java.util.UUID resourceId)
          Delete the resource located at the specified path.
 void deleteCacheDuration(java.util.UUID id)
          Clear the cache duration for the specified resource.
 void excludeFromMainMenu(java.util.UUID resourceId)
          Specify whether a resource should not be included in a site's main menu.
 boolean exists(java.util.UUID resourceId)
          Does a resource with the specified ID exist.
 java.lang.String fileContentsFromPath(java.lang.String absolutePath, java.lang.String charset)
          Look up the contents of a file as a String.
 java.lang.String getAbsolutePath(java.util.UUID resourceId)
          Determine the absolute path to a resource.
 PagedCollection<Revision> history(java.util.UUID resourceId)
          Retrieve the history of a resource.
 void includeInMainMenu(java.util.UUID resourceId)
          Specify that a resource should be included in a site's main menu.
 PagedCollection<ResourceSummary> list(ResourceCriteria criteria, int pageNo, int pageSize)
          List existing resources.
 PagedCollection<ResourceSummary> list(java.util.UUID parent, java.lang.String tag, java.lang.Long before, java.lang.Long after, java.lang.String mainMenu, java.lang.String type, java.lang.String locked, java.lang.String published, java.lang.String sort, SortOrder order, int pageNo, int pageSize)
          List existing resources.
 void lock(java.util.UUID resourceId)
          Lock the specified resource.
 java.util.Map<java.lang.String,java.lang.String> metadata(java.util.UUID resourceId)
          Retrieve the metadata for a resource.
 void move(java.util.UUID resourceId, java.util.UUID newParentId)
          Changes a resource's parent.
 ResourceSummary publish(java.util.UUID resourceId)
          Publish the specified resource.
 void rename(java.util.UUID resourceId, java.lang.String name)
          Rename resource.
 ResourceSummary resourceForLegacyId(java.lang.String legacyId)
          Deprecated. 
 PagedCollection<ResourceSummary> resourceForMetadataKey(java.lang.String key)
          Deprecated. 
 ResourceSummary resourceForPath(java.lang.String path)
          Look up the resource for a specified path.
 Resource resourceForPathSecure(java.lang.String path)
          Deprecated. 
 ResourceSummary retrieve(java.util.UUID resourceId)
          Get the resource located at the specified path.
 Resource revisionForPath(java.lang.String path, int version)
          Deprecated. 
 void unlock(java.util.UUID resourceId)
          Unlock the specified Resource.
 void unpublish(java.util.UUID resourceId)
          Unpublish the specified resource.
 void updateCacheDuration(java.util.UUID resourceId, Resource duration)
          Update the period that a resource should be cached for.
 void updateMetadata(java.util.UUID resourceId, Resource resource)
          Update metadata of the resource.
 void updateResourceTemplate(java.util.UUID resourceId, Resource template)
          Update the specified resource's template on the server.
 Resource workingCopyForPath(java.lang.String path)
          Deprecated. 
 

Field Detail

NAME

static final java.lang.String NAME
NAME : String.

See Also:
Constant Field Values
Method Detail

list

PagedCollection<ResourceSummary> list(java.util.UUID parent,
                                      java.lang.String tag,
                                      java.lang.Long before,
                                      java.lang.Long after,
                                      java.lang.String mainMenu,
                                      java.lang.String type,
                                      java.lang.String locked,
                                      java.lang.String published,
                                      java.lang.String sort,
                                      SortOrder order,
                                      int pageNo,
                                      int pageSize)
List existing resources. Leave field to null if not applicable.

Parameters:
parent - Filter resources by parent.
tag - Filter resources by tag.
before - Include only resources created before this date.
after - Include only resources created after this date.
mainMenu - Filter resources by 'included in main menu'.
type - Filter resources by type.
locked - Filter resources by locked (true or null).
published - Filter resources by published (true or null).
sort - The field results be sorted on.
order - 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 resources.

list

PagedCollection<ResourceSummary> list(ResourceCriteria criteria,
                                      int pageNo,
                                      int pageSize)
List existing resources.

Parameters:
criteria - The criteria by which to filter resources.
pageNo - The page of results to return.
pageSize - The number of results in a page.
Returns:
A list of resources.

exists

boolean exists(java.util.UUID resourceId)
Does a resource with the specified ID exist.

Parameters:
resourceId - The id of the resource.
Returns:
True if it exists, false otherwise

retrieve

ResourceSummary retrieve(java.util.UUID resourceId)
Get the resource located at the specified path.

Parameters:
resourceId - The id of the existing resource.
Returns:
A summary of the resource.

delete

void delete(java.util.UUID resourceId)
Delete the resource located at the specified path.

Parameters:
resourceId - The id of the existing resource.

getAbsolutePath

java.lang.String getAbsolutePath(java.util.UUID resourceId)
Determine the absolute path to a resource.

Parameters:
resourceId - The id of the resource.
Returns:
The absolute path as a string.

history

PagedCollection<Revision> 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 list of resources.

metadata

java.util.Map<java.lang.String,java.lang.String> metadata(java.util.UUID resourceId)
Retrieve the metadata for a resource.

Parameters:
resourceId - The id of the resource.
Returns:
The metadata in a hashmap.

acl

ACL acl(java.util.UUID resourceId)
Get the access control list for a resource.

Parameters:
resourceId - The resource's id.
Returns:
The access control list for the specified resource.

cacheDuration

Duration cacheDuration(java.util.UUID resourceId)
Retrieve resource's cache duration.

Parameters:
resourceId - The id of the resource.
Returns:
Duration.

computeTemplate

Template computeTemplate(java.util.UUID resourceId)
Returns summary of the template assigned for a resource.

Parameters:
resourceId - Id of the resource.
Returns:
TemplateSummary.

resourceForPath

ResourceSummary resourceForPath(java.lang.String path)
Look up the resource for a specified path.

Parameters:
path - The absolute path.
Returns:
A summary of the corresponding resource.

resourceForLegacyId

@Deprecated
ResourceSummary resourceForLegacyId(java.lang.String legacyId)
Deprecated. 

Look up the resource for a specified legacy id.

Parameters:
legacyId - The legacy id of the resource.
Returns:
A summary of the corresponding resource.

resourceForMetadataKey

@Deprecated
PagedCollection<ResourceSummary> resourceForMetadataKey(java.lang.String key)
Deprecated. 

Look up the resources for a specified metadata key.

Parameters:
key - The legacy id of the resource.
Returns:
A summary of the corresponding resource.

updateCacheDuration

void updateCacheDuration(java.util.UUID resourceId,
                         Resource duration)
Update the period that a resource should be cached for.

Parameters:
resourceId - The resource to update.
duration - DTO specifying the cache duration.

lock

void lock(java.util.UUID resourceId)
Lock the specified resource. The resource will be locked by the currently logged in user. If the resource is already locked a CCCException will be thrown.

Parameters:
resourceId - The uuid of the resource to lock.

applyWorkingCopy

void applyWorkingCopy(java.util.UUID resourceId)
Apply a resource's working copy.

Parameters:
resourceId - The id of the resource.

updateResourceTemplate

void updateResourceTemplate(java.util.UUID resourceId,
                            Resource template)
Update the specified resource's template on the server.

Parameters:
resourceId - The id of the resource to update.
template - DTO specifying the new template to set for the resource.

unlock

void unlock(java.util.UUID resourceId)
Unlock the specified Resource. Unlocking an unlocked resource has no effect.

Parameters:
resourceId - The resource to unlock.

unpublish

void unpublish(java.util.UUID resourceId)
Unpublish the specified resource.

Parameters:
resourceId - The id of the resource to update.

publish

ResourceSummary publish(java.util.UUID resourceId)
Publish the specified resource.

Parameters:
resourceId - The id of the resource to update.

move

void move(java.util.UUID resourceId,
          java.util.UUID newParentId)
Changes a resource's parent.

Parameters:
resourceId - The id of the resource to move.
newParentId - The id of the folder to which the resource should be moved.

rename

void rename(java.util.UUID resourceId,
            java.lang.String name)
Rename resource.

Parameters:
resourceId - The id of the resource to rename.
name - The new name.

changeAcl

void changeAcl(java.util.UUID resourceId,
               ACL acl)
Change the access control list for a resource.

Parameters:
resourceId - The resource to update.
acl - The access control list for the specified resource.

excludeFromMainMenu

void excludeFromMainMenu(java.util.UUID resourceId)
Specify whether a resource should not be included in a site's main menu.

Parameters:
resourceId - The id of the resource to update.

includeInMainMenu

void includeInMainMenu(java.util.UUID resourceId)
Specify that a resource should be included in a site's main menu.

Parameters:
resourceId - The id of the resource to update.

updateMetadata

void updateMetadata(java.util.UUID resourceId,
                    Resource resource)
Update metadata of the resource.

Parameters:
resourceId - The id of the resource to update.
resource - The resource containing new metadata.

clearWorkingCopy

void clearWorkingCopy(java.util.UUID pageId)
Delete the working copy for a page.

Parameters:
pageId - The id of the page with a working copy.

createWorkingCopy

void createWorkingCopy(java.util.UUID resourceId,
                       Resource dto)
Create a working copy for the specified resource, using the specified revision.

Parameters:
resourceId - The id of the resource.
dto - The DTO specifying the number of the revision to use.

deleteCacheDuration

void deleteCacheDuration(java.util.UUID id)
Clear the cache duration for the specified resource.

Parameters:
id - The id of the resource to update.

createLogEntry

void createLogEntry(java.util.UUID resourceId,
                    java.lang.String action,
                    java.lang.String detail)
Create a new log entry for the resource.

Parameters:
resourceId - The id of the resource to create log entry for.
action - The action for the log entry.
detail - The details for the log entry.

fileContentsFromPath

java.lang.String fileContentsFromPath(java.lang.String absolutePath,
                                      java.lang.String charset)
Look up the contents of a file as a String. FIXME: Move to files.

Parameters:
absolutePath - The absolute path to the resource.
charset - The character set for the file.
Returns:
The contents as a string.

resourceForPathSecure

@Deprecated
Resource resourceForPathSecure(java.lang.String path)
Deprecated. 

Look up the resource for a specified path.

Parameters:
path - The absolute path.
Returns:
A summary of the corresponding resource.

revisionForPath

@Deprecated
Resource revisionForPath(java.lang.String path,
                                    int version)
Deprecated. 

Look up the resource for a specified path.

Parameters:
path - The absolute path.
version - The version number of the resource to retrieve.
Returns:
A summary of the corresponding resource.

workingCopyForPath

@Deprecated
Resource workingCopyForPath(java.lang.String path)
Deprecated. 

Look up the working copy for a specified path.

Parameters:
path - The absolute path.
Returns:
A summary of the corresponding resource.

createSearch

ResourceSummary createSearch(java.util.UUID parentId,
                             java.lang.String title)
Creates a new search.

Parameters:
parentId - The parent folder where the search should be created.
title - The title of the search.
Returns:
A summary of the newly created search.


Copyright © 2010. All Rights Reserved.