com.xpn.xwiki.doc
Class XWikiDocument

java.lang.Object
  extended by com.xpn.xwiki.doc.XWikiDocument
All Implemented Interfaces:
Cloneable, DocumentModelBridge
Direct Known Subclasses:
LazyXWikiDocument

public class XWikiDocument
extends Object
implements DocumentModelBridge, Cloneable


Nested Class Summary
static class XWikiDocument.XWikiAttachmentToRemove
          An attachment waiting to be deleted at next document save.
 
Field Summary
static EntityReference COMMENTSCLASS_REFERENCE
           
protected  EntityReferenceSerializer<String> compactEntityReferenceSerializer
          Used to convert a proper Document Reference to string (compact form).
protected  EntityReferenceSerializer<String> compactWikiEntityReferenceSerializer
          Used to convert a Document Reference to string (compact form without the wiki part if it matches the current wiki).
protected  DocumentReferenceResolver<String> currentDocumentReferenceResolver
          Used to resolve a string into a proper Document Reference using the current document's reference to fill the blanks.
protected  DocumentReferenceResolver<String> currentMixedDocumentReferenceResolver
          Used to resolve a string into a proper Document Reference using the current document's reference to fill the blanks, except for the page name for which the default page name is used instead and for the wiki name for which the current wiki is used instead of the current document reference's wiki.
protected  DocumentReferenceResolver<EntityReference> currentReferenceDocumentReferenceResolver
          Used to normalize references.
protected  ObjectReferenceResolver<EntityReference> currentReferenceObjectReferenceResolver
          Used to normalize references.
static String DB_SPACE_SEP
          Separator string between database name and space name.
protected  EntityReferenceSerializer<String> defaultEntityReferenceSerializer
          Used to convert a proper Document Reference to string (standard form).
protected  DocumentReferenceResolver<String> explicitDocumentReferenceResolver
          Used to resolve a string into a proper Document Reference.
protected  DocumentReferenceResolver<EntityReference> explicitReferenceDocumentReferenceResolver
          Used to normalize references.
static int HAS_ATTACHMENTS
           
static int HAS_CLASS
           
static int HAS_OBJECTS
           
protected  EntityReferenceSerializer<String> localEntityReferenceSerializer
          Used to convert a proper Document Reference to a string but without the wiki name.
protected  EntityReferenceSerializer<String> localUidStringEntityReferenceSerializer
          Used to compute document identifier.
protected  EntityReferenceResolver<String> relativeEntityReferenceResolver
          Used to resolve parent references in the way they are stored externally (database, xml, etc), ie relative or absolute.
static EntityReference SHEETCLASS_REFERENCE
           
static String SPACE_NAME_SEP
          Separator string between space name and page name.
protected  org.xwiki.rendering.syntax.SyntaxFactory syntaxFactory
          Used to create proper Syntax objects.
protected  EntityReferenceSerializer<String> uidStringEntityReferenceSerializer
          Used to compute document identifier.
protected  org.suigeneris.jrcs.rcs.Version version
           
protected  EntityReferenceResolver<String> xClassEntityReferenceResolver
           
 
Constructor Summary
XWikiDocument()
          Deprecated. since 2.2M1 use XWikiDocument(org.xwiki.model.reference.DocumentReference) instead
XWikiDocument(DocumentReference reference)
           
XWikiDocument(String space, String name)
          Deprecated. since 2.2M1 use XWikiDocument(org.xwiki.model.reference.DocumentReference) instead
XWikiDocument(String wiki, String space, String name)
          Deprecated. since 2.2M1 use XWikiDocument(org.xwiki.model.reference.DocumentReference) instead
 
Method Summary
 XWikiAttachment addAttachment(String fileName, byte[] content, XWikiContext context)
          Deprecated. use addAttachment(String, InputStream, XWikiContext) instead
 XWikiAttachment addAttachment(String fileName, InputStream content, XWikiContext context)
           
 void addAttachment(XWikiAttachment attachment)
          Add passed attachment to the document.
 void addObject(String className, BaseObject object)
          Deprecated. since 2.2M1 use addXObject(BaseObject) instead
 BaseObject addObjectFromRequest(String className, int num, XWikiContext context)
          Deprecated. since 2.2M2 use addXObjectFromRequest(DocumentReference, int, XWikiContext)
 BaseObject addObjectFromRequest(String className, String prefix, int num, XWikiContext context)
          Deprecated. since 2.2M2 use addXObjectFromRequest(EntityReference, String, int, XWikiContext)
 BaseObject addObjectFromRequest(String className, String prefix, XWikiContext context)
          Deprecated. since 2.2M2 use addXObjectFromRequest(DocumentReference, String, XWikiContext)
 BaseObject addObjectFromRequest(String className, XWikiContext context)
          Deprecated. since 2.2M2 use addXObjectFromRequest(EntityReference, XWikiContext)
 List<BaseObject> addObjectsFromRequest(String className, String pref, XWikiContext context)
          Deprecated. since 2.2M2 use addXObjectsFromRequest(DocumentReference, String, XWikiContext)
 List<BaseObject> addObjectsFromRequest(String className, XWikiContext context)
          Deprecated. since 2.2M2 use addXObjectsFromRequest(DocumentReference, XWikiContext)
 void addObjectsToRemove(BaseObject object)
          Deprecated. since 2.2M2 use addXObjectToRemove(BaseObject) )} instead
 void addToZip(ZipOutputStream zos, boolean withVersions, XWikiContext context)
          Deprecated. since 4.2M2
 void addToZip(ZipOutputStream zos, String zipname, boolean withVersions, XWikiContext context)
          Deprecated. since 4.1M2
 void addToZip(ZipOutputStream zos, XWikiContext context)
          Deprecated. since 4.1M2
 void addXObject(BaseObject object)
          Add the object to the document.
 void addXObject(DocumentReference classReference, BaseObject object)
          Deprecated. use addXObject(BaseObject) instead
 BaseObject addXObjectFromRequest(DocumentReference classReference, int num, XWikiContext context)
          Adds object from an new object creation form.
 BaseObject addXObjectFromRequest(DocumentReference classReference, String prefix, XWikiContext context)
          Adds an object from an new object creation form.
 BaseObject addXObjectFromRequest(EntityReference classReference, String prefix, int num, XWikiContext context)
          Adds object from an new object creation form.
 BaseObject addXObjectFromRequest(EntityReference classReference, XWikiContext context)
          Adds an object from an new object creation form.
 BaseObject addXObjectFromRequest(XWikiContext context)
          Adds an object from an new object creation form.
 List<BaseObject> addXObjectsFromRequest(DocumentReference classReference, String pref, XWikiContext context)
          Adds multiple objects from an new objects creation form.
 List<BaseObject> addXObjectsFromRequest(DocumentReference classReference, XWikiContext context)
          Adds multiple objects from an new objects creation form.
 void addXObjectsToRemoveFromVersion(XWikiDocument previousVersion)
          Automatically add objects present in the old version, but not in the current document, to the list of objects marked for removal from the database.
 void addXObjectToRemove(BaseObject object)
           
 void appendMeta(String meta)
           
 boolean apply(XWikiDocument document)
          Apply modification comming from provided document.
 boolean apply(XWikiDocument document, boolean clean)
          Apply modification comming from provided document.
static void backupContext(Map<String,Object> backup, XWikiContext context)
           
 void clearAttachmentsToRemove()
          Clear the list of attachments planned for removal.
 XWikiDocument clone()
           
 void cloneXObjects(XWikiDocument templatedoc)
           
 void clonexWikiObjects(XWikiDocument templatedoc)
          Deprecated. since 2.2M1 use cloneXObjects(XWikiDocument) instead
static boolean containsXMLWikiDocument(org.dom4j.Document domdoc)
          Check if provided xml document is a wiki document.
 void convertSyntax(String targetSyntaxId, XWikiContext context)
          Convert the current document content from its current syntax to the new syntax passed as parameter.
 void convertSyntax(org.xwiki.rendering.syntax.Syntax targetSyntax, XWikiContext context)
          Convert the current document content from its current syntax to the new syntax passed as parameter.
 void copyAttachments(XWikiDocument sourceDocument)
          Copy attachments from one document to another.
 XWikiDocument copyDocument(DocumentReference newDocumentReference, XWikiContext context)
           
 XWikiDocument copyDocument(String newDocumentName, XWikiContext context)
          Deprecated. since 2.2M1 use copyDocument(DocumentReference, XWikiContext) instead
 int createNewObject(String className, XWikiContext context)
          Deprecated. since 2.2M1 use createXObject(EntityReference, XWikiContext) instead
 int createXObject(EntityReference classReference, XWikiContext context)
          Create and add a new object to the document with the provided class.
 void deleteAttachment(XWikiAttachment attachment, boolean toRecycleBin, XWikiContext context)
          Deprecated. since 5.2M1 use removeAttachment(XWikiAttachment) instead
 void deleteAttachment(XWikiAttachment attachment, XWikiContext context)
          Deprecated. since 5.2M1 use removeAttachment(XWikiAttachment) instead
 String display(String fieldname, BaseObject obj, XWikiContext context)
           
 String display(String fieldname, String type, BaseObject obj, String wrappingSyntaxId, XWikiContext context)
           
 String display(String fieldname, String type, BaseObject obj, XWikiContext context)
           
 String display(String fieldname, String type, String pref, BaseObject obj, String wrappingSyntaxId, XWikiContext context)
           
 String display(String fieldname, String type, String pref, BaseObject obj, XWikiContext context)
           
 String display(String fieldname, String mode, String prefix, XWikiContext context)
           
 String display(String fieldname, String mode, XWikiContext context)
           
 String display(String fieldname, XWikiContext context)
           
 String displayEdit(PropertyClass pclass, String prefix, BaseCollection object, XWikiContext context)
           
 String displayForm(DocumentReference classReference, String header, String format, boolean linebreak, XWikiContext context)
           
 String displayForm(DocumentReference classReference, String header, String format, XWikiContext context)
           
 String displayForm(DocumentReference classReference, XWikiContext context)
           
 String displayForm(String className, String header, String format, boolean linebreak, XWikiContext context)
          Deprecated. since 2.2M1, use displayForm(DocumentReference, String, String, boolean, XWikiContext) instead
 String displayForm(String className, String header, String format, XWikiContext context)
          Deprecated. since 2.2M1, use displayForm(DocumentReference, String, String, XWikiContext) instead
 String displayForm(String className, XWikiContext context)
          Deprecated. since 2.2M1, use displayForm(DocumentReference, XWikiContext) instead
 String displayHidden(PropertyClass pclass, String prefix, BaseCollection object, XWikiContext context)
           
 String displayPrettyName(String fieldname, BaseObject obj, XWikiContext context)
           
 String displayPrettyName(String fieldname, boolean showMandatory, BaseObject obj, XWikiContext context)
           
 String displayPrettyName(String fieldname, boolean showMandatory, boolean before, BaseObject obj, XWikiContext context)
           
 String displayPrettyName(String fieldname, boolean showMandatory, boolean before, XWikiContext context)
           
 String displayPrettyName(String fieldname, boolean showMandatory, XWikiContext context)
           
 String displayPrettyName(String fieldname, XWikiContext context)
           
 String displayRendered(PropertyClass pclass, String prefix, BaseCollection object, XWikiContext context)
           
 String displayTooltip(String fieldname, BaseObject obj, XWikiContext context)
           
 String displayTooltip(String fieldname, XWikiContext context)
           
 String displayView(PropertyClass pclass, String prefix, BaseCollection object, XWikiContext context)
           
 XWikiDocument duplicate(DocumentReference newDocumentReference)
          Duplicate this document and give it a new name.
 void duplicateXObjects(XWikiDocument templatedoc)
           
protected  String encodedXMLStringAsUTF8(String xmlString)
           
 boolean equals(Object object)
           
 boolean equalsData(XWikiDocument otherDocument)
          Same as equals(Object) but only for actual datas of the document.
 void fromXML(org.dom4j.Document domdoc, boolean withArchive)
           
 void fromXML(InputStream is)
           
 void fromXML(InputStream in, boolean withArchive)
           
 void fromXML(String xml)
           
 void fromXML(String xml, boolean withArchive)
           
 XWikiAttachment getAttachment(String filename)
           
 List<AttachmentDiff> getAttachmentDiff(XWikiDocument fromDoc, XWikiDocument toDoc, XWikiContext context)
           
 List<XWikiAttachment> getAttachmentList()
           
 String getAttachmentRevisionURL(String filename, String revision, String querystring, XWikiContext context)
           
 String getAttachmentRevisionURL(String filename, String revision, XWikiContext context)
           
 XWikiAttachmentStoreInterface getAttachmentStore(XWikiContext context)
           
 List<XWikiDocument.XWikiAttachmentToRemove> getAttachmentsToRemove()
           
 String getAttachmentURL(String filename, String action, String querystring, XWikiContext context)
           
 String getAttachmentURL(String filename, String action, XWikiContext context)
           
 String getAttachmentURL(String filename, XWikiContext context)
           
 String getAuthor()
          Deprecated. since 3.0M3 use getAuthorReference() instead
 DocumentReference getAuthorReference()
           
 List<String> getBackLinkedPages(XWikiContext context)
          Deprecated. since 2.2M2 use getBackLinkedReferences(XWikiContext)
 List<DocumentReference> getBackLinkedReferences(XWikiContext context)
          Get the wiki document references pointing to this document.
 List<String> getChildren(int nb, int start, XWikiContext context)
          Deprecated. since 2.2M2 use getChildrenReferences(XWikiContext)
 List<String> getChildren(XWikiContext context)
          Deprecated. since 2.2M2 use getChildrenReferences(XWikiContext)
 List<DocumentReference> getChildrenReferences(int nb, int start, XWikiContext context)
          Returns a list of references of all documents which list this document as their parent
 List<DocumentReference> getChildrenReferences(XWikiContext context)
          Returns a list of references of all documents which list this document as their parent getChildren(int, int, com.xpn.xwiki.XWikiContext)
 List<List<ObjectDiff>> getClassDiff(XWikiDocument fromDoc, XWikiDocument toDoc, XWikiContext context)
           
 String getComment()
           
 Vector<BaseObject> getComments()
           
 Vector<BaseObject> getComments(boolean asc)
           
 String getContent()
           
 String getContentAuthor()
          Deprecated. since 3.0M3 use getContentAuthorReference() instead
 DocumentReference getContentAuthorReference()
           
 List<org.suigeneris.jrcs.diff.delta.Delta> getContentDiff(String fromRev, String toRev, XWikiContext context)
           
 List<org.suigeneris.jrcs.diff.delta.Delta> getContentDiff(String fromRev, XWikiContext context)
           
 List<org.suigeneris.jrcs.diff.delta.Delta> getContentDiff(XWikiDocument fromDoc, XWikiDocument toDoc, XWikiContext context)
           
 String getContentOfSection(int sectionNumber)
          Return the content of a section.
 Date getContentUpdateDate()
           
 Date getCreationDate()
           
 String getCreator()
          Deprecated. since 3.0M2 use getCreatorReference() instead
 DocumentReference getCreatorReference()
           
 String getCustomClass()
           
 String getDatabase()
          Deprecated. since 2.2M1 use getDocumentReference() instead
 Date getDate()
           
 String getDefaultEditMode(XWikiContext context)
          Gets the default edit mode for this document.
 String getDefaultEditURL(XWikiContext context)
           
 String getDefaultLanguage()
          Deprecated. since 4.3M2 use getDefaultLocale() instead
 Locale getDefaultLocale()
           
 String getDefaultTemplate()
           
protected  List<org.suigeneris.jrcs.diff.delta.Delta> getDeltas(org.suigeneris.jrcs.diff.Revision rev)
           
 XWikiDocumentArchive getDocumentArchive()
           
 XWikiDocumentArchive getDocumentArchive(XWikiContext context)
           
 DocumentReference getDocumentReference()
           
 DocumentReference getDocumentReferenceWithLocale()
           
 DocumentSection getDocumentSection(int sectionNumber)
          Return a Document section with parameter is sectionNumber.
 String getEditURL(String action, String mode, String language, XWikiContext context)
           
 String getEditURL(String action, String mode, XWikiContext context)
           
