public class WGFakeDocument extends java.lang.Object implements WGDocumentCore
| Constructor and Description |
|---|
WGFakeDocument(WGDatabase db,
int type) |
| 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 |
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.
|
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 name)
Retrieves various meta data for the document core.
|
static java.lang.Object |
getMetaDataDefault(int type,
java.lang.String name,
java.lang.String fakeLanguage) |
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.
|
static boolean |
isFake(WGDocumentCore doc) |
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.
|
void |
setCacheable(boolean cacheable) |
void |
setDeleted(boolean deleted) |
boolean |
setItemValue(java.lang.String strName,
java.lang.Object value)
Sets a new value for a content item.
|
boolean |
setMetaData(java.lang.String strName,
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 WGFakeDocument(WGDatabase db, int type)
public static boolean isFake(WGDocumentCore doc)
public int getType()
WGDocumentCoregetType in interface WGDocumentCorepublic java.lang.Object getFastAccessKey()
throws WGBackendException
WGDocumentCoregetFastAccessKey in interface WGDocumentCoreWGBackendExceptionpublic boolean isDeleted()
WGDocumentCoreisDeleted in interface WGDocumentCorepublic void setDeleted(boolean deleted)
public boolean isTemporary()
WGDocumentCoreisTemporary in interface WGDocumentCorepublic boolean hasItem(java.lang.String strName)
throws WGBackendException
WGDocumentCorehasItem in interface WGDocumentCoreWGBackendExceptionpublic java.lang.Object getItemValue(java.lang.String strName)
throws WGBackendException
WGDocumentCoregetItemValue in interface WGDocumentCorestrName - Name of the requested content item.WGBackendExceptionpublic boolean setItemValue(java.lang.String strName,
java.lang.Object value)
throws WGBackendException
WGDocumentCoresetItemValue in interface WGDocumentCorestrName - Name of the item to be modified.value - New value of the itemWGBackendExceptionpublic java.lang.Object getMetaData(java.lang.String name)
throws WGSystemException,
WGIllegalArgumentException,
WGBackendException
WGDocumentCoregetMetaData in interface WGDocumentCorename - The type of the meta data. See constants META_ of the specific WGDocument subclass for this doc class.WGSystemExceptionWGIllegalArgumentExceptionWGBackendExceptionpublic static java.lang.Object getMetaDataDefault(int type,
java.lang.String name,
java.lang.String fakeLanguage)
throws WGSystemException,
WGIllegalArgumentException
public java.util.List getFileNames()
throws WGBackendException
WGDocumentCoregetFileNames in interface WGDocumentCoreWGBackendExceptionpublic java.io.InputStream getFileData(java.lang.String strFile)
throws WGBackendException
WGDocumentCoregetFileData in interface WGDocumentCorestrFile - The name of the fileWGBackendExceptionpublic int getFileSize(java.lang.String strFile)
throws WGBackendException
WGDocumentCoregetFileSize in interface WGDocumentCorestrFile - The name of the file, whose size is requested.WGBackendExceptionpublic java.util.Date getCreated()
throws WGBackendException
WGDocumentCoregetCreated in interface WGDocumentCoreWGBackendExceptionpublic java.util.Date getLastModified()
throws WGBackendException
WGDocumentCoregetLastModified in interface WGDocumentCoreWGBackendExceptionpublic java.lang.Object evaluateExpression(java.lang.String expression)
throws WGExpressionException,
WGBackendException
WGDocumentCoreevaluateExpression in interface WGDocumentCoreexpression - The expression to be evaluatedWGExpressionExceptionWGBackendExceptionpublic void setWGDocument(WGDocument doc)
WGDocumentCoresetWGDocument in interface WGDocumentCoredoc - The WGDocument object, that wraps this document core.public void dispose()
WGDocumentCoredispose in interface WGDocumentCorepublic WGDatabaseRevision save(java.util.Date lastModified) throws WGBackendException
WGDocumentCoresave in interface WGDocumentCoreWGBackendExceptionpublic boolean setMetaData(java.lang.String strName,
java.lang.Object value)
throws WGBackendException
WGDocumentCoresetMetaData in interface WGDocumentCorestrName - The name of the meta data. See constants META_ of the specific WGDocument subclass for this doc class.WGBackendExceptionpublic java.util.List getItemNames()
throws WGBackendException
WGDocumentCoregetItemNames in interface WGDocumentCoreWGBackendExceptionpublic boolean removeItem(java.lang.String Name)
throws WGBackendException
WGDocumentCoreremoveItem in interface WGDocumentCoreName - Name of the item to removeWGBackendExceptionpublic boolean isDataCacheable()
WGDocumentCoreisDataCacheable in interface WGDocumentCorepublic boolean attachFile(java.io.File file)
throws WGBackendException
WGDocumentCoreattachFile in interface WGDocumentCoreWGBackendExceptionpublic WGDatabaseRevision remove() throws WGBackendException
WGDocumentCoreremove in interface WGDocumentCoreWGBackendExceptionpublic boolean removeFile(java.lang.String name)
throws WGBackendException
WGDocumentCoreremoveFile in interface WGDocumentCorename - Name of the file to removeWGBackendExceptionpublic boolean isSaved()
WGDocumentCoreisSaved in interface WGDocumentCorepublic java.lang.Object getNativeObject()
throws WGBackendException
WGDocumentCoregetNativeObject in interface WGDocumentCoreWGBackendExceptionpublic void setCacheable(boolean cacheable)
public java.lang.String getOriginDatabase()
WGDocumentCoregetOriginDatabase in interface WGDocumentCorepublic void renameFile(java.lang.String oldFileName,
java.lang.String newFileName)
throws WGAPIException
WGDocumentCorerenameFile in interface WGDocumentCoreoldFileName - - file to renamenewFileName - - new name for the fileWGAPIExceptionpublic WGFileMetaData getFileMetaData(java.lang.String strFile) throws WGAPIException
WGDocumentCoreWGDocumentCore.hasFileMetadata() to determine if metadata is present.getFileMetaData in interface WGDocumentCorestrFile - - the filenameWGAPIExceptionpublic WGDocumentCore getRelation(java.lang.String name) throws WGAPIException
WGDocumentCoregetRelation in interface WGDocumentCorename - Name of the relationWGAPIExceptionpublic WGDocumentCore removeRelation(java.lang.String name) throws WGAPIException
WGDocumentCoreremoveRelation in interface WGDocumentCorename - Name of the relationWGAPIExceptionpublic WGDocumentCore setRelation(java.lang.String name, WGDocumentCore target) throws WGAPIException
WGAPIExceptionpublic java.util.List<java.lang.String> getRelationNames()
throws WGAPIException
WGDocumentCoregetRelationNames in interface WGDocumentCoreWGAPIExceptionpublic boolean hasFileMetadata()
throws WGAPIException
WGDocumentCorehasFileMetadata in interface WGDocumentCoreWGAPIExceptionpublic boolean hasFile(java.lang.String file)
throws WGBackendException
WGDocumentCorehasFile in interface WGDocumentCoreWGBackendExceptionpublic WGRelationData getRelationData(java.lang.String name) throws WGAPIException
WGDocumentCoregetRelationData in interface WGDocumentCorename - The name of the relationWGAPIExceptionpublic WGDocumentCore setRelation(WGRelationData data) throws WGAPIException
WGDocumentCoresetRelation in interface WGDocumentCoredata - All data of the relationWGAPIExceptionpublic java.lang.Object getExtensionData(java.lang.String strName)
throws WGAPIException
WGExtensionDataContainergetExtensionData in interface WGExtensionDataContainerstrName - Name of the requested field.WGAPIExceptionpublic java.util.List getExtensionDataNames()
throws WGAPIException
WGExtensionDataContainergetExtensionDataNames in interface WGExtensionDataContainerWGBackendExceptionWGAPIExceptionpublic void removeExtensionData(java.lang.String strName)
throws WGAPIException
WGExtensionDataContainerremoveExtensionData in interface WGExtensionDataContainerstrName - Name of the field to remove.WGAPIExceptionpublic void writeExtensionData(java.lang.String strName,
java.lang.Object value)
throws WGAPIException
WGExtensionDataContainerwriteExtensionData in interface WGExtensionDataContainerstrName - Name of the requested field.value - The value of the fieldWGAPIExceptionpublic java.util.List<java.lang.String> getRelationNamesOfGroup(java.lang.String group,
WGColumnSet order)
throws WGBackendException
WGDocumentCoregetRelationNamesOfGroup in interface WGDocumentCoregroup - The group nameorder - Optional order in which to return relations, evaluated against the relation targets, null for no orderWGBackendExceptionpublic WGExtensionDataContainer retrieveFileExtensionDataHandler(java.lang.String strFile) throws WGAPIException
WGDocumentCoreretrieveFileExtensionDataHandler in interface WGDocumentCorestrFile - - the filenameWGAPIExceptionpublic java.util.List<WGFileDerivateMetaData> getFileDerivates(java.lang.String strFile) throws WGAPIException
WGDocumentCoregetFileDerivates in interface WGDocumentCorestrFile - The file nameWGAPIExceptionpublic void markFileMetaDataModified(WGFileMetaData md) throws WGAPIException
WGDocumentCoremarkFileMetaDataModified in interface WGDocumentCoreWGAPIExceptionpublic 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
WGDocumentCorecreateFileDerivate in interface WGDocumentCoreoriginalFileName - 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 derivateWGAPIExceptionWGNotSupportedException - if derivates are not supported on this databasepublic void removeFileDerivate(java.lang.String id)
throws WGAPIException
WGDocumentCoreremoveFileDerivate in interface WGDocumentCoreid - The ID of the derivateWGAPIExceptionpublic WGFileDerivateMetaData getFileDerivateMetaData(java.lang.String id) throws WGAPIException
WGDocumentCoregetFileDerivateMetaData in interface WGDocumentCoreid - The ID of the derivateWGAPIExceptionpublic void writeFileDerivateMetaData(WGFileDerivateMetaData md) throws WGAPIException, WGNotSupportedException
WGDocumentCorewriteFileDerivateMetaData in interface WGDocumentCoremd - The metadataWGAPIExceptionWGNotSupportedException - if derivates are not supported on this databasepublic java.io.InputStream getFileDerivateData(java.lang.String id)
throws WGAPIException
WGDocumentCoregetFileDerivateData in interface WGDocumentCoreid - The ID of the derivateWGAPIExceptionpublic java.util.Iterator<WGUpdateLog> getLastUpdates() throws WGAPIException
WGDocumentCoregetLastUpdates in interface WGDocumentCoreWGAPIException