Class File
java.lang.Object
org.ametys.plugins.repository.AbstractAmetysObject
org.ametys.plugins.repository.jcr.SimpleAmetysObject<FileFactory>
org.ametys.plugins.repository.jcr.SimpleModelAwareAmetysObject<FileFactory>
org.ametys.plugins.repository.jcr.DefaultAmetysObject<FileFactory>
org.ametys.plugins.repository.jcr.DefaultLockableAmetysObject<FileFactory>
org.ametys.plugins.explorer.resources.jcr.JCRResource<FileFactory>
org.ametys.plugins.workspaces.documents.jcr.File
- All Implemented Interfaces:
CommentableAmetysObject<Comment>,ModifiableResource,Resource,ACLAmetysObject,AmetysObject,CopiableAmetysObject,ModelAwareAmetysObject,ModifiableModelAwareAmetysObject,DataHolder,ModelAwareDataHolder,ModifiableDataHolder,ModifiableModelAwareDataHolder,DublinCoreAwareAmetysObject,ModifiableDublinCoreAwareAmetysObject,JCRAmetysObject,ModelAwareJCRAmetysObject,LockableAmetysObject,LockAwareAmetysObject,MetadataAwareAmetysObject,ModifiableMetadataAwareAmetysObject,ModifiableACLAmetysObject,ModifiableAmetysObject,RemovableAmetysObject,TagAwareAmetysObject,TaggableAmetysObject,TrashableAmetysObject,DataAndVersionAwareAmetysObject,ModifiableDataAwareVersionableAmetysObject,VersionableAmetysObject,VersionAwareAmetysObject,SiteAwareAmetysObject
public class File
extends JCRResource<FileFactory>
implements CommentableAmetysObject<Comment>, SiteAwareAmetysObject
Implementation of
Resource used for document module of workspaces and can handle comments, backed by a JCR node.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordToken class representing a composite object with id, creation date, and file id.Nested classes/interfaces inherited from interface org.ametys.plugins.repository.trash.TrashableAmetysObject
TrashableAmetysObject.MergeComputationMode -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringCreation date property for a tokenstatic final StringFile id property for a tokenstatic final StringToken idstatic final StringToken id propertystatic final StringToken nodestatic final StringTokens nodeFields inherited from class org.ametys.plugins.explorer.resources.jcr.JCRResource
CONTRIBUTOR_NODE_NAME, CREATION_DATE, CREATOR_NODE_NAMEFields inherited from class org.ametys.plugins.repository.jcr.DefaultAmetysObject
__VERSION_COMPARATOR, PROTECTED_PROPERTIESFields inherited from interface org.ametys.plugins.repository.data.holder.ModelAwareDataHolder
ALTERNATIVE_SUFFIX, STATUS_SUFFIXFields inherited from interface org.ametys.web.repository.SiteAwareAmetysObject
METADATA_SITE -
Constructor Summary
ConstructorsConstructorDescriptionFile(javax.jcr.Node node, String parentPath, FileFactory factory) Creates anFile. -
Method Summary
Modifier and TypeMethodDescriptionCreates a commentcreateComment(String commentId, ZonedDateTime creationDate) Creates a comment with the given id and creation date This method allow to create a comment from existing data (ex: data import from archive) The id is not generated here, the source is trusted.Creates a new token with the current date as the creation date.getComment(String commentId) Get a commentgetComments(boolean includeNotValidatedComments, boolean includeValidatedComments) Get the list of available comments (validated, not validated, both or none :))Get the file descriptiongetSite()Returns this object's site.Returns this object's site name.getToken()Retrieves the file token.booleantrueif the description was automatically generated,falseotherwise.voidsetDescription(String description) Set the file descriptionvoidsetIsAutoGeneratedDescription(boolean isAutoGeneratedDescription) Set totrueif the description was automatically generated,falseotherwise.voidsetTokens(List<File.PublicLinkToken> tokens) Stores the list of tokens.Methods inherited from class org.ametys.plugins.explorer.resources.jcr.JCRResource
copyTo, copyTo, getAuthorFromRevision, getCreationDate, getCreator, getDCContributor, getDCCoverage, getDCCreator, getDCDate, getDCDescription, getDCFormat, getDCIdentifier, getDCLanguage, getDCPublisher, getDCRelation, getDCRights, getDCSource, getDCSubject, getDCTitle, getDCType, getInputStream, getKeywords, getKeywordsAsString, getLastContributor, getLastModified, getLength, getMimeType, getResourcePath, getTags, moveToTrash, restoreFromNode, restoreFromTrash, setCreationDate, setCreator, setData, setDCContributor, setDCCoverage, setDCCreator, setDCDate, setDCDescription, setDCFormat, setDCIdentifier, setDCLanguage, setDCPublisher, setDCRelation, setDCRights, setDCSource, setDCSubject, setDCTitle, setDCType, setKeywords, setKeywords, setLastContributor, setLastModified, setMimeType, tag, untagMethods inherited from class org.ametys.plugins.repository.jcr.DefaultLockableAmetysObject
getLockOwner, isLocked, lock, setLockInfoOnCurrentContext, unlockMethods inherited from class org.ametys.plugins.repository.jcr.DefaultAmetysObject
addAllowedGroups, addAllowedProfilesForAnonymous, addAllowedProfilesForAnyConnectedUser, addAllowedUsers, addDeniedGroups, addDeniedProfilesForAnonymous, addDeniedProfilesForAnyConnectedUser, addDeniedUsers, addLabel, checkpoint, copyNode, disallowInheritance, getAllLabels, getAllRevisions, getBaseNode, getBaseVersion, getLabels, getLabels, getNode, getProfilesForAnonymousAndAnyConnectedUser, getProfilesForGroups, getProfilesForUsers, getRevision, getRevisionTimestamp, getRevisionTimestamp, getUnversionedDataHolder, getVersionHistory, isInheritanceDisallowed, removeAllowedGroups, removeAllowedGroups, removeAllowedProfilesForAnonymous, removeAllowedProfilesForAnyConnectedUser, removeAllowedUsers, removeAllowedUsers, removeDeniedGroups, removeDeniedGroups, removeDeniedProfilesForAnonymous, removeDeniedProfilesForAnyConnectedUser, removeDeniedUsers, removeDeniedUsers, removeLabel, restoreFromLabel, restoreFromRevision, switchToLabel, switchToRevisionMethods inherited from class org.ametys.plugins.repository.jcr.SimpleModelAwareAmetysObject
dataToJSON, dataToJSON, dataToJSONForEdition, dataToMap, dataToSAX, dataToSAX, dataToSAXForEdition, getComposite, getComposite, getDataHolder, getDefinition, getDifferences, getDifferences, getDifferences, getDifferences, getExternalComposite, getExternalComposite, getExternalRepeater, getExternalRepeater, getExternalValue, getLocalComposite, getLocalComposite, getLocalRepeater, getLocalRepeater, getLocalValue, getModel, getModelItemTypeExtensionPoint, getParentDataHolder, getRepeater, getRepeater, getRepositoryData, getRootDataHolder, getStatus, getType, getValueOfType, getValueOfTypeOrDefault, getValueOrDefault, getValueWithMultiValuedPathSegments, hasDefinition, hasDifferences, hasDifferences, hasDifferences, hasDifferences, hasExternalValue, hasExternalValueOrEmpty, hasLocalValue, hasLocalValueOrEmpty, hasValue, hasValue, hasValueOrEmpty, isMultiple, isMultiple, removeExternalizableMetadataIfExists, removeExternalValue, removeLocalValue, removeValue, setExternalValue, setLocalValue, setStatus, setValue, setValue, synchronizeValues, synchronizeValues, synchronizeValues, synchronizeValuesMethods inherited from class org.ametys.plugins.repository.jcr.SimpleAmetysObject
_getFactory, _invalidateName, _invalidateParentPath, getId, getMetadataHolder, getName, getParent, getParentPath, getPath, needsSave, remove, rename, revertChanges, saveChangesMethods inherited from class org.ametys.plugins.repository.AbstractAmetysObject
dataToJSON, dataToSAX, equals, getDataNames, getValue, getValueOrDefault, hashCode, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.ametys.plugins.repository.AmetysObject
equals, getId, getName, getParent, getParentPath, getPath, hashCodeMethods inherited from interface org.ametys.plugins.repository.data.holder.DataHolder
copyTo, copyTo, dataToJSON, dataToJSON, dataToSAX, dataToSAX, getValue, getValueOrDefault, hasValue, hasValueOrEmptyMethods inherited from interface org.ametys.plugins.repository.jcr.JCRAmetysObject
getNodeMethods inherited from interface org.ametys.plugins.repository.lock.LockableAmetysObject
lock, setLockInfoOnCurrentContext, unlockMethods inherited from interface org.ametys.plugins.repository.lock.LockAwareAmetysObject
getLockOwner, isLockedMethods inherited from interface org.ametys.plugins.repository.data.holder.ModelAwareDataHolder
dataToJSON, dataToJSON, dataToMap, dataToMap, dataToMap, dataToSAX, dataToSAX, getDataNamesMethods inherited from interface org.ametys.plugins.repository.ModifiableAmetysObject
needsSave, rename, revertChanges, saveChangesMethods inherited from interface org.ametys.plugins.repository.data.holder.ModifiableDataHolder
getRepositoryData, removeValue, synchronizeValuesMethods inherited from interface org.ametys.plugins.repository.metadata.ModifiableMetadataAwareAmetysObject
getMetadataHolderMethods inherited from interface org.ametys.plugins.repository.RemovableAmetysObject
remove
-
Field Details
-
TOKENS_NODE
Tokens node- See Also:
-
TOKEN_NODE
Token node- See Also:
-
TOKEN_ID
Token id- See Also:
-
TOKEN_ID_PROPERTY
Token id property- See Also:
-
TOKEN_CREATION_DATE_PROPERTY
Creation date property for a token- See Also:
-
TOKEN_FILE_ID_PROPERTY
File id property for a token- See Also:
-
-
Constructor Details
-
File
Creates anFile.- Parameters:
node- the node backing thisAmetysObjectparentPath- the parentPath in the Ametys hierarchyfactory- the DefaultAmetysObjectFactory which created the AmetysObject
-
-
Method Details
-
getDescription
Get the file description- Returns:
- the description
-
setDescription
Set the file description- Parameters:
description- the description to set
-
isAutomaticallyGeneratedDescription
trueif the description was automatically generated,falseotherwise.- Returns:
trueif the description was automatically generated,falseotherwise.
-
setIsAutoGeneratedDescription
Set totrueif the description was automatically generated,falseotherwise.- Parameters:
isAutoGeneratedDescription-trueif the description was automatically generated
-
createComment
Description copied from interface:CommentableAmetysObjectCreates a comment- Specified by:
createCommentin interfaceCommentableAmetysObject<Comment>- Returns:
- The new comment
-
createComment
Description copied from interface:CommentableAmetysObjectCreates a comment with the given id and creation date This method allow to create a comment from existing data (ex: data import from archive) The id is not generated here, the source is trusted. Be careful using this method- Specified by:
createCommentin interfaceCommentableAmetysObject<Comment>- Parameters:
commentId- the comment's idcreationDate- the comment's creation date- Returns:
- the new comment
-
getComment
Description copied from interface:CommentableAmetysObjectGet a comment- Specified by:
getCommentin interfaceCommentableAmetysObject<Comment>- Parameters:
commentId- The comment- Returns:
- The comment
- Throws:
AmetysRepositoryException- if error occurs
-
getComments
public List<Comment> getComments(boolean includeNotValidatedComments, boolean includeValidatedComments) throws AmetysRepositoryException Description copied from interface:CommentableAmetysObjectGet the list of available comments (validated, not validated, both or none :))- Specified by:
getCommentsin interfaceCommentableAmetysObject<Comment>- Parameters:
includeNotValidatedComments- true to get the non validated comments.includeValidatedComments- true to get the validated comment.- Returns:
- A non null list of comments on the ametys object.
- Throws:
AmetysRepositoryException- if an error occurred
-
getToken
Retrieves the file token. The JCR can handle multiple tokens, but only the first one is returned for now.- Returns:
- the file token.
-
setTokens
Stores the list of tokens.- Parameters:
tokens- the list of tokens.
-
createToken
Creates a new token with the current date as the creation date.- Returns:
- the created token.
-
getSiteName
Description copied from interface:SiteAwareAmetysObjectReturns this object's site name.- Specified by:
getSiteNamein interfaceSiteAwareAmetysObject- Returns:
- this object's site name.
- Throws:
AmetysRepositoryException- if an error occurs.
-
getSite
Description copied from interface:SiteAwareAmetysObjectReturns this object's site.- Specified by:
getSitein interfaceSiteAwareAmetysObject- Returns:
- this object's site
- Throws:
AmetysRepositoryException- if an error occurs.
-