protected  String getElement(org.dom4j.Element docel, String name)
           
 int getElements()
           
 String getEscapedContent(XWikiContext context)
           
 String getExternalAttachmentURL(String filename, String action, XWikiContext context)
           
 String getExternalURL(String action, String querystring, XWikiContext context)
           
 String getExternalURL(String action, XWikiContext context)
           
 BaseObject getFirstObject(String fieldname)
           
 BaseObject getFirstObject(String fieldname, XWikiContext context)
           
 String getFormat()
           
 String getFullName()
          Deprecated. since 2.2M1 use getDocumentReference() instead
 long getId()
           
 List<String> getIncludedMacros(XWikiContext context)
           
 List<String> getIncludedPages(XWikiContext context)
           
 String getInternalProperty(String propname)
           
static String getInternalPropertyName(String propname, XWikiContext context)
           
 int getIntValue(DocumentReference classReference, String fieldName)
           
 int getIntValue(String fieldName)
           
 int getIntValue(String className, String fieldName)
          Deprecated. since 2.2M2 use getIntValue(DocumentReference, String) instead
 String getKey()
          Temporary helper to produce a uid serialization of this document reference, including the locale.
 String getLanguage()
          Deprecated. since 4.3M2 use getLocale() instead
 List<org.suigeneris.jrcs.diff.delta.Delta> getLastChanges(XWikiContext context)
           
 List getListValue(DocumentReference classReference, String fieldName)
           
 List getListValue(String fieldName)
           
 List getListValue(String className, String fieldName)
          Deprecated. since 2.2M2 use getListValue(DocumentReference, String) instead
 Locale getLocale()
           
 XWikiLock getLock(XWikiContext context)
           
 long getLongValue(DocumentReference classReference, String fieldName)
           
 long getLongValue(String fieldName)
           
 long getLongValue(String className, String fieldName)
          Deprecated. since 2.2M2 use getLongValue(DocumentReference, String) instead
 String getMeta()
           
 List<MetaDataDiff> getMetaDataDiff(String fromRev, String toRev, XWikiContext context)
           
 List<MetaDataDiff> getMetaDataDiff(String fromRev, XWikiContext context)
           
 List<MetaDataDiff> getMetaDataDiff(XWikiDocument fromDoc, XWikiDocument toDoc, XWikiContext context)
           
