|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectccc.domain.Entity
ccc.domain.ResourceEntity
public abstract class ResourceEntity
An abstract superclass that contains shared behaviour for the different types of CCC resource.
Constructor Summary | |
---|---|
protected |
ResourceEntity()
Constructor: for persistence only. |
protected |
ResourceEntity(ResourceName name,
java.lang.String title)
Constructor. |
|
ResourceEntity(java.lang.String title)
Constructor. |
Method Summary | ||
---|---|---|
void |
addGroupPermission(AccessPermission p)
Mutator. |
|
void |
addMetadata(java.util.Map<java.lang.String,java.lang.String> metadata)
Add metadata to this resource. |
|
void |
addMetadatum(java.lang.String key,
java.lang.String value)
Add new metadata for this resource. |
|
void |
addUserPermission(AccessPermission p)
Mutator. |
|
|
as(java.lang.Class<T> resourceType)
Type-safe helper method to convert an instance of ResourceEntity
to a subclass. |
|
boolean |
canUnlock(UserEntity user)
Determine whether a user can unlock this resource. |
|
void |
clearGroupAcl()
Remove all group permissions. |
|
void |
clearMetadata()
Remove all metadata for this resource. |
|
void |
clearMetadatum(java.lang.String key)
Remove the metadatum with the specified key. |
|
void |
clearUserAcl()
Remove all user permissions. |
|
Duration |
computeCache()
Compute the cache duration for the resource. |
|
java.util.Map<java.lang.String,java.lang.String> |
computeMetadata()
Compute the complete set of metadata for this resource. |
|
TemplateEntity |
computeTemplate(TemplateEntity def)
Determine the template for this resource. |
|
void |
confirmLock(UserEntity user)
Confirm this resource is locked by the specified user. |
|
void |
delete()
Mark this file as deleted. |
|
ResourcePath |
getAbsolutePath()
Determine the absolute path for a resource. |
|
ACL |
getAcl()
Accessor. |
|
Duration |
getCacheDuration()
Accessor. |
|
UserEntity |
getChangedBy()
Query method - determine who last changed this resource. |
|
UserEntity |
getCreatedBy()
Query method - determine who created this resource. |
|
java.util.Date |
getDateChanged()
|
|
java.util.Date |
getDateCreated()
|
|
java.lang.String |
getDescription()
|
|
java.util.Collection<ACL.Entry> |
getGroupAcl()
Accessor. |
|
java.lang.Integer |
getIndex()
Accessor. |
|
UserEntity |
getLockedBy()
Query method - determine who has locked this resource. |
|
java.util.Map<java.lang.String,java.lang.String> |
getMetadata()
Accessor for all metadata of the resource. |
|
java.lang.String |
getMetadatum(java.lang.String key)
Calculate the resource's metadatum for a given key. |
|
ResourceName |
getName()
|
|
FolderEntity |
getParent()
Accessor for the resource's parent. |
|
UserEntity |
getPublishedBy()
Return user who published the resource. |
|
ResourceEntity |
getRoot()
Accessor for the root parent of this resource. |
|
java.util.Set<java.lang.String> |
getTags()
|
|
TemplateEntity |
getTemplate()
Accessor for the template. |
|
java.lang.String |
getTitle()
|
|
abstract ResourceType |
getType()
Query the type of this resource. |
|
java.util.Collection<ACL.Entry> |
getUserAcl()
Accessor. |
|
boolean |
isDeleted()
Query method. |
|
boolean |
isIncludedInMainMenu()
|
|
boolean |
isIndexable()
Determine whether a resource can be indexed by the search engine. |
|
boolean |
isLocked()
Query method to determine whether a resource is locked. |
|
boolean |
isPublished()
Query method to determine whether a resource is published. |
|
boolean |
isReadableBy(UserEntity user)
|
|
boolean |
isSecure()
Query method to determine whether a resource is secure. |
|
boolean |
isVisible()
Query method to determine whether a resource is visible. |
|
boolean |
isWriteableBy(UserEntity user)
|
|
void |
lock(UserEntity u)
Lock a resource. |
|
ResourceSummary |
mapResource()
Create a summary for a resource. |
|
static java.util.List<ResourceSummary> |
mapResources(java.util.Collection<? extends ResourceEntity> resources)
Map a collection of Resource to a collection of ResourceSummary. |
|
void |
publish(UserEntity user)
Publish the resource. |
|
void |
setCacheDuration(Duration cache)
Mutator. |
|
void |
setDateChanged(java.util.Date changedOn,
UserEntity changedBy)
Mutator for the date the resource last changed. |
|
void |
setDateCreated(java.util.Date createdOn,
UserEntity createdBy)
Mutator for the date the resource was created. |
|
void |
setDescription(java.lang.String description)
Mutator for the file description. |
|
protected void |
setDtoProps(Resource dto)
Populate the specified DTO with data from this resource. |
|
void |
setIncludedInMainMenu(boolean shouldInclude)
Mutator for 'include in main menu' property. |
|
void |
setIndexPosition(int index)
Set the index value for this resource. |
|
void |
setName(ResourceName resourceName)
Mutator for the name field. |
|
void |
setTags(java.util.Set<java.lang.String> tags)
Set the tags for this resource. |
|
void |
setTemplate(TemplateEntity template)
Sets the template for this resource. |
|
void |
setTitle(java.lang.String titleString)
Sets the title of the resource. |
|
void |
toJson(Json json)
Convert to JSON. |
|
void |
undelete()
Mark this file as un-deleted. |
|
void |
unlock(UserEntity user)
Unlock the resource. |
|
void |
unpublish()
Unpublish the resource. |
Methods inherited from class ccc.domain.Entity |
---|
equals, getId, getVersion, hashCode, setId, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface ccc.domain.SnapshotSupport |
---|
forCurrentRevision, forSpecificRevision, forWorkingCopy |
Constructor Detail |
---|
protected ResourceEntity()
protected ResourceEntity(ResourceName name, java.lang.String title)
name
- The name for this resource.title
- The title of this resource, as a string.public ResourceEntity(java.lang.String title)
ResourceName.escape(String)
to
determine the resource's name.
title
- The title of this resource, as a string.Method Detail |
---|
public abstract ResourceType getType()
public final <T extends ResourceEntity> T as(java.lang.Class<T> resourceType)
ResourceEntity
to a subclass.
T
- The type that this resource should be converted to.resourceType
- The class representing the type that this resource
should be converted to.
public final TemplateEntity computeTemplate(TemplateEntity def)
def
- The default template to use if we cannot compute one.
public final ResourcePath getAbsolutePath()
ResourcePath
.public ResourceName getName()
public void setName(ResourceName resourceName)
resourceName
- The new resource name.public java.lang.String getTitle()
public void setTitle(java.lang.String titleString)
titleString
- The new title for this resource.public TemplateEntity getTemplate()
TemplateEntity
.public void setTemplate(TemplateEntity template)
template
- The new template.public FolderEntity getParent()
public boolean isLocked()
public void lock(UserEntity u)
lock
in interface Lockable
u
- The user who is locking the resource.public UserEntity getLockedBy()
public void unlock(UserEntity user)
unlock
in interface Lockable
user
- The user releasing the lock.public boolean canUnlock(UserEntity user)
user
- The user trying to unlock the resource.
public void setTags(java.util.Set<java.lang.String> tags)
tags
- A set of string tags.public java.util.Set<java.lang.String> getTags()
public void publish(UserEntity user)
user
- The user.public boolean isPublished()
public UserEntity getPublishedBy()
public void unpublish()
public boolean isVisible()
public boolean isSecure()
public void confirmLock(UserEntity user)
confirmLock
in interface Lockable
user
- The user who should have the lock.public boolean isIncludedInMainMenu()
public void setIncludedInMainMenu(boolean shouldInclude)
shouldInclude
- Should the resource be included?public ResourceEntity getRoot()
public void addMetadatum(java.lang.String key, java.lang.String value)
key
- The key by which the datum will be accessed.value
- The value of the datum. May not be NULL.public java.lang.String getMetadatum(java.lang.String key)
If this resource has no value for the key its parents will be checked recursively.
key
- The key to the metadatum.
public void clearMetadatum(java.lang.String key)
key
- The key with which the datum was stored.public java.util.Map<java.lang.String,java.lang.String> getMetadata()
public java.util.Map<java.lang.String,java.lang.String> computeMetadata()
public void clearMetadata()
public java.util.Date getDateCreated()
public UserEntity getCreatedBy()
public void setDateCreated(java.util.Date createdOn, UserEntity createdBy)
createdOn
- The date of creation.createdBy
- The user who created.public java.util.Date getDateChanged()
public UserEntity getChangedBy()
public void setDateChanged(java.util.Date changedOn, UserEntity changedBy)
changedOn
- The date the resource changed.changedBy
- The user who changed the resource.public void addGroupPermission(AccessPermission p)
p
- The permission to add.public java.util.Collection<ACL.Entry> getGroupAcl()
public void addUserPermission(AccessPermission p)
p
- The permission to add.public java.util.Collection<ACL.Entry> getUserAcl()
public boolean isReadableBy(UserEntity user)
public boolean isWriteableBy(UserEntity user)
public void setCacheDuration(Duration cache)
cache
- The cache duration for the resource.public Duration getCacheDuration()
public Duration computeCache()
public final java.lang.String getDescription()
public void setDescription(java.lang.String description)
description
- The new description as a string.public void addMetadata(java.util.Map<java.lang.String,java.lang.String> metadata)
metadata
- The metadata to add, as a hashmap.public boolean isDeleted()
public void delete()
public void undelete()
public void toJson(Json json)
toJson
in interface Jsonable
toJson
in class Entity
json
- The JSON object to write to.public ACL getAcl()
protected void setDtoProps(Resource dto)
dto
- The DTO to populate.public static java.util.List<ResourceSummary> mapResources(java.util.Collection<? extends ResourceEntity> resources)
resources
- The collection of resources to map.
public ResourceSummary mapResource()
public boolean isIndexable()
public void setIndexPosition(int index)
index
- The index value.public java.lang.Integer getIndex()
public void clearGroupAcl()
public void clearUserAcl()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |