public interface WGDocumentCore extends WGExtensionDataContainer
A WGDocumentCore "lives" inside a WGDocument-Object and is directly accessed only by this object. While many threads access the same WGDocument object, each WGDocument object holds multiple WGDocumentCore objects, one for each thread, all representing the same background data. Background resources held by the core implementation should be managed with that fact in mind. After each closed session, all document cores are dropped and will be re-retrieved by their next calling. Therefor WGDocumentCores themselves need not to be thread safe, cause they are specific to one thread and one user session.
Modifier and Type | Method and Description |
---|---|
boolean |
attachFile(java.io.File file)
Attach a file from disk to the document
|
WGFileDerivateMetaData |
createFileDerivate(java.lang.String originalFileName,
java.lang.String creator,
java.lang.String derivateName,
java.io.InputStream in,
java.util.Map<java.lang.String,java.lang.Object> customMdFields)
Creates a derivate for the addressed file.
|
void |
dispose()
Called when this core is disposed "untimely", i.e. before the current session is closed
|
java.lang.Object |
evaluateExpression(java.lang.String expression)
Evaluates an expression in a database-native expression language on this document core.
|
java.util.Date |
getCreated()
Retrieves the creation date of this document.
|
java.lang.Object |
getFastAccessKey()
Can provide an fast access key, that the corresponding database core implementation can use to re-retrieve an instance of this core.
|
java.io.InputStream |
getFileData(java.lang.String strFile)
Retrieves an input stream to the data of an embedded file.
|
java.io.InputStream |
getFileDerivateData(java.lang.String id)
Returns the data of a file derivate.
|
WGFileDerivateMetaData |
getFileDerivateMetaData(java.lang.String id)
Returns the metadata of a file derivate.
|
java.util.List<WGFileDerivateMetaData> |
getFileDerivates(java.lang.String strFile)
Returns metadata about the created derivates for the given file.
|
WGFileMetaData |
getFileMetaData(java.lang.String strFile)
retrieves meta informations for the given file
May throw an exception if method is used on a document that does not serve file metadata.
|
java.util.List<java.lang.String> |
getFileNames()
Returns a list of the names of embedded files.
|
int |
getFileSize(java.lang.String strFile)
Returns the size of an embedded file in bytes.
|
java.util.List<java.lang.String> |
getItemNames()
Returns the names of all items in this document
|
java.lang.Object |
getItemValue(java.lang.String strName)
Returns the value of an content item.
|
java.util.Date |
getLastModified()
Returns the date of the last modification of this document.
|
java.util.Iterator<WGUpdateLog> |
getLastUpdates()
Returns update logs for the last updates done on this document, in descending chronological order
|
java.lang.Object |
getMetaData(java.lang.String type)
Retrieves various meta data for the document core.
|
java.lang.Object |
getNativeObject()
Returns the native backend object of this doc core if there is any
|
java.lang.String |
getOriginDatabase()
Returns the dbReference of the database that this document core was created from
|
WGDocumentCore |
getRelation(java.lang.String name)
Retrieves the target content document of the given content relation
|
WGRelationData |
getRelationData(java.lang.String name)
Retrieves data for the given content relation.
|
java.util.List<java.lang.String> |
getRelationNames()
Returns the names of all relations that this content document holds
|
java.util.List<java.lang.String> |
getRelationNamesOfGroup(java.lang.String group,
WGColumnSet order)
Returns the names of all relations on this content document that
belong to the given relation group.
|
int |
getType()
Returns the type of this document.
|
boolean |
hasFile(java.lang.String file)
Tests if a file of the given name is attached to the document
|
boolean |
hasFileMetadata()
Determines if this document serves metadata for file attachments
|
boolean |
hasItem(java.lang.String strName)
Tests, if the content contains an item of the given name.
|
boolean |
isDataCacheable()
Should return, if the data retrieved as items and metas of this document can be cached while the document doesn't change
|
boolean |
isDeleted()
Tests, if this document is marked as deleted.
|
boolean |
isSaved()
Should return if the document has been saved.
|
boolean |
isTemporary()
Should return true, if this document core cannot be re-retrieved by it's individual key.
|
void |
markFileMetaDataModified(WGFileMetaData md)
Marks a file metadata object as being modified, so the core knows that it must be saved
|
WGDatabaseRevision |
remove()
Removes this document from the database
|
boolean |
removeFile(java.lang.String name)
Removes a file attachment from this document
|
void |
removeFileDerivate(java.lang.String id)
Deletes an existing file derivate
|
boolean |
removeItem(java.lang.String Name)
Removes an item from the document
|
WGDocumentCore |
removeRelation(java.lang.String name)
Removes a content relation
|
void |
renameFile(java.lang.String oldFileName,
java.lang.String newFileName)
Renames an attached file
|
WGExtensionDataContainer |
retrieveFileExtensionDataHandler(java.lang.String strFile)
retrieves the extension data handler for the given file or null if extension data is not supported
|
WGDatabaseRevision |
save(java.util.Date lastModified)
Called to save modifications to this document core.
|
boolean |
setItemValue(java.lang.String strName,
java.lang.Object value)
Sets a new value for a content item.
|
boolean |
setMetaData(java.lang.String name,
java.lang.Object value)
Modifies various meta data for the document core.
|
WGDocumentCore |
setRelation(WGRelationData data)
Sets a content relation to the designated target
|
void |
setWGDocument(WGDocument doc)
Called by the WGAPI after instantiation of this document core to provide a reference to the wrapping WGDocument object.
|
void |
writeFileDerivateMetaData(WGFileDerivateMetaData md)
Writes the modified metadata of a file derivate to the database.
|
getExtensionData, getExtensionDataNames, removeExtensionData, writeExtensionData
int getType()
java.lang.Object getFastAccessKey() throws WGBackendException
WGBackendException
boolean isDeleted() throws WGAPIException
WGAPIException
boolean isTemporary() throws WGAPIException
WGAPIException
boolean hasItem(java.lang.String strName) throws WGAPIException
strName
- WGBackendException
WGAPIException
java.lang.Object getItemValue(java.lang.String strName) throws WGAPIException
strName
- Name of the requested content item.WGAPIException
java.lang.Object getMetaData(java.lang.String type) throws WGAPIException
type
- The type of the meta data. See constants META_ of the specific WGDocument subclass for this doc class.WGAPIException
java.util.List<java.lang.String> getFileNames() throws WGAPIException
WGBackendException
WGAPIException
boolean hasFile(java.lang.String file) throws WGAPIException
WGBackendException
WGAPIException
java.io.InputStream getFileData(java.lang.String strFile) throws WGAPIException
strFile
- The name of the fileWGAPIException
java.util.List<WGFileDerivateMetaData> getFileDerivates(java.lang.String strFile) throws WGAPIException
strFile
- The file nameWGAPIException
int getFileSize(java.lang.String strFile) throws WGAPIException
strFile
- The name of the file, whose size is requested.WGAPIException
java.util.Date getCreated() throws WGAPIException
WGAPIException
java.util.Date getLastModified() throws WGAPIException
WGAPIException
boolean setItemValue(java.lang.String strName, java.lang.Object value) throws WGAPIException
strName
- Name of the item to be modified.value
- New value of the itemWGAPIException
boolean setMetaData(java.lang.String name, java.lang.Object value) throws WGAPIException
name
- The name of the meta data. See constants META_ of the specific WGDocument subclass for this doc class.WGAPIException
WGDatabaseRevision save(java.util.Date lastModified) throws WGAPIException
WGAPIException
java.lang.Object evaluateExpression(java.lang.String expression) throws WGAPIException
expression
- The expression to be evaluatedWGExpressionException
WGBackendException
WGAPIException
void setWGDocument(WGDocument doc)
doc
- The WGDocument object, that wraps this document core.void dispose() throws WGAPIException
WGAPIException
java.util.List<java.lang.String> getItemNames() throws WGAPIException
WGBackendException
WGAPIException
boolean removeItem(java.lang.String Name) throws WGAPIException
Name
- Name of the item to removeWGIllegalArgumentException
WGAPIException
boolean isDataCacheable()
boolean attachFile(java.io.File file) throws WGAPIException
file
- WGAPIException
boolean removeFile(java.lang.String name) throws WGAPIException
name
- Name of the file to removeWGAPIException
WGDatabaseRevision remove() throws WGAPIException
WGAPIException
boolean isSaved() throws WGAPIException
WGAPIException
java.lang.Object getNativeObject() throws WGAPIException
WGBackendException
WGAPIException
java.lang.String getOriginDatabase()
void renameFile(java.lang.String oldFileName, java.lang.String newFileName) throws WGAPIException
oldFileName
- - file to renamenewFileName
- - new name for the fileWGAPIException
WGFileMetaData getFileMetaData(java.lang.String strFile) throws WGAPIException
hasFileMetadata()
to determine if metadata is present.strFile
- - the filenameWGAPIException
WGExtensionDataContainer retrieveFileExtensionDataHandler(java.lang.String strFile) throws WGAPIException
strFile
- - the filenameWGAPIException
WGDocumentCore setRelation(WGRelationData data) throws WGAPIException
data
- All data of the relationWGAPIException
WGDocumentCore getRelation(java.lang.String name) throws WGAPIException
name
- Name of the relationWGAPIException
WGRelationData getRelationData(java.lang.String name) throws WGAPIException
name
- The name of the relationWGAPIException
WGDocumentCore removeRelation(java.lang.String name) throws WGAPIException
name
- Name of the relationWGAPIException
java.util.List<java.lang.String> getRelationNames() throws WGAPIException
WGAPIException
boolean hasFileMetadata() throws WGAPIException
WGAPIException
java.util.List<java.lang.String> getRelationNamesOfGroup(java.lang.String group, WGColumnSet order) throws WGBackendException, WGAPIException
group
- The group nameorder
- Optional order in which to return relations, evaluated against the relation targets, null for no orderWGBackendException
WGAPIException
WGFileDerivateMetaData createFileDerivate(java.lang.String originalFileName, java.lang.String creator, java.lang.String derivateName, java.io.InputStream in, java.util.Map<java.lang.String,java.lang.Object> customMdFields) throws WGAPIException, WGNotSupportedException
originalFileName
- The name of the original filecreator
- Identifier of the creator class of this derivatederivateName
- Name of the derivatein
- The data of the derivate filecustomMdFields
- Additional custom file metadata fields to store for the derivateWGAPIException
WGNotSupportedException
- if derivates are not supported on this databasevoid removeFileDerivate(java.lang.String id) throws WGAPIException
id
- The ID of the derivateWGAPIException
WGFileDerivateMetaData getFileDerivateMetaData(java.lang.String id) throws WGAPIException
id
- The ID of the derivateWGAPIException
void writeFileDerivateMetaData(WGFileDerivateMetaData md) throws WGAPIException, WGNotSupportedException
md
- The metadataWGAPIException
WGNotSupportedException
- if derivates are not supported on this databasejava.io.InputStream getFileDerivateData(java.lang.String id) throws WGAPIException
id
- The ID of the derivateWGAPIException
java.util.Iterator<WGUpdateLog> getLastUpdates() throws WGAPIException
WGAPIException
void markFileMetaDataModified(WGFileMetaData md) throws WGAPIException
WGAPIException