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, saveChangesequals, hashCode, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitequals, getId, getName, getParent, getParentPath, getPath, hashCodeneedsSave, rename, revertChanges, saveChangesremovegetMetadataHolderpublic 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 AmetysObjectparentPath - the parentPath in the Ametys hierarchyfactory - the DefaultAmetysObjectFactory which created the AmetysObjectpublic void setData(InputStream stream, String mimeType, Date lastModified, UserIdentity author)
ModifiableResourcesetData in interface ModifiableResourcestream - The InputStream.mimeType - The file mimetype.lastModified - The date of last modification.author - The author of last modification.public void setLastModified(Date lastModified)
ModifiableResourcesetLastModified in interface ModifiableResourcelastModified - the last modified date.public void setKeywords(String keywords)
ModifiableResourcesetKeywords in interface ModifiableResourcekeywords - the comma-separated keywords.public void setKeywords(String[] keywords)
ModifiableResourcesetKeywords in interface ModifiableResourcekeywords - the keywords.public void setMimeType(String mimeType)
ModifiableResourcesetMimeType in interface ModifiableResourcemimeType - the mime type.public void setCreator(UserIdentity author)
ModifiableResourcesetCreator in interface ModifiableResourceauthor - The authorpublic InputStream getInputStream() throws AmetysRepositoryException
ResourcegetInputStream in interface ResourceAmetysRepositoryException - if an error occurs.public String getMimeType() throws AmetysRepositoryException
ResourcegetMimeType in interface ResourceAmetysRepositoryException - if an error occurs.public Date getLastModified() throws AmetysRepositoryException
ResourcegetLastModified in interface ResourceAmetysRepositoryException - if an error occurs.public long getLength() throws AmetysRepositoryException
ResourcegetLength in interface ResourceAmetysRepositoryException - if an error occurs.public UserIdentity getCreator() throws AmetysRepositoryException
ResourcegetCreator in interface ResourceAmetysRepositoryException - 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
ResourcegetKeywords in interface ResourceAmetysRepositoryException - if an error occurs.public String getKeywordsAsString() throws AmetysRepositoryException
ResourcegetKeywordsAsString in interface ResourceAmetysRepositoryException - if an error occurs.protected void restoreFromNode(Node node) throws RepositoryException
DefaultAmetysObjectrestoreFromNode in class DefaultAmetysObject<F extends JCRResourceFactory>node - The node to restoreRepositoryException - If error occurspublic String getResourcePath() throws AmetysRepositoryException
ResourcegetResourcePath in interface ResourceAmetysRepositoryException - if an error occurs.public void lock() throws AmetysRepositoryException
LockableAmetysObjectAmetysObjectlock in interface LockableAmetysObjectAmetysRepositoryException - if a problem occurspublic void unlock() throws AmetysRepositoryException
LockableAmetysObjectAmetysObjectunlock in interface LockableAmetysObjectAmetysRepositoryException - if a problem occurspublic boolean isLocked() throws AmetysRepositoryException
LockAwareAmetysObjectAmetysObject is lockedisLocked in interface LockAwareAmetysObjectAmetysObject is lockedAmetysRepositoryException - if a problem occurspublic UserIdentity getLockOwner() throws AmetysRepositoryException
LockAwareAmetysObjectgetLockOwner in interface LockAwareAmetysObjectAmetysRepositoryException - if a problem occurspublic Thread getComments(boolean createThread)
CommentableResourcegetComments in interface CommentableResourcecreateThread - True to force the creation of the thread if it does not exists.public AmetysObject copyTo(ModifiableTraversableAmetysObject parent, String name) throws AmetysRepositoryException
CopiableAmetysObjectAmetysObject to the given object. Be careful, this method save changes.copyTo in interface CopiableAmetysObjectparent - 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
CopiableAmetysObjectAmetysObject to the given object if it is not in the restriction list. Be careful, this method save changes.copyTo in interface CopiableAmetysObjectparent - 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
DublinCoreAwareAmetysObjectgetDCTitle in interface DublinCoreAwareAmetysObjectAmetysRepositoryException - if an error occurs.public void setDCTitle(String title) throws AmetysRepositoryException
ModifiableDublinCoreAwareAmetysObjectsetDCTitle in interface ModifiableDublinCoreAwareAmetysObjecttitle - the Dublin Core title to set. Can be null.AmetysRepositoryException - if an error occurs.public String getDCCreator() throws AmetysRepositoryException
DublinCoreAwareAmetysObjectgetDCCreator in interface DublinCoreAwareAmetysObjectAmetysRepositoryException - if an error occurs.public void setDCCreator(String creator) throws AmetysRepositoryException
ModifiableDublinCoreAwareAmetysObjectsetDCCreator in interface ModifiableDublinCoreAwareAmetysObjectcreator - the Dublin Core creator to set. Can be null.AmetysRepositoryException - if an error occurs.public String[] getDCSubject() throws AmetysRepositoryException
DublinCoreAwareAmetysObjectgetDCSubject in interface DublinCoreAwareAmetysObjectAmetysRepositoryException - if an error occurs.public void setDCSubject(String[] subject) throws AmetysRepositoryException
ModifiableDublinCoreAwareAmetysObjectsetDCSubject in interface ModifiableDublinCoreAwareAmetysObjectsubject - the Dublin Core subject to set. Can be null.AmetysRepositoryException - if an error occurs.public String getDCDescription() throws AmetysRepositoryException
DublinCoreAwareAmetysObjectgetDCDescription in interface DublinCoreAwareAmetysObjectAmetysRepositoryException - if an error occurs.public void setDCDescription(String description) throws AmetysRepositoryException
ModifiableDublinCoreAwareAmetysObjectsetDCDescription in interface ModifiableDublinCoreAwareAmetysObjectdescription - the Dublin Core description to set. Can be null.AmetysRepositoryException - if an error occurs.public String getDCPublisher() throws AmetysRepositoryException
DublinCoreAwareAmetysObjectgetDCPublisher in interface DublinCoreAwareAmetysObjectAmetysRepositoryException - if an error occurs.public void setDCPublisher(String publisher) throws AmetysRepositoryException
ModifiableDublinCoreAwareAmetysObjectsetDCPublisher in interface ModifiableDublinCoreAwareAmetysObjectpublisher - the Dublin Core publisher to set. Can be null.AmetysRepositoryException - if an error occurs.public String getDCContributor() throws AmetysRepositoryException
DublinCoreAwareAmetysObjectgetDCContributor in interface DublinCoreAwareAmetysObjectAmetysRepositoryException - if an error occurs.public void setDCContributor(String contributor) throws AmetysRepositoryException
ModifiableDublinCoreAwareAmetysObjectsetDCContributor in interface ModifiableDublinCoreAwareAmetysObjectcontributor - the Dublin Core contributor to set. Can be null.AmetysRepositoryException - if an error occurs.public Date getDCDate() throws AmetysRepositoryException
DublinCoreAwareAmetysObjectgetDCDate in interface DublinCoreAwareAmetysObjectAmetysRepositoryException - if an error occurs.public void setDCDate(Date date) throws AmetysRepositoryException
ModifiableDublinCoreAwareAmetysObjectsetDCDate in interface ModifiableDublinCoreAwareAmetysObjectdate - the Dublin Core date to set. Can be null.AmetysRepositoryException - if an error occurs.public String getDCType() throws AmetysRepositoryException
DublinCoreAwareAmetysObjectgetDCType in interface DublinCoreAwareAmetysObjectAmetysRepositoryException - if an error occurs.private String _getDefaultDCType()
public void setDCType(String type) throws AmetysRepositoryException
ModifiableDublinCoreAwareAmetysObjectsetDCType in interface ModifiableDublinCoreAwareAmetysObjecttype - the Dublin Core type to set. Can be null.AmetysRepositoryException - if an error occurs.public String getDCFormat() throws AmetysRepositoryException
DublinCoreAwareAmetysObjectgetDCFormat in interface DublinCoreAwareAmetysObjectAmetysRepositoryException - if an error occurs.public void setDCFormat(String format) throws AmetysRepositoryException
ModifiableDublinCoreAwareAmetysObjectsetDCFormat in interface ModifiableDublinCoreAwareAmetysObjectformat - the Dublin Core format to set. Can be null.AmetysRepositoryException - if an error occurs.public String getDCIdentifier() throws AmetysRepositoryException
DublinCoreAwareAmetysObjectgetDCIdentifier in interface DublinCoreAwareAmetysObjectAmetysRepositoryException - if an error occurs.public void setDCIdentifier(String identifier) throws AmetysRepositoryException
ModifiableDublinCoreAwareAmetysObjectsetDCIdentifier in interface ModifiableDublinCoreAwareAmetysObjectidentifier - the Dublin Core identifier to set. Can be null.AmetysRepositoryException - if an error occurs.public String getDCSource() throws AmetysRepositoryException
DublinCoreAwareAmetysObjectgetDCSource in interface DublinCoreAwareAmetysObjectAmetysRepositoryException - if an error occurs.public void setDCSource(String source) throws AmetysRepositoryException
ModifiableDublinCoreAwareAmetysObjectsetDCSource in interface ModifiableDublinCoreAwareAmetysObjectsource - the Dublin Core source to set. Can be null.AmetysRepositoryException - if an error occurs.public String getDCLanguage() throws AmetysRepositoryException
DublinCoreAwareAmetysObjectgetDCLanguage in interface DublinCoreAwareAmetysObjectAmetysRepositoryException - if an error occurs.public void setDCLanguage(String language) throws AmetysRepositoryException
ModifiableDublinCoreAwareAmetysObjectsetDCLanguage in interface ModifiableDublinCoreAwareAmetysObjectlanguage - the Dublin Core language to set. Can be null.AmetysRepositoryException - if an error occurs.public String getDCRelation() throws AmetysRepositoryException
DublinCoreAwareAmetysObjectgetDCRelation in interface DublinCoreAwareAmetysObjectAmetysRepositoryException - if an error occurs.public void setDCRelation(String relation) throws AmetysRepositoryException
ModifiableDublinCoreAwareAmetysObjectsetDCRelation in interface ModifiableDublinCoreAwareAmetysObjectrelation - the Dublin Core relation to set. Can be null.AmetysRepositoryException - if an error occurs.public String getDCCoverage() throws AmetysRepositoryException
DublinCoreAwareAmetysObjectgetDCCoverage in interface DublinCoreAwareAmetysObjectAmetysRepositoryException - if an error occurs.public void setDCCoverage(String coverage) throws AmetysRepositoryException
ModifiableDublinCoreAwareAmetysObjectsetDCCoverage in interface ModifiableDublinCoreAwareAmetysObjectcoverage - the Dublin Core coverage to set. Can be null.AmetysRepositoryException - if an error occurs.public String getDCRights() throws AmetysRepositoryException
DublinCoreAwareAmetysObjectgetDCRights in interface DublinCoreAwareAmetysObjectAmetysRepositoryException - if an error occurs.public void setDCRights(String rights) throws AmetysRepositoryException
ModifiableDublinCoreAwareAmetysObjectsetDCRights in interface ModifiableDublinCoreAwareAmetysObjectrights - the Dublin Core rights to set. Can be null.AmetysRepositoryException - if an error occurs.public Date getCreationDate() throws UnknownMetadataException, AmetysRepositoryException
ResourcegetCreationDate in interface ResourceUnknownMetadataException - if this property does not exist.AmetysRepositoryException - if an error occurs.public void setCreationDate(Date creationDate)
ModifiableResourcesetCreationDate in interface ModifiableResourcecreationDate - the creation date.public UserIdentity getLastContributor() throws UnknownMetadataException, AmetysRepositoryException
ResourcegetLastContributor in interface ResourceUnknownMetadataException - if this property does not exist.AmetysRepositoryException - if an error occurs.public void setLastContributor(UserIdentity lastContributor)
ModifiableResourcesetLastContributor in interface ModifiableResourcelastContributor - The last contributor