Package org.ametys.cms.data
Class ExplorerFile
- java.lang.Object
-
- org.ametys.cms.data.ExplorerFile
-
- All Implemented Interfaces:
File
public class ExplorerFile extends Object implements File
Class representing a file from explorer
-
-
Field Summary
Fields Modifier and Type Field Description private AmetysObjectResolver_resolverprivate ModifiableResource_resourceprivate String_resourceIdprivate Session_session
-
Constructor Summary
Constructors Constructor Description ExplorerFile(AmetysObjectResolver resolver, String resourceId)Constructor of the explorer fileExplorerFile(AmetysObjectResolver resolver, String resourceId, Session session)Constructor of the explorer file
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private ModifiableResource_getResource()InputStreamgetInputStream()Returns the data stream.ZonedDateTimegetLastModificationDate()Returns the last modification date.longgetLength()Returns the length of the data stream.StringgetMimeType()Returns the data mime-type.StringgetName()Retrieves the file's nameStringgetPath()Returns the path of this resource in its hierarchy (which is a subset of the whole repository).StringgetResourceId()Retrieves the resource's identifiervoidsetLastModificationDate(ZonedDateTime lastModificationDate)Sets the last modification date of the file's datavoidsetMimeType(String mimeType)Sets the mime type of the file's data
-
-
-
Field Detail
-
_resolver
private AmetysObjectResolver _resolver
-
_resourceId
private String _resourceId
-
_resource
private ModifiableResource _resource
-
-
Constructor Detail
-
ExplorerFile
public ExplorerFile(AmetysObjectResolver resolver, String resourceId)
Constructor of the explorer file- Parameters:
resolver- resolver used to get the resource from its identifierresourceId- resource's identifier
-
ExplorerFile
public ExplorerFile(AmetysObjectResolver resolver, String resourceId, Session session)
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 Detail
-
getResourceId
public String getResourceId()
Retrieves the resource's identifier- Returns:
- the resource's identifier
-
getInputStream
public InputStream getInputStream()
Description copied from interface:FileReturns the data stream.- Specified by:
getInputStreamin interfaceFile- Returns:
- the data stream.
-
getLastModificationDate
public ZonedDateTime getLastModificationDate()
Description copied from interface:FileReturns the last modification date.- Specified by:
getLastModificationDatein interfaceFile- Returns:
- the last modification date.
-
setLastModificationDate
public void setLastModificationDate(ZonedDateTime lastModificationDate)
Description copied from interface:FileSets the last modification date of the file's data- Specified by:
setLastModificationDatein interfaceFile- Parameters:
lastModificationDate- the last modification date to set
-
getLength
public long getLength()
Description copied from interface:FileReturns the length of the data stream.
-
getMimeType
public String getMimeType()
Description copied from interface:FileReturns the data mime-type.- Specified by:
getMimeTypein interfaceFile- Returns:
- the data mime-type.
-
setMimeType
public void setMimeType(String mimeType)
Description copied from interface:FileSets the mime type of the file's data- Specified by:
setMimeTypein interfaceFile- Parameters:
mimeType- the mime type to set
-
getPath
public String getPath()
Description copied from interface:FileReturns the path of this resource in its hierarchy (which is a subset of the whole repository).
-
_getResource
private ModifiableResource _getResource() throws AmetysRepositoryException, UnknownAmetysObjectException
-
-