Package com.xpn.xwiki.doc
Class LazyXWikiDocument
- java.lang.Object
-
- com.xpn.xwiki.doc.XWikiDocument
-
- com.xpn.xwiki.doc.LazyXWikiDocument
-
- All Implemented Interfaces:
Cloneable
,DocumentModelBridge
public class LazyXWikiDocument extends XWikiDocument
Read only lazy loading document.The following informations are taken into account:
- document reference: the absolute reference of the document
- document language: if provided the proper language version of the document is loaded. If not the default one is loaded.
- document version: if provided the proper version of the document is loaded. Also make extra sure to bypass cache storage for remote observation use case.
originalDocument remain the property of
LazyXWikiDocument
object and is not taken from the lazy loaded document since it depends on how thisXWikiDocument
object is used (its technical meaning is its state in the database before any modification but in the case of observation it's used as the previous version of the document). TODO: we should probably think about a separation of theses two notions in something more clear, something for the new model.- Since:
- 2.0M4
- Version:
- $Id: e215d894834917f828fdedad1e54c9872379f377 $
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.xpn.xwiki.doc.XWikiDocument
XWikiDocument.XWikiAttachmentToRemove
-
-
Field Summary
-
Fields inherited from class com.xpn.xwiki.doc.XWikiDocument
CKEY_SDOC, COMMENTSCLASS_REFERENCE, DB_SPACE_SEP, HAS_ATTACHMENTS, HAS_CLASS, HAS_OBJECTS, SHEETCLASS_REFERENCE, SPACE_NAME_SEP, version
-
-
Constructor Summary
Constructors Constructor Description LazyXWikiDocument()
Deprecated.useLazyXWikiDocument(DocumentReference)
insteadLazyXWikiDocument(DocumentReference documentReference)
-
Method Summary
-
Methods inherited from class com.xpn.xwiki.doc.XWikiDocument
addAttachment, addAttachment, addAttachment, addObject, addObjectFromRequest, addObjectFromRequest, addObjectFromRequest, addObjectFromRequest, addObjectsFromRequest, addObjectsFromRequest, addObjectsToRemove, addToZip, addToZip, addToZip, addXObject, addXObject, addXObjectFromRequest, addXObjectFromRequest, addXObjectFromRequest, addXObjectFromRequest, addXObjectFromRequest, addXObjectsFromRequest, addXObjectsFromRequest, addXObjectsToRemoveFromVersion, addXObjectToRemove, appendMeta, apply, apply, backupContext, clearAttachmentsToRemove, clone, clone, cloneRename, cloneXObjects, containsXMLWikiDocument, convertSyntax, convertSyntax, copyAttachments, copyDocument, copyDocument, copyDocument, createNewObject, createXObject, display, display, display, display, display, display, display, display, display, display, display, displayDocument, displayDocument, displayDocument, displayDocument, displayEdit, displayForm, displayForm, displayForm, displayForm, displayForm, displayForm, displayHidden, displayPrettyName, displayPrettyName, displayPrettyName, displayPrettyName, displayPrettyName, displayPrettyName, displayRendered, displayTooltip, displayTooltip, displayView, duplicate, duplicateXObjects, encodedXMLStringAsUTF8, equals, equalsData, fromXML, fromXML, fromXML, fromXML, fromXML, fromXML, getAttachment, getAttachmentDiff, getAttachmentList, getAttachmentRevisionURL, getAttachmentRevisionURL, getAttachmentStore, getAttachmentsToRemove, getAttachmentURL, getAttachmentURL, getAttachmentURL, getAuthor, getAuthors, getBackLinkedPages, getBackLinkedReferences, getChildren, getChildren, getChildrenReferences, getChildrenReferences, getClassDiff, getComments, getComments, getContentAuthor, getContentDiff, getContentDiff, getContentDiff, getContentOfSection, getCreator, getDatabase, getDefaultEditMode, getDefaultEditURL, getDefaultLanguage, getDeltas, getDocumentReference, getDocumentReferenceWithLocale, getDocumentSection, getEditURL, getEditURL, getElement, getEscapedContent, getExactAttachment, getExternalAttachmentURL, getExternalURL, getExternalURL, getFirstObject, getFirstObject, getFullName, getIncludedMacros, getIncludedPages, getInternalProperty, getInternalPropertyName, getIntValue, getIntValue, getIntValue, getIntValue, getKey, getLanguage, getLastChanges, getListValue, getListValue, getListValue, getLocale, getLocalReferenceMaxLength, getLock, getLongValue, getLongValue, getLongValue, getMetaDataDiff, getMetaDataDiff, getMetaDataDiff, getMinorEdit1, getName, getNextVersion, getObject, getObject, getObject, getObject, getObject, getObjectDiff, getObjectDiff, getObjectDiff, getObjectNumbers, getObjects, getObjectsToRemove, getOriginalDocument, getPageName, getPageReference, getPageReferenceWithLocale, getParent, getParentDoc, getParentURL, getPrefixedFullName, getPreviousVersion, getRealLanguage, getRealLanguage, getRealLocale, getRecentRevisions, getRenderedContent, getRenderedContent, getRenderedContent, getRenderedContent, getRenderedContent, getRenderedContent, getRenderedContent, getRenderedContent, getRenderedContent, getRenderedContent, getRenderedContent, getRenderedContent, getRenderedContent, getRenderedContentDiff, getRenderedContentDiff, getRenderedContentDiff, getRenderedTitle, getRenderedTitle, getRevisionInfo, getRevisions, getRevisions, getSections, getSpace, getSpaceName, getStringValue, getStringValue, getStringValue, getStringValue, getSyntaxId, getTagsList, getTemplate, getTemplateDocumentReference, getTranslatedContent, getTranslatedContent, getTranslatedDocument, getTranslatedDocument, getTranslatedDocument, getTranslationList, getTranslationLocales, getUniqueLinkedEntities, getUniqueLinkedPages, getUniqueWikiLinkedPages, getURL, getURL, getURL, getURL, getURL, getVersion, getVersionHashCode, getVersioningStore, getWeb, getWikiName, getXClasses, getXMLContent, getXMLDiff, getXObject, getXObject, getXObject, getXObject, getXObject, getXObject, getXObject, getXObject, getXObject, getXObject, getXObject, getXObject, getXObject, getXObjectProperty, getXObjects, getXObjects, getXObjectSize, getXObjectSize, getXObjectsToRemove, getxWikiClassXML, getxWikiObject, hasElement, hashCode, incrementVersion, initialize, insertText, is10Syntax, is10Syntax, isAdvancedContent, isContentDirty, isCreator, isCreator, isCurrentLocalUserPage, isCurrentUserCreator, isCurrentUserPage, isMetaDataDirty, isMinorEdit, isNew, isProgrammaticContent, isRestricted, loadAttachmentContent, loadAttachments, loadAttachmentsContent, loadAttachmentsContentSafe, loadDocumentArchive, merge, mergeXClass, mergeXObjects, mergexWikiClass, mergexWikiObjects, newDocument, newDocument, newDocument, newObject, newXObject, readAddedUpdatedAndRemovedObjectsFromForm, readDocMetaFromForm, readFromForm, readFromTemplate, readObjectsFromForm, readObjectsFromFormUpdateOrCreate, readTemporaryUploadedFiles, readTranslationMetaFromForm, removeAttachment, removeAttachment, removeLock, removeObject, removeObjects, removeXObject, removeXObjects, removeXObjects, rename, rename, rename, renameProperties, renameProperties, renderXDOM, resetArchive, resolveClassReference, restoreContext, saveAllAttachments, saveAllAttachments, saveAttachmentContent, saveAttachmentContent, saveAttachmentsContent, setAsContextDoc, setAttachment, setAttachment, setAttachmentList, setAuthor, setAuthorReference, setComment, setContent, setContent, setContentAuthor, setContentAuthorReference, setContentDirty, setContentUpdateDate, setCreationDate, setCreator, setCreatorReference, setCustomClass, setDatabase, setDate, setDBStringListValue, setDBStringListValue, setDefaultLanguage, setDefaultLocale, setDefaultTemplate, setDocumentArchive, setDocumentArchive, setDocumentReference, setElement, setElements, setFormat, setFromCache, setFullName, setFullName, setHidden, setId, setIntValue, setIntValue, setLanguage, setLargeStringValue, setLargeStringValue, setLocale, setLock, setMeta, setMetaDataDirty, setMinorEdit, setMinorEdit1, setMostRecent, setName, setNew, setObject, setOriginalDocument, setParent, setParentReference, setProperty, setProperty, setRCSVersion, setRestricted, setSpace, setStore, setStringListValue, setStringListValue, setStringValue, setStringValue, setSyntax, setSyntaxId, setTags, setTemplate, setTemplateDocumentReference, setTitle, setTranslation, setValidationScript, setVersion, setWeb, setWikiNode, setXClass, setXClassXML, setXObject, setXObject, setXObjects, setXObjects, setXObjectsToRemove, setxWikiClassXML, toFullXML, toString, toXML, toXML, toXML, toXML, toXML, toXML, toXMLDocument, updateDocumentSection, updateObjectFromRequest, updateObjectFromRequest, updateObjectFromRequest, updateObjectsFromRequest, updateObjectsFromRequest, updateXObjectFromRequest, updateXObjectFromRequest, updateXObjectFromRequest, updateXObjectsFromRequest, updateXObjectsFromRequest, validate, validate
-
-
-
-
Constructor Detail
-
LazyXWikiDocument
@Deprecated public LazyXWikiDocument()
Deprecated.useLazyXWikiDocument(DocumentReference)
instead
-
LazyXWikiDocument
public LazyXWikiDocument(DocumentReference documentReference)
-
-
Method Detail
-
getRCSVersion
public org.suigeneris.jrcs.rcs.Version getRCSVersion()
- Overrides:
getRCSVersion
in classXWikiDocument
-
getContent
public String getContent()
- Specified by:
getContent
in interfaceDocumentModelBridge
- Overrides:
getContent
in classXWikiDocument
-
getXObjects
public Map<DocumentReference,List<BaseObject>> getXObjects()
- Overrides:
getXObjects
in classXWikiDocument
-
getXClass
public BaseClass getXClass()
- Overrides:
getXClass
in classXWikiDocument
-
getXClassXML
public String getXClassXML()
- Overrides:
getXClassXML
in classXWikiDocument
-
getAuthorReference
public DocumentReference getAuthorReference()
- Overrides:
getAuthorReference
in classXWikiDocument
-
getContentAuthorReference
public DocumentReference getContentAuthorReference()
- Specified by:
getContentAuthorReference
in interfaceDocumentModelBridge
- Overrides:
getContentAuthorReference
in classXWikiDocument
-
getCreatorReference
public DocumentReference getCreatorReference()
- Overrides:
getCreatorReference
in classXWikiDocument
-
getDate
public Date getDate()
- Specified by:
getDate
in interfaceDocumentModelBridge
- Overrides:
getDate
in classXWikiDocument
-
getCreationDate
public Date getCreationDate()
- Specified by:
getCreationDate
in interfaceDocumentModelBridge
- Overrides:
getCreationDate
in classXWikiDocument
-
getContentUpdateDate
public Date getContentUpdateDate()
- Overrides:
getContentUpdateDate
in classXWikiDocument
-
getMeta
public String getMeta()
- Overrides:
getMeta
in classXWikiDocument
-
getTitle
public String getTitle()
- Specified by:
getTitle
in interfaceDocumentModelBridge
- Overrides:
getTitle
in classXWikiDocument
-
getFormat
public String getFormat()
- Overrides:
getFormat
in classXWikiDocument
-
getDefaultLocale
public Locale getDefaultLocale()
- Overrides:
getDefaultLocale
in classXWikiDocument
-
getTranslation
public int getTranslation()
- Overrides:
getTranslation
in classXWikiDocument
-
getCustomClass
public String getCustomClass()
- Overrides:
getCustomClass
in classXWikiDocument
-
getRelativeParentReference
public EntityReference getRelativeParentReference()
Description copied from class:XWikiDocument
Return the reference of the parent document as it stored and passed toXWikiDocument.setParentReference(EntityReference)
.You should use
XWikiDocument.getParentReference()
reference if you want the complete parent reference.- Overrides:
getRelativeParentReference
in classXWikiDocument
- Returns:
- the relative parent reference
-
getParentReference
public DocumentReference getParentReference()
- Overrides:
getParentReference
in classXWikiDocument
- Returns:
- the parent reference or null if the parent is not set
-
getElements
public int getElements()
- Overrides:
getElements
in classXWikiDocument
-
getDefaultTemplate
public String getDefaultTemplate()
- Overrides:
getDefaultTemplate
in classXWikiDocument
-
getValidationScript
public String getValidationScript()
- Overrides:
getValidationScript
in classXWikiDocument
-
getComment
public String getComment()
- Overrides:
getComment
in classXWikiDocument
-
getSyntax
public org.xwiki.rendering.syntax.Syntax getSyntax()
- Specified by:
getSyntax
in interfaceDocumentModelBridge
- Overrides:
getSyntax
in classXWikiDocument
- Returns:
- the syntax of the document
-
isHidden
public Boolean isHidden()
Description copied from class:XWikiDocument
Indicates whether the document is 'hidden' or not, meaning that it should not be returned in public search results.- Specified by:
isHidden
in interfaceDocumentModelBridge
- Overrides:
isHidden
in classXWikiDocument
- Returns:
true
if the document is hidden and does not appear among the results ofXWiki.searchDocuments(String)
,false
otherwise.
-
getDocumentArchive
public XWikiDocumentArchive getDocumentArchive()
- Overrides:
getDocumentArchive
in classXWikiDocument
- Returns:
- the
XWikiDocumentArchive
for this document. If it is not stored in the document, null is returned.
-
loadArchive
public void loadArchive(XWikiContext context) throws XWikiException
- Overrides:
loadArchive
in classXWikiDocument
- Throws:
XWikiException
-
getDocumentArchive
public XWikiDocumentArchive getDocumentArchive(XWikiContext context) throws XWikiException
- Overrides:
getDocumentArchive
in classXWikiDocument
- Throws:
XWikiException
-
getStore
public XWikiStoreInterface getStore()
- Overrides:
getStore
in classXWikiDocument
-
getId
public long getId()
- Overrides:
getId
in classXWikiDocument
- Returns:
- the unique id used to represent the document, as a number. This id is technical and is equivalent to the Document Reference + the language of the Document. This technical id should only be used for the storage layer and all user APIs should instead use Document Reference and language as they are model-related while the id isn't (it's purely technical).
-
getStore
public XWikiStoreInterface getStore(XWikiContext context)
- Overrides:
getStore
in classXWikiDocument
-
getXDOM
public org.xwiki.rendering.block.XDOM getXDOM()
Description copied from class:XWikiDocument
NOTE: This method caches the XDOM and returns a clone that can be safely modified.- Specified by:
getXDOM
in interfaceDocumentModelBridge
- Overrides:
getXDOM
in classXWikiDocument
- Returns:
- the XDOM corresponding to the document's string content
-
getTags
public String getTags(XWikiContext context)
- Overrides:
getTags
in classXWikiDocument
-
getTagsPossibleValues
public List<String> getTagsPossibleValues(XWikiContext context)
- Overrides:
getTagsPossibleValues
in classXWikiDocument
-
isFromCache
public boolean isFromCache()
- Overrides:
isFromCache
in classXWikiDocument
-
isMostRecent
public boolean isMostRecent()
- Overrides:
isMostRecent
in classXWikiDocument
- Returns:
- Is this version the most recent one. False if and only if there are newer versions of this document in the database.
-
toXMLDocument
public org.dom4j.Document toXMLDocument(boolean bWithObjects, boolean bWithRendering, boolean bWithAttachmentContent, boolean bWithVersions, XWikiContext context) throws XWikiException
Description copied from class:XWikiDocument
Serialize the document to an XMLDOMDocument
. You should preferXWikiDocument.toXML(OutputStream, boolean, boolean, boolean, boolean, XWikiContext)
orXWikiDocument.toXML(com.xpn.xwiki.internal.xml.XMLWriter, boolean, boolean, boolean, boolean, XWikiContext)
when possible to reduce memory load.- Overrides:
toXMLDocument
in classXWikiDocument
- Parameters:
bWithObjects
- include XObjectsbWithRendering
- include the rendered contentbWithAttachmentContent
- include attachments contentbWithVersions
- include archived versionscontext
- current XWikiContext- Returns:
- a
DOMDocument
containing the serialized document. - Throws:
XWikiException
- when an errors occurs during wiki operations
-
getWikiNode
public Object getWikiNode()
- Overrides:
getWikiNode
in classXWikiDocument
-
-