public class WrappedKey extends java.lang.Object implements WGDocumentCore
Constructor and Description |
---|
WrappedKey(SimpleContentSource db,
BeanKey key,
java.lang.Object bean,
boolean saved)
Constructor not to be used outside WGAPI.
|
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.lang.Object |
getBean()
Returns the bean that is stored under this key.
|
java.util.Date |
getCreated()
Retrieves the creation date of this document.
|
java.lang.Object |
getExtensionData(java.lang.String strName)
Returns the value of an extension data field.
|
java.util.List |
getExtensionDataNames()
Returns the names of all extension data fields on this entity
|
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 |
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 |
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.
|
BeanKey |
getKey()
Returns the data key
|
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
|
void |
removeExtensionData(java.lang.String strName)
Removes an extension data field from this entity
|
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(java.lang.String name,
WGDocumentCore target) |
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 |
writeExtensionData(java.lang.String strName,
java.lang.Object value)
Sets the value of an extension data field.
|
void |
writeFileDerivateMetaData(WGFileDerivateMetaData md)
Writes the modified metadata of a file derivate to the database.
|
public BeanKey _key
public WrappedKey(SimpleContentSource db, BeanKey key, java.lang.Object bean, boolean saved)
db
- key
- bean
- saved
- public int getType()
WGDocumentCore
getType
in interface WGDocumentCore
public java.lang.Object getFastAccessKey()
WGDocumentCore
getFastAccessKey
in interface WGDocumentCore
public boolean isDeleted()
WGDocumentCore
isDeleted
in interface WGDocumentCore
public boolean isTemporary()
WGDocumentCore
isTemporary
in interface WGDocumentCore
public boolean hasItem(java.lang.String strName)
WGDocumentCore
hasItem
in interface WGDocumentCore
public java.lang.Object getItemValue(java.lang.String strName)
WGDocumentCore
getItemValue
in interface WGDocumentCore
strName
- Name of the requested content item.public java.lang.Object getMetaData(java.lang.String type)
WGDocumentCore
getMetaData
in interface WGDocumentCore
type
- The type of the meta data. See constants META_ of the specific WGDocument subclass for this doc class.public java.util.List getFileNames()
WGDocumentCore
getFileNames
in interface WGDocumentCore
public java.io.InputStream getFileData(java.lang.String strFile)
WGDocumentCore
getFileData
in interface WGDocumentCore
strFile
- The name of the filepublic int getFileSize(java.lang.String strFile)
WGDocumentCore
getFileSize
in interface WGDocumentCore
strFile
- The name of the file, whose size is requested.public java.util.Date getCreated()
WGDocumentCore
getCreated
in interface WGDocumentCore
public java.util.Date getLastModified()
WGDocumentCore
getLastModified
in interface WGDocumentCore
public boolean setItemValue(java.lang.String strName, java.lang.Object value)
WGDocumentCore
setItemValue
in interface WGDocumentCore
strName
- Name of the item to be modified.value
- New value of the itempublic boolean setMetaData(java.lang.String name, java.lang.Object value)
WGDocumentCore
setMetaData
in interface WGDocumentCore
name
- The name of the meta data. See constants META_ of the specific WGDocument subclass for this doc class.public WGDatabaseRevision save(java.util.Date lastModified) throws WGAuthorisationException
WGDocumentCore
save
in interface WGDocumentCore
WGAuthorisationException
public java.lang.Object evaluateExpression(java.lang.String expression) throws WGExpressionException
WGDocumentCore
evaluateExpression
in interface WGDocumentCore
expression
- The expression to be evaluatedWGExpressionException
public void setWGDocument(WGDocument doc)
WGDocumentCore
setWGDocument
in interface WGDocumentCore
doc
- The WGDocument object, that wraps this document core.public void dispose()
WGDocumentCore
dispose
in interface WGDocumentCore
public java.util.List getItemNames()
WGDocumentCore
getItemNames
in interface WGDocumentCore
public boolean removeItem(java.lang.String Name)
WGDocumentCore
removeItem
in interface WGDocumentCore
Name
- Name of the item to removepublic boolean isDataCacheable()
WGDocumentCore
isDataCacheable
in interface WGDocumentCore
public boolean attachFile(java.io.File file)
WGDocumentCore
attachFile
in interface WGDocumentCore
public boolean removeFile(java.lang.String name)
WGDocumentCore
removeFile
in interface WGDocumentCore
name
- Name of the file to removepublic WGDatabaseRevision remove()
WGDocumentCore
remove
in interface WGDocumentCore
public boolean isSaved()
WGDocumentCore
isSaved
in interface WGDocumentCore
public java.lang.Object getBean() throws WGAPIException
WGAPIException
public BeanKey getKey()
public java.lang.Object getNativeObject()
WGDocumentCore
getNativeObject
in interface WGDocumentCore
public java.lang.String getOriginDatabase()
WGDocumentCore
getOriginDatabase
in interface WGDocumentCore
public void renameFile(java.lang.String oldFileName, java.lang.String newFileName) throws WGAPIException
WGDocumentCore
renameFile
in interface WGDocumentCore
oldFileName
- - file to renamenewFileName
- - new name for the fileWGAPIException
public WGFileMetaData getFileMetaData(java.lang.String strFile) throws WGAPIException
WGDocumentCore
WGDocumentCore.hasFileMetadata()
to determine if metadata is present.getFileMetaData
in interface WGDocumentCore
strFile
- - the filenameWGAPIException
public WGDocumentCore getRelation(java.lang.String name) throws WGAPIException
WGDocumentCore
getRelation
in interface WGDocumentCore
name
- Name of the relationWGAPIException
public WGDocumentCore removeRelation(java.lang.String name) throws WGAPIException
WGDocumentCore
removeRelation
in interface WGDocumentCore
name
- Name of the relationWGAPIException
public WGDocumentCore setRelation(java.lang.String name, WGDocumentCore target) throws WGAPIException
WGAPIException
public java.util.List<java.lang.String> getRelationNames() throws WGAPIException
WGDocumentCore
getRelationNames
in interface WGDocumentCore
WGAPIException
public boolean hasFileMetadata() throws WGAPIException
WGDocumentCore
hasFileMetadata
in interface WGDocumentCore
WGAPIException
public boolean hasFile(java.lang.String file) throws WGBackendException
WGDocumentCore
hasFile
in interface WGDocumentCore
WGBackendException
public WGRelationData getRelationData(java.lang.String name) throws WGAPIException
WGDocumentCore
getRelationData
in interface WGDocumentCore
name
- The name of the relationWGAPIException
public WGDocumentCore setRelation(WGRelationData data) throws WGAPIException
WGDocumentCore
setRelation
in interface WGDocumentCore
data
- All data of the relationWGAPIException
public java.lang.Object getExtensionData(java.lang.String strName) throws WGAPIException
WGExtensionDataContainer
getExtensionData
in interface WGExtensionDataContainer
strName
- Name of the requested field.WGAPIException
public java.util.List getExtensionDataNames() throws WGAPIException
WGExtensionDataContainer
getExtensionDataNames
in interface WGExtensionDataContainer
WGBackendException
WGAPIException
public void removeExtensionData(java.lang.String strName) throws WGAPIException
WGExtensionDataContainer
removeExtensionData
in interface WGExtensionDataContainer
strName
- Name of the field to remove.WGAPIException
public void writeExtensionData(java.lang.String strName, java.lang.Object value) throws WGAPIException
WGExtensionDataContainer
writeExtensionData
in interface WGExtensionDataContainer
strName
- Name of the requested field.value
- The value of the fieldWGAPIException
public java.util.List<java.lang.String> getRelationNamesOfGroup(java.lang.String group, WGColumnSet order) throws WGBackendException
WGDocumentCore
getRelationNamesOfGroup
in interface WGDocumentCore
group
- The group nameorder
- Optional order in which to return relations, evaluated against the relation targets, null for no orderWGBackendException
public WGExtensionDataContainer retrieveFileExtensionDataHandler(java.lang.String strFile) throws WGAPIException
WGDocumentCore
retrieveFileExtensionDataHandler
in interface WGDocumentCore
strFile
- - the filenameWGAPIException
public java.util.List<WGFileDerivateMetaData> getFileDerivates(java.lang.String strFile) throws WGAPIException
WGDocumentCore
getFileDerivates
in interface WGDocumentCore
strFile
- The file nameWGAPIException
public void markFileMetaDataModified(WGFileMetaData md) throws WGAPIException
WGDocumentCore
markFileMetaDataModified
in interface WGDocumentCore
WGAPIException
public 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
WGDocumentCore
createFileDerivate
in interface WGDocumentCore
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 databasepublic java.io.InputStream getFileDerivateData(java.lang.String id)
WGDocumentCore
getFileDerivateData
in interface WGDocumentCore
id
- The ID of the derivatepublic WGFileDerivateMetaData getFileDerivateMetaData(java.lang.String id)
WGDocumentCore
getFileDerivateMetaData
in interface WGDocumentCore
id
- The ID of the derivatepublic void writeFileDerivateMetaData(WGFileDerivateMetaData md) throws WGAPIException
WGDocumentCore
writeFileDerivateMetaData
in interface WGDocumentCore
md
- The metadataWGAPIException
WGNotSupportedException
- if derivates are not supported on this databasepublic void removeFileDerivate(java.lang.String id) throws WGAPIException
WGDocumentCore
removeFileDerivate
in interface WGDocumentCore
id
- The ID of the derivateWGAPIException
public java.util.Iterator<WGUpdateLog> getLastUpdates() throws WGAPIException
WGDocumentCore
getLastUpdates
in interface WGDocumentCore
WGAPIException