F
- the actual type of factory.public class JCRResource<F extends JCRResourceFactory> extends DefaultAmetysObject<F> implements ModifiableResource, CopiableAmetysObject
Resource
, backed by a JCR node.Modifier and Type | Field and Description |
---|---|
static String |
CONTRIBUTOR_NODE_NAME
The name of node holding the last contributor
|
static String |
CREATION_DATE
Constants for lastModified Metadata
|
static String |
CREATOR_NODE_NAME
The name of node holding the creator
|
PROTECTED_PROPERTIES
Constructor and Description |
---|
JCRResource(Node node,
String parentPath,
F factory)
Creates an
JCRResource . |
Modifier and Type | Method and Description |
---|---|
private String |
_getDefaultDCType() |
AmetysObject |
copyTo(ModifiableTraversableAmetysObject parent,
String name)
Copy the current
AmetysObject to the given object. |
AmetysObject |
copyTo(ModifiableTraversableAmetysObject parent,
String name,
List<String> restrictTo)
Copy the current
AmetysObject to the given object if it is not in the restriction list. |
UserIdentity |
getAuthorFromRevision(String revision)
Get the author from old revision
|
Thread |
getComments(boolean createThread)
Get the thread holding the comments
|
Date |
getCreationDate()
Retrieves the creation date.
|
UserIdentity |
getCreator()
Returns the last contributor of this resource.
|
String |
getDCContributor()
Get the Dublin Core contributor.
|
String |
getDCCoverage()
Get the Dublin Core coverage.
|
String |
getDCCreator()
Get the Dublin Core creator.
|
Date |
getDCDate()
Get the Dublin Core date.
|
String |
getDCDescription()
Get the Dublin Core description.
|
String |
getDCFormat()
Get the Dublin Core format.
|
String |
getDCIdentifier()
Get the Dublin Core identifier.
|
String |
getDCLanguage()
Get the Dublin Core language.
|
String |
getDCPublisher()
Get the Dublin Core publisher.
|
String |
getDCRelation()
Get the Dublin Core relation.
|
String |
getDCRights()
Get the Dublin Core rights.
|
String |
getDCSource()
Get the Dublin Core source.
|
String[] |
getDCSubject()
Get the Dublin Core subject.
|
String |
getDCTitle()
Get the Dublin Core title.
|
String |
getDCType()
Get the Dublin Core type.
|
InputStream |
getInputStream()
Returns the data stream.
|
String[] |
getKeywords()
Returns the keywords of this resource, as a String array.
|
String |
getKeywordsAsString()
Returns the keywords of this resource, as a comme-separated String.
|
UserIdentity |
getLastContributor()
Retrieves the login of the last contributor.
|
Date |
getLastModified()
Returns the last modification date.
|
long |
getLength()
Returns the length of the data stream.
|
UserIdentity |
getLockOwner()
Returns the owner of the lock, or null if none
|
String |
getMimeType()
Returns the data mime-type.
|
String |
getResourcePath()
Returns the path of this resource in its hierarchy (which is a subset of the whole repository).
|
boolean |
isLocked()
Returns true if this
AmetysObject is locked |
void |
lock()
Locks this
AmetysObject |
protected void |
restoreFromNode(Node node)
Restore from a node
|
void |
setCreationDate(Date creationDate)
Set the creation date if this resource.
|
void |
setCreator(UserIdentity author)
Set the creator of the resource
|
void |
setData(InputStream stream,
String mimeType,
Date lastModified,
UserIdentity author)
Set binary data.
|
void |
setDCContributor(String contributor)
Set the Dublin Core contributor.
|
void |
setDCCoverage(String coverage)
Set the Dublin Core coverage.
|
void |
setDCCreator(String creator)
Set the Dublin Core creator.
|
void |
setDCDate(Date date)
Set the Dublin Core date.
|
void |
setDCDescription(String description)
Set the Dublin Core description.
|
void |
setDCFormat(String format)
Set the Dublin Core format.
|
void |
setDCIdentifier(String identifier)
Set the Dublin Core identifier.
|
void |
setDCLanguage(String language)
Set the Dublin Core language.
|
void |
setDCPublisher(String publisher)
Set the Dublin Core publisher.
|
void |
setDCRelation(String relation)
Set the Dublin Core relation.
|
void |
setDCRights(String rights)
Set the Dublin Core rights.
|
void |
setDCSource(String source)
Set the Dublin Core source.
|
void |
setDCSubject(String[] subject)
Set the Dublin Core subject.
|
void |
setDCTitle(String title)
Set the Dublin Core title.
|
void |
setDCType(String type)
Set the Dublin Core type.
|
void |
setKeywords(String keywords)
Set this resource's keywords.
|
void |
setKeywords(String[] keywords)
Set this resource's keywords.
|
void |
setLastContributor(UserIdentity lastContributor)
Set the last contributor of the resource
|
void |
setLastModified(Date lastModified)
Set the last modified date if this resource.
|
void |
setMimeType(String mimeType)
Set this resource mime type.
|
void |
unlock()
Unlocks this
AmetysObject |
addAllowedGroups, addAllowedProfilesForAnonymous, addAllowedProfilesForAnyConnectedUser, addAllowedUsers, addDeniedGroups, addDeniedProfilesForAnonymous, addDeniedProfilesForAnyConnectedUser, addDeniedUsers, addLabel, checkpoint, copyNode, getAllLabels, getAllowedGroups, getAllowedProfilesForAnonymous, getAllowedProfilesForAnyConnectedUser, getAllowedProfilesForGroups, getAllowedProfilesForUser, getAllowedProfilesForUsers, getAllowedUsers, getAllRevisions, getBaseNode, getBaseVersion, getDeniedGroups, getDeniedProfilesForAnonymous, getDeniedProfilesForAnyConnectedUser, getDeniedProfilesForGroups, getDeniedProfilesForUser, getDeniedProfilesForUsers, getDeniedUsers, getLabels, getLabels, getNode, getRevision, getRevisionTimestamp, getRevisionTimestamp, getUnversionedMetadataHolder, getVersionHistory, removeAllowedGroups, removeAllowedGroups, removeAllowedProfilesForAnonymous, removeAllowedProfilesForAnyConnectedUser, removeAllowedUsers, removeAllowedUsers, removeDeniedGroups, removeDeniedGroups, removeDeniedProfilesForAnonymous, removeDeniedProfilesForAnyConnectedUser, removeDeniedUsers, removeDeniedUsers, removeLabel, restoreFromLabel, restoreFromRevision, switchToLabel, switchToRevision
_getFactory, _invalidateName, _invalidateParentPath, getId, getMetadataHolder, getName, getParent, getParentPath, getPath, needsSave, remove, rename, revertChanges, saveChanges
equals, hashCode, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
equals, getId, getName, getParent, getParentPath, getPath, hashCode
needsSave, rename, revertChanges, saveChanges
remove
getMetadataHolder
public static final String CREATOR_NODE_NAME
public static final String CREATION_DATE
public static final String CONTRIBUTOR_NODE_NAME
public JCRResource(Node node, String parentPath, F factory)
JCRResource
.node
- the node backing this AmetysObject
parentPath
- the parentPath in the Ametys hierarchyfactory
- the DefaultAmetysObjectFactory which created the AmetysObjectpublic void setData(InputStream stream, String mimeType, Date lastModified, UserIdentity author)
ModifiableResource
setData
in interface ModifiableResource
stream
- The InputStream
.mimeType
- The file mimetype.lastModified
- The date of last modification.author
- The author of last modification.public void setLastModified(Date lastModified)
ModifiableResource
setLastModified
in interface ModifiableResource
lastModified
- the last modified date.public void setKeywords(String keywords)
ModifiableResource
setKeywords
in interface ModifiableResource
keywords
- the comma-separated keywords.public void setKeywords(String[] keywords)
ModifiableResource
setKeywords
in interface ModifiableResource
keywords
- the keywords.public void setMimeType(String mimeType)
ModifiableResource
setMimeType
in interface ModifiableResource
mimeType
- the mime type.public void setCreator(UserIdentity author)
ModifiableResource
setCreator
in interface ModifiableResource
author
- The authorpublic InputStream getInputStream() throws AmetysRepositoryException
Resource
getInputStream
in interface Resource
AmetysRepositoryException
- if an error occurs.public String getMimeType() throws AmetysRepositoryException
Resource
getMimeType
in interface Resource
AmetysRepositoryException
- if an error occurs.public Date getLastModified() throws AmetysRepositoryException
Resource
getLastModified
in interface Resource
AmetysRepositoryException
- if an error occurs.public long getLength() throws AmetysRepositoryException
Resource
getLength
in interface Resource
AmetysRepositoryException
- if an error occurs.public UserIdentity getCreator() throws AmetysRepositoryException
Resource
getCreator
in interface Resource
AmetysRepositoryException
- if an error occurs.public UserIdentity getAuthorFromRevision(String revision) throws RepositoryException
revision
- The revisionnull
if not foundRepositoryException
- If an error occurredpublic String[] getKeywords() throws AmetysRepositoryException
Resource
getKeywords
in interface Resource
AmetysRepositoryException
- if an error occurs.public String getKeywordsAsString() throws AmetysRepositoryException
Resource
getKeywordsAsString
in interface Resource
AmetysRepositoryException
- if an error occurs.protected void restoreFromNode(Node node) throws RepositoryException
DefaultAmetysObject
restoreFromNode
in class DefaultAmetysObject<F extends JCRResourceFactory>
node
- The node to restoreRepositoryException
- If error occurspublic String getResourcePath() throws AmetysRepositoryException
Resource
getResourcePath
in interface Resource
AmetysRepositoryException
- if an error occurs.public void lock() throws AmetysRepositoryException
LockableAmetysObject
AmetysObject
lock
in interface LockableAmetysObject
AmetysRepositoryException
- if a problem occurspublic void unlock() throws AmetysRepositoryException
LockableAmetysObject
AmetysObject
unlock
in interface LockableAmetysObject
AmetysRepositoryException
- if a problem occurspublic boolean isLocked() throws AmetysRepositoryException
LockAwareAmetysObject
AmetysObject
is lockedisLocked
in interface LockAwareAmetysObject
AmetysObject
is lockedAmetysRepositoryException
- if a problem occurspublic UserIdentity getLockOwner() throws AmetysRepositoryException
LockAwareAmetysObject
getLockOwner
in interface LockAwareAmetysObject
AmetysRepositoryException
- if a problem occurspublic Thread getComments(boolean createThread)
CommentableResource
getComments
in interface CommentableResource
createThread
- True to force the creation of the thread if it does not exists.public AmetysObject copyTo(ModifiableTraversableAmetysObject parent, String name) throws AmetysRepositoryException
CopiableAmetysObject
AmetysObject
to the given object. Be careful, this method save changes.copyTo
in interface CopiableAmetysObject
parent
- The parent of the new object. Can not be null.name
- Name of the new object. Can be null. If null, the new name will be get from the copied objectAmetysRepositoryException
- if an error occurs.public AmetysObject copyTo(ModifiableTraversableAmetysObject parent, String name, List<String> restrictTo) throws AmetysRepositoryException
CopiableAmetysObject
AmetysObject
to the given object if it is not in the restriction list. Be careful, this method save changes.copyTo
in interface CopiableAmetysObject
parent
- The parent of the new object. Can not be null.name
- Name of the new object. Can be null. If null, the new name will be get from the copied objectrestrictTo
- A restrict list of CopiableAmetysObject
authorized to be copiedAmetysRepositoryException
- if an error occurs.public String getDCTitle() throws AmetysRepositoryException
DublinCoreAwareAmetysObject
getDCTitle
in interface DublinCoreAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public void setDCTitle(String title) throws AmetysRepositoryException
ModifiableDublinCoreAwareAmetysObject
setDCTitle
in interface ModifiableDublinCoreAwareAmetysObject
title
- the Dublin Core title to set. Can be null.AmetysRepositoryException
- if an error occurs.public String getDCCreator() throws AmetysRepositoryException
DublinCoreAwareAmetysObject
getDCCreator
in interface DublinCoreAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public void setDCCreator(String creator) throws AmetysRepositoryException
ModifiableDublinCoreAwareAmetysObject
setDCCreator
in interface ModifiableDublinCoreAwareAmetysObject
creator
- the Dublin Core creator to set. Can be null.AmetysRepositoryException
- if an error occurs.public String[] getDCSubject() throws AmetysRepositoryException
DublinCoreAwareAmetysObject
getDCSubject
in interface DublinCoreAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public void setDCSubject(String[] subject) throws AmetysRepositoryException
ModifiableDublinCoreAwareAmetysObject
setDCSubject
in interface ModifiableDublinCoreAwareAmetysObject
subject
- the Dublin Core subject to set. Can be null.AmetysRepositoryException
- if an error occurs.public String getDCDescription() throws AmetysRepositoryException
DublinCoreAwareAmetysObject
getDCDescription
in interface DublinCoreAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public void setDCDescription(String description) throws AmetysRepositoryException
ModifiableDublinCoreAwareAmetysObject
setDCDescription
in interface ModifiableDublinCoreAwareAmetysObject
description
- the Dublin Core description to set. Can be null.AmetysRepositoryException
- if an error occurs.public String getDCPublisher() throws AmetysRepositoryException
DublinCoreAwareAmetysObject
getDCPublisher
in interface DublinCoreAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public void setDCPublisher(String publisher) throws AmetysRepositoryException
ModifiableDublinCoreAwareAmetysObject
setDCPublisher
in interface ModifiableDublinCoreAwareAmetysObject
publisher
- the Dublin Core publisher to set. Can be null.AmetysRepositoryException
- if an error occurs.public String getDCContributor() throws AmetysRepositoryException
DublinCoreAwareAmetysObject
getDCContributor
in interface DublinCoreAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public void setDCContributor(String contributor) throws AmetysRepositoryException
ModifiableDublinCoreAwareAmetysObject
setDCContributor
in interface ModifiableDublinCoreAwareAmetysObject
contributor
- the Dublin Core contributor to set. Can be null.AmetysRepositoryException
- if an error occurs.public Date getDCDate() throws AmetysRepositoryException
DublinCoreAwareAmetysObject
getDCDate
in interface DublinCoreAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public void setDCDate(Date date) throws AmetysRepositoryException
ModifiableDublinCoreAwareAmetysObject
setDCDate
in interface ModifiableDublinCoreAwareAmetysObject
date
- the Dublin Core date to set. Can be null.AmetysRepositoryException
- if an error occurs.public String getDCType() throws AmetysRepositoryException
DublinCoreAwareAmetysObject
getDCType
in interface DublinCoreAwareAmetysObject
AmetysRepositoryException
- if an error occurs.private String _getDefaultDCType()
public void setDCType(String type) throws AmetysRepositoryException
ModifiableDublinCoreAwareAmetysObject
setDCType
in interface ModifiableDublinCoreAwareAmetysObject
type
- the Dublin Core type to set. Can be null.AmetysRepositoryException
- if an error occurs.public String getDCFormat() throws AmetysRepositoryException
DublinCoreAwareAmetysObject
getDCFormat
in interface DublinCoreAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public void setDCFormat(String format) throws AmetysRepositoryException
ModifiableDublinCoreAwareAmetysObject
setDCFormat
in interface ModifiableDublinCoreAwareAmetysObject
format
- the Dublin Core format to set. Can be null.AmetysRepositoryException
- if an error occurs.public String getDCIdentifier() throws AmetysRepositoryException
DublinCoreAwareAmetysObject
getDCIdentifier
in interface DublinCoreAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public void setDCIdentifier(String identifier) throws AmetysRepositoryException
ModifiableDublinCoreAwareAmetysObject
setDCIdentifier
in interface ModifiableDublinCoreAwareAmetysObject
identifier
- the Dublin Core identifier to set. Can be null.AmetysRepositoryException
- if an error occurs.public String getDCSource() throws AmetysRepositoryException
DublinCoreAwareAmetysObject
getDCSource
in interface DublinCoreAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public void setDCSource(String source) throws AmetysRepositoryException
ModifiableDublinCoreAwareAmetysObject
setDCSource
in interface ModifiableDublinCoreAwareAmetysObject
source
- the Dublin Core source to set. Can be null.AmetysRepositoryException
- if an error occurs.public String getDCLanguage() throws AmetysRepositoryException
DublinCoreAwareAmetysObject
getDCLanguage
in interface DublinCoreAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public void setDCLanguage(String language) throws AmetysRepositoryException
ModifiableDublinCoreAwareAmetysObject
setDCLanguage
in interface ModifiableDublinCoreAwareAmetysObject
language
- the Dublin Core language to set. Can be null.AmetysRepositoryException
- if an error occurs.public String getDCRelation() throws AmetysRepositoryException
DublinCoreAwareAmetysObject
getDCRelation
in interface DublinCoreAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public void setDCRelation(String relation) throws AmetysRepositoryException
ModifiableDublinCoreAwareAmetysObject
setDCRelation
in interface ModifiableDublinCoreAwareAmetysObject
relation
- the Dublin Core relation to set. Can be null.AmetysRepositoryException
- if an error occurs.public String getDCCoverage() throws AmetysRepositoryException
DublinCoreAwareAmetysObject
getDCCoverage
in interface DublinCoreAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public void setDCCoverage(String coverage) throws AmetysRepositoryException
ModifiableDublinCoreAwareAmetysObject
setDCCoverage
in interface ModifiableDublinCoreAwareAmetysObject
coverage
- the Dublin Core coverage to set. Can be null.AmetysRepositoryException
- if an error occurs.public String getDCRights() throws AmetysRepositoryException
DublinCoreAwareAmetysObject
getDCRights
in interface DublinCoreAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public void setDCRights(String rights) throws AmetysRepositoryException
ModifiableDublinCoreAwareAmetysObject
setDCRights
in interface ModifiableDublinCoreAwareAmetysObject
rights
- the Dublin Core rights to set. Can be null.AmetysRepositoryException
- if an error occurs.public Date getCreationDate() throws UnknownMetadataException, AmetysRepositoryException
Resource
getCreationDate
in interface Resource
UnknownMetadataException
- if this property does not exist.AmetysRepositoryException
- if an error occurs.public void setCreationDate(Date creationDate)
ModifiableResource
setCreationDate
in interface ModifiableResource
creationDate
- the creation date.public UserIdentity getLastContributor() throws UnknownMetadataException, AmetysRepositoryException
Resource
getLastContributor
in interface Resource
UnknownMetadataException
- if this property does not exist.AmetysRepositoryException
- if an error occurs.public void setLastContributor(UserIdentity lastContributor)
ModifiableResource
setLastContributor
in interface ModifiableResource
lastContributor
- The last contributor