protected  Boolean getMinorEdit1()
           
 String getName()
          Deprecated. since 2.2M1 used getDocumentReference() instead
 BaseObject getObject(String className)
          Deprecated. since 2.2M1 use getXObject(DocumentReference) instead
 BaseObject getObject(String className, boolean create, XWikiContext context)
          Deprecated. since 2.2M2 use getXObject(DocumentReference, boolean, XWikiContext)
 BaseObject getObject(String className, int nb)
          Deprecated. since 2.2M1 use getXObject(DocumentReference, int) instead
 BaseObject getObject(String className, String key, String value)
          Deprecated. since 2.2M1 use getXObject(DocumentReference, String, String) instead
 BaseObject getObject(String className, String key, String value, boolean failover)
          Deprecated. since 2.2M1 use getXObject(DocumentReference, String, String, boolean) instead
 List<List<ObjectDiff>> getObjectDiff(String fromRev, String toRev, XWikiContext context)
           
 List<List<ObjectDiff>> getObjectDiff(String fromRev, XWikiContext context)
           
 List<List<ObjectDiff>> getObjectDiff(XWikiDocument fromDoc, XWikiDocument toDoc, XWikiContext context)
          Return the object differences between two document versions.
 int getObjectNumbers(String className)
          Deprecated. since 2.2M1 use getXObjectSize(DocumentReference) instead
 Vector<BaseObject> getObjects(String className)
          Deprecated. since 2.2M1 use getXObjects(DocumentReference) instead
 ArrayList<BaseObject> getObjectsToRemove()
          Deprecated. since 2.2M2 use getObjectsToRemove() instead
 XWikiDocument getOriginalDocument()
           
 String getPageName()
          Deprecated. since 2.2M1 use getDocumentReference() instead
 String getParent()
          Deprecated. since 2.2M1 use getParentReference() instead
 XWikiDocument getParentDoc()
          Deprecated. since 2.2M1 use getParentReference() instead
 DocumentReference getParentReference()
           
 String getParentURL(XWikiContext context)
           
 String getPrefixedFullName()
          Deprecated. since 2.2M1 use getDocumentReference() instead
 String getPreviousVersion()
           
 org.suigeneris.jrcs.rcs.Version getRCSVersion()
           
 String getRealLanguage()
          Deprecated. since 4.3M1 use getRealLocale() instead
 String getRealLanguage(XWikiContext context)
          Deprecated. since 4.3M1 use getRealLocale() instead
 Locale getRealLocale()
           
 String[] getRecentRevisions(int nb, XWikiContext context)
           
 EntityReference getRelativeParentReference()
          Return the reference of the parent document as it stored and passed to setParentReference(EntityReference).
 String getRenderedContent(String text, String syntaxId, boolean restrictedTransformationContext, XWikiContext context)
           
 String getRenderedContent(String text, String sourceSyntaxId, String targetSyntaxId, boolean restrictedTransformationContext, XWikiContext context)
           
 String getRenderedContent(String text, String sourceSyntaxId, String targetSyntaxId, XWikiContext context)
           
 String getRenderedContent(String text, String syntaxId, XWikiContext context)
           
 String getRenderedContent(org.xwiki.rendering.syntax.Syntax targetSyntax, boolean isolateVelocityMacros, XWikiContext context)
           
 String getRenderedContent(org.xwiki.rendering.syntax.Syntax targetSyntax, XWikiContext context)
           
 String getRenderedContent(XWikiContext context)
           
 List<org.suigeneris.jrcs.diff.delta.Delta> getRenderedContentDiff(String fromRev, String toRev, XWikiContext context)
           
 List<org.suigeneris.jrcs.diff.delta.Delta> getRenderedContentDiff(String fromRev, XWikiContext context)
           
 List<org.suigeneris.jrcs.diff.delta.Delta> getRenderedContentDiff(XWikiDocument fromDoc, XWikiDocument toDoc, XWikiContext context)
           
 String getRenderedTitle(org.xwiki.rendering.syntax.Syntax outputSyntax, XWikiContext context)
          Get the rendered version of the document title.
 XWikiRCSNodeInfo getRevisionInfo(String version, XWikiContext context)
           
 List<String> getRevisions(RevisionCriteria criteria, XWikiContext context)
          Get document versions matching criterias like author, minimum creation date, etc.
 org.suigeneris.jrcs.rcs.Version[] getRevisions(XWikiContext context)
           
 List<DocumentSection> getSections()
          Get the top sections contained in the document.
 String getSpace()
          Deprecated. since 2.2M1 used getDocumentReference() instead
 String getSpaceName()
          Deprecated. since 2.2M1 use getDocumentReference() instead
 XWikiStoreInterface getStore()
           
 XWikiStoreInterface getStore(XWikiContext context)
           
 String getStringValue(DocumentReference classReference, String fieldName)
           
 String getStringValue(String fieldName)
           
 String getStringValue(String className, String fieldName)
          Deprecated. since 2.2M2 use getStringValue(DocumentReference, String) instead
 org.xwiki.rendering.syntax.Syntax getSyntax()
           
 String getSyntaxId()
          Deprecated. since 2.3M1, use {link #getSyntax()} instead
 String getTags(XWikiContext context)
           
 List<String> getTagsList(XWikiContext context)
           
 List<String> getTagsPossibleValues(XWikiContext context)
           
 String getTemplate()
          Deprecated. since 2.2M1 use getTemplateDocumentReference() instead
 DocumentReference getTemplateDocumentReference()
           
 String getTitle()
           
 String getTranslatedContent(String language, XWikiContext context)
           
 String getTranslatedContent(XWikiContext context)
           
 XWikiDocument getTranslatedDocument(Locale locale, XWikiContext context)
          Return the document in the provided language.
 XWikiDocument getTranslatedDocument(String language, XWikiContext context)
          Deprecated. since 4.3M2 use getTranslatedDocument(Locale, XWikiContext) insead
 XWikiDocument getTranslatedDocument(XWikiContext context)
           
 int getTranslation()
           
 List<String> getTranslationList(XWikiContext context)
          Deprecated. since 5.1M2 use getTranslationLocales(XWikiContext) instead
 List<Locale> getTranslationLocales(XWikiContext context)
          The locales of the translation of this document (the default locale is not included).
 Set<String> getUniqueLinkedPages(XWikiContext context)
          Extract all the unique static (i.e.
 Set<XWikiLink> getUniqueWikiLinkedPages(XWikiContext context)
          Get a list of unique links from this document to others documents.
 String getURL(String action, boolean redirect, XWikiContext context)
           
 String getURL(String action, String params, boolean redirect, XWikiContext context)
           
 String getURL(String action, String querystring, String anchor, XWikiContext context)
           
 String getURL(String action, String querystring, XWikiContext context)
           
 String getURL(String action, XWikiContext context)
           
 String getValidationScript()
           
 String getVersion()
           
 String getVersionHashCode(XWikiContext context)
          Computes a document hash, taking into account all document data: content, objects, attachments, metadata...
 XWikiVersioningStoreInterface getVersioningStore(XWikiContext context)
           
 String getWeb()
          Deprecated. use getDocumentReference() instead
 String getWikiName()
          Deprecated. since 2.2M1 use getDocumentReference() instead
 Object getWikiNode()
           
 BaseClass getXClass()
           
 List<BaseClass> getXClasses(XWikiContext context)
           
 String getXClassXML()
           
 org.xwiki.rendering.block.XDOM getXDOM()
          NOTE: This method caches the XDOM and returns a clone that can be safely modified.
 String getXMLContent(XWikiContext context)
          Retrieve the document in the current context language as an XML string.
 List<org.suigeneris.jrcs.diff.delta.Delta> getXMLDiff(XWikiDocument fromDoc, XWikiDocument toDoc, XWikiContext context)
           
 BaseObject getXObject()
           
 BaseObject getXObject(DocumentReference classReference)
           
 BaseObject getXObject(DocumentReference classReference, boolean create, XWikiContext context)
           
 BaseObject getXObject(DocumentReference classReference, int nb)
           
 BaseObject getXObject(DocumentReference classReference, String key, String value)
           
 BaseObject getXObject(DocumentReference classReference, String key, String value, boolean failover)
           
 BaseObject getXObject(EntityReference reference)
           
 BaseObject getXObject(EntityReference classReference, boolean create, XWikiContext context)
           
 BaseObject getXObject(EntityReference classReference, int nb)
           
 BaseObject getXObject(ObjectReference objectReference)
          Get an object of this document based on its reference.
 BaseProperty<ObjectPropertyReference> getXObjectProperty(ObjectPropertyReference objectPropertyReference)
          Get an object property of this document based on its reference.
 Map<DocumentReference,List<BaseObject>> getXObjects()
           
 List<BaseObject> getXObjects(DocumentReference classReference)
           
 List<BaseObject> getXObjects(EntityReference reference)
           
 int getXObjectSize(DocumentReference classReference)
           
 List<BaseObject> getXObjectsToRemove()
           
 String getxWikiClassXML()
          Deprecated. since 2.2M1 use getXClassXML() instead Hibernate uses this through reflection. It cannot be removed without altering hibernate.cfg.xml
 BaseObject getxWikiObject()
          Deprecated. since 2.2M1 use getXObject() instead
 boolean hasElement(int element)
           
 int hashCode()
           
 void incrementVersion()
           
 void insertText(String text, String marker, XWikiContext context)
           
 boolean is10Syntax()
           
 boolean is10Syntax(String syntaxId)
           
 boolean isAdvancedContent()
           
 boolean isContentDirty()
           
 boolean isCreator(DocumentReference username)
           
 boolean isCreator(String username)
          Deprecated. use isCreator(DocumentReference) instead
 boolean isCurrentLocalUserPage(XWikiContext context)
           
 boolean isCurrentUserCreator(XWikiContext context)
           
 boolean isCurrentUserPage(XWikiContext context)
           
 boolean isFromCache()
           
 Boolean isHidden()
          Indicates whether the document is 'hidden' or not, meaning that it should not be returned in public search results.
 boolean isMetaDataDirty()
           
 boolean isMinorEdit()
           
 boolean isMostRecent()
           
 boolean isNew()
           
 boolean isProgrammaticContent()
           
 void loadArchive(XWikiContext context)
           
 void loadAttachmentContent(XWikiAttachment attachment, XWikiContext context)
           
 void loadAttachments(XWikiContext context)
           
 void loadAttachmentsContent(XWikiContext context)
          Load attachment content from database.
 XWikiDocumentArchive loadDocumentArchive()
           
 MergeResult merge(XWikiDocument previousDocument, XWikiDocument newDocument, MergeConfiguration configuration, XWikiContext context)
          Apply a 3 ways merge on the current document based on provided previous and new version of the document.
 void mergeXClass(XWikiDocument templatedoc)
           
 void mergeXObjects(XWikiDocument templateDoc)
           
 void mergexWikiClass(XWikiDocument templatedoc)
          Deprecated. since 2.2M1 use mergeXClass(XWikiDocument) instead
 void mergexWikiObjects(XWikiDocument templatedoc)
          Deprecated. since 2.2M1 use mergeXObjects(XWikiDocument) instead
 Document newDocument(Class<?> customClass, XWikiContext context)
          Create a new protected Document public API to access page information and actions from scripting.
 Document newDocument(String customClassName, XWikiContext context)
          Create a new protected Document public API to access page information and actions from scripting.
 Document newDocument(XWikiContext context)
           
 BaseObject newObject(String className, XWikiContext context)
          Deprecated. since 2.2M2 use newXObject(EntityReference, XWikiContext)
 BaseObject newXObject(EntityReference classReference, XWikiContext context)
          Create, add and return a new object with the provided class.
 void readDocMetaFromForm(EditForm eform, XWikiContext context)
           
 void readFromForm(EditForm eform, XWikiContext context)
           
 void readFromTemplate(DocumentReference templateDocumentReference, XWikiContext context)
           
 void readFromTemplate(EditForm eform, XWikiContext context)
           
 void readFromTemplate(String template, XWikiContext context)
          Deprecated. since 2.2M1 use readFromTemplate(DocumentReference, XWikiContext) instead
 void readObjectsFromForm(EditForm eform, XWikiContext context)
           
 void readTranslationMetaFromForm(EditForm eform, XWikiContext context)
           
 XWikiAttachment removeAttachment(XWikiAttachment attachment)
          Remove the attachment from the document attachment list and put it in the list of attachments to remove for next document save.
 XWikiAttachment removeAttachment(XWikiAttachment attachmentToRemove, boolean toRecycleBin)
          Remove the attachment from the document attachment list and put it in the list of attachments to remove for next document save.
 void removeLock(XWikiContext context)
           
 boolean removeObject(BaseObject object)
          Deprecated. since 2.2M1, use removeXObject(com.xpn.xwiki.objects.BaseObject) instead
 boolean removeObjects(String className)
          Deprecated. since 2.2M1 use removeXObjects(org.xwiki.model.reference.DocumentReference) instead
 boolean removeXObject(BaseObject object)
          Remove an XObject from the document.
 boolean removeXObjects(DocumentReference classReference)
          Remove all the objects of a given type (XClass) from the document.
 boolean removeXObjects(EntityReference reference)
          Remove all the objects of a given type (XClass) from the document.
 void rename(DocumentReference newDocumentReference, List<DocumentReference> backlinkDocumentReferences, List<DocumentReference> childDocumentReferences, XWikiContext context)
          Same as rename(String, List, XWikiContext) but the list of documents having the current document as their parent is passed in parameter.
 void rename(DocumentReference newDocumentReference, List<DocumentReference> backlinkDocumentReferences, XWikiContext context)
          Rename the current document and all the links pointing to it in the list of passed backlink documents.
 void rename(DocumentReference newDocumentReference, XWikiContext context)
          Rename the current document and all the backlinks leading to it.
 void rename(String newDocumentName, List<String> backlinkDocumentNames, List<String> childDocumentNames, XWikiContext context)
          Deprecated. since 2.2M2 use rename(DocumentReference, List, List, com.xpn.xwiki.XWikiContext)
 void rename(String newDocumentName, List<String> backlinkDocumentNames, XWikiContext context)
          Deprecated. since 2.2M2 use rename(DocumentReference, java.util.List, com.xpn.xwiki.XWikiContext)
 void rename(String newDocumentName, XWikiContext context)
          Deprecated. since 2.2M2 use rename(DocumentReference, XWikiContext)
 void renameProperties(DocumentReference classReference, Map<String,String> fieldsToRename)
           
 void renameProperties(String className, Map<String,String> fieldsToRename)
          Deprecated. since 2.2M2 use renameProperties(DocumentReference, Map) instead
protected static String renderXDOM(org.xwiki.rendering.block.XDOM content, org.xwiki.rendering.syntax.Syntax targetSyntax)
          Render privided XDOM into content of the provided syntax identifier.
 void resetArchive(XWikiContext context)
           
 DocumentReference resolveClassReference(String documentName)
          Backward-compatibility method to use in order to resolve a class reference passed as a String into a DocumentReference proper.
static void restoreContext(Map<String,Object> backup, XWikiContext context)
           
 void saveAllAttachments(boolean updateParent, boolean transaction, XWikiContext context)
           
 void saveAllAttachments(XWikiContext context)
           
 void saveAttachmentContent(XWikiAttachment attachment, boolean updateParent, boolean transaction, XWikiContext context)
           
 void saveAttachmentContent(XWikiAttachment attachment, XWikiContext context)
           
 void saveAttachmentsContent(List<XWikiAttachment> attachments, XWikiContext context)
           
 void setAsContextDoc(XWikiContext context)
           
 void setAttachmentList(List<XWikiAttachment> list)
           
 void setAuthor(String author)
          Deprecated. since 3.0M3 use setAuthorReference(org.xwiki.model.reference.DocumentReference) instead
 void setAuthorReference(DocumentReference authorReference)
           
 void setComment(String comment)
           
 void setContent(String content)
           
 void setContent(org.xwiki.rendering.block.XDOM content)
           
 void setContentAuthor(String contentAuthor)
          Deprecated. since 3.0M3 use setContentAuthorReference(org.xwiki.model.reference.DocumentReference) instead
 void setContentAuthorReference(DocumentReference contentAuthorReference)
           
 void setContentDirty(boolean contentDirty)
           
 void setContentUpdateDate(Date date)
           
 void setCreationDate(Date date)
           
 void setCreator(String creator)
          Deprecated. since 3.0M2 use setCreatorReference(org.xwiki.model.reference.DocumentReference) instead
 void setCreatorReference(DocumentReference creatorReference)
           
 void setCustomClass(String customClass)
           
 void setDatabase(String database)
          Deprecated. since 2.2M1 use setDocumentReference(DocumentReference) instead
 void setDate(Date date)
           
 void setDBStringListValue(EntityReference classReference, String fieldName, List value)
           
 void setDBStringListValue(String className, String fieldName, List value)
          Deprecated. since 2.2M2 use setDBStringListValue(EntityReference, String, List) instead
 void setDefaultLanguage(String defaultLanguage)
          Deprecated. since 4.3M2 use setDefaultLocale(Locale) instead
 void setDefaultLocale(Locale defaultLocale)
           
 void setDefaultTemplate(String defaultTemplate)
           
 void setDocumentArchive(String sarch)
           
 void setDocumentArchive(XWikiDocumentArchive arch)
           
 void setDocumentReference(DocumentReference reference)
          Deprecated. since 2.2.3 don't change the reference of a document once it's been constructed. Instead you can clone the doc, rename it or copy it.
 void setElement(int element, boolean toggle)
           
 void setElements(int elements)
           
 void setFormat(String format)
           
 void setFromCache(boolean fromCache)
           
 void setFullName(String name)
          Deprecated. since 2.2M1 use setDocumentReference(org.xwiki.model.reference.DocumentReference) instead
 void setFullName(String fullName, XWikiContext context)
          Deprecated. since 2.2M1 use setDocumentReference(org.xwiki.model.reference.DocumentReference) instead
 void setHidden(Boolean hidden)
          Indicates whether the document should be 'hidden' or not, meaning that it should not be returned in public search results.
 void setId(long id)
           
 void setIntValue(EntityReference classReference, String fieldName, int value)
           
 void setIntValue(String className, String fieldName, int value)
          Deprecated. since 2.2M2 use setIntValue(EntityReference, String, int) instead
 void setLanguage(String language)
          Deprecated. since 4.3M2 use setLocale(Locale) instead
 void setLargeStringValue(EntityReference classReference, String fieldName, String value)
           
 void setLargeStringValue(String className, String fieldName, String value)
          Deprecated. since 2.2M2 use setLargeStringValue(EntityReference, String, String) instead
 void setLocale(Locale locale)
           
 void setLock(String userName, XWikiContext context)
           
 void setMeta(String meta)
           
 void setMetaDataDirty(boolean metaDataDirty)
           
 void setMinorEdit(boolean isMinor)
           
protected  void setMinorEdit1(Boolean isMinor)
           
 void setMostRecent(boolean mostRecent)
          must not be used unless in store system.
 void setName(String name)
          Deprecated. since 2.2M1 used setDocumentReference(DocumentReference) instead
 void setNew(boolean aNew)
           
 void setObject(String className, int nb, BaseObject object)
          Deprecated. since 2.2M1 use setXObject(DocumentReference, int, BaseObject) instead
 void setOriginalDocument(XWikiDocument originalDocument)
           
 void setParent(String parent)
          Deprecated. since 2.2M1 used setParentReference(DocumentReference) instead
 void setParentReference(DocumentReference parentReference)
          Deprecated. since 2.2.3 use setParentReference(org.xwiki.model.reference.EntityReference) instead
 void setParentReference(EntityReference parentReference)
           
 void setProperty(EntityReference classReference, String fieldName, BaseProperty value)
           
 void setProperty(String className, String fieldName, BaseProperty value)
          Deprecated. since 2.2M2 use setProperty(EntityReference, String, BaseProperty) instead
 void setRCSVersion(org.suigeneris.jrcs.rcs.Version version)
           
 void setSpace(String space)
          Deprecated. since 2.2M1 used setDocumentReference(DocumentReference) instead
 void setStore(XWikiStoreInterface store)
           
 void setStringListValue(EntityReference classReference, String fieldName, List value)
           
 void setStringListValue(String className, String fieldName, List value)
          Deprecated. since 2.2M2 use setStringListValue(EntityReference, String, List) instead
 void setStringValue(EntityReference classReference, String fieldName, String value)
           
 void setStringValue(String className, String fieldName, String value)
          Deprecated. since 2.2M2 use setStringValue(EntityReference, String, String) instead
 void setSyntax(org.xwiki.rendering.syntax.Syntax syntax)
           
 void setSyntaxId(String syntaxId)
          Deprecated. since 2.3M1, use {link #setSyntax(Syntax)} instead
 void setTags(String tagsStr, XWikiContext context)
          add tags to the document.
 void setTemplate(String template)
          Deprecated. since 2.2M1 use setTemplateDocumentReference(DocumentReference) instead
 void setTemplateDocumentReference(DocumentReference templateDocumentReference)
           
 void setTitle(String title)
           
 void setTranslation(int translation)
           
 void setValidationScript(String validationScript)
           
 void setVersion(String version)
           
 void setWeb(String space)
          Deprecated. use setDocumentReference(DocumentReference) instead
 void setWikiNode(Object wikiNode)
           
 void setXClass(BaseClass xwikiClass)
           
 void setXClassXML(String xClassXML)
           
 void setXObject(DocumentReference classReference, int nb, BaseObject object)
          Deprecated. use setXObject(int, BaseObject) instead
 void setXObject(int nb, BaseObject object)
          Replaces the object at the specified position and for the specified object xclass.
 void setXObjects(DocumentReference classReference, List<BaseObject> objects)
           
 void setXObjects(Map<DocumentReference,List<BaseObject>> objects)
           
 void setXObjectsToRemove(List<BaseObject> objectsToRemove)
           
 void setxWikiClassXML(String xClassXML)
          Deprecated. since 2.2M1 use setXClassXML(String) ()} instead Hibernate uses this through reflection. It cannot be removed without altering hibernate.cfg.xml
 String toFullXML(XWikiContext context)
          Retrieve the document as an XML string.
 String toString()
           
 String toXML(boolean bWithObjects, boolean bWithRendering, boolean bWithAttachmentContent, boolean bWithVersions, XWikiContext context)
          Serialize the document to an XML string.
 String toXML(org.dom4j.Document doc, XWikiContext context)
          Deprecated. this method has nothing to do here and is apparently unused
 void toXML(OutputStream out, boolean bWithObjects, boolean bWithRendering, boolean bWithAttachmentContent, boolean bWithVersions, XWikiContext context)
          Serialize the document to an OutputStream.
 void toXML(com.xpn.xwiki.internal.xml.XMLWriter wr, boolean bWithObjects, boolean bWithRendering, boolean bWithAttachmentContent, boolean bWithVersions, XWikiContext context)
          Serialize the document to a XMLWriter.
 String toXML(XWikiContext context)
          Retrieve the document as an XML string.
 org.dom4j.Document toXMLDocument(boolean bWithObjects, boolean bWithRendering, boolean bWithAttachmentContent, boolean bWithVersions, XWikiContext context)
          Serialize the document to an XML DOMDocument.
 org.dom4j.Document toXMLDocument(XWikiContext context)
          Serialize the document to an XML DOMDocument.
 String updateDocumentSection(int sectionNumber, String newSectionContent)
          Update a section content in document.
 BaseObject updateObjectFromRequest(String className, String prefix, int num, XWikiContext context)
          Deprecated. since 2.2M2 use updateXObjectFromRequest(EntityReference, String, int, XWikiContext)
 BaseObject updateObjectFromRequest(String className, String prefix, XWikiContext context)
          Deprecated. since 2.2M2 use updateXObjectFromRequest(EntityReference, String, XWikiContext)
 BaseObject updateObjectFromRequest(String className, XWikiContext context)
          Deprecated. since 2.2M2 use updateXObjectFromRequest(EntityReference, XWikiContext)
 List<BaseObject> updateObjectsFromRequest(String className, String pref, XWikiContext context)
          Deprecated. since 2.2M2 use updateXObjectsFromRequest(EntityReference, String, XWikiContext)
 List<BaseObject> updateObjectsFromRequest(String className, XWikiContext context)
          Deprecated. since 2.2M2 use updateXObjectsFromRequest(EntityReference, XWikiContext)
 BaseObject updateXObjectFromRequest(EntityReference classReference, String prefix, int num, XWikiContext context)
          Adds an object from an new object creation form.
 BaseObject updateXObjectFromRequest(EntityReference classReference, String prefix, XWikiContext context)
          Adds an object from an new object creation form.
 BaseObject updateXObjectFromRequest(EntityReference classReference, XWikiContext context)
          Adds an object from an new object creation form.
 List<BaseObject> updateXObjectsFromRequest(EntityReference classReference, String pref, XWikiContext context)
          Adds multiple objects from an new objects creation form.
 List<BaseObject> updateXObjectsFromRequest(EntityReference classReference, XWikiContext context)
          Adds an object from an new object creation form.
 boolean validate(String[] classNames, XWikiContext context)
           
 boolean validate(XWikiContext context)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

COMMENTSCLASS_REFERENCE

public static final EntityReference COMMENTSCLASS_REFERENCE

SHEETCLASS_REFERENCE

public static final EntityReference SHEETCLASS_REFERENCE

version

protected org.suigeneris.jrcs.rcs.Version version

HAS_ATTACHMENTS

public static final int HAS_ATTACHMENTS
See Also:
Constant Field Values

HAS_OBJECTS

public static final int HAS_OBJECTS
See Also:
Constant Field Values

HAS_CLASS

public static final int HAS_CLASS
See Also:
Constant Field Values

DB_SPACE_SEP

public static final String DB_SPACE_SEP
Separator string between database name and space name.

See Also:
Constant Field Values

SPACE_NAME_SEP

public static final String SPACE_NAME_SEP
Separator string between space name and page name.

See Also:
Constant Field Values

currentDocumentReferenceResolver

protected DocumentReferenceResolver<String> currentDocumentReferenceResolver
Used to resolve a string into a proper Document Reference using the current document's reference to fill the blanks.


explicitDocumentReferenceResolver

protected DocumentReferenceResolver<String> explicitDocumentReferenceResolver
Used to resolve a string into a proper Document Reference.


xClassEntityReferenceResolver

protected EntityReferenceResolver<String> xClassEntityReferenceResolver

currentMixedDocumentReferenceResolver

protected DocumentReferenceResolver<String> currentMixedDocumentReferenceResolver
Used to resolve a string into a proper Document Reference using the current document's reference to fill the blanks, except for the page name for which the default page name is used instead and for the wiki name for which the current wiki is used instead of the current document reference's wiki.


currentReferenceDocumentReferenceResolver

protected DocumentReferenceResolver<EntityReference> currentReferenceDocumentReferenceResolver
Used to normalize references.


explicitReferenceDocumentReferenceResolver

protected DocumentReferenceResolver<EntityReference> explicitReferenceDocumentReferenceResolver
Used to normalize references.


relativeEntityReferenceResolver

protected EntityReferenceResolver<String> relativeEntityReferenceResolver
Used to resolve parent references in the way they are stored externally (database, xml, etc), ie relative or absolute.


compactEntityReferenceSerializer

protected EntityReferenceSerializer<String> compactEntityReferenceSerializer
Used to convert a proper Document Reference to string (compact form).


defaultEntityReferenceSerializer

protected EntityReferenceSerializer<String> defaultEntityReferenceSerializer
Used to convert a proper Document Reference to string (standard form).


compactWikiEntityReferenceSerializer

protected EntityReferenceSerializer<String> compactWikiEntityReferenceSerializer
Used to convert a Document Reference to string (compact form without the wiki part if it matches the current wiki).


localEntityReferenceSerializer

protected EntityReferenceSerializer<String> localEntityReferenceSerializer
Used to convert a proper Document Reference to a string but without the wiki name.


uidStringEntityReferenceSerializer

protected EntityReferenceSerializer<String> uidStringEntityReferenceSerializer
Used to compute document identifier.


localUidStringEntityReferenceSerializer

protected EntityReferenceSerializer<String> localUidStringEntityReferenceSerializer
Used to compute document identifier.


currentReferenceObjectReferenceResolver

protected ObjectReferenceResolver<EntityReference> currentReferenceObjectReferenceResolver
Used to normalize references.


syntaxFactory

protected org.xwiki.rendering.syntax.SyntaxFactory syntaxFactory
Used to create proper Syntax objects.

Constructor Detail

XWikiDocument

public XWikiDocument(DocumentReference reference)
Since:
2.2M1

XWikiDocument

@Deprecated
public XWikiDocument()
Deprecated. since 2.2M1 use XWikiDocument(org.xwiki.model.reference.DocumentReference) instead


XWikiDocument

@Deprecated
public XWikiDocument(String space,
                                String name)
Deprecated. since 2.2M1 use XWikiDocument(org.xwiki.model.reference.DocumentReference) instead

Constructor that specifies the local document identifier: space name, document name. setDatabase(String) must be called afterwards to specify the wiki name.

Parameters:
space - the space this document belongs to
name - the name of the document

XWikiDocument

@Deprecated
public XWikiDocument(String wiki,
                                String space,
                                String name)
Deprecated. since 2.2M1 use XWikiDocument(org.xwiki.model.reference.DocumentReference) instead

Constructor that specifies the full document identifier: wiki name, space name, document name.

Parameters:
wiki - The wiki this document belongs to.
space - The space this document belongs to.
name - The name of the document (can contain either the page name or the space and page name)
Method Detail

getStore

public XWikiStoreInterface getStore(XWikiContext context)

getAttachmentStore

public XWikiAttachmentStoreInterface getAttachmentStore(XWikiContext context)

getVersioningStore

public XWikiVersioningStoreInterface getVersioningStore(XWikiContext context)

getStore

public XWikiStoreInterface getStore()

setStore

public void setStore(XWikiStoreInterface store)

getKey

public String getKey()
Temporary helper to produce a uid serialization of this document reference, including the locale. Only translated document will have locale appended. FIXME: when reference contains locale, this is no more needed.

Returns:
a unique name (8:wikiname5:space4:name2:lg or 8:wikiname5:space4:name)
Since:
4.0M1

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getId

public long getId()
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).

setId

public void setId(long id)
See Also:
getId()

getSpace

@Deprecated
public String getSpace()
Deprecated. since 2.2M1 used getDocumentReference() instead

Note that this method cannot be removed for now since it's used by Hibernate for saving a XWikiDocument.

Returns:
the name of the space of the document

setSpace

@Deprecated
public void setSpace(String space)
Deprecated. since 2.2M1 used setDocumentReference(DocumentReference) instead

Note that this method cannot be removed for now since it's used by Hibernate for loading a XWikiDocument.


getWeb

@Deprecated
public String getWeb()
Deprecated. use getDocumentReference() instead

Note that this method cannot be removed for now since it's used by Hibernate for saving a XWikiDocument.

Returns:
the name of the space of the document

setWeb

@Deprecated
public void setWeb(String space)
Deprecated. use setDocumentReference(DocumentReference) instead

Note that this method cannot be removed for now since it's used by Hibernate for loading a XWikiDocument.


getVersion

public String getVersion()
Specified by:
getVersion in interface DocumentModelBridge

setVersion

public void setVersion(String version)

getRCSVersion

public org.suigeneris.jrcs.rcs.Version getRCSVersion()

setRCSVersion

public void setRCSVersion(org.suigeneris.jrcs.rcs.Version version)

getOriginalDocument

public XWikiDocument getOriginalDocument()
Specified by:
getOriginalDocument in interface DocumentModelBridge
Returns:
the copy of this XWikiDocument instance before any modification was made to it. It is reset to the actual values when the document is saved in the database. This copy is used for finding out differences made to this document (useful for example to send the correct notifications to document change listeners).

setOriginalDocument

public void setOriginalDocument(XWikiDocument originalDocument)
Parameters:
originalDocument - the original document representing this document instance before any change was made to it, prior to the last time it was saved
See Also:
getOriginalDocument()

getParentReference

public DocumentReference getParentReference()
Returns:
the parent reference or null if the parent is not set
Since:
2.2M1

getParent

@Deprecated
public String getParent()
Deprecated. since 2.2M1 use getParentReference() instead

Note that this method cannot be removed for now since it's used by Hibernate for saving a XWikiDocument.

Returns:
the parent reference stored in the database, which is relative to this document, or an empty string ("") if the parent is not set
See Also:
getParentReference()

getParentDoc

@Deprecated
public XWikiDocument getParentDoc()
Deprecated. since 2.2M1 use getParentReference() instead


setParentReference

public void setParentReference(EntityReference parentReference)
Since:
2.2.3

setParentReference

@Deprecated
public void setParentReference(DocumentReference parentReference)
Deprecated. since 2.2.3 use setParentReference(org.xwiki.model.reference.EntityReference) instead

Convert a full document reference into the proper relative document reference (wiki part is removed if it's the same as document wiki) to store as parent.


setParent

@Deprecated
public void setParent(String parent)
Deprecated. since 2.2M1 used setParentReference(DocumentReference) instead

Note that this method cannot be removed for now since it's used by Hibernate for loading a XWikiDocument.

Parameters:
parent - the reference of the parent relative to the document

getContent

public String getContent()
Specified by:
getContent in interface DocumentModelBridge

setContent

public void setContent(String content)

setContent

public void setContent(org.xwiki.rendering.block.XDOM content)
                throws XWikiException
Throws:
XWikiException

getRenderedContent

public String getRenderedContent(org.xwiki.rendering.syntax.Syntax targetSyntax,
                                 XWikiContext context)
                          throws XWikiException
Throws:
XWikiException

getRenderedContent

public String getRenderedContent(org.xwiki.rendering.syntax.Syntax targetSyntax,
                                 boolean isolateVelocityMacros,
                                 XWikiContext context)
                          throws XWikiException
Throws:
XWikiException

getRenderedContent

public String getRenderedContent(XWikiContext context)
                          throws XWikiException
Throws:
XWikiException

getRenderedContent

public String getRenderedContent(String text,
                                 String syntaxId,
                                 XWikiContext context)
Parameters:
text - the text to render
syntaxId - the id of the Syntax used by the passed text (for example: "xwiki/1.0")
context - the XWiki Context object
Returns:
the given text rendered in the context of this document using the passed Syntax
Since:
1.6M1

getRenderedContent

public String getRenderedContent(String text,
                                 String syntaxId,
                                 boolean restrictedTransformationContext,
                                 XWikiContext context)
Parameters:
text - the text to render
syntaxId - the id of the Syntax used by the passed text (for example: "xwiki/1.0")
restrictedTransformationContext - see DocumentDisplayerParameters.isTransformationContextRestricted().
context - the XWiki Context object
Returns:
the given text rendered in the context of this document using the passed Syntax
Since:
4.2M1

getRenderedContent

public String getRenderedContent(String text,
                                 String sourceSyntaxId,
                                 String targetSyntaxId,
                                 XWikiContext context)
Parameters:
text - the text to render
sourceSyntaxId - the id of the Syntax used by the passed text (for example: "xwiki/1.0")
targetSyntaxId - the id of the syntax in which to render the document content
Returns:
the given text rendered in the context of this document using the passed Syntax
Since:
2.0M3

getRenderedContent

public String getRenderedContent(String text,
                                 String sourceSyntaxId,
                                 String targetSyntaxId,
                                 boolean restrictedTransformationContext,
                                 XWikiContext context)
Parameters:
text - the text to render
sourceSyntaxId - the id of the Syntax used by the passed text (for example: "xwiki/1.0")
targetSyntaxId - the id of the syntax in which to render the document content
restrictedTransformationContext - see DocumentDisplayerParameters.isTransformationContextRestricted().
Returns:
the given text rendered in the context of this document using the passed Syntax
Since:
4.2M1

getEscapedContent

public String getEscapedContent(XWikiContext context)
                         throws XWikiException
Throws:
XWikiException

getName

@Deprecated
public String getName()
Deprecated. since 2.2M1 used getDocumentReference() instead

Note that this method cannot be removed for now since it's used by Hibernate for saving a XWikiDocument.


setName

@Deprecated
public void setName(String name)
Deprecated. since 2.2M1 used setDocumentReference(DocumentReference) instead

Note that this method cannot be removed for now since it's used by Hibernate for loading a XWikiDocument.


getDocumentReference

public DocumentReference getDocumentReference()
Specified by:
getDocumentReference in interface DocumentModelBridge

getDocumentReferenceWithLocale

public DocumentReference getDocumentReferenceWithLocale()
Returns:
the DocumentReference of the document also containing the document Locale
Since:
5.3M2

getFullName

@Deprecated
public String getFullName()
Deprecated. since 2.2M1 use getDocumentReference() instead

Specified by:
getFullName in interface DocumentModelBridge
Returns:
the document's space + page name (eg "space.page")

getPrefixedFullName

@Deprecated
public String getPrefixedFullName()
Deprecated. since 2.2M1 use getDocumentReference() instead

Returns:
the docoument's wiki + space + page name (eg "wiki:space.page")

setDocumentReference

@Deprecated
public void setDocumentReference(DocumentReference reference)
Deprecated. since 2.2.3 don't change the reference of a document once it's been constructed. Instead you can clone the doc, rename it or copy it.

Since:
2.2M1

setFullName

@Deprecated
public void setFullName(String name)
Deprecated. since 2.2M1 use setDocumentReference(org.xwiki.model.reference.DocumentReference) instead


setFullName

@Deprecated
public void setFullName(String fullName,
                                   XWikiContext context)
Deprecated. since 2.2M1 use setDocumentReference(org.xwiki.model.reference.DocumentReference) instead


getWikiName

@Deprecated
public String getWikiName()
Deprecated. since 2.2M1 use getDocumentReference() instead

Specified by:
getWikiName in interface DocumentModelBridge
See Also:
DocumentModelBridge.getWikiName()

getSpaceName

@Deprecated
public String getSpaceName()
Deprecated. since 2.2M1 use getDocumentReference() instead

Specified by:
getSpaceName in interface DocumentModelBridge
See Also:
DocumentModelBridge.getSpaceName()

getPageName

@Deprecated
public String getPageName()
Deprecated. since 2.2M1 use getDocumentReference() instead

Specified by:
getPageName in interface DocumentModelBridge
See Also:
DocumentModelBridge.getSpaceName()

getTitle

public String getTitle()
Specified by:
getTitle in interface DocumentModelBridge

getRenderedTitle

public String getRenderedTitle(org.xwiki.rendering.syntax.Syntax outputSyntax,
                               XWikiContext context)
Get the rendered version of the document title. If the title is not specified then an attempt is made to extract the title from the document content. If this fails then the document name is used as title. The Velocity code from the title is evaluated if the title is specified or if it is extracted from the document content.

Parameters:
outputSyntax - the syntax to render to; this is not taken into account for XWiki 1.0 syntax
context - the XWiki context
Returns:
the rendered version of the document title

setTitle

public void setTitle(String title)

getFormat

public String getFormat()

setFormat

public void setFormat(String format)

getAuthorReference

public DocumentReference getAuthorReference()
Since:
3.0M3

setAuthorReference

public void setAuthorReference(DocumentReference authorReference)
Since:
3.0M3

getAuthor

@Deprecated
public String getAuthor()
Deprecated. since 3.0M3 use getAuthorReference() instead

Note that this method cannot be removed for now since it's used by Hibernate for saving a XWikiDocument.


setAuthor

@Deprecated
public void setAuthor(String author)
Deprecated. since 3.0M3 use setAuthorReference(org.xwiki.model.reference.DocumentReference) instead

Note that this method cannot be removed for now since it's used by Hibernate for loading a XWikiDocument.


getContentAuthorReference

public DocumentReference getContentAuthorReference()
Since:
3.0M3

setContentAuthorReference

public void setContentAuthorReference(DocumentReference contentAuthorReference)
Since:
3.0M3

getContentAuthor

@Deprecated
public String getContentAuthor()
Deprecated. since 3.0M3 use getContentAuthorReference() instead

Note that this method cannot be removed for now since it's used by Hibernate for saving a XWikiDocument.


setContentAuthor

@Deprecated
public void setContentAuthor(String contentAuthor)
Deprecated. since 3.0M3 use setContentAuthorReference(org.xwiki.model.reference.DocumentReference) instead

Note that this method cannot be removed for now since it's used by Hibernate for loading a XWikiDocument.


getCreatorReference

public DocumentReference getCreatorReference()
Since:
3.0M3

setCreatorReference

public void setCreatorReference(DocumentReference creatorReference)
Since:
3.0M3

getCreator

@Deprecated
public String getCreator()
Deprecated. since 3.0M2 use getCreatorReference() instead

Note that this method cannot be removed for now since it's used by Hibernate for saving a XWikiDocument.


setCreator

@Deprecated
public void setCreator(String creator)
Deprecated. since 3.0M2 use setCreatorReference(org.xwiki.model.reference.DocumentReference) instead

Note that this method cannot be removed for now since it's used by Hibernate for loading a XWikiDocument.


getDate

public Date getDate()

setDate

public void setDate(Date date)

getCreationDate

public Date getCreationDate()

setCreationDate

public void setCreationDate(Date date)

getContentUpdateDate

public Date getContentUpdateDate()

setContentUpdateDate

public void setContentUpdateDate(Date date)

getMeta

public String getMeta()

setMeta

public void setMeta(String meta)

appendMeta

public void appendMeta(String meta)

isContentDirty

public boolean isContentDirty()

incrementVersion

public void incrementVersion()

setContentDirty

public void setContentDirty(boolean contentDirty)

isMetaDataDirty

public boolean isMetaDataDirty()

setMetaDataDirty

public void setMetaDataDirty(boolean metaDataDirty)

getAttachmentURL

public String getAttachmentURL(String filename,
                               XWikiContext context)

getAttachmentURL

public String getAttachmentURL(String filename,
                               String action,
                               XWikiContext context)

getExternalAttachmentURL

public String getExternalAttachmentURL(String filename,
                                       String action,
                                       XWikiContext context)

getAttachmentURL

public String getAttachmentURL(String filename,
                               String action,
                               String querystring,
                               XWikiContext context)

getAttachmentRevisionURL

public String getAttachmentRevisionURL(String filename,
                                       String revision,
                                       XWikiContext context)

getAttachmentRevisionURL

public String getAttachmentRevisionURL(String filename,
                                       String revision,
                                       String querystring,
                                       XWikiContext context)

getURL

public String getURL(String action,
                     String params,
                     boolean redirect,
                     XWikiContext context)
Parameters:
action - the action, see the struts-config.xml file for a list of all existing action names
params - the URL query string
redirect - true if the URL is going to be used in HttpServletResponse.sendRedirect(String)
context - the XWiki context
Returns:
the URL

getURL

public String getURL(String action,
                     boolean redirect,
                     XWikiContext context)

getURL

public String getURL(String action,
                     XWikiContext context)

getURL

public String getURL(String action,
                     String querystring,
                     XWikiContext context)

getURL

public String getURL(String action,
                     String querystring,
                     String anchor,
                     XWikiContext context)

getExternalURL

public String getExternalURL(String action,
                             XWikiContext context)

getExternalURL

public String getExternalURL(String action,
                             String querystring,
                             XWikiContext context)

getParentURL

public String getParentURL(XWikiContext context)
                    throws XWikiException
Throws:
XWikiException

getDocumentArchive

public XWikiDocumentArchive getDocumentArchive(XWikiContext context)
                                        throws XWikiException
Throws:
XWikiException

newDocument

public Document newDocument(String customClassName,
                            XWikiContext context)
Create a new protected Document public API to access page information and actions from scripting.

Parameters:
customClassName - the name of the custom Document class of the object to create.
context - the XWiki context.
Returns:
a wrapped version of an XWikiDocument. Prefer this function instead of new Document(XWikiDocument, XWikiContext)

newDocument

public Document newDocument(Class<?> customClass,
                            XWikiContext context)
Create a new protected Document public API to access page information and actions from scripting.

Parameters:
customClass - the custom Document class the object to create.
context - the XWiki context.
Returns:
a wrapped version of an XWikiDocument. Prefer this function instead of new Document(XWikiDocument, XWikiContext)

newDocument

public Document newDocument(XWikiContext context)

loadArchive

public void loadArchive(XWikiContext context)
                 throws XWikiException
Throws:
XWikiException

getDocumentArchive

public XWikiDocumentArchive getDocumentArchive()
Returns:
the XWikiDocumentArchive for this document. If it is not stored in the document, null is returned.

loadDocumentArchive

public XWikiDocumentArchive loadDocumentArchive()
Returns:
the XWikiDocumentArchive for this document. If it is not stored in the document, we get it using the current context. If there is an exception, null is returned.

setDocumentArchive

public void setDocumentArchive(XWikiDocumentArchive arch)

setDocumentArchive

public void setDocumentArchive(String sarch)
                        throws XWikiException
Throws:
XWikiException

getRevisions

public org.suigeneris.jrcs.rcs.Version[] getRevisions(XWikiContext context)
                                               throws XWikiException
Throws:
XWikiException

getRecentRevisions

public String[] getRecentRevisions(int nb,
                                   XWikiContext context)
                            throws XWikiException
Throws:
XWikiException

getRevisions

public List<String> getRevisions(RevisionCriteria criteria,
                                 XWikiContext context)
                          throws XWikiException
Get document versions matching criterias like author, minimum creation date, etc.

Parameters:
criteria - criteria used to match versions
Returns:
a list of matching versions
Throws:
XWikiException

getRevisionInfo

public XWikiRCSNodeInfo getRevisionInfo(String version,
                                        XWikiContext context)
                                 throws XWikiException
Throws:
XWikiException

isMostRecent

public boolean isMostRecent()
Returns:
Is this version the most recent one. False if and only if there are newer versions of this document in the database.

setMostRecent

public void setMostRecent(boolean mostRecent)
must not be used unless in store system.

Parameters:
mostRecent - - mark document as most recent.

getXClass

public BaseClass getXClass()
Since:
2.2M1

setXClass

public void setXClass(BaseClass xwikiClass)
Since:
2.2M1

getXObjects

public Map<DocumentReference,List<BaseObject>> getXObjects()
Since:
2.2M1

setXObjects

public void setXObjects(Map<DocumentReference,List<BaseObject>> objects)
Since:
2.2M1

getXObject

public BaseObject getXObject()
Since:
2.2M1

getxWikiObject

@Deprecated
public BaseObject getxWikiObject()
Deprecated. since 2.2M1 use getXObject() instead


getXClasses

public List<BaseClass> getXClasses(XWikiContext context)
Since:
2.2M1

createXObject

public int createXObject(EntityReference classReference,
                         XWikiContext context)
                  throws XWikiException
Create and add a new object to the document with the provided class.

Note that absolute reference are not supported for xclasses which mean that the wiki part (whatever the wiki is) of the reference will be systematically removed.

Parameters:
classReference - the reference of the class
context - the XWiki context
Returns:
the index of teh newly created object
Throws:
XWikiException - error when creating the new object
Since:
2.2.3

createNewObject

@Deprecated
public int createNewObject(String className,
                                      XWikiContext context)
                    throws XWikiException
Deprecated. since 2.2M1 use createXObject(EntityReference, XWikiContext) instead

Throws:
XWikiException

getXObjectSize

public int getXObjectSize(DocumentReference classReference)
Since:
2.2M1

getObjectNumbers

@Deprecated
public int getObjectNumbers(String className)
Deprecated. since 2.2M1 use getXObjectSize(DocumentReference) instead


getXObjects

public List<BaseObject> getXObjects(DocumentReference classReference)
Since:
2.2M1

getXObjects

public List<BaseObject> getXObjects(EntityReference reference)
Since:
3.3M1

getObjects

@Deprecated
public Vector<BaseObject> getObjects(String className)
Deprecated. since 2.2M1 use getXObjects(DocumentReference) instead


setXObjects

public void setXObjects(DocumentReference classReference,
                        List<BaseObject> objects)
Since:
2.2M1

getXObject

public BaseObject getXObject(EntityReference reference)
Since:
3.3M1

getXObject

public BaseObject getXObject(DocumentReference classReference)
Since:
2.2M1

getXObject

public BaseObject getXObject(ObjectReference objectReference)
Get an object of this document based on its reference.

Parameters:
objectReference - the reference of the object
Returns:
the XWiki object
Since:
3.2M1

getXObjectProperty

public BaseProperty<ObjectPropertyReference> getXObjectProperty(ObjectPropertyReference objectPropertyReference)
Get an object property of this document based on its reference.

Parameters:
objectPropertyReference - the reference of the object property
Returns:
the object property
Since:
3.2M3

getObject

@Deprecated
public BaseObject getObject(String className)
Deprecated. since 2.2M1 use getXObject(DocumentReference) instead


getXObject

public BaseObject getXObject(DocumentReference classReference,
                             int nb)
Since:
2.2M1

getXObject

public BaseObject getXObject(EntityReference classReference,
                             int nb)
Since:
4.1M1

getObject

@Deprecated
public BaseObject getObject(String className,
                                       int nb)
Deprecated. since 2.2M1 use getXObject(DocumentReference, int) instead


getXObject

public BaseObject getXObject(DocumentReference classReference,
                             String key,
                             String value)
Since:
2.2M1

getObject

@Deprecated
public BaseObject getObject(String className,
                                       String key,
                                       String value)
Deprecated. since 2.2M1 use getXObject(DocumentReference, String, String) instead


getXObject

public BaseObject getXObject(DocumentReference classReference,
                             String key,
                             String value,
                             boolean failover)
Since:
2.2M1

getObject

@Deprecated
public BaseObject getObject(String className,
                                       String key,
                                       String value,
                                       boolean failover)
Deprecated. since 2.2M1 use getXObject(DocumentReference, String, String, boolean) instead


addXObject

@Deprecated
public void addXObject(DocumentReference classReference,
                                  BaseObject object)
Deprecated. use addXObject(BaseObject) instead

Since:
2.2M1

addXObject

public void addXObject(BaseObject object)
Add the object to the document.

Parameters:
object - the xobject to add
Throws:
NullPointerException - if the specified object is null because we need the get the class reference from the object
Since:
2.2.3

addObject

@Deprecated
public void addObject(String className,
                                 BaseObject object)
Deprecated. since 2.2M1 use addXObject(BaseObject) instead


setXObject

@Deprecated
public void setXObject(DocumentReference classReference,
                                  int nb,
                                  BaseObject object)
Deprecated. use setXObject(int, BaseObject) instead

Since:
2.2M1

setXObject

public void setXObject(int nb,
                       BaseObject object)
Replaces the object at the specified position and for the specified object xclass.

Parameters:
nb - index of the element to replace
object - the xobject to insert
Throws:
NullPointerException - if the specified object is null because we need the get the class reference from the object
Since:
2.2.3

setObject

@Deprecated
public void setObject(String className,
                                 int nb,
                                 BaseObject object)
Deprecated. since 2.2M1 use setXObject(DocumentReference, int, BaseObject) instead


isNew

public boolean isNew()
Returns:
true if the document is a new one (i.e. it has never been saved) or false otherwise

setNew

public void setNew(boolean aNew)

mergeXClass

public void mergeXClass(XWikiDocument templatedoc)
Since:
2.2M1

mergexWikiClass

@Deprecated
public void mergexWikiClass(XWikiDocument templatedoc)
Deprecated. since 2.2M1 use mergeXClass(XWikiDocument) instead


mergeXObjects

public void mergeXObjects(XWikiDocument templateDoc)
Since:
2.2M1

mergexWikiObjects

@Deprecated
public void mergexWikiObjects(XWikiDocument templatedoc)
Deprecated. since 2.2M1 use mergeXObjects(XWikiDocument) instead


cloneXObjects

public void cloneXObjects(XWikiDocument templatedoc)
Since:
2.2M1

duplicateXObjects

public void duplicateXObjects(XWikiDocument templatedoc)
Since:
2.2.3

clonexWikiObjects

@Deprecated
public void clonexWikiObjects(XWikiDocument templatedoc)
Deprecated. since 2.2M1 use cloneXObjects(XWikiDocument) instead


getTemplateDocumentReference

public DocumentReference getTemplateDocumentReference()
Since:
2.2M1

getTemplate

@Deprecated
public String getTemplate()
Deprecated. since 2.2M1 use getTemplateDocumentReference() instead


setTemplateDocumentReference

public void setTemplateDocumentReference(DocumentReference templateDocumentReference)
Since:
2.2M1

setTemplate

@Deprecated
public void setTemplate(String template)
Deprecated. since 2.2M1 use setTemplateDocumentReference(DocumentReference) instead


displayPrettyName

public String displayPrettyName(String fieldname,
                                XWikiContext context)

displayPrettyName

public String displayPrettyName(String fieldname,
                                boolean showMandatory,
                                XWikiContext context)

displayPrettyName

public String displayPrettyName(String fieldname,
                                boolean showMandatory,
                                boolean before,
                                XWikiContext context)

displayPrettyName

public String displayPrettyName(String fieldname,
                                BaseObject obj,
                                XWikiContext context)

displayPrettyName

public String displayPrettyName(String fieldname,
                                boolean showMandatory,
                                BaseObject obj,
                                XWikiContext context)

displayPrettyName

public String displayPrettyName(String fieldname,
                                boolean showMandatory,
                                boolean before,
                                BaseObject obj,
                                XWikiContext context)

displayTooltip

public String displayTooltip(String fieldname,
                             XWikiContext context)

displayTooltip

public String displayTooltip(String fieldname,
                             BaseObject obj,
                             XWikiContext context)

display

public String display(String fieldname,
                      XWikiContext context)
Parameters:
fieldname - the name of the field to display
context - the XWiki context
Returns:
the rendered field

display

public String display(String fieldname,
                      BaseObject obj,
                      XWikiContext context)
Parameters:
fieldname - the name of the field to display
obj - the object containing the field to display
context - the XWiki context
Returns:
the rendered field

display

public String display(String fieldname,
                      String mode,
                      XWikiContext context)
Parameters:
fieldname - the name of the field to display
mode - the mode to use ("view", "edit", ...)
context - the XWiki context
Returns:
the rendered field

display

public String display(String fieldname,
                      String type,
                      BaseObject obj,
                      XWikiContext context)
Parameters:
fieldname - the name of the field to display
type - the type of the field to display
obj - the object containing the field to display
context - the XWiki context
Returns:
the rendered field

display

public String display(String fieldname,
                      String mode,
                      String prefix,
                      XWikiContext context)
Parameters:
fieldname - the name of the field to display
mode - the mode to use ("view", "edit", ...)
prefix - the prefix to add in the field identifier in edit display for example
context - the XWiki context
Returns:
the rendered field

display

public String display(String fieldname,
                      String type,
                      BaseObject obj,
                      String wrappingSyntaxId,
                      XWikiContext context)
Parameters:
fieldname - the name of the field to display
type - the type of the field to display
obj - the object containing the field to display
wrappingSyntaxId - the syntax of the content in which the result will be included. This to take care of some escaping depending of the syntax.
context - the XWiki context
Returns:
the rendered field

display

public String display(String fieldname,
                      String type,
                      String pref,
                      BaseObject obj,
                      XWikiContext context)
Parameters:
fieldname - the name of the field to display
type - the type of the field to display
pref - the prefix to add in the field identifier in edit display for example
obj - the object containing the field to display
context - the XWiki context
Returns:
the rendered field

display

public String display(String fieldname,
                      String type,
                      String pref,
                      BaseObject obj,
                      String wrappingSyntaxId,
                      XWikiContext context)
Parameters:
fieldname - the name of the field to display
type - the type of the field to display
pref - the prefix to add in the field identifier in edit display for example
obj - the object containing the field to display
wrappingSyntaxId - the syntax of the content in which the result will be included. This to take care of some escaping depending of the syntax.
context - the XWiki context
Returns:
the rendered field

displayForm

public String displayForm(DocumentReference classReference,
                          String header,
                          String format,
                          XWikiContext context)
Since:
2.2M1

displayForm

@Deprecated
public String displayForm(String className,
                                     String header,
                                     String format,
                                     XWikiContext context)
Deprecated. since 2.2M1, use displayForm(DocumentReference, String, String, XWikiContext) instead


displayForm

public String displayForm(DocumentReference classReference,
                          String header,
                          String format,
                          boolean linebreak,
                          XWikiContext context)
Since:
2.2M1

displayForm

@Deprecated
public String displayForm(String className,
                                     String header,
                                     String format,
                                     boolean linebreak,
                                     XWikiContext context)
Deprecated. since 2.2M1, use displayForm(DocumentReference, String, String, boolean, XWikiContext) instead


displayForm

public String displayForm(DocumentReference classReference,
                          XWikiContext context)
Since:
2.2M1

displayForm

@Deprecated
public String displayForm(String className,
                                     XWikiContext context)
Deprecated. since 2.2M1, use displayForm(DocumentReference, XWikiContext) instead


isFromCache

public boolean isFromCache()

setFromCache

public void setFromCache(boolean fromCache)

readDocMetaFromForm

public void readDocMetaFromForm(EditForm eform,
                                XWikiContext context)
                         throws XWikiException
Throws:
XWikiException

setTags

public void setTags(String tagsStr,
                    XWikiContext context)
             throws XWikiException
add tags to the document.

Throws:
XWikiException

getTags

public String getTags(XWikiContext context)

getTagsList

public List<String> getTagsList(XWikiContext context)

getTagsPossibleValues

public List<String> getTagsPossibleValues(XWikiContext context)

readTranslationMetaFromForm

public void readTranslationMetaFromForm(EditForm eform,
                                        XWikiContext context)
                                 throws XWikiException
Throws:
XWikiException

readObjectsFromForm

public void readObjectsFromForm(EditForm eform,
                                XWikiContext context)
                         throws XWikiException
Throws:
XWikiException

readFromForm

public void readFromForm(EditForm eform,
                         XWikiContext context)
                  throws XWikiException
Throws:
XWikiException

readFromTemplate

public void readFromTemplate(EditForm eform,
                             XWikiContext context)
                      throws XWikiException
Throws:
XWikiException

readFromTemplate

public void readFromTemplate(DocumentReference templateDocumentReference,
                             XWikiContext context)
                      throws XWikiException
Throws:
XWikiException
Since:
2.2M1

readFromTemplate

@Deprecated
public void readFromTemplate(String template,
                                        XWikiContext context)
                      throws XWikiException
Deprecated. since 2.2M1 use readFromTemplate(DocumentReference, XWikiContext) instead

Throws:
XWikiException

clone

public XWikiDocument clone()
Overrides:
clone in class Object

duplicate

public XWikiDocument duplicate(DocumentReference newDocumentReference)
Duplicate this document and give it a new name.

Since:
2.2.3

copyAttachments

public void copyAttachments(XWikiDocument sourceDocument)
Copy attachments from one document to another. This implementation expects that you are copying the attachment from one document to another and thus it should be saved seperately from the original in the database.

Parameters:
sourceDocument - an XWikiDocument to copy attachments from

loadAttachmentsContent

public void loadAttachmentsContent(XWikiContext context)
                            throws XWikiException
Load attachment content from database.

Parameters:
context - the XWiki context
Throws:
XWikiException - when failing to load attachments
Since:
5.3M2

loadAttachments

public void loadAttachments(XWikiContext context)
                     throws XWikiException
Throws:
XWikiException

equals

public boolean equals(Object object)
Overrides:
equals in class Object

equalsData

public boolean equalsData(XWikiDocument otherDocument)
Same as equals(Object) but only for actual datas of the document.

The goal being to compare two versions of the same document this method skip every version/reference/author related information. For example it allows to compare a document comming from a another wiki and easily check if thoses actually are the same thing whatever the plumbing differences.

Parameters:
otherDocument - the document to compare
Returns:
true if bith documents have the same datas
Since:
4.1.1

toXML

@Deprecated
public String toXML(org.dom4j.Document doc,
                               XWikiContext context)
Deprecated. this method has nothing to do here and is apparently unused

Convert a Document into an XML string. You should prefer toXML(OutputStream, boolean, boolean, boolean, boolean, XWikiContext) or toXML(com.xpn.xwiki.internal.xml.XMLWriter, boolean, boolean, boolean, boolean, XWikiContext) when possible to avoid memory load.

Parameters:
doc - the Document to convert to a String
context - current XWikiContext
Returns:
an XML representation of the Document

getXMLContent

public String getXMLContent(XWikiContext context)
                     throws XWikiException
Retrieve the document in the current context language as an XML string. The rendrered document content and all XObjects are included. Document attachments and archived versions are excluded. You should prefer toXML(OutputStream, true, true, false, false, XWikiContext)} or toXML(com.xpn.xwiki.util.XMLWriter, true, true, false, false, XWikiContext) on the translated document when possible to reduce memory load.

Parameters:
context - current XWikiContext
Returns:
a string containing an XML representation of the document in the current context language
Throws:
XWikiException - when an error occurs during wiki operation

toXML

public String toXML(XWikiContext context)
             throws XWikiException
Retrieve the document as an XML string. All XObject are included. Rendered content, attachments and archived version are excluded. You should prefer toXML(OutputStream, true, false, false, false, XWikiContext)} or toXML(com.xpn.xwiki.util.XMLWriter, true, false, false, false, XWikiContext) when possible to reduce memory load.

