|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectccc.services.ejb3.ResourcesEJB
@RolesAllowed(value={}) public class ResourcesEJB
EJB implementation of the ResourcesExt
interface.
Field Summary |
---|
Fields inherited from interface ccc.api.core.Resources |
---|
NAME |
Constructor Summary | |
---|---|
ResourcesEJB()
|
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. |
|
protected void |
checkPermission(java.lang.String... permissions)
Check that the current user has ONE OF the specified permissions. |
|
protected void |
checkRead(ResourceEntity r)
Check that a resource is readable by a user. |
|
protected void |
checkWrite(ResourceEntity r)
Check that a resource is write-able by a user. |
|
void |
clearWorkingCopy(java.util.UUID resourceId)
Delete the working copy for a page. |
|
CommandFactory |
commands()
Accessor. |
|
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,
long index)
Create a working copy for the specified resource, using the specified log entry. |
|
void |
createWorkingCopy(java.util.UUID resourceId,
Resource pu)
Create a working copy for the specified resource, using the specified revision. |
|
protected UserEntity |
currentUser()
Accessor. |
|
protected java.util.UUID |
currentUserId()
Accessor. |
|
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. |
|
protected
|
execute(Command<T> command)
Execute a command on behalf of the current user. |
|
void |
executeAction(java.util.UUID actionId)
Execute the specified action. |
|
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. |
|
protected java.util.Collection<? extends ResourceEntity> |
filterAccessibleTo(UserEntity u,
java.util.List<? extends ResourceEntity> resources)
Filter a collection of resources based on accessibility. |
|
java.lang.String |
getAbsolutePath(java.util.UUID resourceId)
Determine the absolute path to a resource. |
|
protected IRepositoryFactory |
getRepoFactory()
Accessor. |
|
protected javax.ejb.TimerService |
getTimerService()
Accessor. |
|
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. |
|
void |
includeInMainMenu(java.util.UUID resourceId,
boolean include)
Specify whether 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)
Look up the resource for a specified legacy id. |
|
PagedCollection<ResourceSummary> |
resourceForMetadataKey(java.lang.String key)
Look up the resources for a specified metadata key. |
|
ResourceSummary |
resourceForPath(java.lang.String rootPath)
Look up the resource for a specified path. |
|
Resource |
resourceForPathSecure(java.lang.String rootPath)
Look up the resource for a specified path. |
|
ResourceSummary |
retrieve(java.util.UUID resourceId)
Get the resource located at the specified path. |
|
Resource |
revisionForPath(java.lang.String path,
int version)
Look up the resource for a specified path. |
|
protected
|
sudoExecute(Command<T> command,
java.util.UUID actorId,
java.util.Date happenedOn)
Execute a command on behalf of another user. |
|
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,
Duration duration)
Update the period that a resource should be cached for. |
|
void |
updateCacheDuration(java.util.UUID resourceId,
Resource pu)
Update the period that a resource should be cached for. |
|
void |
updateMetadata(java.util.UUID resourceId,
Resource resource)
Update metadata of the resource. |
|
void |
updateMetadata(java.util.UUID resourceId,
java.lang.String title,
java.lang.String description,
java.util.Set<java.lang.String> tags,
java.util.Map<java.lang.String,java.lang.String> metadata)
Update metadata of the resource. |
|
void |
updateResourceTemplate(java.util.UUID resourceId,
Resource pu)
Update the specified resource's template on the server. |
|
void |
updateResourceTemplate(java.util.UUID resourceId,
java.util.UUID templateId)
Update the specified resource's template on the server. |
|
protected UserEntity |
userForId(java.util.UUID userId)
Look up the user for the specified ID. |
|
Resource |
workingCopyForPath(java.lang.String rootPath)
Look up the working copy for a specified path. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ResourcesEJB()
Method Detail |
---|
@RolesAllowed(value="ACTION_EXECUTE") public void executeAction(java.util.UUID actionId)
executeAction
in interface ActionExecutor
actionId
- The action to execute.@PermitAll public void lock(java.util.UUID resourceId)
lock
in interface Resources
resourceId
- The uuid of the resource to lock.@RolesAllowed(value="RESOURCE_MOVE") public void move(java.util.UUID resourceId, java.util.UUID newParentId)
move
in interface Resources
resourceId
- The id of the resource to move.newParentId
- The id of the folder to which the resource should be
moved.@PermitAll public ResourceSummary publish(java.util.UUID resourceId)
publish
in interface Resources
resourceId
- The id of the resource to update.@RolesAllowed(value="RESOURCE_RENAME") public void rename(java.util.UUID resourceId, java.lang.String name)
rename
in interface Resources
resourceId
- The id of the resource to rename.name
- The new name.@PermitAll public void unlock(java.util.UUID resourceId)
unlock
in interface Resources
resourceId
- The resource to unlock.@RolesAllowed(value="RESOURCE_UNPUBLISH") public void unpublish(java.util.UUID resourceId)
unpublish
in interface Resources
resourceId
- The id of the resource to update.@RolesAllowed(value="RESOURCE_UPDATE") public void createWorkingCopy(java.util.UUID resourceId, long index)
createWorkingCopy
in interface ResourcesExt
resourceId
- The id of the resource.index
- The index number of the log entry.@RolesAllowed(value="RESOURCE_UPDATE") public void createWorkingCopy(java.util.UUID resourceId, Resource pu)
createWorkingCopy
in interface Resources
resourceId
- The id of the resource.pu
- The DTO specifying the number of the revision to use.@RolesAllowed(value="RESOURCE_UPDATE") public void updateResourceTemplate(java.util.UUID resourceId, java.util.UUID templateId)
updateResourceTemplate
in interface ResourcesExt
resourceId
- The id of the resource to update.templateId
- The new template to set for the resource.@RolesAllowed(value="RESOURCE_UPDATE") public void updateResourceTemplate(java.util.UUID resourceId, Resource pu)
updateResourceTemplate
in interface Resources
resourceId
- The id of the resource to update.pu
- DTO specifying the new template to set for the resource.@RolesAllowed(value="RESOURCE_MM") public void includeInMainMenu(java.util.UUID resourceId, boolean include)
includeInMainMenu
in interface ResourcesExt
resourceId
- The id of the resource to update.include
- True if the resource should be included, false otherwise.@RolesAllowed(value="RESOURCE_MM") public void includeInMainMenu(java.util.UUID resourceId)
includeInMainMenu
in interface Resources
resourceId
- The id of the resource to update.@RolesAllowed(value="RESOURCE_MM") public void excludeFromMainMenu(java.util.UUID resourceId)
excludeFromMainMenu
in interface Resources
resourceId
- The id of the resource to update.@RolesAllowed(value="RESOURCE_UPDATE") public void updateMetadata(java.util.UUID resourceId, Resource resource)
updateMetadata
in interface Resources
resourceId
- The id of the resource to update.resource
- The resource containing new metadata.@RolesAllowed(value="RESOURCE_UPDATE") public void updateMetadata(java.util.UUID resourceId, java.lang.String title, java.lang.String description, java.util.Set<java.lang.String> tags, java.util.Map<java.lang.String,java.lang.String> metadata)
updateMetadata
in interface ResourcesExt
resourceId
- The id of the resource to update.title
- The new title to set.description
- The new description to set.tags
- The new tags to set.metadata
- The metadata to update.@RolesAllowed(value="SEARCH_CREATE") public ResourceSummary createSearch(java.util.UUID parentId, java.lang.String title)
createSearch
in interface Resources
parentId
- The parent folder where the search should be created.title
- The title of the search.
@RolesAllowed(value="RESOURCE_ACL_UPDATE") public void changeAcl(java.util.UUID resourceId, ACL acl)
changeAcl
in interface Resources
resourceId
- The resource to update.acl
- The access control list for the specified resource.@RolesAllowed(value="RESOURCE_UPDATE") public void applyWorkingCopy(java.util.UUID resourceId)
applyWorkingCopy
in interface Resources
resourceId
- The id of the resource.@RolesAllowed(value="RESOURCE_CACHE_UPDATE") public void updateCacheDuration(java.util.UUID resourceId, Duration duration)
updateCacheDuration
in interface ResourcesExt
resourceId
- The resource to update.duration
- The cache duration.@RolesAllowed(value="RESOURCE_CACHE_UPDATE") public void updateCacheDuration(java.util.UUID resourceId, Resource pu)
updateCacheDuration
in interface Resources
resourceId
- The resource to update.pu
- DTO specifying the cache duration.@RolesAllowed(value="RESOURCE_UPDATE") public void clearWorkingCopy(java.util.UUID resourceId)
clearWorkingCopy
in interface Resources
resourceId
- The id of the page with a working copy.@RolesAllowed(value="RESOURCE_CACHE_UPDATE") public void deleteCacheDuration(java.util.UUID id)
deleteCacheDuration
in interface Resources
id
- The id of the resource to update.@RolesAllowed(value="RESOURCE_DELETE") public void delete(java.util.UUID resourceId)
delete
in interface Resources
resourceId
- The id of the existing resource.@RolesAllowed(value="RESOURCE_READ") public PagedCollection<Revision> history(java.util.UUID resourceId)
history
in interface Resources
resourceId
- The id of the resource whose history we will look up.
@RolesAllowed(value="RESOURCE_READ") public ACL acl(java.util.UUID resourceId)
acl
in interface Resources
resourceId
- The resource's id.
@RolesAllowed(value="RESOURCE_READ") public Duration cacheDuration(java.util.UUID resourceId)
cacheDuration
in interface Resources
resourceId
- The id of the resource.
@RolesAllowed(value="RESOURCE_READ") public Template computeTemplate(java.util.UUID resourceId)
computeTemplate
in interface Resources
resourceId
- Id of the resource.
@RolesAllowed(value="RESOURCE_READ") public ResourceSummary resourceForPath(java.lang.String rootPath)
resourceForPath
in interface Resources
rootPath
- The absolute path.
@PermitAll public PagedCollection<ResourceSummary> resourceForMetadataKey(java.lang.String key)
resourceForMetadataKey
in interface Resources
key
- The legacy id of the resource.
@PermitAll public ResourceSummary resourceForLegacyId(java.lang.String legacyId)
resourceForLegacyId
in interface Resources
legacyId
- The legacy id of the resource.
@PermitAll public java.lang.String getAbsolutePath(java.util.UUID resourceId)
getAbsolutePath
in interface Resources
resourceId
- The id of the resource.
@PermitAll public Resource resourceForPathSecure(java.lang.String rootPath)
resourceForPathSecure
in interface Resources
rootPath
- The absolute path.
@PermitAll public Resource workingCopyForPath(java.lang.String rootPath)
workingCopyForPath
in interface Resources
rootPath
- The absolute path.
@PermitAll public Resource revisionForPath(java.lang.String path, int version)
revisionForPath
in interface Resources
path
- The absolute path.version
- The version number of the resource to retrieve.
@PermitAll public java.lang.String fileContentsFromPath(java.lang.String absolutePath, java.lang.String charset)
fileContentsFromPath
in interface Resources
absolutePath
- The absolute path to the resource.charset
- The character set for the file.
@PermitAll public java.util.Map<java.lang.String,java.lang.String> metadata(java.util.UUID resourceId)
metadata
in interface Resources
resourceId
- The id of the resource.
@PermitAll public ResourceSummary retrieve(java.util.UUID resourceId)
retrieve
in interface Resources
resourceId
- The id of the existing resource.
@PermitAll public boolean exists(java.util.UUID resourceId)
exists
in interface Resources
resourceId
- The id of the resource.
@PermitAll public void createLogEntry(java.util.UUID resourceId, java.lang.String action, java.lang.String detail)
createLogEntry
in interface Resources
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.@PermitAll public 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
in interface Resources
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.
@PermitAll public PagedCollection<ResourceSummary> list(ResourceCriteria criteria, int pageNo, int pageSize)
list
in interface Resources
criteria
- The criteria by which to filter resources.pageNo
- The page of results to return.pageSize
- The number of results in a page.
protected IRepositoryFactory getRepoFactory()
public CommandFactory commands()
protected final javax.ejb.TimerService getTimerService()
protected final <T> T sudoExecute(Command<T> command, java.util.UUID actorId, java.util.Date happenedOn)
T
- The command's return type.command
- The command to execute.actorId
- The actor executing the command.happenedOn
- When the command was executed.
protected final <T> T execute(Command<T> command)
T
- The command's return type.command
- The command to execute.
protected UserEntity userForId(java.util.UUID userId)
userId
- The user's ID.
protected UserEntity currentUser()
protected java.util.UUID currentUserId()
protected void checkRead(ResourceEntity r)
r
- The resource to check.protected void checkWrite(ResourceEntity r)
r
- The resource to check.protected void checkPermission(java.lang.String... permissions)
permissions
- The permissions to check.protected java.util.Collection<? extends ResourceEntity> filterAccessibleTo(UserEntity u, java.util.List<? extends ResourceEntity> resources)
u
- The user reading the collection.resources
- The un-filtered collection.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |