Package org.ametys.cms.data
Class ExplorerFile
java.lang.Object
org.ametys.cms.data.ExplorerFile
- All Implemented Interfaces:
File
Class representing a file from explorer
-
Constructor Summary
ConstructorDescriptionExplorerFile
(AmetysObjectResolver resolver, String resourceId) Constructor of the explorer fileExplorerFile
(AmetysObjectResolver resolver, String resourceId, javax.jcr.Session session) Constructor of the explorer file -
Method Summary
Modifier and TypeMethodDescriptionReturns the data stream.Returns the last modification date.long
Returns the length of the data stream.Returns the data mime-type.getName()
Retrieves the file's nameRetrieves the file resourceRetrieves the resource's identifiervoid
setLastModificationDate
(ZonedDateTime lastModificationDate) Sets the last modification date of the file's datavoid
setMimeType
(String mimeType) Sets the mime type of the file's data
-
Constructor Details
-
ExplorerFile
Constructor of the explorer file- Parameters:
resolver
- resolver used to get the resource from its identifierresourceId
- resource's identifier
-
ExplorerFile
Constructor of the explorer file- Parameters:
resolver
- resolver used to get the resource from its identifierresourceId
- resource's identifiersession
- the current session. Ifnull
, a new session will be used to retrieve the resource's data
-
-
Method Details
-
getResourceId
Retrieves the resource's identifier- Returns:
- the resource's identifier
-
getInputStream
Description copied from interface:File
Returns the data stream.- Specified by:
getInputStream
in interfaceFile
- Returns:
- the data stream.
-
getLastModificationDate
Description copied from interface:File
Returns the last modification date.- Specified by:
getLastModificationDate
in interfaceFile
- Returns:
- the last modification date.
-
setLastModificationDate
Description copied from interface:File
Sets the last modification date of the file's data- Specified by:
setLastModificationDate
in interfaceFile
- Parameters:
lastModificationDate
- the last modification date to set
-
getLength
Description copied from interface:File
Returns the length of the data stream. -
getMimeType
Description copied from interface:File
Returns the data mime-type.- Specified by:
getMimeType
in interfaceFile
- Returns:
- the data mime-type.
-
setMimeType
Description copied from interface:File
Sets the mime type of the file's data- Specified by:
setMimeType
in interfaceFile
- Parameters:
mimeType
- the mime type to set
-
getName
Description copied from interface:File
Retrieves the file's name -
getResource
public ModifiableResource getResource() throws AmetysRepositoryException, UnknownAmetysObjectExceptionRetrieves the file resource- Returns:
- the file resource
- Throws:
AmetysRepositoryException
- if an error occurs while resolving the resource by its idUnknownAmetysObjectException
- if the resource does not exist
-