Parameters:
context - current XWikiContext
Returns:
a string containing an XML representation of the document
Throws:
XWikiException - when an error occurs during wiki operation

toFullXML

public String toFullXML(XWikiContext context)
                 throws XWikiException
Retrieve the document as an XML string. All XObjects attachments and archived version are included. Rendered content is excluded. You should prefer toXML(OutputStream, true, false, true, true, XWikiContext)} or toXML(com.xpn.xwiki.util.XMLWriter, true, false, true, true, XWikiContext) when possible to reduce memory load.

Parameters:
context - current XWikiContext
Returns:
a string containing an XML representation of the document
Throws:
XWikiException - when an error occurs during wiki operation

addToZip

@Deprecated
public void addToZip(ZipOutputStream zos,
                                String zipname,
                                boolean withVersions,
                                XWikiContext context)
              throws XWikiException,
                     IOException
Deprecated. since 4.1M2

Serialize the document into a new entry of an ZipOutputStream in XML format. All XObjects and attachments are included. Rendered content is excluded.

Parameters:
zos - the ZipOutputStream to write to
zipname - the name of the new entry to create
withVersions - if true, also include archived version of the document
context - current XWikiContext
Throws:
XWikiException - when an error occurs during xwiki operations
IOException - when an error occurs during streaming operations
Since:
2.3M2

