Package org.silverpeas.core.wbe
Class WbeFile
- java.lang.Object
-
- org.silverpeas.core.wbe.WbeFile
-
- All Implemented Interfaces:
Securable
- Direct Known Subclasses:
SimpleWbeFile
,WbeFileWrapper
,WebdavWbeFile
public abstract class WbeFile extends Object implements Securable
Representation of a Silverpeas's file exposed to the Office infrastructure.The instance is not immutable and data returned by different signatures of a same instance MAY not the same during the time.
- Author:
- silveryocha
-
-
Constructor Summary
Constructors Constructor Description WbeFile()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description String
ext()
Gets the extension of the file.OffsetDateTime
getLastEditionDate()
Gets the date of last edition.String
id()
A File ID is a string that represents a file being operated on via WBE operations.abstract OffsetDateTime
lastModificationDate()
Gets anOffsetDateTime
instance that represents the last time that the file was modified.abstract Optional<ResourceReference>
linkedToResource()
Gets the optional resource reference the file is linked to.abstract void
loadInto(OutputStream output)
Loads the content of the underlying Silverpeas's file into the givenOutputStream
.WbeFileLock
lock()
Gets the current lock identifier.abstract String
mimeType()
Gets the mime type of the file.abstract String
name()
Gets the string name of the file, including extension, without a path.abstract User
owner()
A string that uniquely identifies the owner of the file.void
setLastEditionDateAtNow()
Updates the last edition date with the current date and time.abstract String
silverpeasId()
Silverpeas's identifier identifies the file from point of view of Silverpeas's platform.abstract long
size()
Gets the size of the file in bytes.String
toString()
abstract void
updateFrom(InputStream input)
Updates the content of underlying Silverpeas's file from data provided by the givenInputStream
.String
version()
The current version of the file based on the server’s file version schema, as a string.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.silverpeas.core.security.Securable
canBeAccessedBy, canBeDeletedBy, canBeFiledInBy, canBeModifiedBy
-
-
-
-
Method Detail
-
getLastEditionDate
public OffsetDateTime getLastEditionDate()
Gets the date of last edition.- Returns:
- an
OffsetDateTime
instance.
-
linkedToResource
public abstract Optional<ResourceReference> linkedToResource()
Gets the optional resource reference the file is linked to.- Returns:
- an optional
ResourceReference
.
-
silverpeasId
public abstract String silverpeasId()
Silverpeas's identifier identifies the file from point of view of Silverpeas's platform.In most of case,
id()
will return same identifier assilverpeasId()
returns.But sometimes, when a temporary view exists for a file and that the temporary view is the content exposed for modifications,
silverpeasId()
returns the identifier of the document andid()
returns the identifier of the view (the one used by Web Browser Edition exchanges).- Returns:
- a unique identifier as string.
-
id
public String id()
A File ID is a string that represents a file being operated on via WBE operations. A host must issue a unique ID for any file used by a WBE client. The client will, in turn, include the file ID when making requests to the WBE host. Thus, a host must be able to use the file ID to locate a particular file.A file ID must:
- Represent a single file.
- Be an URL-safe string because IDs are passed in URLs
- Remain the same when the file is edited.
- Remain the same when the file is moved or renamed.
- Remain the same when any ancestor container, including the parent container, is renamed .
- In the case of shared files, the ID for a given file must be the same for every user that accesses the file.
- Returns:
- a unique identifier as string.
-
owner
public abstract User owner()
A string that uniquely identifies the owner of the file. In most cases, the user who uploaded or created the file should be considered the owner.- Returns:
- the
User
which is the owner.
-
name
public abstract String name()
Gets the string name of the file, including extension, without a path. Used for display in user interface (UI), and determining the extension of the file.- Returns:
- a string representing a file name.
-
ext
public String ext()
Gets the extension of the file.- Returns:
- a string representing a mime-type.
-
mimeType
public abstract String mimeType()
Gets the mime type of the file.- Returns:
- a string representing a mime-type.
-
size
public abstract long size()
Gets the size of the file in bytes.- Returns:
- a long representing a file content length.
-
lastModificationDate
public abstract OffsetDateTime lastModificationDate()
Gets anOffsetDateTime
instance that represents the last time that the file was modified.- Returns:
- an
OffsetDateTime
.
-
version
public String version()
The current version of the file based on the server’s file version schema, as a string. This value must change when the file changes, and version values must never repeat for a given file.- Returns:
- a version value as string.
-
updateFrom
public abstract void updateFrom(InputStream input) throws IOException
Updates the content of underlying Silverpeas's file from data provided by the givenInputStream
.- Parameters:
input
- anInputStream
from which the data are written.- Throws:
IOException
- when it is not possible to write into the physical file.
-
loadInto
public abstract void loadInto(OutputStream output) throws IOException
Loads the content of the underlying Silverpeas's file into the givenOutputStream
.- Parameters:
output
- the stream into which content file MUST be loaded.- Throws:
IOException
- when it is not possible to read the physical file.
-
lock
public WbeFileLock lock()
Gets the current lock identifier.- Returns:
- a string.
-
setLastEditionDateAtNow
public void setLastEditionDateAtNow()
Updates the last edition date with the current date and time.
-
-