Class DragAndDropWbeFile
- java.lang.Object
-
- org.silverpeas.core.wbe.WbeFile
-
- org.silverpeas.core.wbe.SimpleWbeFile
-
- org.silverpeas.core.contribution.content.ddwe.DragAndDropWbeFile
-
- All Implemented Interfaces:
Securable
public class DragAndDropWbeFile extends SimpleWbeFile
This class represents a file content dedicated to the registering of Drag&Drop web editor contents.This file representation permits to such content to be taken in charge by WBE services and so to be edited by web browser editors.
- Author:
- silveryocha
-
-
Field Summary
-
Fields inherited from class org.silverpeas.core.wbe.SimpleWbeFile
MUTEX
-
-
Constructor Summary
Constructors Constructor Description DragAndDropWbeFile(DragAndDropWebEditorStore store)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canBeAccessedBy(User user)
Checks the given user can access this resource.boolean
canBeModifiedBy(User user)
Checks the given user can modify this resource.Optional<String>
getFinalContent()
Optional<String>
getTemporaryContent()
String
id()
A File ID is a string that represents a file being operated on via WBE operations.Optional<ContributionIdentifier>
linkedToContribution()
Optional<ResourceReference>
linkedToResource()
Gets the optional resource reference the file is linked to.void
loadInto(OutputStream output)
Loads the content of the underlying Silverpeas's file into the givenOutputStream
.String
mimeType()
Gets the mime type of the file.String
name()
Gets the string name of the file, including extension, without a path.User
owner()
A string that uniquely identifies the owner of the file.void
resetTemporaryContent()
Resets the temporary content with the final one.String
silverpeasId()
Silverpeas's identifier identifies the file from point of view of Silverpeas's platform.void
updateFrom(InputStream input)
Updates the content of underlying Silverpeas's file from data provided by the givenInputStream
.-
Methods inherited from class org.silverpeas.core.wbe.SimpleWbeFile
lastModificationDate, size
-
Methods inherited from class org.silverpeas.core.wbe.WbeFile
ext, getLastEditionDate, lock, setLastEditionDateAtNow, toString, version
-
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
canBeDeletedBy, canBeFiledInBy
-
-
-
-
Constructor Detail
-
DragAndDropWbeFile
public DragAndDropWbeFile(DragAndDropWebEditorStore store)
-
-
Method Detail
-
linkedToContribution
public Optional<ContributionIdentifier> linkedToContribution()
-
linkedToResource
public Optional<ResourceReference> linkedToResource()
Description copied from class:WbeFile
Gets the optional resource reference the file is linked to.- Overrides:
linkedToResource
in classSimpleWbeFile
- Returns:
- an optional
ResourceReference
.
-
id
public String id()
Description copied from class:WbeFile
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.
-
silverpeasId
public String silverpeasId()
Description copied from class:WbeFile
Silverpeas's identifier identifies the file from point of view of Silverpeas's platform.In most of case,
WbeFile.id()
will return same identifier asWbeFile.silverpeasId()
returns.But sometimes, when a temporary view exists for a file and that the temporary view is the content exposed for modifications,
WbeFile.silverpeasId()
returns the identifier of the document andWbeFile.id()
returns the identifier of the view (the one used by Web Browser Edition exchanges).- Overrides:
silverpeasId
in classSimpleWbeFile
- Returns:
- a unique identifier as string.
-
owner
public User owner()
Description copied from class:WbeFile
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.- Overrides:
owner
in classSimpleWbeFile
- Returns:
- the
User
which is the owner.
-
name
public String name()
Description copied from class:WbeFile
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.- Overrides:
name
in classSimpleWbeFile
- Returns:
- a string representing a file name.
-
mimeType
public String mimeType()
Description copied from class:WbeFile
Gets the mime type of the file.- Overrides:
mimeType
in classSimpleWbeFile
- Returns:
- a string representing a mime-type.
-
updateFrom
public void updateFrom(InputStream input) throws IOException
Description copied from class:WbeFile
Updates the content of underlying Silverpeas's file from data provided by the givenInputStream
.- Overrides:
updateFrom
in classSimpleWbeFile
- Parameters:
input
- anInputStream
from which the data are written.- Throws:
IOException
- when it is not possible to write into the physical file.
-
loadInto
public void loadInto(OutputStream output) throws IOException
Description copied from class:WbeFile
Loads the content of the underlying Silverpeas's file into the givenOutputStream
.- Overrides:
loadInto
in classSimpleWbeFile
- Parameters:
output
- the stream into which content file MUST be loaded.- Throws:
IOException
- when it is not possible to read the physical file.
-
resetTemporaryContent
public void resetTemporaryContent()
Resets the temporary content with the final one.If no final content exists, then the temporary content if exists is set to empty value or nothing is performed if no temporary content exists.
-
canBeAccessedBy
public boolean canBeAccessedBy(User user)
Description copied from interface:Securable
Checks the given user can access this resource.- Specified by:
canBeAccessedBy
in interfaceSecurable
- Overrides:
canBeAccessedBy
in classSimpleWbeFile
- Parameters:
user
- a user in Silverpeas.- Returns:
- true if the user can access the data managed by this instance, false otherwise.
-
canBeModifiedBy
public boolean canBeModifiedBy(User user)
Description copied from interface:Securable
Checks the given user can modify this resource. By default, if the user can access this securable resource, then it can also modify it.- Parameters:
user
- a user in Silverpeas.- Returns:
- true if the user can modify the data managed by this instance, false otherwise.
-
-