addToZip

@Deprecated
public void addToZip(ZipOutputStream zos,
                                boolean withVersions,
                                XWikiContext context)
              throws XWikiException,
                     IOException
Deprecated. since 4.2M2

Serialize the document into a new entry of an ZipOutputStream in XML format. The new entry is named 'LastSpaceName/DocumentName'. All XObjects and attachments are included. Rendered content is excluded.

Parameters:
zos - the ZipOutputStream to write to
withVersions - if true, also include archived version of the document
context - current XWikiContext
Throws:
XWikiException - when an error occurs during xwiki operations
IOException - when an error occurs during streaming operations
Since:
2.3M2

addToZip

@Deprecated
public void addToZip(ZipOutputStream zos,
                                XWikiContext context)
              throws XWikiException,
                     IOException
Deprecated. since 4.1M2

Serialize the document into a new entry of an ZipOutputStream in XML format. The new entry is named 'LastSpaceName/DocumentName'. All XObjects, attachments and archived versions are included. Rendered content is excluded.

Parameters:
zos - the ZipOutputStream to write to
context - current XWikiContext
Throws:
XWikiException - when an error occurs during xwiki operations
IOException - when an error occurs during streaming operations
Since:
2.3M2

toXML

public String toXML(boolean bWithObjects,
                    boolean bWithRendering,
                    boolean bWithAttachmentContent,
                    boolean bWithVersions,
                    XWikiContext context)
             throws XWikiException
