|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectccc.domain.Entity
ccc.domain.ResourceEntity
ccc.domain.HistoricalResource<U,T>
ccc.domain.WorkingCopySupport<FileRevision,File,FileWorkingCopy>
ccc.domain.FileEntity
public class FileEntity
A file resource. This class encapsulates all file metadata. The raw file data
is stored separately and can be accessed using the token stored in this
class' #fileData()
field.
Constructor Summary | |
---|---|
protected |
FileEntity()
Constructor: for persistence only. |
|
FileEntity(ResourceName name,
java.lang.String title,
java.lang.String description,
Data data,
long size,
MimeType mimeType,
java.util.Map<java.lang.String,java.lang.String> properties,
RevisionMetadata metadata)
Constructor. |
|
FileEntity(ResourceName name,
java.lang.String title,
java.lang.String description,
Data data,
long size,
RevisionMetadata metadata)
Constructor. |
Method Summary | |
---|---|
protected FileWorkingCopy |
createWorkingCopy(File delta)
Create a working copy from a delta. |
File |
deltaFile()
Create a delta for a file. |
File |
forCurrentRevision()
Create a snapshot for the current revision. |
File |
forSpecificRevision(int revNo)
Create a snapshot for the specified revision. |
File |
forWorkingCopy()
Create a snapshot for the working copy. |
java.lang.String |
getCharset()
Accessor for text charset. |
Data |
getData()
Accessor for the data field. |
java.lang.String |
getHeight()
Accessor for image height. |
MimeType |
getMimeType()
Accessor for mime type. |
java.util.Map<java.lang.String,java.lang.String> |
getProperties()
Accessor for the properties field. |
ResourceType |
getType()
Query the type of this resource. |
java.lang.String |
getWidth()
Accessor for image width. |
boolean |
isExecutable()
Determine if a file can be executed. |
boolean |
isImage()
Query if this file is an image. |
boolean |
isText()
Query if this file is a text file. |
File |
mapFile()
Create a summary of a file. |
static java.util.List<File> |
mapFiles(java.util.Collection<FileEntity> files)
Create summaries for a collection of files. |
File |
mapTextFile(DataRepository dataRepo)
Create a summary of a text file. |
static java.lang.String |
read(DataRepository dm,
File file)
Helper method that reads a file's contents into a string. |
static java.lang.String |
read(DataRepository dm,
FileEntity file)
Helper method that reads a file's contents into a string. |
long |
size()
Accessor for size. |
protected void |
update(File delta,
RevisionMetadata metadata)
Update the resource from the specified delta. |
Methods inherited from class ccc.domain.WorkingCopySupport |
---|
applyWorkingCopy, clearWorkingCopy, getOrCreateWorkingCopy, getWorkingCopy, hasWorkingCopy, setOrUpdateWorkingCopy, setWorkingCopy, setWorkingCopyFromRevision |
Methods inherited from class ccc.domain.HistoricalResource |
---|
addRevision, currentRevision, currentRevisionNo, revision, revisions, toJson |
Methods inherited from class ccc.domain.Entity |
---|
equals, getId, getVersion, hashCode, setId, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected FileEntity()
public FileEntity(ResourceName name, java.lang.String title, java.lang.String description, Data data, long size, RevisionMetadata metadata)
name
- The name of the file.title
- The title of the file.description
- The description of the file.data
- A token representing the binary content of the file.size
- The size of the file in bytes.metadata
- The metadata for the revision.public FileEntity(ResourceName name, java.lang.String title, java.lang.String description, Data data, long size, MimeType mimeType, java.util.Map<java.lang.String,java.lang.String> properties, RevisionMetadata metadata)
name
- The name of the file.title
- The title of the file.description
- The description of the file.data
- A token representing the binary content of the file.size
- The size of the file in bytes.mimeType
- The mime type for the file.properties
- The properties of the file..metadata
- The metadata for the revision.Method Detail |
---|
public ResourceType getType()
getType
in class ResourceEntity
public long size()
public MimeType getMimeType()
public Data getData()
public java.util.Map<java.lang.String,java.lang.String> getProperties()
public java.lang.String getCharset()
public java.lang.String getWidth()
public java.lang.String getHeight()
public boolean isImage()
public boolean isText()
public boolean isExecutable()
protected void update(File delta, RevisionMetadata metadata)
update
in class WorkingCopySupport<FileRevision,File,FileWorkingCopy>
delta
- The delta to apply.metadata
- The metadata for the update.protected FileWorkingCopy createWorkingCopy(File delta)
createWorkingCopy
in class WorkingCopySupport<FileRevision,File,FileWorkingCopy>
delta
- The delta for the working copy.
public final File forWorkingCopy()
public final File forCurrentRevision()
public final File forSpecificRevision(int revNo)
revNo
- The revision to create a snapshot for.
public File mapFile()
public File mapTextFile(DataRepository dataRepo)
dataRepo
- The repository used to read the file's data.
public static java.util.List<File> mapFiles(java.util.Collection<FileEntity> files)
files
- The files.
public File deltaFile()
public static java.lang.String read(DataRepository dm, FileEntity file)
dm
- The file repository.file
- The file to read.
public static java.lang.String read(DataRepository dm, File file)
dm
- The file repository.file
- The file to read.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |