public abstract class WGDocument extends java.lang.Object implements Lockable, WGExtensionDataContainer, WGFileMetaDataContext, MetaInfoProvider
Modifier and Type | Class and Description |
---|---|
static class |
WGDocument.Cache |
static class |
WGDocument.FakeMetaDataContext
Fake md context when the metadata does not represent already stored md
|
static interface |
WGDocument.SaveAction
An interface defining an action that can be execute after the current
document was saved in the current session
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CSFEATURE_EXTDATA
Feature identifier for
WGContentStoreVersionException regarding extension data operations |
static java.util.regex.Pattern |
DERIVATE_NAME_PATTERN |
static java.lang.String |
DOCKEY_DIVIDER
Divider character for
WGDocumentKey strings, dividing the key parts |
static java.lang.String |
EXT_PRIMARY_ATTACHMENT
extension data field which stores the "primary attachment" for this document in CS Versions > 5
|
static java.lang.String |
EXTDATA_META_PREFIX
Prefix for names of extension data fields that actually store document metadata fields
|
static java.lang.String |
META_CREATED |
static java.lang.String |
META_LASTMODIFIED |
static java.lang.String |
META_PASTAUTHORS |
static java.lang.String |
META_PASTEDITDATES |
static java.lang.String |
META_REVISION |
static MetaInfo |
METAINFO_CREATED |
static MetaInfo |
METAINFO_LASTMODIFIED |
static MetaInfo |
METAINFO_PASTAUTHORS |
static MetaInfo |
METAINFO_PASTEDITDATES |
static MetaInfo |
METAINFO_REVISION |
static java.lang.String |
NOONE_ALLOWED
String used in WGStructEntry fields for edit access to symbolize that noone may edit this document.
|
static java.lang.String |
PAGERESTRICTION_ANY
Restriction string for page positioning: Any page allowed
|
static java.lang.String |
PAGERESTRICTION_FIXEDTYPES
Restriction string for page positioning: Pages of special content types allowed
|
static java.lang.String |
PAGERESTRICTION_NONE
Restriction string for page positioning: No pages allowed
|
static java.lang.String |
PAGERESTRICTION_UNSPECIFIED
Restriction string for page positioning: No restriction set here, retrieve from "parent"
|
static int |
TYPE_ACLENTRY
Pseudo document type for ACL entries
|
static int |
TYPE_AREA
Document types of WGArea objects
|
static int |
TYPE_CONTENT
Document types of WGContent objects
|
static int |
TYPE_CONTENTTYPE
Document types of WGContentType objects
|
static int |
TYPE_CSSJS
Document types of WGCSSJSModule objects
|
static int |
TYPE_DBMETADATA
Pseudo document type for database metadata (i.e. extension data on db level)
|
static int |
TYPE_FILECONTAINER
Document types of WGFileContainer objects
|
static int |
TYPE_FILEDERIVATE
Pseudo document type for file derivate
|
static int |
TYPE_LANGUAGE
Document types of WGLanguage objects
|
static int |
TYPE_STRUCTENTRY
Document types of WGStructEntry objects
|
static int |
TYPE_TML
Document types of WGTMLModule objects
|
static int |
TYPE_USERPROFILE
Document types of WGUserProfile objects
|
static java.lang.String |
TYPENAME_ACLENTRY
Pseudo document type name for ACL entries
|
static java.lang.String |
TYPENAME_AREA
Document type name of WGArea objects
|
static java.lang.String |
TYPENAME_CONTENT
Document type name of WGContent objects
|
static java.lang.String |
TYPENAME_CONTENTTYPE
Document type name of WGContentType objects
|
static java.lang.String |
TYPENAME_CSSJS
Document type name of WGCSSJSModule objects
|
static java.lang.String |
TYPENAME_DBMETADATA
Pseudo document type name for database metadata
|
static java.lang.String |
TYPENAME_FILECONTAINER
Document type name of WGFileContainer objects
|
static java.lang.String |
TYPENAME_FILEDERIVATE
Pseudo document type name for file derivate
|
static java.lang.String |
TYPENAME_LANGUAGE
Document type name of WGLanguage objects
|
static java.lang.String |
TYPENAME_STRUCTENTRY
Document type name of WGStructEntry objects
|
static java.lang.String |
TYPENAME_TML
Document type name of WGTMLModule objects
|
static java.lang.String |
TYPENAME_USERPROFILE
Document type name of WGUserProfile objects
|
Constructor and Description |
---|
WGDocument(WGDatabase db,
WGDocumentCore core) |
WGDocument(WGDatabase db,
WGDocumentCore core,
de.innovationgate.webgate.api.WGDocumentObjectFlags flags)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
afterSave(WGDocument.SaveAction action)
Adds an action that will be executed after the document is saved the next time on this database session.
|
void |
attachAllFiles(WGDocument doc)
Copies all attachments of the parameter document to the current document.
|
void |
attachAllFiles(WGDocument doc,
boolean copyExtensionData)
Copies all attachments of the parameter document to the current document
|
boolean |
attachFile(java.io.File file)
Attaches a file to the document.
|
boolean |
attachFile(java.io.File file,
java.util.List<WGFileAnnotator> additionalAnnotators)
Attaches a file to the document.
|
boolean |
attachFile(java.io.InputStream stream,
java.lang.String filename)
Takes data from an input stream and attaches the data as file
under the given name.
|
boolean |
attachFileWithoutAnnotation(java.io.File file)
Attaches a file to the document without running any annotators
|
boolean |
attachFileWithoutAnnotation(java.io.InputStream stream,
java.lang.String filename)
Takes data from an input stream and attaches the data as file, without running any annotators
under the given name.
|
void |
autoSave()
Marks the document to be automatically saved at the end of the session
|
static WGDocumentKey |
buildDocumentKey(WGDocumentCore core,
WGDatabase db)
Builds the document key for a document core.
|
abstract WGDocument |
createClone(WGDatabase db,
WGDocument ref)
Creates a clone of this document in another database
|
WGFileDerivateMetaData |
createFileDerivate(java.lang.String fileName,
java.lang.String creator,
java.lang.String name,
java.io.File file,
java.lang.String usage,
java.util.List<WGFileAnnotator> additionalAnnotators)
Creates a new file derivate for an existing original file attachment
|
WGFileDerivateMetaData |
createFileDerivate(java.lang.String fileName,
java.lang.String creator,
java.lang.String derivateName,
java.io.InputStream in,
java.lang.String usage,
java.util.List<WGFileAnnotator> additionalAnnotators)
Creates a new file derivate for an existing original file attachment
|
static java.lang.Integer |
docTypeClassToNumber(java.lang.Class<?> clazz)
Converts document type classes of the WGAPI to doctype numbers
|
static int |
doctypeNameToNumber(java.lang.String name)
Converts doctype names WGDocument.TYPENAME_... to number constants
WGDocument.TYPE_...
|
static java.lang.Class<?> |
doctypeNumberToClass(int number)
Converts doctype numbers WGDocument.TYPE... to document type classes in WGAPI
|
static java.lang.String |
doctypeNumberToName(int number)
Converts doctype numbers WGDocument.TYPE_... to doctype names
WGDocument.TYPENAME_...
|
void |
dropCache()
Drops the cache of this document.
|
void |
dropCore()
Drops the retrieved document core (i.e. backend document), if there is one.
|
boolean |
equals(java.lang.Object obj) |
java.lang.Object |
evaluateExpression(java.lang.String expression)
Evaluates a native expression with the current document as context.
|
WGDocumentCore |
getCore()
Returns the core implementation object for this document.
|
java.util.Date |
getCoreRetrieved()
Returns the time when the document core was retrieved in the current session.
|
java.util.Date |
getCreated()
Returns the creation date of this document
|
WGDatabase |
getDatabase()
Returns the database that stores this document
|
java.lang.String |
getDocumentKey()
Returns the document key of this document, which is unique in this
database among all documents.
|
WGDocumentKey |
getDocumentKeyObj()
Returns a parsed document key object, ready to access single parts of the key
|
static java.lang.Class<?> |
getExpectedMetaClass(int type,
java.lang.String metaName)
Returns the expected data type of a metadata field
|
static java.lang.String |
getExtdataMetaName(MetaInfo metaInfo)
Returns the name that a metadata field has when stored as extension data
|
java.lang.Object |
getExtensionData(java.lang.String strName)
Returns the value of an extension data field.
|
java.util.List<java.lang.String> |
getExtensionDataNames()
Returns the names of all extension data fields on this entity
|
java.io.InputStream |
getFileData(java.lang.String strFile)
Returns the data of a file attachment as input stream
Retrieving the data of a recently attached file while the document is not yet saved is not supported and may produce unknown results.
|
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 fileName)
Returns a list of all available derivates for the specified file
|
java.util.Date |
getFileLastModified(java.lang.String file)
Provides the best (most specific) information about the last modified date of an individual file attachment.
|
WGFileMetaData |
getFileMetaData(java.lang.String strFile)
Returns the meta data object for the given filename
|
java.lang.String |
getFileMimeType(java.lang.String strFile)
Returns the (primary) mime-type for the file of the given name.
|
java.util.Collection<java.lang.String> |
getFileMimeTypes(java.lang.String strFile)
Returns all mime-types for the file of the given name.
|
java.util.List<java.lang.String> |
getFileNames()
Returns a list of file attachment names for this document
|
WGDocument |
getFileParent()
Returns the parent document holding the file attachment, if possible
|
int |
getFileSize(java.lang.String strFile)
Returns the size of an attachment in bytes.
|
java.io.Reader |
getFileText(java.lang.String strFile)
Deprecated.
Use
getFileText(String) which allows specifying an encoding |
java.io.Reader |
getFileText(java.lang.String strFile,
java.lang.String encoding)
Returns the contents of a file attachment in text format.
|
java.util.Date |
getItemDate(java.lang.String strName)
Retrieves the value of a date item.
|
java.util.List<java.lang.String> |
getItemNames()
Retrieves a list of the names of all content items on this document
|
java.lang.Number |
getItemNumber(java.lang.String strName)
Retrieves a number item.
|
java.lang.String |
getItemText(java.lang.String strName)
Returns a text item.
|
java.lang.Object |
getItemValue(java.lang.String strName)
Returns an item's value.
|
java.util.List<?> |
getItemValueList(java.lang.String name)
Returns an items value(s) always as list.
|
java.util.Date |
getLastModified()
Returns the last modification date of the document
|
de.innovationgate.utils.SkippingIterator<WGUpdateLog> |
getLastUpdates()
Returns update logs for the last updates done to this document, in descending chronological order
|
int |
getLockStatus()
returns the lock status for the current sessioncontext
|
int |
getLockStatus(LockOwner owner)
returns the current lockstatus of the lockable - if parent is set and locked the lockstatus is inherited
|
java.lang.Object |
getMetaData(java.lang.String name)
Returns meta data about this document.
|
java.util.List<?> |
getMetaDataList(java.lang.String name)
Returns meta data about this document.
|
MetaInfo |
getMetaInfo(java.lang.String metaName)
Returns the meta information for a given metadata field.
|
static MetaInfo |
getMetaInfoByType(int type,
java.lang.String metaName)
returns the metaInfo of the given metaName for the given doctype
|
java.util.List<java.lang.String> |
getMetaNames()
Returns all meta names that are supported by the current document type.
|
static java.lang.String |
getName(WGDocumentCore core)
Retrieves the name information for the given document core.
|
java.lang.Object |
getNativeObject()
Returns the native backend object of this document if there is one.
|
java.util.Date |
getObjectCreated()
Returns the time that this document object was created
|
abstract Lockable |
getParentLockable()
returns the parent lockable of this lockable for e.g.
|
java.util.List<java.lang.String> |
getPastAuthors()
Gets the names list for past authors of this document.
|
java.util.List<java.util.Date> |
getPastEditDates()
Gets the list of dates, when this document was edited in the past.
|
java.util.Map<java.lang.String,java.lang.Object> |
getPersistentStore()
Returns a map as persistent store for the implementation of this
document.
|
java.lang.String |
getPrimaryFileName()
Returns the name of the primary attachment of this document
The primary attachment is a file attachment that is regarded the main attachment of this document (to be interpreted in a custom way).
|
int |
getRevision()
Returns the revision number of this document.
|
abstract int |
getType()
Returns the type of this document as constant WGDocument.TYPE_...
|
boolean |
hasFile(java.lang.String name)
Tests if a file of this name is attached to the document.
|
boolean |
hasFileMetadata()
Determines if this document serves metadata for file attachments
|
int |
hashCode() |
boolean |
hasItem(java.lang.String itemName)
Tests if the document has an item of this name
|
boolean |
innerAttachFile(java.io.File file) |
boolean |
isCachingEnabled()
Tests if caching for this document is enabled.
|
boolean |
isCoreRetrieved()
Returns if the current documents holds a document core (i.e. a backend document)
|
boolean |
isDeleted()
Returns if this document has been deleted
This method may choose to only check cached deletion flags for performance reasons.
|
boolean |
isDeleted(boolean forceBackendCheck)
Returns if this document has been deleted
|
boolean |
isDummy()
Returns, if this document is a "dummy content document", i.e. this document is nowhere stored in the database
but is only temporarily created to provide a content context for the current request.
|
boolean |
isEdited()
Returns if the document was edited and the current state of the document is not yet saved.
|
static boolean |
isListMeta(int type,
java.lang.String name)
Determines if the given metadata field should return lists or single values.
|
boolean |
isSaved()
Returns if the document has been saved to the database.
|
boolean |
isTemporary()
Tests if this document object is temporary and will be discarded after
the session.
|
void |
lock()
locks the document for the current sessionContext
|
void |
lock(LockOwner owner)
locks the object for the given owner
|
void |
markEdited()
Manually sets this document as being edited.
|
void |
markMetaDataModified(WGFileMetaData md)
Informs the parent resource that the file metadata object is modified, so it is saveable
|
boolean |
mayPushExtData(java.lang.String extName)
checks if extension data may be "pushed".
|
boolean |
mayRemove()
Tests if the current user is allowed to remove the current document
For getting more details about failure reasons for remove checks see
performRemoveCheck(boolean) |
boolean |
mayRemove(boolean deepCheck)
Tests if the current user is allowed to remove the current document
For getting more details about failure reasons for remove checks see
performRemoveCheck(boolean) |
boolean |
maySave()
Tests if the current user is allowed to save the current document
For getting more details about failure reasons for save checks see
performSaveCheck() |
void |
performRemoveCheck()
Performs a validation for removing the document at the current state, just like it actually was removed.
|
void |
performRemoveCheck(boolean deepCheck)
Performs a validation for removing the document at the current state, just like it actually was removed.
|
void |
performSaveCheck()
Performs a validation for saving the document at the current state, just like it actually was saved.
|
void |
pushData(WGDocument doc)
Pushed the data of this document to another document of the same type.
|
boolean |
remove()
Remove the current document permanently from the database.
|
void |
removeAllExtensionData()
Convenience method to remove all extension data fields from the document at once
|
void |
removeAllFiles()
Convenience method to remove all file attachments from the document at once
|
void |
removeAllItems()
Convenience method to remove all items from the document at once
|
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 the document
Note: When this method is called you should save the document before attempting to attach a
new file of the same name.
|
void |
removeFileDerivate(java.lang.String id)
Deletes an existing file derivate
|
void |
removeItem(java.lang.String name)
Removes an item from the document
|
void |
renameFile(java.lang.String oldFileName,
java.lang.String newFileName)
Renames a file exception on this document
|
boolean |
resultIsFalse(java.lang.Object exprResult)
Tests, if the given native expression result means "false" for this
database implementation.
|
boolean |
resultIsTrue(java.lang.Object exprResult)
Tests, if the given native expression result means "true" for this
database implementation.
|
boolean |
save()
Saved the current state of the document.
|
boolean |
save(java.util.Date lastModified)
Saves the current document with it's modifications.
|
void |
saveQuiet()
Saves the document without updating the last modified timestamp
|
void |
saveWithGivenTimestamps(java.util.Date created,
java.util.Date modified)
Sets the given dates as created and modified dates of the document and saved it with them
|
void |
setCachingEnabled(boolean b)
Controls if item/meta caching is enabled for this document.
|
WGDocument |
setItem(java.lang.String name,
java.lang.Object value) |
WGDocument |
setItems(java.util.Map<java.lang.String,java.lang.Object> values) |
boolean |
setItemValue(java.lang.String strName,
java.lang.Object value)
Sets an item to the given value.
|
WGDocument |
setMeta(java.lang.String name,
java.lang.Object value) |
boolean |
setMetaData(java.lang.String strName,
java.lang.Object value)
Sets a meta data of this document.
|
WGDocument |
setMetas(java.util.Map<java.lang.String,java.lang.Object> values) |
void |
setMetaToDefault(java.lang.String metaName)
sets the given meta to the default value
|
void |
setPrimaryFileName(java.lang.String name)
Manually sets the primary attachment of this document
|
WGDocument |
setValues(java.util.Map<java.lang.String,java.lang.Object> values) |
void |
unlock()
unlocks the document for the current sessioncontext
|
void |
unlock(LockOwner owner)
unlock the object if it is locked by the given owner
this method only delegates to LockOwner.releaseLock()
|
boolean |
validateMetas()
Variant of
validateMetas(boolean) that performs no auto correction. |
boolean |
validateMetas(boolean autoCorrection)
checks all metas of this document to ensure value and datatype correspond to the current
api implementation.
|
void |
writeExtensionData(java.lang.String strName,
java.lang.Object value)
Sets the value of an extension data field.
|
void |
writeFileDerivateMetaData(WGFileDerivateMetaData md)
Write modifications to derivate metadata to the derivate
|
public static java.util.regex.Pattern DERIVATE_NAME_PATTERN
public static final java.lang.String CSFEATURE_EXTDATA
WGContentStoreVersionException
regarding extension data operationspublic static final java.lang.String META_CREATED
public static final MetaInfo METAINFO_CREATED
public static final java.lang.String META_LASTMODIFIED
public static final MetaInfo METAINFO_LASTMODIFIED
public static final java.lang.String META_REVISION
public static final MetaInfo METAINFO_REVISION
public static final java.lang.String META_PASTAUTHORS
public static final MetaInfo METAINFO_PASTAUTHORS
public static final java.lang.String META_PASTEDITDATES
public static final MetaInfo METAINFO_PASTEDITDATES
public static final java.lang.String DOCKEY_DIVIDER
WGDocumentKey
strings, dividing the key partspublic static final int TYPE_CONTENT
public static final int TYPE_STRUCTENTRY
public static final int TYPE_AREA
public static final int TYPE_LANGUAGE
public static final int TYPE_CONTENTTYPE
public static final int TYPE_TML
public static final int TYPE_CSSJS
public static final int TYPE_FILECONTAINER
public static final int TYPE_USERPROFILE
public static final int TYPE_ACLENTRY
public static final int TYPE_DBMETADATA
public static final int TYPE_FILEDERIVATE
public static final java.lang.String TYPENAME_CONTENT
public static final java.lang.String TYPENAME_STRUCTENTRY
public static final java.lang.String TYPENAME_AREA
public static final java.lang.String TYPENAME_LANGUAGE
public static final java.lang.String TYPENAME_CONTENTTYPE
public static final java.lang.String TYPENAME_TML
public static final java.lang.String TYPENAME_CSSJS
public static final java.lang.String TYPENAME_FILECONTAINER
public static final java.lang.String TYPENAME_USERPROFILE
public static final java.lang.String TYPENAME_ACLENTRY
public static final java.lang.String TYPENAME_DBMETADATA
public static final java.lang.String TYPENAME_FILEDERIVATE
public static final java.lang.String EXTDATA_META_PREFIX
public static final java.lang.String EXT_PRIMARY_ATTACHMENT
public static final java.lang.String NOONE_ALLOWED
public static final java.lang.String PAGERESTRICTION_UNSPECIFIED
public static final java.lang.String PAGERESTRICTION_NONE
public static final java.lang.String PAGERESTRICTION_ANY
public static final java.lang.String PAGERESTRICTION_FIXEDTYPES
public WGDocument(WGDatabase db, WGDocumentCore core) throws WGAPIException
WGAPIException
public WGDocument(WGDatabase db, WGDocumentCore core, de.innovationgate.webgate.api.WGDocumentObjectFlags flags) throws WGAPIException
db
- core
- tempDuplicate
- WGAPIException
public MetaInfo getMetaInfo(java.lang.String metaName) throws WGSystemException
metaName
- The name of the metadate field to return information forWGSystemException
- if the metaDataFramework cannot be accessedpublic static MetaInfo getMetaInfoByType(int type, java.lang.String metaName) throws WGSystemException, WGIllegalArgumentException
type
- metaName
- WGSystemException
- if metaDataFramework access failsWGIllegalArgumentException
- if type or metaName are invalidpublic static java.lang.Class<?> getExpectedMetaClass(int type, java.lang.String metaName) throws WGSystemException, WGIllegalArgumentException
type
- Document type for the metadata fieldmetaName
- Name of the metadata fieldWGIllegalArgumentException
WGSystemException
public static boolean isListMeta(int type, java.lang.String name) throws WGSystemException, WGIllegalArgumentException
type
- Document type of metadata fieldname
- Name of metadata fieldWGIllegalArgumentException
WGSystemException
public boolean validateMetas(boolean autoCorrection) throws WGAPIException
WGAPIException
public boolean validateMetas() throws WGAPIException
validateMetas(boolean)
that performs no auto correction.WGAPIException
public void setMetaToDefault(java.lang.String metaName) throws WGAPIException
metaName
- WGAPIException
public static WGDocumentKey buildDocumentKey(WGDocumentCore core, WGDatabase db) throws WGAPIException
core
- WGAPIException
public java.lang.String getDocumentKey()
public WGDocumentKey getDocumentKeyObj()
public static int doctypeNameToNumber(java.lang.String name)
name
- public static java.lang.Class<?> doctypeNumberToClass(int number)
number
- The doctype numberpublic static java.lang.Integer docTypeClassToNumber(java.lang.Class<?> clazz)
clazz
- the doctype classpublic static java.lang.String doctypeNumberToName(int number)
number
- public void dropCache() throws WGAPIException
WGAPIException
public java.lang.String getItemText(java.lang.String strName) throws WGAPIException
strName
- Name of the itemWGAPIException
public java.lang.Object getItemValue(java.lang.String strName) throws WGAPIException
strName
- Name of the itemWGAPIException
public java.util.List<?> getItemValueList(java.lang.String name) throws WGAPIException
name
- The item's nameWGAPIException
public java.lang.Number getItemNumber(java.lang.String strName) throws WGAPIException
strName
- Name of the item.WGAPIException
public java.util.Date getItemDate(java.lang.String strName) throws WGAPIException
strName
- Name of the itemWGAPIException
public boolean setItemValue(java.lang.String strName, java.lang.Object value) throws WGAPIException
strName
- Name of the itemvalue
- Value of the item. Accepted values are dependent to the
database implementationWGAPIException
public boolean setMetaData(java.lang.String strName, java.lang.Object value) throws WGAPIException
strName
- Name of the meta data. Use constants META_... of WGDocument
and all descendant objects.value
- Value to set this metadataWGAPIException
public boolean save(java.util.Date lastModified) throws WGAPIException
lastModified
- Date of last modification to set (if this is supported by the implementation)WGAuthorisationException
WGValidationException
LockException
- - instance of ResourceIsLockedException if a process try to modifiy a locked object without obtaining a lockWGSystemException
WGIllegalArgumentException
WGAPIException
public void performSaveCheck() throws WGAuthorisationException, WGAPIException, ResourceIsLockedException
WGAuthorisationException
is thrown.
For checking saving permissions without catching an exception see maySave()
.public boolean maySave() throws WGAPIException
performSaveCheck()
WGAPIException
public boolean mayRemove() throws WGAPIException
performRemoveCheck(boolean)
WGAPIException
public boolean mayRemove(boolean deepCheck) throws WGAPIException
performRemoveCheck(boolean)
deepCheck
- Perform an hierarchical check beyond the current document, which is more expensive but also 100% accurate. This is only effective for document types whose deletion will also delete dependent documents.WGAPIException
public boolean save() throws WGAPIException
WGAPIException
public java.lang.Object evaluateExpression(java.lang.String expression) throws WGAPIException
expression
- The expressionWGAPIException
public WGDatabase getDatabase()
public abstract int getType()
public java.lang.Object getMetaData(java.lang.String name) throws WGAPIException
WGAPIException
public static java.lang.String getExtdataMetaName(MetaInfo metaInfo)
metaInfo
- The metaInfo of the metadata fieldpublic java.util.List<?> getMetaDataList(java.lang.String name) throws WGAPIException
WGAPIException
public java.util.Date getCreated() throws WGAPIException
WGAPIException
public java.util.Date getLastModified() throws WGAPIException
WGAPIException
public WGDocumentCore getCore() throws WGAPIException
WGAPIException
public boolean isCoreRetrieved() throws WGClosedSessionException
WGClosedSessionException
public boolean resultIsTrue(java.lang.Object exprResult)
public boolean resultIsFalse(java.lang.Object exprResult)
exprResult
- public boolean isTemporary()
public boolean isDeleted(boolean forceBackendCheck) throws WGAPIException
forceBackendCheck
- Specify true if you want to enforce a check on the database backend. Otherwise WGAPI may choose to check cached deletion flags.WGAPIException
public boolean isDeleted() throws WGAPIException
isDeleted(boolean)
to force real backend check.WGAPIException
public java.util.List<java.lang.String> getFileNames() throws WGAPIException
WGAPIException
public void removeAllFiles() throws WGAPIException
WGAPIException
public void attachAllFiles(WGDocument doc) throws java.io.IOException, WGAPIException
doc
- The document to get attachments fromjava.io.IOException
WGAPIException
public void attachAllFiles(WGDocument doc, boolean copyExtensionData) throws java.io.IOException, WGAPIException
doc
- The document to get attachments fromcopyExtensionData
- Specify true to also copy extension data from source to target. The sources extension data will overwrite eventual automatic annotations done on the attaching process.java.io.IOException
WGAPIException
public java.io.InputStream getFileData(java.lang.String strFile) throws WGAPIException
strFile
- The name of the attachmentWGAPIException
public WGFileMetaData getFileMetaData(java.lang.String strFile) throws WGAPIException
strFile
- WGAPIException
public java.lang.String getFileMimeType(java.lang.String strFile) throws WGAPIException
WGFileMetaData
. If that does not exist it will fallback to mimetype determination based on file data.strFile
- WGAPIException
public java.util.Collection<java.lang.String> getFileMimeTypes(java.lang.String strFile) throws WGAPIException
getFileMimeType(String)
.strFile
- WGAPIException
public java.io.Reader getFileText(java.lang.String strFile) throws WGAPIException
getFileText(String)
which allows specifying an encodingstrFile
- The file attachmentWGAPIException
public java.io.Reader getFileText(java.lang.String strFile, java.lang.String encoding) throws WGAPIException, java.io.UnsupportedEncodingException
strFile
- The file attachmentencoding
- The text encoding to use when interpreting the file data as textWGAPIException
java.io.UnsupportedEncodingException
public int getFileSize(java.lang.String strFile) throws WGAPIException
strFile
- The file to retrieve size information forWGAPIException
public java.util.Date getFileLastModified(java.lang.String file) throws WGAPIException
file
- Name of the file attachmentWGAPIException
public void dropCore() throws WGClosedSessionException
WGClosedSessionException
public java.util.Map<java.lang.String,java.lang.Object> getPersistentStore()
public static java.lang.String getName(WGDocumentCore core) throws WGAPIException
core
- WGAPIException
public boolean hasItem(java.lang.String itemName) throws WGAPIException
WGAPIException
public java.util.List<java.lang.String> getItemNames() throws WGAPIException
WGAPIException
public void removeItem(java.lang.String name) throws WGAPIException
name
- Name of the itemWGAPIException
public boolean attachFile(java.io.File file, java.util.List<WGFileAnnotator> additionalAnnotators) throws WGAPIException
file
- The file on disk.additionalAnnotators
- Additional annotators to annotate the attached file with image information or custom fields. Specify null to use no additional annotators.WGAPIException
public boolean innerAttachFile(java.io.File file) throws WGAPIException, WGClosedSessionException
public boolean attachFileWithoutAnnotation(java.io.File file) throws WGAPIException
file
- The file on disk.WGAPIException
public boolean attachFile(java.io.File file) throws WGAPIException
file
- The file on disk.WGAPIException
public void renameFile(java.lang.String oldFileName, java.lang.String newFileName) throws WGAPIException, java.io.IOException
oldFileName
- The current file namenewFileName
- The new file nameWGAPIException
java.io.IOException
public boolean attachFile(java.io.InputStream stream, java.lang.String filename) throws WGAPIException, java.io.IOException
attachFile(File)
that creates a temporary file of the desired name
and attaches this. This is becaues some WGAPI implementations cannot attach a data stream directly but need
a physical file.stream
- The input stream providing the file datafilename
- The file name under which the file will be attachedWGAPIException
java.io.IOException
public boolean attachFileWithoutAnnotation(java.io.InputStream stream, java.lang.String filename) throws WGAPIException, java.io.IOException
attachFileWithoutAnnotation(File)
that creates a temporary file of the desired name
and attaches this. This is becaues some WGAPI implementations cannot attach a data stream directly but need
a physical file.stream
- The input stream providing the file datafilename
- The file name under which the file will be attachedWGAPIException
java.io.IOException
public boolean removeFile(java.lang.String name) throws WGAPIException
name
- Name of the file attachmentWGAPIException
public final boolean remove() throws WGAPIException
WGAPIException
public final void performRemoveCheck() throws WGAuthorisationException, WGAPIException
WGAuthorisationException
is thrown.
For checking remove permissions without catching an exception see mayRemove(boolean)
.
This remove check performs no exhaustive "deep" check, like can be triggered via performRemoveCheck(boolean)
.public final void performRemoveCheck(boolean deepCheck) throws WGAuthorisationException, WGAPIException
WGAuthorisationException
is thrown.
For checking remove permissions without catching an exception see mayRemove(boolean)
.deepCheck
- Perform an hierarchical check beyond the current document, which is more expensive but also 100% accurate. This is only effective for document types whose deletion will also delete dependent documents.WGAuthorisationException
WGAPIException
public abstract WGDocument createClone(WGDatabase db, WGDocument ref) throws WGAPIException
db
- The target databaseref
- A reference document in the target database. For struct
entries, this is the parent entry in the target db. For
contents this is the struct entry in the target db.WGAPIException
public boolean isCachingEnabled()
public void setCachingEnabled(boolean b)
b
- public boolean isSaved() throws WGAPIException
WGAPIException
public java.util.List<java.lang.String> getPastAuthors() throws WGAPIException
WGAPIException
public java.util.List<java.util.Date> getPastEditDates() throws WGAPIException
WGAPIException
public int getRevision() throws WGAPIException
WGAPIException
public java.util.List<java.lang.String> getMetaNames() throws WGSystemException
WGSystemException
public java.lang.Object getNativeObject() throws WGAPIException
WGAPIException
public boolean isEdited() throws WGClosedSessionException
WGClosedSessionException
public void markEdited() throws WGClosedSessionException
WGSessionContext.getEditedDocuments()
.WGClosedSessionException
public void pushData(WGDocument doc) throws WGAPIException
doc
- The target document receiving the data.WGAPIException
- If something goes wrongpublic boolean mayPushExtData(java.lang.String extName)
extName
- public boolean isDummy()
public java.util.Date getCoreRetrieved() throws WGClosedSessionException
WGClosedSessionException
public java.util.Date getObjectCreated()
public boolean hasFile(java.lang.String name) throws WGAPIException
name
- The name of file to searchWGAPIException
public void lock(LockOwner owner) throws WGAPIException
Lockable
lock
in interface Lockable
WGAPIException
- - instance of LockWaitTimeoutException when the lock request timed out- instance of ParentIsLockedException when the lock cannot be obtained
because the parent object is already locked
- other API Exceptions on API errors
public void lock() throws WGAPIException
WGAPIException
public void unlock(LockOwner owner)
Lockable
public void unlock()
public int getLockStatus(LockOwner owner) throws WGAPIException
Lockable
getLockStatus
in interface Lockable
owner
- - LockOwner who wants to retrieve his lockstatus for this documentWGAPIException
public int getLockStatus() throws WGAPIException
WGAPIException
public abstract Lockable getParentLockable() throws WGAPIException
Lockable
getParentLockable
in interface Lockable
WGAPIException
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public void removeAllItems() throws WGAPIException
WGAPIException
public void removeAllExtensionData() throws WGAPIException
WGAPIException
public void saveWithGivenTimestamps(java.util.Date created, java.util.Date modified) throws WGAPIException
created
- The created datemodified
- The modified dateWGAPIException
public void saveQuiet() throws WGAPIException
WGAPIException
public boolean hasFileMetadata() throws WGAPIException
WGAPIException
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<java.lang.String> 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.lang.String getPrimaryFileName() throws WGAPIException
setPrimaryFileName(String)
.WGAPIException
public void setPrimaryFileName(java.lang.String name) throws WGAPIException
name
- The name of the file to become primary attachment. Use null to remove the current primary attachment reference (not the attachment itself)WGAPIException
public java.util.List<WGFileDerivateMetaData> getFileDerivates(java.lang.String fileName) throws WGAPIException
fileName
- The name of the fileWGAPIException
public void markMetaDataModified(WGFileMetaData md) throws WGAPIException
WGFileMetaDataContext
markMetaDataModified
in interface WGFileMetaDataContext
WGAPIException
public WGFileDerivateMetaData getFileDerivateMetaData(java.lang.String id) throws WGAPIException
id
- ID of the derivateWGAPIException
public void writeFileDerivateMetaData(WGFileDerivateMetaData md) throws WGAPIException
md
- The modified metadataWGAPIException
public java.io.InputStream getFileDerivateData(java.lang.String id) throws WGAPIException
id
- The derivate idWGAPIException
public WGFileDerivateMetaData createFileDerivate(java.lang.String fileName, java.lang.String creator, java.lang.String name, java.io.File file, java.lang.String usage, java.util.List<WGFileAnnotator> additionalAnnotators) throws WGAPIException
fileName
- The name of the original file on the documentcreator
- An ID of the creator classname
- The name of the derivate to createfile
- The derivate data as fileusage
- The usage type of the derivateadditionalAnnotators
- Additional annotators to annotate the attached derivate with image information or custom fields. Specify null to use no additional annotators.WGAPIException
public WGFileDerivateMetaData createFileDerivate(java.lang.String fileName, java.lang.String creator, java.lang.String derivateName, java.io.InputStream in, java.lang.String usage, java.util.List<WGFileAnnotator> additionalAnnotators) throws WGAPIException, java.io.IOException
fileName
- The name of the original file on the documentcreator
- An ID of the creator classderivateName
- The name of the derivate to createin
- The data of the derivateusage
- The usage type of the derivateadditionalAnnotators
- Additional annotators to run on the new derivatejava.io.IOException
WGAPIException
public void removeFileDerivate(java.lang.String id) throws WGAPIException
id
- The derivate IDWGAPIException
public de.innovationgate.utils.SkippingIterator<WGUpdateLog> getLastUpdates() throws WGAPIException
WGAPIException
public WGDocument getFileParent()
WGFileMetaDataContext
getFileParent
in interface WGFileMetaDataContext
public void afterSave(WGDocument.SaveAction action) throws WGAPIException
action
- The action to executeWGAPIException
public void autoSave() throws WGAPIException
WGAPIException
public WGDocument setItem(java.lang.String name, java.lang.Object value) throws WGAPIException
WGAPIException
public WGDocument setItems(java.util.Map<java.lang.String,java.lang.Object> values) throws WGAPIException
WGAPIException
public WGDocument setMeta(java.lang.String name, java.lang.Object value) throws WGAPIException
WGAPIException
public WGDocument setMetas(java.util.Map<java.lang.String,java.lang.Object> values) throws WGAPIException
WGAPIException
public WGDocument setValues(java.util.Map<java.lang.String,java.lang.Object> values) throws WGAPIException
WGAPIException