Serialize the document to an XML string. You should prefer toXML(OutputStream, boolean, boolean, boolean, boolean, XWikiContext) or toXML(com.xpn.xwiki.internal.xml.XMLWriter, boolean, boolean, boolean, boolean, XWikiContext) when possible to reduce memory load.

Parameters:
bWithObjects - include XObjects
bWithRendering - include the rendered content
bWithAttachmentContent - include attachments content
bWithVersions - include archived versions
context - current XWikiContext
Returns:
a string containing an XML representation of the document
Throws:
XWikiException - when an errors occurs during wiki operations

toXMLDocument

public org.dom4j.Document toXMLDocument(XWikiContext context)
                                 throws XWikiException
Serialize the document to an XML DOMDocument. All XObject are included. Rendered content, attachments and archived version are excluded. You should prefer toXML(OutputStream, true, false, false, false, XWikiContext)} or toXML(com.xpn.xwiki.util.XMLWriter, true, false, false, false, XWikiContext) when possible to reduce memory load.

Parameters:
context - current XWikiContext
Returns:
a DOMDocument containing the serialized document.
Throws:
XWikiException - when an errors occurs during wiki operations

toXMLDocument

public org.dom4j.Document toXMLDocument(boolean bWithObjects,
                                        boolean bWithRendering,
                                        boolean bWithAttachmentContent,
                                        boolean bWithVersions,
                                        XWikiContext context)
                                 throws XWikiException
Serialize the document to an XML DOMDocument. You should prefer toXML(OutputStream, boolean, boolean, boolean, boolean, XWikiContext) or toXML(com.xpn.xwiki.internal.xml.XMLWriter, boolean, boolean, boolean, boolean, XWikiContext) when possible to reduce memory load.

Parameters:
bWithObjects - include XObjects
bWithRendering - include the rendered content
bWithAttachmentContent - include attachments content
bWithVersions - include archived versions
context - current XWikiContext
Returns:
a DOMDocument containing the serialized document.
Throws:
XWikiException - when an errors occurs during wiki operations

toXML

public void toXML(com.xpn.xwiki.internal.xml.XMLWriter wr,
                  boolean bWithObjects,
                  boolean bWithRendering,
                  boolean bWithAttachmentContent,
                  boolean bWithVersions,
                  XWikiContext context)
           throws XWikiException,
                  IOException
Serialize the document to a XMLWriter.

Parameters:
bWithObjects - include XObjects
bWithRendering - include the rendered content
bWithAttachmentContent - include attachments content
bWithVersions - include archived versions
context - current XWikiContext
Throws:
XWikiException - when an errors occurs during wiki operations
IOException - when an errors occurs during streaming operations
Since:
2.3M2

toXML

public void toXML(OutputStream out,
                  boolean bWithObjects,
                  boolean bWithRendering,
                  boolean bWithAttachmentContent,
                  boolean bWithVersions,
                  XWikiContext context)
           throws XWikiException,
                  IOException
Serialize the document to an OutputStream.

Parameters:
bWithObjects - include XObjects
bWithRendering - include the rendered content
bWithAttachmentContent - include attachments content
bWithVersions - include archived versions
context - current XWikiContext
Throws:
XWikiException - when an errors occurs during wiki operations
IOException - when an errors occurs during streaming operations
Since:
2.3M2

encodedXMLStringAsUTF8

protected String encodedXMLStringAsUTF8(String xmlString)

getElement

protected String getElement(org.dom4j.Element docel,
                            String name)

fromXML

public void fromXML(String xml)
             throws XWikiException
Throws:
XWikiException

fromXML

public void fromXML(InputStream is)
             throws XWikiException
Throws:
XWikiException

fromXML

public void fromXML(String xml,
                    boolean withArchive)
             throws XWikiException
Throws:
XWikiException

fromXML

public void fromXML(InputStream in,
                    boolean withArchive)
             throws XWikiException
Throws:
XWikiException

fromXML

public void fromXML(org.dom4j.Document domdoc,
                    boolean withArchive)
             throws XWikiException
Throws:
XWikiException

containsXMLWikiDocument

public static boolean containsXMLWikiDocument(org.dom4j.Document domdoc)
Check if provided xml document is a wiki document.

Parameters:
domdoc - the xml document.
Returns:
true if provided xml document is a wiki document.

setAttachmentList

public void setAttachmentList(List<XWikiAttachment> list)

getAttachmentList

public List<XWikiAttachment> getAttachmentList()

saveAllAttachments

public void saveAllAttachments(XWikiContext context)
                        throws XWikiException
Throws:
XWikiException

saveAllAttachments

public void saveAllAttachments(boolean updateParent,
                               boolean transaction,
                               XWikiContext context)
                        throws XWikiException
Throws:
XWikiException

saveAttachmentsContent

public void saveAttachmentsContent(List<XWikiAttachment> attachments,
                                   XWikiContext context)
                            throws XWikiException
Throws:
XWikiException

saveAttachmentContent

public void saveAttachmentContent(XWikiAttachment attachment,
                                  XWikiContext context)
                           throws XWikiException
Throws:
XWikiException

saveAttachmentContent

public void saveAttachmentContent(XWikiAttachment attachment,
                                  boolean updateParent,
                                  boolean transaction,
                                  XWikiContext context)
                           throws XWikiException
Throws:
XWikiException

loadAttachmentContent

public void loadAttachmentContent(XWikiAttachment attachment,
                                  XWikiContext context)
                           throws XWikiException
Throws:
XWikiException

removeAttachment

public XWikiAttachment removeAttachment(XWikiAttachment attachment)
Remove the attachment from the document attachment list and put it in the list of attachments to remove for next document save.

The attachment will be move to recycle bin.

Parameters:
attachment - the attachment to remove
Returns:
the removed attachment, null if none could be found
Since:
5.2M1

removeAttachment

public XWikiAttachment removeAttachment(XWikiAttachment attachmentToRemove,
                                        boolean toRecycleBin)
Remove the attachment from the document attachment list and put it in the list of attachments to remove for next document save.

Parameters:
attachmentToRemove - the attachment to remove
toRecycleBin - indicate if the attachment should be moved to recycle bin
Returns:
the removed attachment, null if none could be found
Since:
5.2M1

getAttachmentsToRemove

public List<XWikiDocument.XWikiAttachmentToRemove> getAttachmentsToRemove()
Returns:
the attachment planned for removal

clearAttachmentsToRemove

public void clearAttachmentsToRemove()
Clear the list of attachments planned for removal.


deleteAttachment

@Deprecated
public void deleteAttachment(XWikiAttachment attachment,
                                        XWikiContext context)
                      throws XWikiException
Deprecated. since 5.2M1 use removeAttachment(XWikiAttachment) instead

Throws:
XWikiException

deleteAttachment

@Deprecated
public void deleteAttachment(XWikiAttachment attachment,
                                        boolean toRecycleBin,
                                        XWikiContext context)
                      throws XWikiException
Deprecated. since 5.2M1 use removeAttachment(XWikiAttachment) instead

Throws:
XWikiException

getBackLinkedReferences

public List<DocumentReference> getBackLinkedReferences(XWikiContext context)
                                                throws XWikiException
Get the wiki document references pointing to this document.

Theses links are stored to the database when documents are saved. You can use "backlinks" in XWikiPreferences or "xwiki.backlinks" in xwiki.cfg file to enable links storage in the database.

Parameters:
context - the XWiki context.
Returns:
the found wiki document references
Throws:
XWikiException - error when getting pages names from database.
Since:
2.2M2

getBackLinkedPages

@Deprecated
public List<String> getBackLinkedPages(XWikiContext context)
                                throws XWikiException
Deprecated. since 2.2M2 use getBackLinkedReferences(XWikiContext)

Throws:
XWikiException

getUniqueWikiLinkedPages

public Set<XWikiLink> getUniqueWikiLinkedPages(XWikiContext context)
                                        throws XWikiException
Get a list of unique links from this document to others documents.

Parameters:
context - the XWiki context
Returns:
the found wiki links.
Throws:
XWikiException - error when getting links from database when 1.0 content.
Since:
1.9M2

getUniqueLinkedPages

public Set<String> getUniqueLinkedPages(XWikiContext context)
Extract all the unique static (i.e. not generated by macros) wiki links (pointing to wiki page) from this document's content to others documents.

Parameters:
context - the XWiki context.
Returns:
the document names for linked pages, if null an error append.
Since:
1.9M2

getChildrenReferences

public List<DocumentReference> getChildrenReferences(XWikiContext context)
                                              throws XWikiException
Returns a list of references of all documents which list this document as their parent getChildren(int, int, com.xpn.xwiki.XWikiContext)

Throws:
XWikiException
Since:
2.2M2

getChildren

@Deprecated
public List<String> getChildren(XWikiContext context)
                         throws XWikiException
Deprecated. since 2.2M2 use getChildrenReferences(XWikiContext)

Throws:
XWikiException

getChildrenReferences

public List<DocumentReference> getChildrenReferences(int nb,
                                                     int start,
                                                     XWikiContext context)
                                              throws XWikiException
Returns a list of references of all documents which list this document as their parent

Parameters:
nb - The number of results to return.
start - The number of results to skip before we begin returning results.
context - The context.
Returns:
the list of document references
Throws:
XWikiException - If there's an error querying the database.
Since:
2.2M2

getChildren

@Deprecated
public List<String> getChildren(int nb,
                                           int start,
                                           XWikiContext context)
                         throws XWikiException
Deprecated. since 2.2M2 use getChildrenReferences(XWikiContext)

Throws:
XWikiException

renameProperties

public void renameProperties(DocumentReference classReference,
                             Map<String,String> fieldsToRename)
Since:
2.2M2

renameProperties

@Deprecated
public void renameProperties(String className,
                                        Map<String,String> fieldsToRename)
Deprecated. since 2.2M2 use renameProperties(DocumentReference, Map) instead


addXObjectToRemove

public void addXObjectToRemove(BaseObject object)
Since:
2.2M1

addXObjectsToRemoveFromVersion

public void addXObjectsToRemoveFromVersion(XWikiDocument previousVersion)
Automatically add objects present in the old version, but not in the current document, to the list of objects marked for removal from the database.

Parameters:
previousVersion - the version of the document present in the database
Since:
3.3M2

addObjectsToRemove

@Deprecated
public void addObjectsToRemove(BaseObject object)
Deprecated. since 2.2M2 use addXObjectToRemove(BaseObject) )} instead


getXObjectsToRemove

public List<BaseObject> getXObjectsToRemove()
Since:
2.2M2

getObjectsToRemove

@Deprecated
public ArrayList<BaseObject> getObjectsToRemove()
Deprecated. since 2.2M2 use getObjectsToRemove() instead


setXObjectsToRemove

public void setXObjectsToRemove(List<BaseObject> objectsToRemove)
Since:
2.2M1

getIncludedPages

public List<String> getIncludedPages(XWikiContext context)

getIncludedMacros

public List<String> getIncludedMacros(XWikiContext context)

displayRendered

public String displayRendered(PropertyClass pclass,
                              String prefix,
                              BaseCollection object,
                              XWikiContext context)
                       throws XWikiException
Throws:
XWikiException

displayView

public String displayView(PropertyClass pclass,
                          String prefix,
                          BaseCollection object,
                          XWikiContext context)

displayEdit

public String displayEdit(PropertyClass pclass,
                          String prefix,
                          BaseCollection object,
                          XWikiContext context)

displayHidden

public String displayHidden(PropertyClass pclass,
                            String prefix,
                            BaseCollection object,
                            XWikiContext context)

getAttachment

public XWikiAttachment getAttachment(String filename)
Parameters:
filename - the file name of the attachment with or without the extension
Returns:
the XWikiAttachment corresponding to the file name, null if none can be found

addAttachment

public void addAttachment(XWikiAttachment attachment)
Add passed attachment to the document.

Parameters:
attachment - the attachment to add
Since:
5.3M2

addAttachment

public XWikiAttachment addAttachment(String fileName,
                                     byte[] content,
                                     XWikiContext context)
                              throws XWikiException
Deprecated. use addAttachment(String, InputStream, XWikiContext) instead

Throws:
XWikiException

addAttachment

public XWikiAttachment addAttachment(String fileName,
                                     InputStream content,
                                     XWikiContext context)
                              throws XWikiException,
                                     IOException
Throws:
XWikiException
IOException

getFirstObject

public BaseObject getFirstObject(String fieldname)

getFirstObject

public BaseObject getFirstObject(String fieldname,
                                 XWikiContext context)

setProperty

public void setProperty(EntityReference classReference,
                        String fieldName,
                        BaseProperty value)
Since:
2.2.3

setProperty

@Deprecated
public void setProperty(String className,
                                   String fieldName,
                                   BaseProperty value)
Deprecated. since 2.2M2 use setProperty(EntityReference, String, BaseProperty) instead


getIntValue

public int getIntValue(DocumentReference classReference,
                       String fieldName)
Since:
2.2M2

getIntValue

@Deprecated
public int getIntValue(String className,
                                  String fieldName)
Deprecated. since 2.2M2 use getIntValue(DocumentReference, String) instead


getLongValue

public long getLongValue(DocumentReference classReference,
                         String fieldName)
Since:
2.2M2

getLongValue

@Deprecated
public long getLongValue(String className,
                                    String fieldName)
Deprecated. since 2.2M2 use getLongValue(DocumentReference, String) instead


getStringValue

public String getStringValue(DocumentReference classReference,
                             String fieldName)
Since:
2.2M2

getStringValue

@Deprecated
public String getStringValue(String className,
                                        String fieldName)
Deprecated. since 2.2M2 use getStringValue(DocumentReference, String) instead


getIntValue

public int getIntValue(String fieldName)

getLongValue

public long getLongValue(String fieldName)

getStringValue

public String getStringValue(String fieldName)

setStringValue

public void setStringValue(EntityReference classReference,
                           String fieldName,
                           String value)
Since:
2.2.3

setStringValue

@Deprecated
public void setStringValue(String className,
                                      String fieldName,
                                      String value)
Deprecated. since 2.2M2 use setStringValue(EntityReference, String, String) instead


getListValue

public List getListValue(DocumentReference classReference,
                         String fieldName)
Since:
2.2M2

getListValue

@Deprecated
public List getListValue(String className,
                                    String fieldName)
Deprecated. since 2.2M2 use getListValue(DocumentReference, String) instead


getListValue

public List getListValue(String fieldName)

setStringListValue

public void setStringListValue(EntityReference classReference,
                               String fieldName,
                               List value)
Since:
2.2.3

setStringListValue

@Deprecated
public void setStringListValue(String className,
                                          String fieldName,
                                          List value)
Deprecated. since 2.2M2 use setStringListValue(EntityReference, String, List) instead


setDBStringListValue

public void setDBStringListValue(EntityReference classReference,
                                 String fieldName,
                                 List value)
Since:
2.2.3

setDBStringListValue

@Deprecated
public void setDBStringListValue(String className,
                                            String fieldName,
                                            List value)
Deprecated. since 2.2M2 use setDBStringListValue(EntityReference, String, List) instead


setLargeStringValue

public void setLargeStringValue(EntityReference classReference,
                                String fieldName,
                                String value)
Since:
2.2.3

setLargeStringValue

@Deprecated
public void setLargeStringValue(String className,
                                           String fieldName,
                                           String value)
Deprecated. since 2.2M2 use setLargeStringValue(EntityReference, String, String) instead


setIntValue

public void setIntValue(EntityReference classReference,
                        String fieldName,
                        int value)
Since:
2.2.3

setIntValue

@Deprecated
public void setIntValue(String className,
                                   String fieldName,
                                   int value)
Deprecated. since 2.2M2 use setIntValue(EntityReference, String, int) instead


getDatabase

@Deprecated
public String getDatabase()
Deprecated. since 2.2M1 use getDocumentReference() instead

Note that this method cannot be removed for now since it's used by Hibernate for saving a XWikiDocument.


setDatabase

@Deprecated
public void setDatabase(String database)
Deprecated. since 2.2M1 use setDocumentReference(DocumentReference) instead

Note that this method cannot be removed for now since it's used by Hibernate for loading a XWikiDocument.


