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
_resolver
private ModifiableResource
_resource
private String
_resourceId
private 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()
InputStream
getInputStream()
Returns the data stream.ZonedDateTime
getLastModificationDate()
Returns the last modification date.long
getLength()
Returns the length of the data stream.String
getMimeType()
Returns the data mime-type.String
getName()
Retrieves the file's nameString
getPath()
Returns the path of this resource in its hierarchy (which is a subset of the whole repository).String
getResourceId()
Retrieves 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
-
-
-
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:File
Returns the data stream.- Specified by:
getInputStream
in interfaceFile
- Returns:
- the data stream.
-
getLastModificationDate
public ZonedDateTime getLastModificationDate()
Description copied from interface:File
Returns the last modification date.- Specified by:
getLastModificationDate
in interfaceFile
- Returns:
- the last modification date.
-
setLastModificationDate
public void setLastModificationDate(ZonedDateTime lastModificationDate)
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
public long getLength()
Description copied from interface:File
Returns the length of the data stream.
-
getMimeType
public String getMimeType()
Description copied from interface:File
Returns the data mime-type.- Specified by:
getMimeType
in interfaceFile
- Returns:
- the data mime-type.
-
setMimeType
public void setMimeType(String mimeType)
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
-
getPath
public String getPath()
Description copied from interface:File
Returns the path of this resource in its hierarchy (which is a subset of the whole repository).
-
_getResource
private ModifiableResource _getResource() throws AmetysRepositoryException, UnknownAmetysObjectException
-
-