Class XWikiDocument
- java.lang.Object
-
- 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
Nested Classes Modifier and Type Class Description static class
XWikiDocument.XWikiAttachmentToRemove
An attachment waiting to be deleted at next document save.
-
Field Summary
Fields Modifier and Type Field Description static String
CKEY_SDOC
The name of the key in the XWikiContext which contains the document used to check for programming rights.static EntityReference
COMMENTSCLASS_REFERENCE
static String
DB_SPACE_SEP
Separator string between database name and space name.static int
HAS_ATTACHMENTS
static int
HAS_CLASS
static int
HAS_OBJECTS
static EntityReference
SHEETCLASS_REFERENCE
static String
SPACE_NAME_SEP
Separator string between space name and page name.protected org.suigeneris.jrcs.rcs.Version
version
-
Constructor Summary
Constructors Constructor Description XWikiDocument()
Deprecated.XWikiDocument(String space, String name)
Deprecated.XWikiDocument(String wiki, String space, String name)
Deprecated.XWikiDocument(DocumentReference reference)
Create a document for the given reference, with theLocale.ROOT
even if the reference contains a locale.XWikiDocument(DocumentReference reference, Locale locale)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addAttachment(XWikiAttachment attachment)
Deprecated.usesetAttachment(XWikiAttachment)
insteadXWikiAttachment
addAttachment(String fileName, byte[] content, XWikiContext context)
Deprecated.usesetAttachment(String, InputStream, XWikiContext)
insteadXWikiAttachment
addAttachment(String fileName, InputStream content, XWikiContext context)
Deprecated.usesetAttachment(String, InputStream, XWikiContext)
insteadvoid
addObject(String className, BaseObject object)
Deprecated.useaddXObject(BaseObject)
insteadBaseObject
addObjectFromRequest(String className, int num, XWikiContext context)
Deprecated.BaseObject
addObjectFromRequest(String className, XWikiContext context)
Deprecated.BaseObject
addObjectFromRequest(String className, String prefix, int num, XWikiContext context)
Deprecated.BaseObject
addObjectFromRequest(String className, String prefix, XWikiContext context)
Deprecated.List<BaseObject>
addObjectsFromRequest(String className, XWikiContext context)
Deprecated.List<BaseObject>
addObjectsFromRequest(String className, String pref, XWikiContext context)
Deprecated.void
addObjectsToRemove(BaseObject object)
Deprecated.useaddXObjectToRemove(BaseObject)
)} insteadvoid
addToZip(ZipOutputStream zos, boolean withVersions, XWikiContext context)
Deprecated.void
addToZip(ZipOutputStream zos, XWikiContext context)
Deprecated.void
addToZip(ZipOutputStream zos, String zipname, boolean withVersions, XWikiContext context)
Deprecated.void
addXObject(BaseObject object)
Add the object to the document.void
addXObject(DocumentReference classReference, BaseObject object)
Deprecated.useaddXObject(BaseObject)
insteadBaseObject
addXObjectFromRequest(XWikiContext context)
Adds an object from an new object creation form.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, 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.List<BaseObject>
addXObjectsFromRequest(DocumentReference classReference, XWikiContext context)
Adds multiple objects from an new objects creation form.List<BaseObject>
addXObjectsFromRequest(DocumentReference classReference, String pref, 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
clone(XWikiDocument document)
Use the document passed as parameter as the new identity for the current document.XWikiDocument
cloneRename(DocumentReference newDocumentReference, XWikiContext context)
Clone a document and change its reference.void
cloneXObjects(XWikiDocument templatedoc)
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(String newDocumentName, XWikiContext context)
Deprecated.usecopyDocument(DocumentReference, XWikiContext)
insteadXWikiDocument
copyDocument(DocumentReference newDocumentReference, boolean cloneArchive, XWikiContext context)
XWikiDocument
copyDocument(DocumentReference newDocumentReference, XWikiContext context)
int
createNewObject(String className, XWikiContext context)
Deprecated.usecreateXObject(EntityReference, XWikiContext)
insteadint
createXObject(EntityReference classReference, XWikiContext context)
Create and add a new object to the document with the provided class.String
display(String fieldname, BaseObject obj, XWikiContext context)
String
display(String fieldname, XWikiContext context)
String
display(String fieldname, String type, BaseObject obj, boolean isolated, XWikiContext context)
String
display(String fieldname, String type, BaseObject obj, XWikiContext context)
String
display(String fieldname, String type, BaseObject obj, String wrappingSyntaxId, XWikiContext context)
String
display(String fieldname, String mode, XWikiContext context)
String
display(String fieldname, String type, String pref, BaseObject obj, boolean isolated, XWikiContext context)
String
display(String fieldname, String type, String pref, BaseObject obj, XWikiContext context)
String
display(String fieldname, String type, String pref, BaseObject obj, String wrappingSyntaxId, boolean isolated, XWikiContext context)
String
display(String fieldname, String type, String pref, BaseObject obj, String wrappingSyntaxId, XWikiContext context)
String
display(String fieldname, String mode, String prefix, XWikiContext context)
String
displayDocument(boolean restricted, XWikiContext context)
Execute and render the current document in the current context.String
displayDocument(XWikiContext context)
Execute and render the current document in the current context.String
displayDocument(org.xwiki.rendering.syntax.Syntax targetSyntax, boolean restricted, XWikiContext context)
Execute and render the current document in the current context.String
displayDocument(org.xwiki.rendering.syntax.Syntax targetSyntax, XWikiContext context)
Execute and render the current document in the current context.String
displayEdit(PropertyClass pclass, String prefix, BaseCollection object, XWikiContext context)
String
displayForm(String className, XWikiContext context)
Deprecated.usedisplayForm(DocumentReference, XWikiContext)
insteadString
displayForm(String className, String header, String format, boolean linebreak, XWikiContext context)
Deprecated.String
displayForm(String className, String header, String format, XWikiContext context)
Deprecated.String
displayForm(DocumentReference classReference, 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
displayHidden(PropertyClass pclass, String prefix, BaseCollection object, 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, BaseObject obj, XWikiContext context)
String
displayPrettyName(String fieldname, boolean showMandatory, XWikiContext context)
String
displayPrettyName(String fieldname, BaseObject obj, 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 asequals(Object)
but only for actual datas of the document.void
fromXML(InputStream is)
void
fromXML(InputStream source, boolean withArchive)
void
fromXML(String xml)
void
fromXML(String source, boolean withArchive)
void
fromXML(org.dom4j.Document domdoc, boolean withArchive)
Deprecated.usefromXML(InputStream)
insteadvoid
fromXML(org.xwiki.filter.input.InputSource source, boolean withArchive)
XWikiAttachment
getAttachment(String filename)
Return the first attachment of the attachment list either exactly matching the provided filename or that matches the provided filename with a n arbitrary extension (i.e., filename.ext).List<AttachmentDiff>
getAttachmentDiff(XWikiDocument fromDoc, XWikiDocument toDoc, XWikiContext context)
List<XWikiAttachment>
getAttachmentList()
String
getAttachmentRevisionURL(String filename, String revision, XWikiContext context)
String
getAttachmentRevisionURL(String filename, String revision, String querystring, XWikiContext context)
XWikiAttachmentStoreInterface
getAttachmentStore(XWikiContext context)
Deprecated.useXWiki.getDefaultAttachmentContentStore()
insteadList<XWikiDocument.XWikiAttachmentToRemove>
getAttachmentsToRemove()
String
getAttachmentURL(String filename, XWikiContext context)
String
getAttachmentURL(String filename, String action, XWikiContext context)
String
getAttachmentURL(String filename, String action, String querystring, XWikiContext context)
String
getAuthor()
Deprecated.since 3.0M3 usegetAuthorReference()
insteadDocumentReference
getAuthorReference()
Deprecated.usegetAuthors()
and thenDocumentAuthors.getEffectiveMetadataAuthor()
insteadDocumentAuthors
getAuthors()
List<String>
getBackLinkedPages(XWikiContext context)
Deprecated.List<DocumentReference>
getBackLinkedReferences(XWikiContext context)
Get the wiki document references pointing to this document.List<String>
getChildren(int nb, int start, XWikiContext context)
Deprecated.List<String>
getChildren(XWikiContext context)
Deprecated.List<DocumentReference>
getChildrenReferences(int nb, int start, XWikiContext context)
Returns a list of references of all documents which list this document as their parent, in the current wiki.List<DocumentReference>
getChildrenReferences(XWikiContext context)
Returns a list of references of all documents which list this document as their parent, in the current wiki.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.usegetContentAuthorReference()
insteadDocumentReference
getContentAuthorReference()
Deprecated.usegetAuthors()
and thenDocumentAuthors.getContentAuthor()
insteadList<org.suigeneris.jrcs.diff.delta.Delta>
getContentDiff(XWikiDocument fromDoc, XWikiDocument toDoc, XWikiContext context)
List<org.suigeneris.jrcs.diff.delta.Delta>
getContentDiff(String fromRev, XWikiContext context)
List<org.suigeneris.jrcs.diff.delta.Delta>
getContentDiff(String fromRev, String toRev, XWikiContext context)
String
getContentOfSection(int sectionNumber)
Return the content of a section.Date
getContentUpdateDate()
Date
getCreationDate()
String
getCreator()
Deprecated.usegetCreatorReference()
insteadDocumentReference
getCreatorReference()
Deprecated.usegetAuthors()
and thenDocumentAuthors.getCreator()
insteadString
getCustomClass()
String
getDatabase()
Deprecated.usegetDocumentReference()
insteadDate
getDate()
String
getDefaultEditMode(XWikiContext context)
Gets the default edit mode for this document.String
getDefaultEditURL(XWikiContext context)
String
getDefaultLanguage()
Deprecated.usegetDefaultLocale()
insteadLocale
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, XWikiContext context)
String
getEditURL(String action, String mode, String language, XWikiContext context)
protected String
getElement(org.dom4j.Element docel, String name)
int
getElements()
String
getEscapedContent(XWikiContext context)
XWikiAttachment
getExactAttachment(String filename)
Return the attachment that exactly matches the provided file.String
getExternalAttachmentURL(String filename, String action, XWikiContext context)
String
getExternalURL(String action, XWikiContext context)
String
getExternalURL(String action, String querystring, XWikiContext context)
BaseObject
getFirstObject(String fieldname)
BaseObject
getFirstObject(String fieldname, XWikiContext context)
String
getFormat()
String
getFullName()
Deprecated.usegetDocumentReference()
insteadlong
getId()
List<String>
getIncludedMacros(XWikiContext context)
List<String>
getIncludedPages(XWikiContext context)
String
getInternalProperty(String propname)
static String
getInternalPropertyName(String propname, XWikiContext context)
int
getIntValue(String fieldName)
int
getIntValue(String className, String fieldName)
Deprecated.usegetIntValue(DocumentReference, String)
insteadint
getIntValue(DocumentReference classReference, String fieldName)
int
getIntValue(DocumentReference classReference, String fieldName, int defaultValue)
Retrieve the int value of the given property of the first object of the given class.String
getKey()
Helper to produce and cache a uid serialization of this document reference, including the language.String
getLanguage()
Deprecated.usegetLocale()
insteadList<org.suigeneris.jrcs.diff.delta.Delta>
getLastChanges(XWikiContext context)
List
getListValue(String fieldName)
List
getListValue(String className, String fieldName)
Deprecated.usegetListValue(DocumentReference, String)
insteadList
getListValue(DocumentReference classReference, String fieldName)
Locale
getLocale()
int
getLocalReferenceMaxLength()
Compute and return the maximum authorized length for the full name (i.e.XWikiLock
getLock(XWikiContext context)
long
getLongValue(String fieldName)
long
getLongValue(String className, String fieldName)
Deprecated.usegetLongValue(DocumentReference, String)
insteadlong
getLongValue(DocumentReference classReference, String fieldName)
String
getMeta()
List<MetaDataDiff>
getMetaDataDiff(XWikiDocument fromDoc, XWikiDocument toDoc, XWikiContext context)
List<MetaDataDiff>
getMetaDataDiff(String fromRev, XWikiContext context)
List<MetaDataDiff>
getMetaDataDiff(String fromRev, String toRev, XWikiContext context)
protected Boolean
getMinorEdit1()
String
getName()
Deprecated.usegetDocumentReference()
insteadstatic org.suigeneris.jrcs.rcs.Version
getNextVersion(org.suigeneris.jrcs.rcs.Version version, boolean minorEdit)
This method computes the next version and returns it, but won't change the current version.BaseObject
getObject(String className)
Deprecated.usegetXObject(DocumentReference)
insteadBaseObject
getObject(String className, boolean create, XWikiContext context)
Deprecated.BaseObject
getObject(String className, int nb)
Deprecated.usegetXObject(DocumentReference, int)
insteadBaseObject
getObject(String className, String key, String value)
Deprecated.usegetXObject(DocumentReference, String, String)
insteadBaseObject
getObject(String className, String key, String value, boolean failover)
Deprecated.List<List<ObjectDiff>>
getObjectDiff(XWikiDocument fromDoc, XWikiDocument toDoc, XWikiContext context)
Return the object differences between two document versions.List<List<ObjectDiff>>
getObjectDiff(String fromRev, XWikiContext context)
List<List<ObjectDiff>>
getObjectDiff(String fromRev, String toRev, XWikiContext context)
int
getObjectNumbers(String className)
Deprecated.usegetXObjectSize(DocumentReference)
insteadVector<BaseObject>
getObjects(String className)
Deprecated.usegetXObjects(DocumentReference)
insteadArrayList<BaseObject>
getObjectsToRemove()
Deprecated.usegetObjectsToRemove()
insteadXWikiDocument
getOriginalDocument()
String
getPageName()
Deprecated.usegetDocumentReference()
insteadPageReference
getPageReference()
PageReference
getPageReferenceWithLocale()
String
getParent()
Deprecated.usegetParentReference()
insteadXWikiDocument
getParentDoc()
Deprecated.usegetParentReference()
insteadDocumentReference
getParentReference()
String
getParentURL(XWikiContext context)
String
getPrefixedFullName()
Deprecated.usegetDocumentReference()
insteadString
getPreviousVersion()
org.suigeneris.jrcs.rcs.Version
getRCSVersion()
String
getRealLanguage()
Deprecated.usegetRealLocale()
insteadString
getRealLanguage(XWikiContext context)
Deprecated.usegetRealLocale()
insteadLocale
getRealLocale()
String[]
getRecentRevisions(int nb, XWikiContext context)
EntityReference
getRelativeParentReference()
Return the reference of the parent document as it stored and passed tosetParentReference(EntityReference)
.String
getRenderedContent(boolean transformationContextIsolated, XWikiContext context)
String
getRenderedContent(XWikiContext context)
String
getRenderedContent(String text, String syntaxId, boolean restrictedTransformationContext, XWikiDocument sDocument, XWikiContext context)
String
getRenderedContent(String text, String syntaxId, boolean restrictedTransformationContext, XWikiContext context)
String
getRenderedContent(String text, String syntaxId, XWikiContext context)
String
getRenderedContent(String text, String sourceSyntaxId, String targetSyntaxId, boolean restrictedTransformationContext, XWikiDocument sDocument, 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, org.xwiki.rendering.syntax.Syntax sourceSyntaxId, boolean restrictedTransformationContext, XWikiDocument sDocument, boolean isolated, XWikiContext context)
String
getRenderedContent(String text, org.xwiki.rendering.syntax.Syntax sourceSyntaxId, XWikiDocument sDocument, boolean isolated, XWikiContext context)
String
getRenderedContent(String text, org.xwiki.rendering.syntax.Syntax sourceSyntaxId, org.xwiki.rendering.syntax.Syntax targetSyntaxId, boolean restrictedTransformationContext, XWikiDocument sDocument, boolean isolated, XWikiContext context)
String
getRenderedContent(org.xwiki.rendering.syntax.Syntax targetSyntax, boolean transformationContextIsolated, XWikiContext context)
Execute and render the document or its translation in the current context.String
getRenderedContent(org.xwiki.rendering.syntax.Syntax targetSyntax, XWikiContext context)
List<org.suigeneris.jrcs.diff.delta.Delta>
getRenderedContentDiff(XWikiDocument fromDoc, XWikiDocument toDoc, XWikiContext context)
List<org.suigeneris.jrcs.diff.delta.Delta>
getRenderedContentDiff(String fromRev, XWikiContext context)
List<org.suigeneris.jrcs.diff.delta.Delta>
getRenderedContentDiff(String fromRev, String toRev, XWikiContext context)
String
getRenderedTitle(XWikiContext context)
Similar togetRenderedTitle(Syntax, XWikiContext)
but the output Syntax used is XHTML 1.0 unless the current skin defines another output Syntax in which case it's the one used.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.usegetDocumentReference()
insteadString
getSpaceName()
Deprecated.usegetDocumentReference()
insteadXWikiStoreInterface
getStore()
XWikiStoreInterface
getStore(XWikiContext context)
String
getStringValue(String fieldName)
String
getStringValue(String className, String fieldName)
Deprecated.usegetStringValue(DocumentReference, String)
insteadString
getStringValue(DocumentReference classReference, String fieldName)
String
getStringValue(EntityReference classReference, String fieldName)
org.xwiki.rendering.syntax.Syntax
getSyntax()
String
getSyntaxId()
Deprecated.use {link #getSyntax()} insteadString
getTags(XWikiContext context)
List<String>
getTagsList(XWikiContext context)
List<String>
getTagsPossibleValues(XWikiContext context)
String
getTemplate()
Deprecated.usegetTemplateDocumentReference()
insteadDocumentReference
getTemplateDocumentReference()
String
getTitle()
String
getTranslatedContent(XWikiContext context)
String
getTranslatedContent(String locale, XWikiContext context)
XWikiDocument
getTranslatedDocument(XWikiContext context)
XWikiDocument
getTranslatedDocument(String language, XWikiContext context)
Deprecated.usegetTranslatedDocument(Locale, XWikiContext)
inseadXWikiDocument
getTranslatedDocument(Locale locale, XWikiContext context)
Return the document in the provided language.int
getTranslation()
List<String>
getTranslationList(XWikiContext context)
Deprecated.usegetTranslationLocales(XWikiContext)
insteadList<Locale>
getTranslationLocales(XWikiContext context)
The locales of the translation of this document (the default locale is not included).Set<EntityReference>
getUniqueLinkedEntities(XWikiContext context)
Extract all the unique static (i.e.Set<String>
getUniqueLinkedPages(XWikiContext context)
Extract all the unique entity references found in the current document (they can be wiki links, macro parameters, etc) and pointing to documents (either using a Document Reference or a Page Reference).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, XWikiContext context)
String
getURL(String action, String params, boolean redirect, XWikiContext context)
String
getURL(String action, String querystring, XWikiContext context)
String
getURL(String action, String querystring, String anchor, 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.usegetDocumentReference()
insteadString
getWikiName()
Deprecated.usegetDocumentReference()
insteadObject
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(EntityReference classReference, int number, boolean create, XWikiContext xcontext)
Get an xobject with the passed xclass at the passed location.BaseObject
getXObject(EntityReference reference, String key, String value, boolean failover)
BaseObject
getXObject(ObjectReference objectReference)
Get an object of this document based on its reference.BaseObject
getXObject(ObjectReference objectReference, boolean create, XWikiContext context)
Get or create 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)
Retrieve and returns all objects corresponding to the given class reference, or an empty list if there's none.List<BaseObject>
getXObjects(EntityReference reference)
Retrieve and returns all objects corresponding to the class reference corresponding to the resolution of the given entity reference, or an empty list if there's none.int
getXObjectSize(DocumentReference classReference)
int
getXObjectSize(EntityReference classReference)
List<BaseObject>
getXObjectsToRemove()
String
getxWikiClassXML()
Deprecated.usegetXClassXML()
instead as Hibernate uses this through reflection.BaseObject
getxWikiObject()
Deprecated.usegetXObject()
insteadboolean
hasElement(int element)
int
hashCode()
void
incrementVersion()
Increment the current document version.void
initialize()
Make sure any document metadata which may depend on configuration is initialized to its default value.void
insertText(String text, String marker, XWikiContext context)
boolean
is10Syntax()
boolean
is10Syntax(String syntaxId)
boolean
isAdvancedContent()
boolean
isContentDirty()
boolean
isCreator(String username)
Deprecated.useisCreator(DocumentReference)
insteadboolean
isCreator(DocumentReference username)
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)
Deprecated.void
loadAttachments(XWikiContext context)
void
loadAttachmentsContent(XWikiContext context)
Load attachment content from database.void
loadAttachmentsContentSafe(XWikiContext context)
Same asloadAttachmentContent(XWikiAttachment, XWikiContext)
but in some context we don't really care if an attachment content could not be loaded (we are going to overwrite or ignore it).XWikiDocumentArchive
loadDocumentArchive()
MergeResult
merge(XWikiDocument previousDocument, XWikiDocument newDocument, MergeConfiguration configuration, XWikiContext context)
void
mergeXClass(XWikiDocument templatedoc)
void
mergeXObjects(XWikiDocument templateDoc)
void
mergexWikiClass(XWikiDocument templatedoc)
Deprecated.usemergeXClass(XWikiDocument)
insteadvoid
mergexWikiObjects(XWikiDocument templatedoc)
Deprecated.usemergeXObjects(XWikiDocument)
insteadDocument
newDocument(XWikiContext context)
Document
newDocument(Class<?> customClass, XWikiContext context)
Create a new protectedDocument
public API to access page information and actions from scripting.Document
newDocument(String customClassName, XWikiContext context)
Create a new protectedDocument
public API to access page information and actions from scripting.BaseObject
newObject(String className, XWikiContext context)
Deprecated.usenewXObject(EntityReference, XWikiContext)
insteadBaseObject
newXObject(EntityReference classReference, XWikiContext context)
Create, add and return a new object with the provided class.void
readAddedUpdatedAndRemovedObjectsFromForm(EditForm eform, XWikiContext context)
Adds objects, applies property updates and removes objects as specified in the form.void
readDocMetaFromForm(EditForm eform, XWikiContext context)
void
readFromForm(EditForm eform, XWikiContext context)
void
readFromTemplate(DocumentReference templateDocumentReference, XWikiContext context)
void
readObjectsFromForm(EditForm eform, XWikiContext context)
Updates properties of existing objects with the values from the given form.void
readObjectsFromFormUpdateOrCreate(EditForm eform, XWikiContext context)
Create and/or update objects in a document given a list of HTTP parameters of the form<spacename>.<classname>_<number>_<propertyname>
.void
readTemporaryUploadedFiles(EditForm editForm)
Read the list of attachment that should be added fromEditForm.getTemporaryUploadedFiles()
and attach them to the current document if they can be found in theTemporaryAttachmentSessionsManager
.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.useremoveXObject(com.xpn.xwiki.objects.BaseObject)
insteadboolean
removeObjects(String className)
Deprecated.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, XWikiContext context)
Deprecated.void
rename(DocumentReference newDocumentReference, List<DocumentReference> backlinkDocumentReferences, XWikiContext context)
Deprecated.void
rename(DocumentReference newDocumentReference, List<DocumentReference> backlinkDocumentReferences, List<DocumentReference> childDocumentReferences, XWikiContext context)
Deprecated.void
renameProperties(String className, Map<String,String> fieldsToRename)
Deprecated.userenameProperties(DocumentReference, Map)
insteadvoid
renameProperties(DocumentReference classReference, Map<String,String> fieldsToRename)
protected static String
renderXDOM(org.xwiki.rendering.block.XDOM content, org.xwiki.rendering.syntax.Syntax targetSyntax)
Render provided 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)
Deprecated.should not be used, save the document insteadvoid
saveAllAttachments(XWikiContext context)
Deprecated.should not be used, save the document insteadvoid
saveAttachmentContent(XWikiAttachment attachment, boolean updateParent, boolean transaction, XWikiContext context)
Deprecated.should not be used, save the document insteadvoid
saveAttachmentContent(XWikiAttachment attachment, XWikiContext context)
Deprecated.should not be used, save the document insteadvoid
saveAttachmentsContent(List<XWikiAttachment> attachments, XWikiContext context)
Deprecated.should not be used, save the document insteadvoid
setAsContextDoc(XWikiContext context)
XWikiAttachment
setAttachment(XWikiAttachment attachment)
Insert passed attachment in the document and return any pre-existing attachment with the same name.XWikiAttachment
setAttachment(String fileName, InputStream content, XWikiContext context)
Create or update attachment with the passed name with the passed content.void
setAttachmentList(List<XWikiAttachment> list)
void
setAuthor(String author)
Deprecated.void
setAuthorReference(DocumentReference authorReference)
Deprecated.usegetAuthors()
and thenDocumentAuthors.setEffectiveMetadataAuthor(UserReference)
insteadvoid
setComment(String comment)
void
setContent(String content)
void
setContent(org.xwiki.rendering.block.XDOM content)
void
setContentAuthor(String contentAuthor)
Deprecated.void
setContentAuthorReference(DocumentReference contentAuthorReference)
Deprecated.usegetAuthors()
and thenDocumentAuthors.setContentAuthor(UserReference)
insteadvoid
setContentDirty(boolean contentDirty)
void
setContentUpdateDate(Date date)
void
setCreationDate(Date date)
void
setCreator(String creator)
Deprecated.void
setCreatorReference(DocumentReference creatorReference)
Deprecated.usegetAuthors()
and thenDocumentAuthors.setCreator(UserReference)
insteadvoid
setCustomClass(String customClass)
void
setDatabase(String database)
Deprecated.usesetDocumentReference(DocumentReference)
insteadvoid
setDate(Date date)
void
setDBStringListValue(String className, String fieldName, List value)
Deprecated.void
setDBStringListValue(EntityReference classReference, String fieldName, List value)
void
setDefaultLanguage(String defaultLanguage)
Deprecated.usesetDefaultLocale(Locale)
insteadvoid
setDefaultLocale(Locale defaultLocale)
void
setDefaultTemplate(String defaultTemplate)
void
setDocumentArchive(XWikiDocumentArchive arch)
void
setDocumentArchive(String sarch)
void
setDocumentReference(DocumentReference reference)
Deprecated.don't change the reference of a document once it's been constructed.void
setElement(int element, boolean toggle)
void
setElements(int elements)
void
setFormat(String format)
void
setFromCache(boolean fromCache)
void
setFullName(String name)
Deprecated.void
setFullName(String fullName, XWikiContext context)
Deprecated.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(String className, String fieldName, int value)
Deprecated.usesetIntValue(EntityReference, String, int)
insteadvoid
setIntValue(EntityReference classReference, String fieldName, int value)
void
setLanguage(String language)
Deprecated.usesetLocale(Locale)
insteadvoid
setLargeStringValue(String className, String fieldName, String value)
Deprecated.void
setLargeStringValue(EntityReference classReference, String fieldName, String value)
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.usesetDocumentReference(DocumentReference)
insteadvoid
setNew(boolean aNew)
void
setObject(String className, int nb, BaseObject object)
Deprecated.usesetXObject(DocumentReference, int, BaseObject)
insteadvoid
setOriginalDocument(XWikiDocument originalDocument)
void
setParent(String parent)
Deprecated.usesetParentReference(EntityReference)
insteadvoid
setParentReference(EntityReference parentReference)
void
setProperty(String className, String fieldName, BaseProperty value)
Deprecated.void
setProperty(EntityReference classReference, String fieldName, BaseProperty value)
void
setRCSVersion(org.suigeneris.jrcs.rcs.Version version)
void
setSpace(String spaces)
Deprecated.usesetDocumentReference(DocumentReference)
insteadvoid
setStore(XWikiStoreInterface store)
void
setStringListValue(String className, String fieldName, List value)
Deprecated.void
setStringListValue(EntityReference classReference, String fieldName, List value)
void
setStringValue(String className, String fieldName, String value)
Deprecated.usesetStringValue(EntityReference, String, String)
insteadvoid
setStringValue(EntityReference classReference, String fieldName, String value)
void
setSyntax(org.xwiki.rendering.syntax.Syntax syntax)
void
setSyntaxId(String syntaxId)
Deprecated.use {link #setSyntax(Syntax)} insteadvoid
setTags(String tagsStr, XWikiContext context)
add tags to the document.void
setTemplate(String template)
Deprecated.usesetTemplateDocumentReference(DocumentReference)
insteadvoid
setTemplateDocumentReference(DocumentReference templateDocumentReference)
void
setTitle(String title)
void
setTranslation(int translation)
Deprecated.stored in the database to speedup some queries (really ?) but inXWikiDocument
it's calculated based on the document localevoid
setValidationScript(String validationScript)
void
setVersion(String version)
void
setWeb(String space)
Deprecated.usesetDocumentReference(DocumentReference)
insteadvoid
setWikiNode(Object wikiNode)
void
setXClass(BaseClass xwikiClass)
void
setXClassXML(String xClassXML)
void
setXObject(int nb, BaseObject object)
Replaces the object at the specified position and for the specified object's xclass.void
setXObject(DocumentReference classReference, int nb, BaseObject object)
Deprecated.usesetXObject(int, BaseObject)
insteadvoid
setXObjects(Map<DocumentReference,List<BaseObject>> objects)
void
setXObjects(DocumentReference classReference, List<BaseObject> objects)
void
setXObjectsToRemove(List<BaseObject> objectsToRemove)
void
setxWikiClassXML(String xClassXML)
Deprecated.usesetXClassXML(String)
()} instead as Hibernate uses this through reflection.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.void
toXML(com.xpn.xwiki.internal.xml.XMLWriter wr, boolean bWithObjects, boolean bWithRendering, boolean bWithAttachmentContent, boolean bWithVersions, XWikiContext context)
Deprecated.String
toXML(XWikiContext context)
Retrieve the document as an XML string.void
toXML(OutputStream out, boolean bWithObjects, boolean bWithRendering, boolean bWithAttachmentContent, boolean bWithVersions, XWikiContext context)
Serialize the document to an OutputStream.void
toXML(DocumentInstanceInputProperties documentProperties, XAROutputProperties xarProperties)
Serialize the document to an OutputStream.void
toXML(org.xwiki.filter.output.OutputTarget out, boolean bWithObjects, boolean bWithRendering, boolean bWithAttachmentContent, boolean bWithVersions, boolean format, String encoding)
Serialize the document to an OutputStream.org.dom4j.Document
toXMLDocument(boolean bWithObjects, boolean bWithRendering, boolean bWithAttachmentContent, boolean bWithVersions, XWikiContext context)
Deprecated.org.dom4j.Document
toXMLDocument(XWikiContext context)
Deprecated.String
updateDocumentSection(int sectionNumber, String newSectionContent)
Update a section content in document.BaseObject
updateObjectFromRequest(String className, XWikiContext context)
Deprecated.BaseObject
updateObjectFromRequest(String className, String prefix, int num, XWikiContext context)
Deprecated.BaseObject
updateObjectFromRequest(String className, String prefix, XWikiContext context)
Deprecated.List<BaseObject>
updateObjectsFromRequest(String className, XWikiContext context)
Deprecated.List<BaseObject>
updateObjectsFromRequest(String className, String pref, XWikiContext context)
Deprecated.BaseObject
updateXObjectFromRequest(EntityReference classReference, XWikiContext context)
Adds an object from an new object creation form.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.List<BaseObject>
updateXObjectsFromRequest(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.boolean
validate(XWikiContext context)
boolean
validate(String[] classNames, XWikiContext context)
-
-
-
Field Detail
-
COMMENTSCLASS_REFERENCE
public static final EntityReference COMMENTSCLASS_REFERENCE
-
SHEETCLASS_REFERENCE
public static final EntityReference SHEETCLASS_REFERENCE
-
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
-
CKEY_SDOC
public static final String CKEY_SDOC
The name of the key in the XWikiContext which contains the document used to check for programming rights.- 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
-
version
protected org.suigeneris.jrcs.rcs.Version version
-
-
Constructor Detail
-
XWikiDocument
public XWikiDocument(DocumentReference reference)
Create a document for the given reference, with theLocale.ROOT
even if the reference contains a locale. If you want to create a document for another locale, useXWikiDocument(DocumentReference, Locale)
.- Since:
- 2.2M1
-
XWikiDocument
public XWikiDocument(DocumentReference reference, Locale locale)
- Since:
- 6.2
-
XWikiDocument
@Deprecated(since="2.2M1") public XWikiDocument()
Deprecated.
-
XWikiDocument
@Deprecated(since="2.2M1") public XWikiDocument(String space, String name)
Deprecated.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 toname
- the name of the document
-
XWikiDocument
@Deprecated(since="2.2M1") public XWikiDocument(String wiki, String space, String name)
Deprecated.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
@Deprecated(since="9.9RC1") public XWikiAttachmentStoreInterface getAttachmentStore(XWikiContext context)
Deprecated.useXWiki.getDefaultAttachmentContentStore()
instead
-
getVersioningStore
public XWikiVersioningStoreInterface getVersioningStore(XWikiContext context)
-
getStore
public XWikiStoreInterface getStore()
-
setStore
public void setStore(XWikiStoreInterface store)
-
getKey
public String getKey()
Helper to produce and cache a uid serialization of this document reference, including the language. Only translated document will have language appended.- Returns:
- a unique name (8:wikiname5:space4:name2:lg or 8:wikiname5:space4:name)
- Since:
- 4.0M1
-
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(since="2.2M1") public String getSpace()
Deprecated.usegetDocumentReference()
insteadReturn the full local space reference. For example a document located in sub-spacespace11
of spacespace1
will returnspace1.space11
.Note that this method cannot be removed for now since it's used by Hibernate for saving a XWikiDocument.
- Returns:
- the local reference the space of the document as String
-
setSpace
@Deprecated(since="2.2M1") public void setSpace(String spaces)
Deprecated.usesetDocumentReference(DocumentReference)
insteadSet the full local space reference.Note that this method cannot be removed for now since it's used by Hibernate for loading a XWikiDocument.
- See Also:
getSpace()
-
getWeb
@Deprecated public String getWeb()
Deprecated.usegetDocumentReference()
insteadNote 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
- See Also:
getSpace()
-
setWeb
@Deprecated public void setWeb(String space)
Deprecated.usesetDocumentReference(DocumentReference)
insteadNote 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 interfaceDocumentModelBridge
-
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 interfaceDocumentModelBridge
- Returns:
- the copy of this XWikiDocument instance before any modification was made to it. 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(since="2.2M1") public String getParent()
Deprecated.usegetParentReference()
insteadNote 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(since="2.2M1") public XWikiDocument getParentDoc()
Deprecated.usegetParentReference()
instead
-
setParentReference
public void setParentReference(EntityReference parentReference)
- Since:
- 2.2.3
-
setParent
@Deprecated(since="2.2M1") public void setParent(String parent)
Deprecated.usesetParentReference(EntityReference)
insteadNote 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 interfaceDocumentModelBridge
-
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(boolean transformationContextIsolated, XWikiContext context) throws XWikiException
- Throws:
XWikiException
- Since:
- 8.4RC1
-
displayDocument
public String displayDocument(XWikiContext context) throws XWikiException
Execute and render the current document in the current context. The code is executed with right of this document content author.- Parameters:
context
- the XWiki Context object- Returns:
- the rendered content of the document or its translation.
- Throws:
XWikiException
- in case of error during the rendering.- Since:
- 11.3RC1
-
displayDocument
public String displayDocument(boolean restricted, XWikiContext context) throws XWikiException
Execute and render the current document in the current context. The code is executed with right of this document content author.- Parameters:
context
- the XWiki Context objectrestricted
- seeDocumentDisplayerParameters.isTransformationContextRestricted()
.- Returns:
- the rendered content of the document or its translation.
- Throws:
XWikiException
- in case of error during the rendering.- Since:
- 11.5RC1
-
displayDocument
public String displayDocument(org.xwiki.rendering.syntax.Syntax targetSyntax, XWikiContext context) throws XWikiException
Execute and render the current document in the current context. The code is executed with right of this document content author.- Parameters:
targetSyntax
- the syntax to use to render the documentcontext
- the XWiki Context object- Returns:
- the rendered content of the document or its translation.
- Throws:
XWikiException
- in case of error during the rendering.- Since:
- 11.3RC1
-
displayDocument
public String displayDocument(org.xwiki.rendering.syntax.Syntax targetSyntax, boolean restricted, XWikiContext context) throws XWikiException
Execute and render the current document in the current context. The code is executed with right of this document content author.- Parameters:
targetSyntax
- the syntax to use to render the documentcontext
- the XWiki Context objectrestricted
- seeDocumentDisplayerParameters.isTransformationContextRestricted()
.- Returns:
- the rendered content of the document or its translation.
- Throws:
XWikiException
- in case of error during the rendering.- Since:
- 11.5RC1
-
getRenderedContent
public String getRenderedContent(org.xwiki.rendering.syntax.Syntax targetSyntax, boolean transformationContextIsolated, XWikiContext context) throws XWikiException
Execute and render the document or its translation in the current context. The code is executed with right of this document (or the translation) content author. The translations are retrieved if they exist and based on XWiki preferences (seegetTranslatedDocument(XWikiContext)
).- Parameters:
targetSyntax
- the syntax to use to render the documenttransformationContextIsolated
- seeDocumentDisplayerParameters.isTransformationContextIsolated()
context
- the XWiki Context object- Returns:
- the rendered content of the document or its translation.
- Throws:
XWikiException
- in case of error during the rendering.
-
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 rendersyntaxId
- the id of the Syntax used by the passed text (e.g.xwiki/2.1
)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 rendersyntaxId
- the id of the Syntax used by the passed text (e.g.xwiki/2.1
)restrictedTransformationContext
- seeDocumentDisplayerParameters.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 syntaxId, boolean restrictedTransformationContext, XWikiDocument sDocument, XWikiContext context)
- Parameters:
text
- the text to rendersyntaxId
- the id of the Syntax used by the passed text (e.g.xwiki/2.1
)restrictedTransformationContext
- seeDocumentDisplayerParameters.isTransformationContextRestricted()
.sDocument
- theXWikiDocument
to use as secure document, if null keep the current onecontext
- the XWiki Context object- Returns:
- the given text rendered in the context of this document using the passed Syntax
- Since:
- 8.3
-
getRenderedContent
public String getRenderedContent(String text, String sourceSyntaxId, String targetSyntaxId, XWikiContext context)
- Parameters:
text
- the text to rendersourceSyntaxId
- the id of the Syntax used by the passed text (e.g.xwiki/2.1
)targetSyntaxId
- the id of the syntax in which to render the document contentcontext
- the XWiki context- 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 rendersourceSyntaxId
- the id of the Syntax used by the passed text (e.g.xwiki/2.1
)targetSyntaxId
- the id of the syntax in which to render the document contentrestrictedTransformationContext
- seeDocumentDisplayerParameters.isTransformationContextRestricted()
.context
- the XWiki context- 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, boolean restrictedTransformationContext, XWikiDocument sDocument, XWikiContext context)
- Parameters:
text
- the text to rendersourceSyntaxId
- the id of the Syntax used by the passed text (e.g.xwiki/2.1
)targetSyntaxId
- the id of the syntax in which to render the document contentrestrictedTransformationContext
- seeDocumentDisplayerParameters.isTransformationContextRestricted()
.sDocument
- theXWikiDocument
to use as secure document, if null keep the current onecontext
- the XWiki context- Returns:
- the given text rendered in the context of this document using the passed Syntax
- Since:
- 8.3
-
getRenderedContent
public String getRenderedContent(String text, org.xwiki.rendering.syntax.Syntax sourceSyntaxId, XWikiDocument sDocument, boolean isolated, XWikiContext context)
- Parameters:
text
- the text to rendersourceSyntaxId
- the id of the Syntax used by the passed text (e.g.xwiki/2.1
)sDocument
- theXWikiDocument
to use as secure document, if null keep the current oneisolated
- true of the content should be executed in this document's contextcontext
- the XWiki context- Returns:
- the given text rendered in the context of this document using the passed Syntax
- Since:
- 13.0
-
getRenderedContent
@Unstable public String getRenderedContent(String text, org.xwiki.rendering.syntax.Syntax sourceSyntaxId, boolean restrictedTransformationContext, XWikiDocument sDocument, boolean isolated, XWikiContext context)
- Parameters:
text
- the text to rendersourceSyntaxId
- the id of the Syntax used by the passed text (e.g.xwiki/2.1
)restrictedTransformationContext
- seeDocumentDisplayerParameters.isTransformationContextRestricted()
.sDocument
- theXWikiDocument
to use as secure document, if null keep the current oneisolated
- true of the content should be executed in this document's contextcontext
- the XWiki context- Returns:
- the given text rendered in the context of this document using the passed Syntax
- Since:
- 14.10, 14.4.7, 13.10.11
-
getRenderedContent
public String getRenderedContent(String text, org.xwiki.rendering.syntax.Syntax sourceSyntaxId, org.xwiki.rendering.syntax.Syntax targetSyntaxId, boolean restrictedTransformationContext, XWikiDocument sDocument, boolean isolated, XWikiContext context)
- Parameters:
text
- the text to rendersourceSyntaxId
- the id of the Syntax used by the passed text (e.g.xwiki/2.1
)targetSyntaxId
- the id of the syntax in which to render the document contentrestrictedTransformationContext
- seeDocumentDisplayerParameters.isTransformationContextRestricted()
.sDocument
- theXWikiDocument
to use as secure document, if null keep the current oneisolated
- true of the content should be executed in this document's contextcontext
- the XWiki context- Returns:
- the given text rendered in the context of this document using the passed Syntax
- Since:
- 13.0
-
getEscapedContent
public String getEscapedContent(XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
getName
@Deprecated(since="2.2M1") public String getName()
Deprecated.usegetDocumentReference()
insteadNote that this method cannot be removed for now since it's used by Hibernate for saving a XWikiDocument.
-
setName
@Deprecated(since="2.2M1") public void setName(String name)
Deprecated.usesetDocumentReference(DocumentReference)
insteadNote 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 interfaceDocumentModelBridge
-
getPageReference
public PageReference getPageReference()
- Returns:
- the reference of the document as
PageReference
- Since:
- 10.6RC1
-
getPageReferenceWithLocale
public PageReference getPageReferenceWithLocale()
- Returns:
- the reference of the document as
PageReference
including theLocale
- Since:
- 10.6RC1
-
getDocumentReferenceWithLocale
public DocumentReference getDocumentReferenceWithLocale()
- Returns:
- the
DocumentReference
of the document also containing the documentLocale
- Since:
- 5.3M2
-
getFullName
@Deprecated(since="2.2M1") public String getFullName()
Deprecated.usegetDocumentReference()
instead- Specified by:
getFullName
in interfaceDocumentModelBridge
- Returns:
- the document's space + page name (eg "space.page")
-
getPrefixedFullName
@Deprecated(since="2.2M1") public String getPrefixedFullName()
Deprecated.usegetDocumentReference()
instead- Returns:
- the docoument's wiki + space + page name (eg "wiki:space.page")
-
setDocumentReference
@Deprecated(since="2.2.3") public void setDocumentReference(DocumentReference reference)
Deprecated.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(since="2.2M1") public void setFullName(String name)
Deprecated.
-
setFullName
@Deprecated(since="2.2M1") public void setFullName(String fullName, XWikiContext context)
Deprecated.
-
getWikiName
@Deprecated(since="2.2M1") public String getWikiName()
Deprecated.usegetDocumentReference()
instead- Specified by:
getWikiName
in interfaceDocumentModelBridge
- See Also:
DocumentModelBridge.getWikiName()
-
getSpaceName
@Deprecated(since="2.2M1") public String getSpaceName()
Deprecated.usegetDocumentReference()
instead- Specified by:
getSpaceName
in interfaceDocumentModelBridge
- See Also:
DocumentModelBridge.getSpaceName()
-
getPageName
@Deprecated(since="2.2M1") public String getPageName()
Deprecated.usegetDocumentReference()
instead- Specified by:
getPageName
in interfaceDocumentModelBridge
- See Also:
DocumentModelBridge.getSpaceName()
-
getTitle
public String getTitle()
- Specified by:
getTitle
in interfaceDocumentModelBridge
-
getRenderedTitle
public String getRenderedTitle(org.xwiki.rendering.syntax.Syntax outputSyntax, XWikiContext context)
Get the rendered version of the document title. The title is extracted and then Velocity is applied on it and it's then rendered using the passed Syntax. The following logic is used to extract the title:- If a Sheet is specified for the document and this Sheet document contains a non empty title then it's used
- If not and the document's title is specified then it's used
- If not and if the title compatibility mode is turned on (
xwiki.title.compatibility=1
inxwiki.cfg
) then an attempt is made to extract the title from the first heading found in the document's content - If not, then at last resort the page name is returned
- Parameters:
outputSyntax
- the syntax to render to; this is not taken into account for XWiki 1.0 syntaxcontext
- the XWiki context- Returns:
- the rendered version of the document title
-
getRenderedTitle
public String getRenderedTitle(XWikiContext context)
Similar togetRenderedTitle(Syntax, XWikiContext)
but the output Syntax used is XHTML 1.0 unless the current skin defines another output Syntax in which case it's the one used.- Parameters:
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
@Deprecated(since="14.0RC1") public DocumentReference getAuthorReference()
Deprecated.usegetAuthors()
and thenDocumentAuthors.getEffectiveMetadataAuthor()
instead- Since:
- 3.0M3
-
setAuthorReference
@Deprecated(since="14.0RC1") public void setAuthorReference(DocumentReference authorReference)
Deprecated.usegetAuthors()
and thenDocumentAuthors.setEffectiveMetadataAuthor(UserReference)
instead- Since:
- 3.0M3
-
getAuthor
@Deprecated public String getAuthor()
Deprecated.since 3.0M3 usegetAuthorReference()
insteadNote that this method cannot be removed for now since it's used by Hibernate for saving a XWikiDocument.
-
setAuthor
@Deprecated(since="3.0M3") public void setAuthor(String author)
Deprecated.Note that this method cannot be removed for now since it's used by Hibernate for loading a XWikiDocument.
-
getContentAuthorReference
@Deprecated(since="14.0RC1") public DocumentReference getContentAuthorReference()
Deprecated.usegetAuthors()
and thenDocumentAuthors.getContentAuthor()
instead- Specified by:
getContentAuthorReference
in interfaceDocumentModelBridge
- Since:
- 3.0M3
-
setContentAuthorReference
@Deprecated(since="14.0RC1") public void setContentAuthorReference(DocumentReference contentAuthorReference)
Deprecated.usegetAuthors()
and thenDocumentAuthors.setContentAuthor(UserReference)
instead- Since:
- 3.0M3
-
getContentAuthor
@Deprecated(since="3.0M3") public String getContentAuthor()
Deprecated.usegetContentAuthorReference()
insteadNote that this method cannot be removed for now since it's used by Hibernate for saving a XWikiDocument.
-
setContentAuthor
@Deprecated(since="3.0M3") public void setContentAuthor(String contentAuthor)
Deprecated.Note that this method cannot be removed for now since it's used by Hibernate for loading a XWikiDocument.
-
getCreatorReference
@Deprecated(since="14.0RC1") public DocumentReference getCreatorReference()
Deprecated.usegetAuthors()
and thenDocumentAuthors.getCreator()
instead- Since:
- 3.0M3
-
setCreatorReference
@Deprecated(since="14.0RC1") public void setCreatorReference(DocumentReference creatorReference)
Deprecated.usegetAuthors()
and thenDocumentAuthors.setCreator(UserReference)
instead- Since:
- 3.0M3
-
getCreator
@Deprecated(since="3.0M2") public String getCreator()
Deprecated.usegetCreatorReference()
insteadNote that this method cannot be removed for now since it's used by Hibernate for saving a XWikiDocument.
-
setCreator
@Deprecated(since="3.0M2") public void setCreator(String creator)
Deprecated.Note that this method cannot be removed for now since it's used by Hibernate for loading a XWikiDocument.
-
getDate
public Date getDate()
- Specified by:
getDate
in interfaceDocumentModelBridge
-
setDate
public void setDate(Date date)
-
getCreationDate
public Date getCreationDate()
- Specified by:
getCreationDate
in interfaceDocumentModelBridge
-
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()
Increment the current document version. This method will usegetNextVersion(Version, boolean)
to compute the new version.
-
getNextVersion
public static org.suigeneris.jrcs.rcs.Version getNextVersion(org.suigeneris.jrcs.rcs.Version version, boolean minorEdit)
This method computes the next version and returns it, but won't change the current version. In order to change the current version, seeincrementVersion()
.- Parameters:
version
- the based version from which to compute the next one.minorEdit
- true means it's a minor edition.- Returns:
- the new version computed based on the current one.
- Since:
- 11.2RC1
-
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 thestruts-config.xml
file for a list of all existing action namesparams
- the URL query stringredirect
- true if the URL is going to be used inHttpServletResponse.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 protectedDocument
public API to access page information and actions from scripting.- Parameters:
customClassName
- the name of the customDocument
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 protectedDocument
public API to access page information and actions from scripting.- Parameters:
customClass
- the customDocument
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(since="2.2M1") public BaseObject getxWikiObject()
Deprecated.usegetXObject()
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 classcontext
- 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(since="2.2M1") public int createNewObject(String className, XWikiContext context) throws XWikiException
Deprecated.usecreateXObject(EntityReference, XWikiContext)
instead- Throws:
XWikiException
-
getXObjectSize
public int getXObjectSize(DocumentReference classReference)
- Since:
- 2.2M1
-
getXObjectSize
public int getXObjectSize(EntityReference classReference)
- Since:
- 7.3M1, 7.2.1, 7.1.3, 6.4.6
-
getObjectNumbers
@Deprecated(since="2.2M1") public int getObjectNumbers(String className)
Deprecated.usegetXObjectSize(DocumentReference)
instead
-
getXObjects
public List<BaseObject> getXObjects(DocumentReference classReference)
Retrieve and returns all objects corresponding to the given class reference, or an empty list if there's none. Be aware that some elements of this list might be null since all objects are in the list at their real index.- Parameters:
classReference
- the reference of the xclass for which to retrieve the xobjects- Returns:
- a list of xobjects and null elements (for deleted xobjects) corresponding to the given xclass or an empty list.
- Since:
- 2.2M1
-
getXObjects
public List<BaseObject> getXObjects(EntityReference reference)
Retrieve and returns all objects corresponding to the class reference corresponding to the resolution of the given entity reference, or an empty list if there's none. Be aware that some elements of this list might be null since all objects are in the list at their real index.- Parameters:
reference
- the reference that is resolved to an xclass for retrieving the corresponding xobjects- Returns:
- a list of xobjects and null elements (for deleted xobjects) corresponding to the given xclass or an empty list.
- Since:
- 3.3M1
-
getObjects
@Deprecated(since="2.2M1") public Vector<BaseObject> getObjects(String className)
Deprecated.usegetXObjects(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
-
getXObject
@Unstable public BaseObject getXObject(ObjectReference objectReference, boolean create, XWikiContext context) throws XWikiException
Get or create an object of this document based on its reference.- Parameters:
objectReference
- The reference of the object.create
- If the object shall be created if missing.context
- The XWiki context for creating the object.- Returns:
- The found or created objected.
- Throws:
XWikiException
- If object creation failed.- Since:
- 14.0RC1
-
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(since="2.2M1") public BaseObject getObject(String className)
Deprecated.usegetXObject(DocumentReference)
instead
-
getXObject
public BaseObject getXObject(DocumentReference classReference, int nb)
- Since:
- 2.2M1
-
getXObject
public BaseObject getXObject(EntityReference classReference, int number, boolean create, XWikiContext xcontext) throws XWikiException
Get an xobject with the passed xclass at the passed location.If
create
is true and the is no xobject at the passed located, it's created.- Parameters:
classReference
- the xlcass of the object to retrievenumber
- the location of the xobjectcreate
- if true the xobject is created when it does not existxcontext
- the XWiki context- Returns:
- a
BaseObject
stored at passed location - Throws:
XWikiException
- when failing to create new xobject instance- Since:
- 7.3M1, 7.2.1, 7.1.3, 6.4.6
-
getXObject
public BaseObject getXObject(EntityReference classReference, int nb)
- Since:
- 4.1M1
-
getObject
@Deprecated(since="2.2M1") public BaseObject getObject(String className, int nb)
Deprecated.usegetXObject(DocumentReference, int)
instead
-
getXObject
public BaseObject getXObject(DocumentReference classReference, String key, String value)
- Since:
- 2.2M1
-
getObject
@Deprecated(since="2.2M1") public BaseObject getObject(String className, String key, String value)
Deprecated.usegetXObject(DocumentReference, String, String)
instead
-
getXObject
public BaseObject getXObject(EntityReference reference, String key, String value, boolean failover)
- Returns:
- 6.3M1
-
getXObject
public BaseObject getXObject(DocumentReference classReference, String key, String value, boolean failover)
- Since:
- 2.2M1
-
getObject
@Deprecated(since="2.2M1") public BaseObject getObject(String className, String key, String value, boolean failover)
Deprecated.
-
addXObject
@Deprecated public void addXObject(DocumentReference classReference, BaseObject object)
Deprecated.useaddXObject(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(since="2.2M1") public void addObject(String className, BaseObject object)
Deprecated.useaddXObject(BaseObject)
instead
-
setXObject
@Deprecated public void setXObject(DocumentReference classReference, int nb, BaseObject object)
Deprecated.usesetXObject(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's xclass.- Parameters:
nb
- index of the element to replaceobject
- 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(since="2.2M1") public void setObject(String className, int nb, BaseObject object)
Deprecated.usesetXObject(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(since="2.2M1") public void mergexWikiClass(XWikiDocument templatedoc)
Deprecated.usemergeXClass(XWikiDocument)
instead
-
mergeXObjects
public void mergeXObjects(XWikiDocument templateDoc)
- Since:
- 2.2M1
-
mergexWikiObjects
@Deprecated(since="2.2M1") public void mergexWikiObjects(XWikiDocument templatedoc)
Deprecated.usemergeXObjects(XWikiDocument)
instead
-
cloneXObjects
public void cloneXObjects(XWikiDocument templatedoc)
- Since:
- 2.2M1
-
duplicateXObjects
public void duplicateXObjects(XWikiDocument templatedoc)
- Since:
- 2.2.3
-
getTemplateDocumentReference
public DocumentReference getTemplateDocumentReference()
- Since:
- 2.2M1
-
getTemplate
@Deprecated(since="2.2M1") public String getTemplate()
Deprecated.usegetTemplateDocumentReference()
instead
-
setTemplateDocumentReference
public void setTemplateDocumentReference(DocumentReference templateDocumentReference)
- Since:
- 2.2M1
-
setTemplate
@Deprecated(since="2.2M1") public void setTemplate(String template)
Deprecated.usesetTemplateDocumentReference(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 displaycontext
- 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 displayobj
- the object containing the field to displaycontext
- 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 displaymode
- 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 displaytype
- the type of the field to displayobj
- the object containing the field to displaycontext
- the XWiki context- Returns:
- the rendered field
-
display
public String display(String fieldname, String type, BaseObject obj, boolean isolated, XWikiContext context)
- Parameters:
fieldname
- the name of the field to displaytype
- the type of the field to displayobj
- the object containing the field to displayisolated
- true if the property should be displayed in it's own document contextcontext
- the XWiki context- Returns:
- the rendered field
- Since:
- 13.0
-
display
public String display(String fieldname, String mode, String prefix, XWikiContext context)
- Parameters:
fieldname
- the name of the field to displaymode
- the mode to use ("view", "edit", ...)prefix
- the prefix to add in the field identifier in edit display for examplecontext
- 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 displaytype
- the type of the field to displayobj
- the object containing the field to displaywrappingSyntaxId
- 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 displaytype
- the type of the field to displaypref
- the prefix to add in the field identifier in edit display for exampleobj
- the object containing the field to displaycontext
- the XWiki context- Returns:
- the rendered field
-
display
public String display(String fieldname, String type, String pref, BaseObject obj, boolean isolated, XWikiContext context)
- Parameters:
fieldname
- the name of the field to displaytype
- the type of the field to displaypref
- the prefix to add in the field identifier in edit display for exampleobj
- the object containing the field to displayisolated
- true if the property should be displayed in it's own document contextcontext
- the XWiki context- Returns:
- the rendered field
- Since:
- 13.0
-
display
public String display(String fieldname, String type, String pref, BaseObject obj, String wrappingSyntaxId, XWikiContext context)
- Parameters:
fieldname
- the name of the field to displaytype
- the type of the field to displaypref
- the prefix to add in the field identifier in edit display for exampleobj
- the object containing the field to displaywrappingSyntaxId
- 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, String wrappingSyntaxId, boolean isolated, XWikiContext context)
- Parameters:
fieldname
- the name of the field to displaytype
- the type of the field to displaypref
- the prefix to add in the field identifier in edit display for exampleobj
- the object containing the field to displaywrappingSyntaxId
- the syntax of the content in which the result will be included. This to take care of some escaping depending of the syntax.isolated
- true if the property should be displayed in it's own document contextcontext
- the XWiki context- Returns:
- the rendered field
-
displayForm
public String displayForm(DocumentReference classReference, String header, String format, XWikiContext context)
- Since:
- 2.2M1
-
displayForm
@Deprecated(since="2.2M1") public String displayForm(String className, String header, String format, XWikiContext context)
Deprecated.
-
displayForm
public String displayForm(DocumentReference classReference, String header, String format, boolean linebreak, XWikiContext context)
- Since:
- 2.2M1
-
displayForm
@Deprecated(since="2.2M1") public String displayForm(String className, String header, String format, boolean linebreak, XWikiContext context)
Deprecated.
-
displayForm
public String displayForm(DocumentReference classReference, XWikiContext context)
- Since:
- 2.2M1
-
displayForm
@Deprecated(since="2.2M1") public String displayForm(String className, XWikiContext context)
Deprecated.usedisplayForm(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
Updates properties of existing objects with the values from the given form.- Parameters:
eform
- The form to read the values fromcontext
- The context used for getting the classes of objects- Throws:
XWikiException
- On errors
-
readObjectsFromFormUpdateOrCreate
public void readObjectsFromFormUpdateOrCreate(EditForm eform, XWikiContext context) throws XWikiException
Create and/or update objects in a document given a list of HTTP parameters of the form<spacename>.<classname>_<number>_<propertyname>
. If the object already exists, the field is replaced by the given value. If the object doesn't exist in the document, it is created and the property<propertyname>
is initialized with the given value.- Parameters:
eform
- is form information that contains all the query parameterscontext
-- Throws:
XWikiException
- Since:
- 7.1M1
-
readFromForm
public void readFromForm(EditForm eform, XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
readTemporaryUploadedFiles
@Unstable public void readTemporaryUploadedFiles(EditForm editForm)
Read the list of attachment that should be added fromEditForm.getTemporaryUploadedFiles()
and attach them to the current document if they can be found in theTemporaryAttachmentSessionsManager
.- Parameters:
editForm
- the form from which to read the list of files.- Since:
- 14.3RC1
-
readAddedUpdatedAndRemovedObjectsFromForm
@Unstable public void readAddedUpdatedAndRemovedObjectsFromForm(EditForm eform, XWikiContext context) throws XWikiException
Adds objects, applies property updates and removes objects as specified in the form.- Parameters:
eform
- The form from which the values shall be read.context
- The XWiki context.- Throws:
XWikiException
- If an error occurs.- Since:
- 14.0RC1
-
readFromTemplate
public void readFromTemplate(DocumentReference templateDocumentReference, XWikiContext context) throws XWikiException
- Throws:
XWikiException
- Since:
- 2.2M1
-
clone
public void clone(XWikiDocument document)
Use the document passed as parameter as the new identity for the current document.- Parameters:
document
- the document containing the new identity
-
clone
public XWikiDocument clone()
-
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 separately 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
-
loadAttachmentsContentSafe
public void loadAttachmentsContentSafe(XWikiContext context)
Same asloadAttachmentContent(XWikiAttachment, XWikiContext)
but in some context we don't really care if an attachment content could not be loaded (we are going to overwrite or ignore it).- Parameters:
context
- the XWiki context- Since:
- 10.1RC1
-
loadAttachments
public void loadAttachments(XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
equalsData
public boolean equalsData(XWikiDocument otherDocument)
Same asequals(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
-
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(since="4.1M2") public void addToZip(ZipOutputStream zos, String zipname, boolean withVersions, XWikiContext context) throws XWikiException, IOException
Deprecated.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 tozipname
- the name of the new entry to createwithVersions
- if true, also include archived version of the documentcontext
- current XWikiContext- Throws:
XWikiException
- when an error occurs during xwiki operationsIOException
- when an error occurs during streaming operations- Since:
- 2.3M2
-
addToZip
@Deprecated(since="4.2M2") public void addToZip(ZipOutputStream zos, boolean withVersions, XWikiContext context) throws XWikiException, IOException
Deprecated.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 towithVersions
- if true, also include archived version of the documentcontext
- current XWikiContext- Throws:
XWikiException
- when an error occurs during xwiki operationsIOException
- when an error occurs during streaming operations- Since:
- 2.3M2
-
addToZip
@Deprecated(since="4.1M2") public void addToZip(ZipOutputStream zos, XWikiContext context) throws XWikiException, IOException
Deprecated.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 tocontext
- current XWikiContext- Throws:
XWikiException
- when an error occurs during xwiki operationsIOException
- 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 prefertoXML(OutputStream, boolean, boolean, boolean, boolean, XWikiContext)
ortoXML(com.xpn.xwiki.internal.xml.XMLWriter, boolean, boolean, boolean, boolean, XWikiContext)
when possible to reduce memory load.- Parameters:
bWithObjects
- include XObjectsbWithRendering
- include the rendered contentbWithAttachmentContent
- include attachments contentbWithVersions
- include archived versionscontext
- current XWikiContext- Returns:
- a string containing an XML representation of the document
- Throws:
XWikiException
- when an errors occurs during wiki operations
-
toXMLDocument
@Deprecated(since="9.0RC1") public org.dom4j.Document toXMLDocument(XWikiContext context) throws XWikiException
Deprecated.Serialize the document to an XMLDOMDocument
. 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
@Deprecated(since="9.0RC1") public org.dom4j.Document toXMLDocument(boolean bWithObjects, boolean bWithRendering, boolean bWithAttachmentContent, boolean bWithVersions, XWikiContext context) throws XWikiException
Deprecated.Serialize the document to an XMLDOMDocument
. You should prefertoXML(OutputStream, boolean, boolean, boolean, boolean, XWikiContext)
ortoXML(com.xpn.xwiki.internal.xml.XMLWriter, boolean, boolean, boolean, boolean, XWikiContext)
when possible to reduce memory load.- Parameters:
bWithObjects
- include XObjectsbWithRendering
- include the rendered contentbWithAttachmentContent
- include attachments contentbWithVersions
- include archived versionscontext
- current XWikiContext- Returns:
- a
DOMDocument
containing the serialized document. - Throws:
XWikiException
- when an errors occurs during wiki operations
-
toXML
@Deprecated(since="9.0RC1") public void toXML(com.xpn.xwiki.internal.xml.XMLWriter wr, boolean bWithObjects, boolean bWithRendering, boolean bWithAttachmentContent, boolean bWithVersions, XWikiContext context) throws XWikiException, IOException
Deprecated.Serialize the document to aXMLWriter
.- Parameters:
bWithObjects
- include XObjectsbWithRendering
- include the rendered contentbWithAttachmentContent
- include attachments contentbWithVersions
- include archived versionscontext
- current XWikiContext- Throws:
XWikiException
- when an errors occurs during wiki operationsIOException
- 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 XObjectsbWithRendering
- include the rendered contentbWithAttachmentContent
- include attachments contentbWithVersions
- include archived versionscontext
- current XWikiContext- Throws:
XWikiException
- when an errors occurs during wiki operationsIOException
- when an errors occurs during streaming operations- Since:
- 2.3M2
-
toXML
public void toXML(org.xwiki.filter.output.OutputTarget out, boolean bWithObjects, boolean bWithRendering, boolean bWithAttachmentContent, boolean bWithVersions, boolean format, String encoding) throws XWikiException
Serialize the document to an OutputStream.- Parameters:
out
- the output where to write the XMLbWithObjects
- include XObjectsbWithRendering
- include the rendered contentbWithAttachmentContent
- include attachments contentbWithVersions
- include archived versionsformat
- true if the XML should be formatedencoding
- the encoding to use to write the XML- Throws:
XWikiException
- when an errors occurs during wiki operations- Since:
- 9.0RC1
-
toXML
public void toXML(DocumentInstanceInputProperties documentProperties, XAROutputProperties xarProperties) throws XWikiException
Serialize the document to an OutputStream.- Parameters:
xarProperties
- the configuration of the output filterdocumentProperties
- the configuration of the input filter- Throws:
XWikiException
- when an errors occurs during wiki operations- Since:
- 13.8RC1
-
fromXML
public void fromXML(String xml) throws XWikiException
- Throws:
XWikiException
-
fromXML
public void fromXML(InputStream is) throws XWikiException
- Throws:
XWikiException
-
fromXML
public void fromXML(org.xwiki.filter.input.InputSource source, boolean withArchive) throws XWikiException
- Throws:
XWikiException
-
fromXML
public void fromXML(String source, boolean withArchive) throws XWikiException
- Throws:
XWikiException
-
fromXML
public void fromXML(InputStream source, boolean withArchive) throws XWikiException
- Throws:
XWikiException
-
fromXML
@Deprecated(since="9.0RC1") public void fromXML(org.dom4j.Document domdoc, boolean withArchive) throws XWikiException
Deprecated.usefromXML(InputStream)
instead- 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
@Deprecated public void saveAllAttachments(XWikiContext context) throws XWikiException
Deprecated.should not be used, save the document instead- Throws:
XWikiException
-
saveAllAttachments
@Deprecated public void saveAllAttachments(boolean updateParent, boolean transaction, XWikiContext context) throws XWikiException
Deprecated.should not be used, save the document instead- Throws:
XWikiException
-
saveAttachmentsContent
@Deprecated public void saveAttachmentsContent(List<XWikiAttachment> attachments, XWikiContext context) throws XWikiException
Deprecated.should not be used, save the document instead- Throws:
XWikiException
-
saveAttachmentContent
@Deprecated public void saveAttachmentContent(XWikiAttachment attachment, XWikiContext context) throws XWikiException
Deprecated.should not be used, save the document instead- Throws:
XWikiException
-
saveAttachmentContent
@Deprecated public void saveAttachmentContent(XWikiAttachment attachment, boolean updateParent, boolean transaction, XWikiContext context) throws XWikiException
Deprecated.should not be used, save the document instead- Throws:
XWikiException
-
loadAttachmentContent
@Deprecated(since="9.9RC1") public void loadAttachmentContent(XWikiAttachment attachment, XWikiContext context) throws XWikiException
Deprecated.- 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 removetoRecycleBin
- 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.
-
getBackLinkedReferences
public List<DocumentReference> getBackLinkedReferences(XWikiContext context) throws XWikiException
Get the wiki document references pointing to this document.Theses links are stored in the Solr search core when the document is indexed. You can use "backlinks" in XWikiPreferences or "xwiki.backlinks" in xwiki.cfg file to enable links storage in the database.
Since 14.8RC1, this method return all backlinked documents and not just those located in the context wiki.
- 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(since="2.2M2") public List<String> getBackLinkedPages(XWikiContext context) throws XWikiException
Deprecated.- Throws:
XWikiException
-
getUniqueWikiLinkedPages
public Set<XWikiLink> getUniqueWikiLinkedPages(XWikiContext context) throws XWikiException
Get a list of unique links from this document to others documents.- xwiki/1.0 content: get the unique links associated to document from database. This is stored when the document is saved. You can use "backlinks" in XWikiPreferences or "xwiki.backlinks" in xwiki.cfg file to enable links storage in the database.
- Other content: call
getUniqueLinkedPages(XWikiContext)
and generate the List.
- Parameters:
context
- the XWiki context- Returns:
- the found wiki links.
- Throws:
XWikiException
- error when getting links from database when xwiki/1.0 content.- Since:
- 1.9M2
-
getUniqueLinkedPages
public Set<String> getUniqueLinkedPages(XWikiContext context)
Extract all the unique entity references found in the current document (they can be wiki links, macro parameters, etc) and pointing to documents (either using a Document Reference or a Page Reference).- Parameters:
context
- the XWiki context- Returns:
- the serialized entity references, and null if an error happened
- Since:
- 1.9M2
-
getUniqueLinkedEntities
@Unstable public Set<EntityReference> getUniqueLinkedEntities(XWikiContext context)
Extract all the unique static (i.e. not generated by macros) entity references pointed by wiki links (pointing to wiki document or attachments) for the current context document.- Parameters:
context
- the XWiki context- Returns:
- the entity references pointing to either document or attachments. If
null
, an error happened - Since:
- 14.2RC1
-
getChildrenReferences
public List<DocumentReference> getChildrenReferences(XWikiContext context) throws XWikiException
Returns a list of references of all documents which list this document as their parent, in the current wiki.getChildren(int, int, com.xpn.xwiki.XWikiContext)
- Throws:
XWikiException
- Since:
- 2.2M2
-
getChildren
@Deprecated(since="2.2M2") public List<String> getChildren(XWikiContext context) throws XWikiException
Deprecated.- 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, in the current wiki.- Parameters:
nb
- The number of results to return.start
- The number of results to skip before we begin returning results.context
- Thecontext
.- Returns:
- the list of document references
- Throws:
XWikiException
- If there's an error querying the database.- Since:
- 2.2M2
-
getChildren
@Deprecated(since="2.2M2") public List<String> getChildren(int nb, int start, XWikiContext context) throws XWikiException
Deprecated.- Throws:
XWikiException
-
renameProperties
public void renameProperties(DocumentReference classReference, Map<String,String> fieldsToRename)
- Since:
- 2.2M2
-
renameProperties
@Deprecated(since="2.2M2") public void renameProperties(String className, Map<String,String> fieldsToRename)
Deprecated.userenameProperties(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(since="2.2M2") public void addObjectsToRemove(BaseObject object)
Deprecated.useaddXObjectToRemove(BaseObject)
)} instead
-
getXObjectsToRemove
public List<BaseObject> getXObjectsToRemove()
- Since:
- 2.2M2
-
getObjectsToRemove
@Deprecated(since="2.2M2") public ArrayList<BaseObject> getObjectsToRemove()
Deprecated.usegetObjectsToRemove()
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)
Return the first attachment of the attachment list either exactly matching the provided filename or that matches the provided filename with a n arbitrary extension (i.e., filename.ext). To get only attachments that exactly matches the provided filename usegetExactAttachment(String)
.- 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 - See Also:
getExactAttachment(String)
-
getExactAttachment
public XWikiAttachment getExactAttachment(String filename)
Return the attachment that exactly matches the provided file. To also get the first attachment that matches the provided filename with an arbitrary extension usegetAttachment(String)
.- Parameters:
filename
- the file name of the attachment- Returns:
- the
XWikiAttachment
exactly corresponding to the file name, null if none can be found - Since:
- 14.1RC1, 13.10.3
-
addAttachment
@Deprecated(since="9.10RC1") public void addAttachment(XWikiAttachment attachment)
Deprecated.usesetAttachment(XWikiAttachment)
insteadAdd passed attachment to the document.- Parameters:
attachment
- the attachment to add- Since:
- 5.3M2
-
setAttachment
public XWikiAttachment setAttachment(XWikiAttachment attachment)
Insert passed attachment in the document and return any pre-existing attachment with the same name.- Parameters:
attachment
- the attachment to insert in the document- Returns:
- the attachment replaced by the passed attachment
- Since:
- 9.10RC1
-
addAttachment
@Deprecated public XWikiAttachment addAttachment(String fileName, byte[] content, XWikiContext context) throws XWikiException
Deprecated.usesetAttachment(String, InputStream, XWikiContext)
instead- Throws:
XWikiException
-
addAttachment
@Deprecated(since="9.10RC1") public XWikiAttachment addAttachment(String fileName, InputStream content, XWikiContext context) throws XWikiException, IOException
Deprecated.usesetAttachment(String, InputStream, XWikiContext)
instead- Parameters:
fileName
- the name of the attachmentcontent
- the content of the attachmentcontext
- the XWiki context- Returns:
- the new attachment
- Throws:
XWikiException
- never sentIOException
- when failing to read the passed content
-
setAttachment
public XWikiAttachment setAttachment(String fileName, InputStream content, XWikiContext context) throws IOException
Create or update attachment with the passed name with the passed content.- Parameters:
fileName
- the name of the attachmentcontent
- the content of the attachmentcontext
- the XWiki context- Returns:
- the new attachment
- Throws:
IOException
- when failing to read the passed content- Since:
- 9.10rc1
-
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(since="2.2M2") public void setProperty(String className, String fieldName, BaseProperty value)
Deprecated.
-
getIntValue
public int getIntValue(DocumentReference classReference, String fieldName)
- Since:
- 2.2M2
-
getIntValue
public int getIntValue(DocumentReference classReference, String fieldName, int defaultValue)
Retrieve the int value of the given property of the first object of the given class.- Parameters:
classReference
- the reference of the object to findfieldName
- the property to get the value fromdefaultValue
- the default value to return if the object doesn't exist, or if the property is not set- Returns:
- the retrieved value or the default value.
- Since:
- 11.9RC1
-
getIntValue
@Deprecated(since="2.2M2") public int getIntValue(String className, String fieldName)
Deprecated.usegetIntValue(DocumentReference, String)
instead
-
getLongValue
public long getLongValue(DocumentReference classReference, String fieldName)
- Since:
- 2.2M2
-
getLongValue
@Deprecated(since="2.2M2") public long getLongValue(String className, String fieldName)
Deprecated.usegetLongValue(DocumentReference, String)
instead
-
getStringValue
public String getStringValue(EntityReference classReference, String fieldName)
- Since:
- 6.2M1
-
getStringValue
public String getStringValue(DocumentReference classReference, String fieldName)
- Since:
- 2.2M2
-
getStringValue
@Deprecated(since="2.2M2") public String getStringValue(String className, String fieldName)
Deprecated.usegetStringValue(DocumentReference, String)
instead
-
getIntValue
public int getIntValue(String fieldName)
-
getLongValue
public long getLongValue(String fieldName)
-
setStringValue
public void setStringValue(EntityReference classReference, String fieldName, String value)
- Since:
- 2.2.3
-
setStringValue
@Deprecated(since="2.2M2") public void setStringValue(String className, String fieldName, String value)
Deprecated.usesetStringValue(EntityReference, String, String)
instead
-
getListValue
public List getListValue(DocumentReference classReference, String fieldName)
- Since:
- 2.2M2
-
getListValue
@Deprecated(since="2.2M2") public List getListValue(String className, String fieldName)
Deprecated.usegetListValue(DocumentReference, String)
instead
-
setStringListValue
public void setStringListValue(EntityReference classReference, String fieldName, List value)
- Since:
- 2.2.3
-
setStringListValue
@Deprecated(since="2.2M2") public void setStringListValue(String className, String fieldName, List value)
Deprecated.
-
setDBStringListValue
public void setDBStringListValue(EntityReference classReference, String fieldName, List value)
- Since:
- 2.2.3
-
setDBStringListValue
@Deprecated(since="2.2M2") public void setDBStringListValue(String className, String fieldName, List value)
Deprecated.
-
setLargeStringValue
public void setLargeStringValue(EntityReference classReference, String fieldName, String value)
- Since:
- 2.2.3
-
setLargeStringValue
@Deprecated(since="2.2M2") public void setLargeStringValue(String className, String fieldName, String value)
Deprecated.
-
setIntValue
public void setIntValue(EntityReference classReference, String fieldName, int value)
- Since:
- 2.2.3
-
setIntValue
@Deprecated(since="2.2M2") public void setIntValue(String className, String fieldName, int value)
Deprecated.usesetIntValue(EntityReference, String, int)
instead
-
getDatabase
@Deprecated(since="2.2M1") public String getDatabase()
Deprecated.usegetDocumentReference()
insteadNote that this method cannot be removed for now since it's used by Hibernate for saving a XWikiDocument.
-
setDatabase
@Deprecated(since="2.2M1") public void setDatabase(String database)
Deprecated.usesetDocumentReference(DocumentReference)
insteadNote that this method cannot be removed for now since it's used by Hibernate for loading a XWikiDocument.
-
getLanguage
@Deprecated(since="4.3M2") public String getLanguage()
Deprecated.usegetLocale()
insteadNote that this method cannot be removed for now since it's used by Hibernate for saving a XWikiDocument.
-
setLanguage
@Deprecated(since="4.3M2") public void setLanguage(String language)
Deprecated.usesetLocale(Locale)
insteadNote 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(since="4.3M2") public String getDefaultLanguage()
Deprecated.usegetDefaultLocale()
insteadNote that this method cannot be removed for now since it's used by Hibernate for saving a XWikiDocument.
-
setDefaultLanguage
@Deprecated(since="4.3M2") public void setDefaultLanguage(String defaultLanguage)
Deprecated.usesetDefaultLocale(Locale)
insteadNote 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
@Deprecated(since="5.4.6") public void setTranslation(int translation)
Deprecated.stored in the database to speedup some queries (really ?) but inXWikiDocument
it's calculated based on the document localeNote that this method cannot be removed for now since it's called by Hibernate when loading a XWikiDocument.
-
getTranslatedContent
public String getTranslatedContent(XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
getTranslatedContent
public String getTranslatedContent(String locale, XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
getTranslatedDocument
public XWikiDocument getTranslatedDocument(XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
getTranslatedDocument
@Deprecated(since="4.3M2") public XWikiDocument getTranslatedDocument(String language, XWikiContext context) throws XWikiException
Deprecated.usegetTranslatedDocument(Locale, XWikiContext)
inseadReturn 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 returncontext
- 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 returncontext
- 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(since="4.3M1") public String getRealLanguage(XWikiContext context) throws XWikiException
Deprecated.usegetRealLocale()
instead- Throws:
XWikiException
-
getRealLanguage
@Deprecated(since="4.3M1") public String getRealLanguage()
Deprecated.usegetRealLocale()
instead- Specified by:
getRealLanguage
in interfaceDocumentModelBridge
- See Also:
DocumentModelBridge.getRealLanguage()
-
getRealLocale
public Locale getRealLocale()
- Returns:
- the actual locale of the document
-
getTranslationList
@Deprecated(since="5.1M2") public List<String> getTranslationList(XWikiContext context) throws XWikiException
Deprecated.usegetTranslationLocales(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
- Thecontext
.- 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
@Deprecated(since="12.5RC1") public void rename(DocumentReference newDocumentReference, XWikiContext context) throws XWikiException
Deprecated.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(DocumentReference, List, List, XWikiContext)
for more details.- Parameters:
newDocumentReference
- the new document referencecontext
- the ubiquitous XWiki Context- Throws:
XWikiException
- in case of an error- Since:
- 2.2M2
-
rename
@Deprecated(since="12.5RC1") public void rename(DocumentReference newDocumentReference, List<DocumentReference> backlinkDocumentReferences, XWikiContext context) throws XWikiException
Deprecated.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:- [Page]
- [Page?param=1]
- [currentwiki:Page]
- [CurrentSpace.Page]
- [currentwiki:CurrentSpace.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 referencebacklinkDocumentReferences
- the list of references of documents to parse and for which links will be modified to point to the new document referencecontext
- the ubiquitous XWiki Context- Throws:
XWikiException
- in case of an error- Since:
- 2.2M2
-
rename
@Deprecated(since="12.5RC1") public void rename(DocumentReference newDocumentReference, List<DocumentReference> backlinkDocumentReferences, List<DocumentReference> childDocumentReferences, XWikiContext context) throws XWikiException
Deprecated.Same asrename(DocumentReference, List, XWikiContext)
but the list of documents having the current document as their parent is passed in parameter.- Parameters:
newDocumentReference
- the new document referencebacklinkDocumentReferences
- the list of references of documents to parse and for which links will be modified to point to the new document referencechildDocumentReferences
- the list of references of document whose parent field will be set to the new document referencecontext
- the ubiquitous XWiki Context- Throws:
XWikiException
- in case of an error- Since:
- 2.2M2
-
cloneRename
public XWikiDocument cloneRename(DocumentReference newDocumentReference, XWikiContext context) throws XWikiException
Clone a document and change its reference.- Parameters:
newDocumentReference
- the new reference of the cloned document.context
- the current context.- Returns:
- a clone of the current document with a new reference.
- Throws:
XWikiException
- in case of problem during the clone operation.- Since:
- 12.5RC1
-
copyDocument
public XWikiDocument copyDocument(DocumentReference newDocumentReference, XWikiContext context) throws XWikiException
- Throws:
XWikiException
- Since:
- 2.2M1
-
copyDocument
public XWikiDocument copyDocument(DocumentReference newDocumentReference, boolean cloneArchive, XWikiContext context) throws XWikiException
- Throws:
XWikiException
- Since:
- 14.3RC1
-
copyDocument
@Deprecated(since="2.2M1") public XWikiDocument copyDocument(String newDocumentName, XWikiContext context) throws XWikiException
Deprecated.usecopyDocument(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(since="2.2M1") public String getxWikiClassXML()
Deprecated.usegetXClassXML()
instead as 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(since="2.2M1") public void setxWikiClassXML(String xClassXML)
Deprecated.usesetXClassXML(String)
()} instead as 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 anXWiki.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 oldSheetClass
, 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
- since XWiki 6.3M1 it's not used anymore and "edit" is returned in case of error, with an error log
-
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 interfaceDocumentModelBridge
- Returns:
- the syntax of the document
- Since:
- 2.3M1
-
getSyntaxId
@Deprecated(since="2.3M1") public String getSyntaxId()
Deprecated.use {link #getSyntax()} insteadNote that this method cannot be removed for now since it's used by Hibernate for saving a XWikiDocument.
- Specified by:
getSyntaxId
in interfaceDocumentModelBridge
- 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(since="2.3M1") public void setSyntaxId(String syntaxId)
Deprecated.use {link #setSyntax(Syntax)} insteadNote 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 (e.g.xwiki/2.0
,xwiki/2.1
, 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.useisCreator(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(since="2.2M2") public BaseObject addObjectFromRequest(String className, XWikiContext context) throws XWikiException
Deprecated.- 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(since="2.2M2") public BaseObject addObjectFromRequest(String className, String prefix, XWikiContext context) throws XWikiException
Deprecated.- 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(since="2.2M2") public List<BaseObject> addObjectsFromRequest(String className, XWikiContext context) throws XWikiException
Deprecated.- 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(since="2.2M2") public List<BaseObject> addObjectsFromRequest(String className, String pref, XWikiContext context) throws XWikiException
Deprecated.- 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(since="2.2M2") public BaseObject addObjectFromRequest(String className, int num, XWikiContext context) throws XWikiException
Deprecated.- 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(since="2.2M2") public BaseObject addObjectFromRequest(String className, String prefix, int num, XWikiContext context) throws XWikiException
Deprecated.- 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(since="2.2M2") public BaseObject updateObjectFromRequest(String className, XWikiContext context) throws XWikiException
Deprecated.- 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(since="2.2M2") public BaseObject updateObjectFromRequest(String className, String prefix, XWikiContext context) throws XWikiException
Deprecated.- 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(since="2.2M2") public BaseObject updateObjectFromRequest(String className, String prefix, int num, XWikiContext context) throws XWikiException
Deprecated.- 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(since="2.2M2") public List<BaseObject> updateObjectsFromRequest(String className, XWikiContext context) throws XWikiException
Deprecated.- 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(since="2.2M2") public List<BaseObject> updateObjectsFromRequest(String className, String pref, XWikiContext context) throws XWikiException
Deprecated.- 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(since="2.2M1") public boolean removeObject(BaseObject object)
Deprecated.useremoveXObject(com.xpn.xwiki.objects.BaseObject)
insteadRemove 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:
reference
- 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(since="2.2M1") public boolean removeObjects(String className)
Deprecated.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)
-
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 classcontext
- the XWiki context- Returns:
- the newly created object
- Throws:
XWikiException
- error when creating the new object- Since:
- 2.2.3
-
newObject
@Deprecated(since="2.2M2") public BaseObject newObject(String className, XWikiContext context) throws XWikiException
Deprecated.usenewXObject(EntityReference, XWikiContext)
instead- 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(since="2.2M2") public BaseObject getObject(String className, boolean create, XWikiContext context)
Deprecated.
-
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.
-
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 thehidden
property.
-
isHidden
public Boolean isHidden()
Indicates whether the document is 'hidden' or not, meaning that it should not be returned in public search results.- Specified by:
isHidden
in interfaceDocumentModelBridge
- Returns:
true
if the document is hidden and does not appear among the results ofXWiki.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 (e.g.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 (e.g.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 interfaceDocumentModelBridge
- 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 provided XDOM into content of the provided syntax identifier.- Parameters:
content
- the XDOM content to rendertargetSyntax
- 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 tosetParentReference(EntityReference)
.You should use
getParentReference()
reference if you want the complete parent reference.- Returns:
- the relative parent reference
- Since:
- 2.2.3
-
merge
@Deprecated(since="11.8RC1") public MergeResult merge(XWikiDocument previousDocument, XWikiDocument newDocument, MergeConfiguration configuration, XWikiContext context)
Deprecated.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 documentnewDocument
- the next version of the documentconfiguration
- the configuration of the merge indicates 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
-
getLocalReferenceMaxLength
public int getLocalReferenceMaxLength()
Compute and return the maximum authorized length for the full name (i.e. the serialized reference of the document) based on the current store limitation.- Returns:
- the maximum authorized length for a document full name.
- Since:
- 11.4RC1
-
getAuthors
public DocumentAuthors getAuthors()
- Specified by:
getAuthors
in interfaceDocumentModelBridge
-
initialize
@Unstable public void initialize()
Make sure any document metadata which may depend on configuration is initialized to its default value.- Since:
- 14.8RC1, 14.4.4, 13.10.10
-
-