getLanguage

@Deprecated
public String getLanguage()
Deprecated. since 4.3M2 use getLocale() instead

Note that this method cannot be removed for now since it's used by Hibernate for saving a XWikiDocument.


setLanguage

@Deprecated
public void setLanguage(String language)
Deprecated. since 4.3M2 use setLocale(Locale) instead

Note that this method cannot be removed for now since it's used by Hibernate for saving a XWikiDocument.


getLocale

public Locale getLocale()
Returns:
the locale of the document

setLocale

public void setLocale(Locale locale)
Parameters:
locale - the locale of the document

getDefaultLanguage

@Deprecated
public String getDefaultLanguage()
Deprecated. since 4.3M2 use getDefaultLocale() instead

Note that this method cannot be removed for now since it's used by Hibernate for saving a XWikiDocument.


setDefaultLanguage

@Deprecated
public void setDefaultLanguage(String defaultLanguage)
Deprecated. since 4.3M2 use setDefaultLocale(Locale) instead

Note that this method cannot be removed for now since it's used by Hibernate for saving a XWikiDocument.


getDefaultLocale

public Locale getDefaultLocale()

setDefaultLocale

public void setDefaultLocale(Locale defaultLocale)

getTranslation

public int getTranslation()

setTranslation

public void setTranslation(int translation)

getTranslatedContent

public String getTranslatedContent(XWikiContext context)
                            throws XWikiException
Throws:
XWikiException

getTranslatedContent

public String getTranslatedContent(String language,
                                   XWikiContext context)
                            throws XWikiException
Throws:
XWikiException

getTranslatedDocument

public XWikiDocument getTranslatedDocument(XWikiContext context)
                                    throws XWikiException
Throws:
XWikiException

getTranslatedDocument

@Deprecated
public XWikiDocument getTranslatedDocument(String language,
                                                      XWikiContext context)
                                    throws XWikiException
Deprecated. since 4.3M2 use getTranslatedDocument(Locale, XWikiContext) insead

Return the document in the provided language.

This method return this if the provided language does not exists. See

Parameters:
language - the language of the document to return
context - the XWiki Context
Returns:
the document in the provided language or this if the provided language does not exists
Throws:
XWikiException - error when loading the document

getTranslatedDocument

public XWikiDocument getTranslatedDocument(Locale locale,
                                           XWikiContext context)
                                    throws XWikiException
Return the document in the provided language.

This method return this if the provided language does not exists. See

Parameters:
locale - the locale of the document to return
context - the XWiki Context
Returns:
the document in the provided language or this if the provided language does not exists
Throws:
XWikiException - error when loading the document

getRealLanguage

@Deprecated
public String getRealLanguage(XWikiContext context)
                       throws XWikiException
Deprecated. since 4.3M1 use getRealLocale() instead

Throws:
XWikiException

getRealLanguage

@Deprecated
public String getRealLanguage()
Deprecated. since 4.3M1 use getRealLocale() instead

Specified by:
getRealLanguage in interface DocumentModelBridge
See Also:
DocumentModelBridge.getRealLanguage()

getRealLocale

public Locale getRealLocale()
Returns:
the actual locale of the document

getTranslationList

@Deprecated
public List<String> getTranslationList(XWikiContext context)
                                throws XWikiException
Deprecated. since 5.1M2 use getTranslationLocales(XWikiContext) instead

Throws:
XWikiException

getTranslationLocales

public List<Locale> getTranslationLocales(XWikiContext context)
                                   throws XWikiException
The locales of the translation of this document (the default locale is not included).

Parameters:
context - the XWiki context
Returns:
the locales of the translations
Throws:
XWikiException - if retriving the translations from the database failed

getXMLDiff

public List<org.suigeneris.jrcs.diff.delta.Delta> getXMLDiff(XWikiDocument fromDoc,
                                                             XWikiDocument toDoc,
                                                             XWikiContext context)
                                                      throws XWikiException,
                                                             org.suigeneris.jrcs.diff.DifferentiationFailedException
Throws:
XWikiException
org.suigeneris.jrcs.diff.DifferentiationFailedException

getContentDiff

public List<org.suigeneris.jrcs.diff.delta.Delta> getContentDiff(XWikiDocument fromDoc,
                                                                 XWikiDocument toDoc,
                                                                 XWikiContext context)
                                                          throws XWikiException,
                                                                 org.suigeneris.jrcs.diff.DifferentiationFailedException
Throws:
XWikiException
org.suigeneris.jrcs.diff.DifferentiationFailedException

getContentDiff

public List<org.suigeneris.jrcs.diff.delta.Delta> getContentDiff(String fromRev,
                                                                 String toRev,
                                                                 XWikiContext context)
                                                          throws XWikiException,
                                                                 org.suigeneris.jrcs.diff.DifferentiationFailedException
Throws:
XWikiException
org.suigeneris.jrcs.diff.DifferentiationFailedException

getContentDiff

public List<org.suigeneris.jrcs.diff.delta.Delta> getContentDiff(String fromRev,
                                                                 XWikiContext context)
                                                          throws XWikiException,
                                                                 org.suigeneris.jrcs.diff.DifferentiationFailedException
Throws:
XWikiException
org.suigeneris.jrcs.diff.DifferentiationFailedException

getLastChanges

public List<org.suigeneris.jrcs.diff.delta.Delta> getLastChanges(XWikiContext context)
                                                          throws XWikiException,
                                                                 org.suigeneris.jrcs.diff.DifferentiationFailedException
Throws:
XWikiException
org.suigeneris.jrcs.diff.DifferentiationFailedException

getRenderedContentDiff

public List<org.suigeneris.jrcs.diff.delta.Delta> getRenderedContentDiff(XWikiDocument fromDoc,
                                                                         XWikiDocument toDoc,
                                                                         XWikiContext context)
                                                                  throws XWikiException,
                                                                         org.suigeneris.jrcs.diff.DifferentiationFailedException
Throws:
XWikiException
org.suigeneris.jrcs.diff.DifferentiationFailedException

getRenderedContentDiff

public List<org.suigeneris.jrcs.diff.delta.Delta> getRenderedContentDiff(String fromRev,
                                                                         String toRev,
                                                                         XWikiContext context)
                                                                  throws XWikiException,
                                                                         org.suigeneris.jrcs.diff.DifferentiationFailedException
Throws:
XWikiException
org.suigeneris.jrcs.diff.DifferentiationFailedException

getRenderedContentDiff

public List<org.suigeneris.jrcs.diff.delta.Delta> getRenderedContentDiff(String fromRev,
                                                                         XWikiContext context)
                                                                  throws XWikiException,
                                                                         org.suigeneris.jrcs.diff.DifferentiationFailedException
Throws:
XWikiException
org.suigeneris.jrcs.diff.DifferentiationFailedException

getDeltas

protected List<org.suigeneris.jrcs.diff.delta.Delta> getDeltas(org.suigeneris.jrcs.diff.Revision rev)

getMetaDataDiff

public List<MetaDataDiff> getMetaDataDiff(String fromRev,
                                          String toRev,
                                          XWikiContext context)
                                   throws XWikiException
Throws:
XWikiException

getMetaDataDiff

public List<MetaDataDiff> getMetaDataDiff(String fromRev,
                                          XWikiContext context)
                                   throws XWikiException
Throws:
XWikiException

getMetaDataDiff

public List<MetaDataDiff> getMetaDataDiff(XWikiDocument fromDoc,
                                          XWikiDocument toDoc,
                                          XWikiContext context)
                                   throws XWikiException
Throws:
XWikiException

getObjectDiff

public List<List<ObjectDiff>> getObjectDiff(String fromRev,
                                            String toRev,
                                            XWikiContext context)
                                     throws XWikiException
Throws:
XWikiException

getObjectDiff

public List<List<ObjectDiff>> getObjectDiff(String fromRev,
                                            XWikiContext context)
                                     throws XWikiException
Throws:
XWikiException

getObjectDiff

public List<List<ObjectDiff>> getObjectDiff(XWikiDocument fromDoc,
                                            XWikiDocument toDoc,
                                            XWikiContext context)
Return the object differences between two document versions. There is no hard requirement on the order of the two versions, but the results are semantically correct only if the two versions are given in the right order.

Parameters:
fromDoc - The old ('before') version of the document.
toDoc - The new ('after') version of the document.
context - The context.
Returns:
The object differences. The returned list's elements are other lists, one for each changed object. The inner lists contain ObjectDiff elements, one object for each changed property of the object. Additionally, if the object was added or removed, then the first entry in the list will be an "object-added" or "object-removed" marker.

getClassDiff

public List<List<ObjectDiff>> getClassDiff(XWikiDocument fromDoc,
                                           XWikiDocument toDoc,
                                           XWikiContext context)

getAttachmentDiff

public List<AttachmentDiff> getAttachmentDiff(XWikiDocument fromDoc,
                                              XWikiDocument toDoc,
                                              XWikiContext context)
Parameters:
fromDoc -
toDoc -
context -
Returns:

rename

public void rename(DocumentReference newDocumentReference,
                   XWikiContext context)
            throws XWikiException
Rename the current document and all the backlinks leading to it. Will also change parent field in all documents which list the document we are renaming as their parent.

See rename(String, java.util.List, com.xpn.xwiki.XWikiContext) for more details.

Parameters:
newDocumentReference - the new document reference
context - the ubiquitous XWiki Context
Throws:
XWikiException - in case of an error
Since:
2.2M2

rename

@Deprecated
public void rename(String newDocumentName,
                              XWikiContext context)
            throws XWikiException
Deprecated. since 2.2M2 use rename(DocumentReference, XWikiContext)

Throws:
XWikiException

rename

public void rename(DocumentReference newDocumentReference,
                   List<DocumentReference> backlinkDocumentReferences,
                   XWikiContext context)
            throws XWikiException
Rename the current document and all the links pointing to it in the list of passed backlink documents. The renaming algorithm takes into account the fact that there are several ways to write a link to a given page and all those forms need to be renamed. For example the following links all point to the same page:

Note: links without a space are renamed with the space added and all documents which have the document being renamed as parent have their parent field set to "currentwiki:CurrentSpace.Page".

Parameters:
newDocumentReference - the new document reference
backlinkDocumentReferences - the list of references of documents to parse and for which links will be modified to point to the new document reference
context - the ubiquitous XWiki Context
Throws:
XWikiException - in case of an error
Since:
2.2M2

rename

@Deprecated
public void rename(String newDocumentName,
                              List<String> backlinkDocumentNames,
                              XWikiContext context)
            throws XWikiException
Deprecated. since 2.2M2 use rename(DocumentReference, java.util.List, com.xpn.xwiki.XWikiContext)

Throws:
XWikiException

rename

public void rename(DocumentReference newDocumentReference,
                   List<DocumentReference> backlinkDocumentReferences,
                   List<DocumentReference> childDocumentReferences,
                   XWikiContext context)
            throws XWikiException
Same as rename(String, List, XWikiContext) but the list of documents having the current document as their parent is passed in parameter.

Parameters:
newDocumentReference - the new document reference
backlinkDocumentReferences - the list of references of documents to parse and for which links will be modified to point to the new document reference
childDocumentReferences - the list of references of document whose parent field will be set to the new document reference
context - the ubiquitous XWiki Context
Throws:
XWikiException - in case of an error
Since:
2.2M2

rename

@Deprecated
public void rename(String newDocumentName,
                              List<String> backlinkDocumentNames,
                              List<String> childDocumentNames,
                              XWikiContext context)
            throws XWikiException
Deprecated. since 2.2M2 use rename(DocumentReference, List, List, com.xpn.xwiki.XWikiContext)

Throws:
XWikiException

copyDocument

public XWikiDocument copyDocument(DocumentReference newDocumentReference,
                                  XWikiContext context)
                           throws XWikiException
Throws:
XWikiException
Since:
2.2M1

copyDocument

@Deprecated
public XWikiDocument copyDocument(String newDocumentName,
                                             XWikiContext context)
                           throws XWikiException
Deprecated. since 2.2M1 use copyDocument(DocumentReference, XWikiContext) instead

Throws:
XWikiException

getLock

public XWikiLock getLock(XWikiContext context)
                  throws XWikiException
Throws:
XWikiException

setLock

public void setLock(String userName,
                    XWikiContext context)
             throws XWikiException
Throws:
XWikiException

removeLock

public void removeLock(XWikiContext context)
                throws XWikiException
Throws:
XWikiException

insertText

public void insertText(String text,
                       String marker,
                       XWikiContext context)
                throws XWikiException
Throws:
XWikiException

getWikiNode

public Object getWikiNode()

setWikiNode

public void setWikiNode(Object wikiNode)

getXClassXML

public String getXClassXML()
Since:
2.2M1

getxWikiClassXML

@Deprecated
public String getxWikiClassXML()
Deprecated. since 2.2M1 use getXClassXML() instead Hibernate uses this through reflection. It cannot be removed without altering hibernate.cfg.xml


setXClassXML

public void setXClassXML(String xClassXML)
Since:
2.2M1

setxWikiClassXML

@Deprecated
public void setxWikiClassXML(String xClassXML)
Deprecated. since 2.2M1 use setXClassXML(String) ()} instead Hibernate uses this through reflection. It cannot be removed without altering hibernate.cfg.xml


getElements

public int getElements()

setElements

public void setElements(int elements)

setElement

public void setElement(int element,
                       boolean toggle)

hasElement

public boolean hasElement(int element)

getDefaultEditMode

public String getDefaultEditMode(XWikiContext context)
                          throws XWikiException
Gets the default edit mode for this document. An edit mode (other than the default "edit") can be enforced by creating an XWiki.EditModeClass object in the current document, with the appropriate value for the defaultEditMode property, or by adding this object in a sheet included by the document. This function also falls back on the old SheetClass, deprecated since 3.1M2, which can be attached to included documents to specify that the current document should be edited inline.

Parameters:
context - the context of the request for this document
Returns:
the default edit mode for this document ("edit" or "inline" usually)
Throws:
XWikiException - if an error happens when computing the edit mode

getDefaultEditURL

public String getDefaultEditURL(XWikiContext context)
                         throws XWikiException
Throws:
XWikiException

getEditURL

public String getEditURL(String action,
                         String mode,
                         XWikiContext context)
                  throws XWikiException
Throws:
XWikiException

getEditURL

public String getEditURL(String action,
                         String mode,
                         String language,
                         XWikiContext context)

getDefaultTemplate

public String getDefaultTemplate()

setDefaultTemplate

public void setDefaultTemplate(String defaultTemplate)

getComments

public Vector<BaseObject> getComments()

getSyntax

public org.xwiki.rendering.syntax.Syntax getSyntax()
Specified by:
getSyntax in interface DocumentModelBridge
Returns:
the syntax of the document
Since:
2.3M1

getSyntaxId

@Deprecated
public String getSyntaxId()
Deprecated. since 2.3M1, use {link #getSyntax()} instead

Note that this method cannot be removed for now since it's used by Hibernate for saving a XWikiDocument.

Specified by:
getSyntaxId in interface DocumentModelBridge
See Also:
DocumentModelBridge.getSyntaxId()

setSyntax

public void setSyntax(org.xwiki.rendering.syntax.Syntax syntax)
Parameters:
syntax - the new syntax to set for this document
Since:
2.3M1
See Also:
getSyntax()

setSyntaxId

@Deprecated
public void setSyntaxId(String syntaxId)
Deprecated. since 2.3M1, use {link #setSyntax(Syntax)} instead

Note that this method cannot be removed for now since it's used by Hibernate for saving a XWikiDocument.

Parameters:
syntaxId - the new syntax id to set (eg "xwiki/1.0", "xwiki/2.0", etc)
See Also:
getSyntaxId()

getComments

public Vector<BaseObject> getComments(boolean asc)

isCurrentUserCreator

public boolean isCurrentUserCreator(XWikiContext context)

isCreator

@Deprecated
public boolean isCreator(String username)
Deprecated. use isCreator(DocumentReference) instead


isCreator

public boolean isCreator(DocumentReference username)

isCurrentUserPage

public boolean isCurrentUserPage(XWikiContext context)

isCurrentLocalUserPage

public boolean isCurrentLocalUserPage(XWikiContext context)

resetArchive

public void resetArchive(XWikiContext context)
                  throws XWikiException
Throws:
XWikiException

addXObjectFromRequest

public BaseObject addXObjectFromRequest(XWikiContext context)
                                 throws XWikiException
Adds an object from an new object creation form.

Throws:
XWikiException
Since:
2.2M2

addXObjectFromRequest

public BaseObject addXObjectFromRequest(EntityReference classReference,
                                        XWikiContext context)
                                 throws XWikiException
Adds an object from an new object creation form.

Throws:
XWikiException
Since:
2.2.3

addObjectFromRequest

@Deprecated
public BaseObject addObjectFromRequest(String className,
                                                  XWikiContext context)
                                throws XWikiException
Deprecated. since 2.2M2 use addXObjectFromRequest(EntityReference, XWikiContext)

Throws:
XWikiException

addXObjectFromRequest

public BaseObject addXObjectFromRequest(DocumentReference classReference,
                                        String prefix,
                                        XWikiContext context)
                                 throws XWikiException
Adds an object from an new object creation form.

Throws:
XWikiException
Since:
2.2M2

addObjectFromRequest

@Deprecated
public BaseObject addObjectFromRequest(String className,
                                                  String prefix,
                                                  XWikiContext context)
                                throws XWikiException
Deprecated. since 2.2M2 use addXObjectFromRequest(DocumentReference, String, XWikiContext)

Throws:
XWikiException

addXObjectsFromRequest

public List<BaseObject> addXObjectsFromRequest(DocumentReference classReference,
                                               XWikiContext context)
                                        throws XWikiException
Adds multiple objects from an new objects creation form.

Throws:
XWikiException
Since:
2.2M2

addObjectsFromRequest

@Deprecated
public List<BaseObject> addObjectsFromRequest(String className,
                                                         XWikiContext context)
                                       throws XWikiException
Deprecated. since 2.2M2 use addXObjectsFromRequest(DocumentReference, XWikiContext)

Throws:
XWikiException

addXObjectsFromRequest

public List<BaseObject> addXObjectsFromRequest(DocumentReference classReference,
                                               String pref,
                                               XWikiContext context)
                                        throws XWikiException
Adds multiple objects from an new objects creation form.

Throws:
XWikiException
Since:
2.2M2

addObjectsFromRequest

@Deprecated
public List<BaseObject> addObjectsFromRequest(String className,
                                                         String pref,
                                                         XWikiContext context)
                                       throws XWikiException
Deprecated. since 2.2M2 use addXObjectsFromRequest(DocumentReference, String, XWikiContext)

Throws:
XWikiException

addXObjectFromRequest

public BaseObject addXObjectFromRequest(DocumentReference classReference,
                                        int num,
                                        XWikiContext context)
                                 throws XWikiException
Adds object from an new object creation form.

Throws:
XWikiException
Since:
2.2M2

addObjectFromRequest

@Deprecated
public BaseObject addObjectFromRequest(String className,
                                                  int num,
                                                  XWikiContext context)
                                throws XWikiException
Deprecated. since 2.2M2 use addXObjectFromRequest(DocumentReference, int, XWikiContext)

Throws:
XWikiException

addXObjectFromRequest

public BaseObject addXObjectFromRequest(EntityReference classReference,
                                        String prefix,
                                        int num,
                                        XWikiContext context)
                                 throws XWikiException
Adds object from an new object creation form.

Throws:
XWikiException
Since:
2.2.3

addObjectFromRequest

@Deprecated
public BaseObject addObjectFromRequest(String className,
                                                  String prefix,
                                                  int num,
                                                  XWikiContext context)
                                throws XWikiException
Deprecated. since 2.2M2 use addXObjectFromRequest(EntityReference, String, int, XWikiContext)

Throws:
XWikiException

updateXObjectFromRequest

public BaseObject updateXObjectFromRequest(EntityReference classReference,
                                           XWikiContext context)
                                    throws XWikiException
Adds an object from an new object creation form.

Throws:
XWikiException
Since:
2.2.3

updateObjectFromRequest

@Deprecated
public BaseObject updateObjectFromRequest(String className,
                                                     XWikiContext context)
                                   throws XWikiException
Deprecated. since 2.2M2 use updateXObjectFromRequest(EntityReference, XWikiContext)

Throws:
XWikiException

updateXObjectFromRequest

public BaseObject updateXObjectFromRequest(EntityReference classReference,
                                           String prefix,
                                           XWikiContext context)
                                    throws XWikiException
Adds an object from an new object creation form.

Throws:
XWikiException
Since:
2.2.3

updateObjectFromRequest

@Deprecated
public BaseObject updateObjectFromRequest(String className,
                                                     String prefix,
                                                     XWikiContext context)
                                   throws XWikiException
Deprecated. since 2.2M2 use updateXObjectFromRequest(EntityReference, String, XWikiContext)

Throws:
XWikiException

updateXObjectFromRequest

public BaseObject updateXObjectFromRequest(EntityReference classReference,
                                           String prefix,
                                           int num,
                                           XWikiContext context)
                                    throws XWikiException
Adds an object from an new object creation form.

Throws:
XWikiException
Since:
2.2.3

updateObjectFromRequest

@Deprecated
public BaseObject updateObjectFromRequest(String className,
                                                     String prefix,
                                                     int num,
                                                     XWikiContext context)
                                   throws XWikiException
Deprecated. since 2.2M2 use updateXObjectFromRequest(EntityReference, String, int, XWikiContext)

Throws:
XWikiException

updateXObjectsFromRequest

public List<BaseObject> updateXObjectsFromRequest(EntityReference classReference,
                                                  XWikiContext context)
                                           throws XWikiException
Adds an object from an new object creation form.

Throws:
XWikiException
Since:
2.2.3

updateObjectsFromRequest

@Deprecated
public List<BaseObject> updateObjectsFromRequest(String className,
                                                            XWikiContext context)
                                          throws XWikiException
Deprecated. since 2.2M2 use updateXObjectsFromRequest(EntityReference, XWikiContext)

Throws:
XWikiException

updateXObjectsFromRequest

public List<BaseObject> updateXObjectsFromRequest(EntityReference classReference,
                                                  String pref,
                                                  XWikiContext context)
                                           throws XWikiException
Adds multiple objects from an new objects creation form.

Throws:
XWikiException
Since:
2.2.3

updateObjectsFromRequest

@Deprecated
public List<BaseObject> updateObjectsFromRequest(String className,
                                                            String pref,
                                                            XWikiContext context)
                                          throws XWikiException
Deprecated. since 2.2M2 use updateXObjectsFromRequest(EntityReference, String, XWikiContext)

Throws:
XWikiException

isAdvancedContent

public boolean isAdvancedContent()

isProgrammaticContent

public boolean isProgrammaticContent()

removeXObject

public boolean removeXObject(BaseObject object)
Remove an XObject from the document. The changes are not persisted until the document is saved.

Parameters:
object - the object to remove
Returns:
true if the object was successfully removed, false if the object was not found in the current document.
Since:
2.2M1

removeObject

@Deprecated
public boolean removeObject(BaseObject object)
Deprecated. since 2.2M1, use removeXObject(com.xpn.xwiki.objects.BaseObject) instead

Remove an XObject from the document. The changes are not persisted until the document is saved.

Parameters:
object - the object to remove
Returns:
true if the object was successfully removed, false if the object was not found in the current document.

removeXObjects

public boolean removeXObjects(DocumentReference classReference)
Remove all the objects of a given type (XClass) from the document. The object counter is left unchanged, so that future objects will have new (different) numbers. However, on some storage engines the counter will be reset if the document is removed from the cache and reloaded from the persistent storage.

Parameters:
classReference - The XClass reference of the XObjects to be removed.
Returns:
true if the objects were successfully removed, false if no object from the target class was in the current document.
Since:
2.2M1

removeXObjects

public boolean removeXObjects(EntityReference reference)
Remove all the objects of a given type (XClass) from the document. The object counter is left unchanged, so that future objects will have new (different) numbers. However, on some storage engines the counter will be reset if the document is removed from the cache and reloaded from the persistent storage.

Parameters:
classReference - The XClass reference of the XObjects to be removed.
Returns:
true if the objects were successfully removed, false if no object from the target class was in the current document.
Since:
5.0M1

removeObjects

@Deprecated
public boolean removeObjects(String className)
Deprecated. since 2.2M1 use removeXObjects(org.xwiki.model.reference.DocumentReference) instead

Remove all the objects of a given type (XClass) from the document. The object counter is left unchanged, so that future objects will have new (different) numbers. However, on some storage engines the counter will be reset if the document is removed from the cache and reloaded from the persistent storage.

Parameters:
className - The class name of the objects to be removed.
Returns:
true if the objects were successfully removed, false if no object from the target class was in the current document.

getSections

public List<DocumentSection> getSections()
                                  throws XWikiException
Get the top sections contained in the document.

The section are filtered by xwiki.section.depth property on the maximum depth of the sections to return. This method is usually used to get "editable" sections.

Returns:
the sections in the current document
Throws:
XWikiException

getDocumentSection

public DocumentSection getDocumentSection(int sectionNumber)
                                   throws XWikiException
Return a Document section with parameter is sectionNumber.

Parameters:
sectionNumber - the index (+1) of the section in the list of all sections in the document.
Returns:
Throws:
XWikiException - error when extracting sections from document

getContentOfSection

public String getContentOfSection(int sectionNumber)
                           throws XWikiException
Return the content of a section.

Parameters:
sectionNumber - the index (+1) of the section in the list of all sections in the document.
Returns:
the content of a section or null if the section can't be found.
Throws:
XWikiException - error when trying to extract section content

updateDocumentSection

public String updateDocumentSection(int sectionNumber,
                                    String newSectionContent)
                             throws XWikiException
Update a section content in document.

Parameters:
sectionNumber - the index (starting at 1) of the section in the list of all sections in the document.
newSectionContent - the new section content.
Returns:
the new document content.
Throws:
XWikiException - error when updating content

getVersionHashCode

public String getVersionHashCode(XWikiContext context)
Computes a document hash, taking into account all document data: content, objects, attachments, metadata... TODO: cache the hash value, update only on modification.


getInternalPropertyName

public static String getInternalPropertyName(String propname,
                                             XWikiContext context)

getInternalProperty

public String getInternalProperty(String propname)

getCustomClass

public String getCustomClass()

setCustomClass

public void setCustomClass(String customClass)

setValidationScript

public void setValidationScript(String validationScript)

getValidationScript

public String getValidationScript()

getComment

public String getComment()

setComment

public void setComment(String comment)

isMinorEdit

public boolean isMinorEdit()

setMinorEdit

public void setMinorEdit(boolean isMinor)

getMinorEdit1

protected Boolean getMinorEdit1()

setMinorEdit1

protected void setMinorEdit1(Boolean isMinor)

newXObject

public BaseObject newXObject(EntityReference classReference,
                             XWikiContext context)
                      throws XWikiException
Create, add and return a new object with the provided class.

Note that absolute reference are not supported for xclasses which mean that the wiki part (whatever the wiki is) of the reference will be systematically removed.

Parameters:
classReference - the reference of the class
context - the XWiki context
Returns:
the newly created object
Throws:
XWikiException - error when creating the new object
Since:
2.2.3

newObject

@Deprecated
public BaseObject newObject(String className,
                                       XWikiContext context)
                     throws XWikiException
Deprecated. since 2.2M2 use newXObject(EntityReference, XWikiContext)

Throws:
XWikiException

getXObject

public BaseObject getXObject(DocumentReference classReference,
                             boolean create,
                             XWikiContext context)
Since:
2.2M2

getXObject

public BaseObject getXObject(EntityReference classReference,
                             boolean create,
                             XWikiContext context)
Since:
3.4M1

getObject

@Deprecated
public BaseObject getObject(String className,
                                       boolean create,
                                       XWikiContext context)
Deprecated. since 2.2M2 use getXObject(DocumentReference, boolean, XWikiContext)


validate

public boolean validate(XWikiContext context)
                 throws XWikiException
Throws:
XWikiException

validate

public boolean validate(String[] classNames,
                        XWikiContext context)
                 throws XWikiException
Throws:
XWikiException

backupContext

public static void backupContext(Map<String,Object> backup,
                                 XWikiContext context)

restoreContext

public static void restoreContext(Map<String,Object> backup,
                                  XWikiContext context)

setAsContextDoc

public void setAsContextDoc(XWikiContext context)

getPreviousVersion

public String getPreviousVersion()
Returns:
the String representation of the previous version of this document or null if this is the first version.

toString

public String toString()
Overrides:
toString in class Object

setHidden

public void setHidden(Boolean hidden)
Indicates whether the document should be 'hidden' or not, meaning that it should not be returned in public search results.

Parameters:
hidden - The new value of the hidden property.

isHidden

public Boolean isHidden()
Indicates whether the document is 'hidden' or not, meaning that it should not be returned in public search results.

Returns:
true if the document is hidden and does not appear among the results of XWiki.searchDocuments(String), false otherwise.

convertSyntax

public void convertSyntax(String targetSyntaxId,
                          XWikiContext context)
                   throws XWikiException
Convert the current document content from its current syntax to the new syntax passed as parameter.

Parameters:
targetSyntaxId - the syntax to convert to (eg "xwiki/2.0", "xhtml/1.0", etc)
Throws:
XWikiException - if an exception occurred during the conversion process

convertSyntax

public void convertSyntax(org.xwiki.rendering.syntax.Syntax targetSyntax,
                          XWikiContext context)
                   throws XWikiException
Convert the current document content from its current syntax to the new syntax passed as parameter.

Parameters:
targetSyntax - the syntax to convert to (eg "xwiki/2.0", "xhtml/1.0", etc)
Throws:
XWikiException - if an exception occurred during the conversion process

getXDOM

public org.xwiki.rendering.block.XDOM getXDOM()
NOTE: This method caches the XDOM and returns a clone that can be safely modified.

Specified by:
getXDOM in interface DocumentModelBridge
Returns:
the XDOM corresponding to the document's string content

is10Syntax

public boolean is10Syntax()
Returns:
true if the document has a xwiki/1.0 syntax content

is10Syntax

public boolean is10Syntax(String syntaxId)
Returns:
true if the document has a xwiki/1.0 syntax content

renderXDOM

protected static String renderXDOM(org.xwiki.rendering.block.XDOM content,
                                   org.xwiki.rendering.syntax.Syntax targetSyntax)
                            throws XWikiException
Render privided XDOM into content of the provided syntax identifier.

Parameters:
content - the XDOM content to render
targetSyntax - the syntax identifier of the rendered content
Returns:
the rendered content
Throws:
XWikiException - if an exception occurred during the rendering process

resolveClassReference

public DocumentReference resolveClassReference(String documentName)
Backward-compatibility method to use in order to resolve a class reference passed as a String into a DocumentReference proper.

Returns:
the resolved class reference but using this document's wiki if the passed String doesn't specify a wiki, the "XWiki" space if the passed String doesn't specify a space and this document's page if the passed String doesn't specify a page.

getRelativeParentReference

public EntityReference getRelativeParentReference()
Return the reference of the parent document as it stored and passed to setParentReference(EntityReference).

You should use getParentReference() reference if you want to complete parent reference.

Returns:
the relative parent reference
Since:
2.2.3

merge

public MergeResult merge(XWikiDocument previousDocument,
                         XWikiDocument newDocument,
                         MergeConfiguration configuration,
                         XWikiContext context)
Apply a 3 ways merge on the current document based on provided previous and new version of the document.

All 3 documents are supposed to have the same document reference and language already since that's what makes them uniques.

Parameters:
previousDocument - the previous version of the document
newDocument - the next version of the document
configuration - the configuration of the merge Indicate how to deal with some conflicts use cases, etc.
context - the XWiki context
Returns:
a repport of what happen during the merge (errors, etc.)
Since:
3.2M1

apply

public boolean apply(XWikiDocument document)
Apply modification comming from provided document.

Thid method does not take into account versions and author related informations and the provided document should have the same reference. Like merge(XWikiDocument, XWikiDocument, MergeConfiguration, XWikiContext), this method is dealing with "real" data and should not change anything related to version management and document identifier.

Important note: this method does not take care of attachments contents related operations and only remove attachments which need to be removed from the list. For memory handling reasons all attachments contents related operations should be done elsewhere.

Parameters:
document - the document to apply
Returns:
false is nothing changed

apply

public boolean apply(XWikiDocument document,
                     boolean clean)
Apply modification comming from provided document.

Thid method does not take into account versions and author related informations and the provided document should have the same reference. Like merge(XWikiDocument, XWikiDocument, MergeConfiguration, XWikiContext), this method is dealing with "real" data and should not change everything related to version management and document identifier.

Parameters:
document - the document to apply
Returns:
false is nothing changed


Copyright © 2004–2014 XWiki. All rights reserved.