|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.xpn.xwiki.api.Api
com.xpn.xwiki.api.Document
public class Document
This class represents a document or page in the wiki.
This is a security and usability wrapper which wraps XWikiDocument
In scripting, an object representing the document in which the script resides will be bound to a variable called
doc.
Field Summary | |
---|---|
protected boolean |
cloned
Indicates if this API wraps a cloned XWikiDocument. |
protected Object |
currentObj
Convenience object used by object related methods. |
protected com.xpn.xwiki.doc.XWikiDocument |
doc
The XWikiDocument object wrapped by this API. |
Fields inherited from class com.xpn.xwiki.api.Api |
---|
context |
Constructor Summary | |
---|---|
Document(com.xpn.xwiki.doc.XWikiDocument doc,
com.xpn.xwiki.XWikiContext context)
Document constructor. |
Method Summary | |
---|---|
Attachment |
addAttachment(String fileName,
byte[] data)
|
Attachment |
addAttachment(String fileName,
InputStream iStream)
|
int |
addAttachments()
|
int |
addAttachments(String fieldName)
|
Object |
addObjectFromRequest()
|
Object |
addObjectFromRequest(String className)
|
Object |
addObjectFromRequest(String className,
String prefix)
|
List<Object> |
addObjectsFromRequest(String className)
|
List<Object> |
addObjectsFromRequest(String className,
String prefix)
|
boolean |
checkAccess(String right)
|
boolean |
convertSyntax(String targetSyntaxId)
Convert the current document content from its current syntax to the new syntax passed as parameter. |
int |
createNewObject(String classname)
|
void |
delete()
|
void |
deleteAsAuthor()
Delete the document if the content author of the script calling this method has
permission to do so. |
protected void |
deleteDocument()
Remove document from the wiki. |
void |
deleteWithProgrammingRights()
|
String |
display(String fieldname)
|
String |
display(String fieldname,
Object obj)
|
String |
display(String fieldname,
String mode)
|
String |
display(String fieldname,
String mode,
Object obj)
|
String |
display(String fieldname,
String type,
Object obj,
String wrappingSyntaxId)
|
String |
display(String fieldname,
String mode,
String prefix)
|
String |
display(String fieldname,
String mode,
String prefix,
Object obj)
|
String |
displayEdit(PropertyClass pclass,
String prefix,
Collection object)
|
String |
displayForm(String className)
|
String |
displayForm(String className,
String header,
String format)
|
String |
displayForm(String className,
String header,
String format,
boolean linebreak)
|
String |
displayHidden(PropertyClass pclass,
String prefix,
Collection object)
|
String |
displayPrettyName(String fieldname)
|
String |
displayPrettyName(String fieldname,
boolean showMandatory)
|
String |
displayPrettyName(String fieldname,
boolean showMandatory,
boolean before)
|
String |
displayPrettyName(String fieldname,
boolean showMandatory,
boolean before,
Object obj)
|
String |
displayPrettyName(String fieldname,
boolean showMandatory,
Object obj)
|
String |
displayPrettyName(String fieldname,
Object obj)
|
String |
displayRendered(PropertyClass pclass,
String prefix,
Collection object)
|
String |
displayTooltip(String fieldname)
|
String |
displayTooltip(String fieldname,
Object obj)
|
String |
displayView(PropertyClass pclass,
String prefix,
Collection object)
|
void |
dropPermissions()
Drop permissions for the remainder of the rendering cycle. |
boolean |
equals(Object arg0)
|
Object |
get(String classOrFieldName)
|
String |
getActiveClass()
|
String |
getArchive()
|
Attachment |
getAttachment(String filename)
|
List<com.xpn.xwiki.doc.AttachmentDiff> |
getAttachmentDiff(Document origdoc,
Document newdoc)
|
List<Attachment> |
getAttachmentList()
|
String |
getAttachmentRevisionURL(String filename,
String version)
Get an old revision of an attachment. |
String |
getAttachmentRevisionURL(String filename,
String version,
String queryString)
Get an old revision of an attachment. |
String |
getAttachmentURL(String filename)
Return the URL of download for the the given attachment name. |
String |
getAttachmentURL(String filename,
String action)
Get the URL of the given action for the the given attachment name. |
String |
getAttachmentURL(String filename,
String action,
String queryString)
Get the URL of an action on an attachment. |
String |
getAuthor()
Get fullName of the profile document of the author of the current version of the document. |
List<String> |
getBacklinks()
|
List<String> |
getChildren()
Get document children. |
List<String> |
getChildren(int nb,
int start)
Get document children. |
List<List<com.xpn.xwiki.objects.ObjectDiff>> |
getClassDiff(Document origdoc,
Document newdoc)
|
String |
getComment()
|
Vector<Object> |
getComments()
|
Vector<Object> |
getComments(boolean asc)
|
String |
getContent()
Get raw content of the document, i.e. |
String |
getContentAuthor()
Get fullName of the profile document of the author of the last content modification in the document. |
List<org.suigeneris.jrcs.diff.delta.Delta> |
getContentDiff(Document origdoc,
Document newdoc)
|
Date |
getContentUpdateDate()
Get the date when the last content modification has been done on the document. |
Date |
getCreationDate()
Get the date when the document has been created. |
String |
getCreator()
Get fullName of the profile document of the document creator. |
com.xpn.xwiki.stats.impl.DocumentStats |
getCurrentMonthPageStats(String action)
Get statistics about the number of request for the current page during the current month. |
List<com.xpn.xwiki.stats.impl.RefererStats> |
getCurrentMonthRefStats()
Get referer statistics for the current document during the current month. |
com.xpn.xwiki.stats.impl.DocumentStats |
getCurrentMonthSpaceStats(String action)
Get statistics about the number of request for the current space during the current month. |
Date |
getDate()
Get the date when the current document version has been created, i.e. |
String |
getDefaultEditMode()
|
String |
getDefaultEditURL()
|
String |
getDefaultLanguage()
return the language of the default document |
String |
getDefaultTemplate()
|
String |
getDisplayTitle()
Get document title. |
protected com.xpn.xwiki.doc.XWikiDocument |
getDoc()
Get a clone of the XWikiDocument wrapped by this API. |
com.xpn.xwiki.doc.XWikiDocument |
getDocument()
Get the XWikiDocument wrapped by this API. |
com.xpn.xwiki.doc.XWikiDocumentArchive |
getDocumentArchive()
Get the archive of this document's history. |
org.xwiki.model.reference.DocumentReference |
getDocumentReference()
|
Document |
getDocumentRevision(String revision)
Allow to easily access any revision of a document |
String |
getEditURL(String action,
String mode)
|
String |
getEditURL(String action,
String mode,
String language)
|
String |
getEscapedContent()
Get the document's content XML-escaped. |
String |
getExternalURL()
Get the external URL to do a given action on this document. |
String |
getExternalURL(String action)
Get the external URL to do a given action on this document. |
String |
getExternalURL(String action,
String queryString)
Get the URL to do a given action on this document. |
Object |
getFirstObject(String fieldname)
|
String |
getFormat()
|
String |
getFullName()
Get the fullName of the document. |
long |
getId()
return the ID of the document. |
List<String> |
getIncludedMacros()
|
List<String> |
getIncludedPages()
|
String |
getLanguage()
Get the language of the document. |
List<org.suigeneris.jrcs.diff.delta.Delta> |
getLastChanges()
|
List<String> |
getLinkedPages()
|
List<com.xpn.xwiki.doc.XWikiLink> |
getLinks()
|
boolean |
getLocked()
|
Date |
getLockingDate()
|
String |
getLockingUser()
|
List<com.xpn.xwiki.doc.MetaDataDiff> |
getMetaDataDiff(Document origdoc,
Document newdoc)
|
String |
getName()
return the name of a document. |
Object |
getObject(String classname)
|
Object |
getObject(String classname,
boolean create)
get the object of the given className. |
Object |
getObject(String classname,
int nb)
|
Object |
getObject(String classname,
String key,
String value)
|
Object |
getObject(String classname,
String key,
String value,
boolean failover)
|
List<List<com.xpn.xwiki.objects.ObjectDiff>> |
getObjectDiff(Document origdoc,
Document newdoc)
|
int |
getObjectNumbers(String classname)
|
Vector<Object> |
getObjects(String className)
|
Vector<Object> |
getObjects(String classname,
String key,
String value)
Select a subset of objects from a given class, filtered on a "key = value" criteria. |
String |
getParent()
Get the name of the parent of this document. |
String |
getParentURL()
|
String |
getPlainTitle()
|
String |
getPrefixedFullName()
Get the complete fullName of the document. |
Document |
getPreviousDocument()
Allow to easily access the previous revision of a document |
String |
getPreviousVersion()
Get a string representing the previous version of the document. |
org.suigeneris.jrcs.rcs.Version |
getRCSVersion()
Get a Version object representing the current version of the document. |
String |
getRealLanguage()
return the real language of the document |
String[] |
getRecentRevisions()
|
String[] |
getRecentRevisions(int nb)
|
String |
getRenderedContent()
|
String |
getRenderedContent(String text)
Deprecated. since 1.6M1 use getRenderedContent(String, String) |
String |
getRenderedContent(String text,
String syntaxId)
|
String |
getRenderedContent(String text,
String sourceSyntaxId,
String targetSyntaxId)
|
String |
getRenderedContent(org.xwiki.rendering.syntax.Syntax targetSyntax)
|
List<org.suigeneris.jrcs.diff.delta.Delta> |
getRenderedContentDiff(Document origdoc,
Document newdoc)
|
String |
getRenderedTitle(String syntaxId)
|
RevisionInfo |
getRevisionInfo(String version)
Get information about a document version : author, date, etc. |
org.suigeneris.jrcs.rcs.Version[] |
getRevisions()
|
List<String> |
getRevisions(com.xpn.xwiki.criteria.impl.RevisionCriteria criteria)
Get document versions matching criterias like author, minimum creation date, etc. |
List<DocumentSection> |
getSections()
Get the top sections contained in the document. |
String |
getSpace()
return the name of the space of the document for example if the fullName of a document is "MySpace.Mydoc", the name is MySpace. |
org.xwiki.rendering.syntax.Syntax |
getSyntax()
|
String |
getSyntaxId()
Deprecated. since 2.3M1 use getSyntax() instead |
List<String> |
getTagList()
|
String |
getTags()
|
List<String> |
getTagsPossibleValues()
|
String |
getTemplate()
|
String |
getTextArea()
|
String |
getTitle()
Get the value of the title field of the document. |
Map<String,Map<String,Object>> |
getTOC(int init,
int max,
boolean numbered)
Returns data needed for a generation of Table of Content for this document. |
String |
getTranslatedContent()
|
String |
getTranslatedContent(String language)
|
Document |
getTranslatedDocument()
|
Document |
getTranslatedDocument(String language)
|
List<String> |
getTranslationList()
|
String |
getURL()
Get the URL of this document. |
String |
getURL(String action)
Get the URL to do a given action on this document. |
String |
getURL(String action,
String queryString)
Get the URL to do a given action on this document. |
String |
getValidationScript()
Retrieves the validation script associated with this document, a Velocity script that is executed when validating the document data. |
Object |
getValue(String fieldName)
|
Object |
getValue(String fieldName,
Object object)
|
String |
getVersion()
Get a string representing the current version of the document. |
String |
getVersionHashCode()
|
String |
getWeb()
Deprecated. use getSpace() instead of this function. |
String |
getWiki()
Get the name wiki where the document is stored. |
String |
getXMLContent()
|
List<org.suigeneris.jrcs.diff.delta.Delta> |
getXMLDiff(Document origdoc,
Document newdoc)
|
protected Vector<Object> |
getXObjects(List<com.xpn.xwiki.objects.BaseObject> objects)
|
Class |
getxWikiClass()
|
Class[] |
getxWikiClasses()
|
Map<String,Vector<Object>> |
getxWikiObjects()
|
boolean |
hasAccessLevel(String level)
|
boolean |
hasAccessLevel(String level,
String user)
Check if the current user has an access level on a given document. |
void |
insertText(String text,
String marker)
|
boolean |
isAdvancedContent()
|
boolean |
isCreator(String username)
|
boolean |
isCurrentLocalUserPage()
|
boolean |
isCurrentUserCreator()
|
boolean |
isCurrentUserPage()
|
boolean |
isFromCache()
|
boolean |
isMinorEdit()
|
boolean |
isMostRecent()
|
boolean |
isNew()
|
boolean |
isProgrammaticContent()
|
Object |
newObject(String classname)
|
boolean |
removeObject(Object object)
Remove an XObject from the document. |
boolean |
removeObjects(String className)
Remove all the objects of a given type (XClass) from the document. |
void |
rename(org.xwiki.model.reference.DocumentReference newReference)
Rename the current document and all the backlinks leading to it. |
void |
rename(org.xwiki.model.reference.DocumentReference newReference,
List<org.xwiki.model.reference.DocumentReference> backlinkDocumentNames,
List<org.xwiki.model.reference.DocumentReference> childDocumentNames)
Same as rename(String, List) but the list of documents having the current document as their parent is
passed in parameter. |
void |
rename(String newDocumentName)
Rename the current document and all the backlinks leading to it. |
void |
rename(String newDocumentName,
List<String> backlinkDocumentNames)
Rename the current document and all the links pointing to it in the list of passed backlink documents. |
void |
rename(String newDocumentName,
List<String> backlinkDocumentNames,
List<String> childDocumentNames)
Same as rename(String, List) but the list of documents having the current document as their parent is
passed in parameter. |
void |
renameDocument(String newDocumentName)
Deprecated. use rename(String) instead |
void |
renameDocument(String newDocumentName,
List<String> backlinkDocumentNames)
Deprecated. use rename(String, java.util.List) instead |
void |
save()
|
void |
save(String comment)
|
void |
save(String comment,
boolean minorEdit)
|
void |
saveAsAuthor()
Save the document if the content author of the script calling this method has
permission to do so. |
void |
saveAsAuthor(String comment)
Save the document if the content author of the script calling this method has
permission to do so. |
void |
saveAsAuthor(String comment,
boolean minorEdit)
Save the document if the content author of the script calling this method has
permission to do so. |
protected void |
saveDocument(String comment,
boolean minorEdit)
|
void |
saveWithProgrammingRights()
|
void |
saveWithProgrammingRights(String comment)
|
void |
saveWithProgrammingRights(String comment,
boolean minorEdit)
|
void |
set(String fieldname,
Object value)
|
void |
set(String fieldname,
Object value,
Object obj)
|
void |
setComment(String comment)
|
void |
setContent(String content)
|
void |
setCustomClass(String customClass)
|
void |
setDefaultTemplate(String dtemplate)
|
void |
setMinorEdit(boolean isMinor)
|
void |
setParent(String parent)
|
void |
setSyntax(org.xwiki.rendering.syntax.Syntax syntax)
|
void |
setSyntaxId(String syntaxId)
|
void |
setTitle(String title)
|
void |
setValidationScript(String validationScript)
Sets a new validation script for this document, a Velocity script that is executed when validating the document data. |
String |
toString()
|
String |
toXML()
|
org.dom4j.Document |
toXMLDocument()
|
Object |
updateObjectFromRequest(String className)
|
Object |
updateObjectFromRequest(String className,
String prefix)
|
List<Object> |
updateObjectsFromRequest(String className)
|
List<Object> |
updateObjectsFromRequest(String className,
String prefix)
|
void |
use(Object object)
|
void |
use(String className)
|
void |
use(String className,
int nb)
|
boolean |
validate()
|
boolean |
validate(String[] classNames)
|
Methods inherited from class com.xpn.xwiki.api.Api |
---|
convert, convert, getXWikiContext, hasAdminRights, hasProgrammingRights, hasWikiAdminRights |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected com.xpn.xwiki.doc.XWikiDocument doc
protected boolean cloned
protected Object currentObj
Constructor Detail |
---|
public Document(com.xpn.xwiki.doc.XWikiDocument doc, com.xpn.xwiki.XWikiContext context)
doc
- The XWikiDocument object to wrap.context
- The current request context.Method Detail |
---|
public com.xpn.xwiki.doc.XWikiDocument getDocument()
protected com.xpn.xwiki.doc.XWikiDocument getDoc()
public long getId()
public org.xwiki.model.reference.DocumentReference getDocumentReference()
public String getName()
public String getSpace()
public String getWiki()
@Deprecated public String getWeb()
getSpace()
instead of this function.
public String getFullName()
public String getPrefixedFullName()
public org.suigeneris.jrcs.rcs.Version getRCSVersion()
public String getVersion()
public String getPreviousVersion()
public String getTitle()
public String getDisplayTitle()
public String getPlainTitle()
public String getRenderedTitle(String syntaxId) throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
XWikiDocument.getRenderedTitle(Syntax, XWikiContext)
public String getFormat()
public String getAuthor()
public String getContentAuthor()
public Date getDate()
public Date getContentUpdateDate()
public Date getCreationDate()
public String getParent()
public String getCreator()
public String getContent()
public org.xwiki.rendering.syntax.Syntax getSyntax()
@Deprecated public String getSyntaxId()
getSyntax()
instead
public String getLanguage()
public String getTemplate()
public String getRealLanguage() throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public String getDefaultLanguage()
public String getDefaultTemplate()
public String getComment()
public boolean isMinorEdit()
public List<String> getTranslationList() throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public String getTranslatedContent() throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public String getTranslatedContent(String language) throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public Document getTranslatedDocument(String language) throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public Document getTranslatedDocument() throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public String getRenderedContent() throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
@Deprecated public String getRenderedContent(String text) throws com.xpn.xwiki.XWikiException
getRenderedContent(String, String)
text
- the text to render
com.xpn.xwiki.XWikiException
public String getRenderedContent(String text, String syntaxId) throws com.xpn.xwiki.XWikiException
text
- the text to rendersyntaxId
- the id of the Syntax used by the passed text (for example: "xwiki/1.0")
com.xpn.xwiki.XWikiException
public String getRenderedContent(String text, String sourceSyntaxId, String targetSyntaxId) throws com.xpn.xwiki.XWikiException
text
- the text to rendersourceSyntaxId
- the id of the Syntax used by the passed text (for example: "xwiki/1.0")targetSyntaxId
- the id of the syntax in which to render the document content
com.xpn.xwiki.XWikiException
public String getRenderedContent(org.xwiki.rendering.syntax.Syntax targetSyntax) throws com.xpn.xwiki.XWikiException
targetSyntax
- the syntax in which to render the document content
com.xpn.xwiki.XWikiException
- error when rendering contentpublic String getEscapedContent() throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public String getArchive() throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public com.xpn.xwiki.doc.XWikiDocumentArchive getDocumentArchive() throws com.xpn.xwiki.XWikiException
XWikiDocumentArchive
.
com.xpn.xwiki.XWikiException
public boolean isNew()
public String getAttachmentURL(String filename)
filename
- the name of the attachment
public String getAttachmentURL(String filename, String action)
filename
- the name of the attachment.action
- what to do to the file for example "delattachment", "download" or "downloadrev".
public String getAttachmentURL(String filename, String action, String queryString)
filename
- the name of the attachment.action
- what to do to the file for example "delattachment", "download" or "downloadrev"queryString
- parameters added to the URL, the "rev" parameter is used to specify a revision if using
the "downloadrev" action. The query string must not begin with an ? character.
public String getAttachmentRevisionURL(String filename, String version)
filename
- the name of the attachment.version
- a revision number such as "1.1" or "1.2".
public String getAttachmentRevisionURL(String filename, String version, String queryString)
filename
- the name of the attachment.version
- a revision number such as "1.1" or "1.2".queryString
- additional query parameters to pass in the request.
public String getURL()
for an absolute URL which can used outside of the site.
public String getURL(String action)
action
- what to do to the document for example "view", "edit" or "inline".
for an absolute URL which can used outside of the site.
public String getURL(String action, String queryString)
action
- what to do to the document for example "view", "edit" or "inline".queryString
- parameters to pass in the request eg: "paramA=value1¶mB=value2"
for an absolute URL which can used outside of the site.
public String getExternalURL()
for a reletive URL which can only be used inside of the site.
public String getExternalURL(String action)
action
- what to do to the document for example "view", "edit" or "inline".
for a relative URL which can only be used inside of the site.
public String getExternalURL(String action, String queryString)
action
- what to do to the document for example "view", "edit" or "inline".queryString
- parameters to pass in the request eg: "paramA=value1¶mB=value2"
for a relative URL which can only be used inside of the site.
public String getParentURL() throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public Class getxWikiClass()
public Class[] getxWikiClasses()
public int createNewObject(String classname) throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public Object newObject(String classname) throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public boolean isFromCache()
public int getObjectNumbers(String classname)
public Map<String,Vector<Object>> getxWikiObjects()
protected Vector<Object> getXObjects(List<com.xpn.xwiki.objects.BaseObject> objects)
public Vector<Object> getObjects(String className)
public Object getFirstObject(String fieldname)
public Object getObject(String classname, String key, String value, boolean failover)
public Vector<Object> getObjects(String classname, String key, String value)
classname
- The type of objects to return.key
- The name of the property used for filtering.value
- The required value.
objects
matching the criteria. If no objects are found, or if the key is an
empty String, then an empty vector is returned.public Object getObject(String classname, String key, String value)
public Object getObject(String classname)
public Object getObject(String classname, boolean create)
public Object getObject(String classname, int nb)
public String getXMLContent() throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public String toXML() throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public org.dom4j.Document toXMLDocument() throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public org.suigeneris.jrcs.rcs.Version[] getRevisions() throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public String[] getRecentRevisions() throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public String[] getRecentRevisions(int nb) throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public List<String> getRevisions(com.xpn.xwiki.criteria.impl.RevisionCriteria criteria) throws com.xpn.xwiki.XWikiException
criteria
- criteria used to match versions
com.xpn.xwiki.XWikiException
public RevisionInfo getRevisionInfo(String version) throws com.xpn.xwiki.XWikiException
version
- the version you want to get information about
com.xpn.xwiki.XWikiException
public List<Attachment> getAttachmentList()
public Vector<Object> getComments()
public Vector<Object> getComments(boolean asc)
public void use(Object object)
public void use(String className)
public void use(String className, int nb)
public String getActiveClass()
public String displayPrettyName(String fieldname)
public String displayPrettyName(String fieldname, Object obj)
public String displayPrettyName(String fieldname, boolean showMandatory)
public String displayPrettyName(String fieldname, boolean showMandatory, Object obj)
public String displayPrettyName(String fieldname, boolean showMandatory, boolean before)
public String displayPrettyName(String fieldname, boolean showMandatory, boolean before, Object obj)
public String displayTooltip(String fieldname)
public String displayTooltip(String fieldname, Object obj)
public String display(String fieldname)
public String display(String fieldname, String mode)
public String display(String fieldname, String mode, String prefix)
public String display(String fieldname, Object obj)
public String display(String fieldname, String type, Object obj, String wrappingSyntaxId)
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.
public String display(String fieldname, String mode, Object obj)
public String display(String fieldname, String mode, String prefix, Object obj)
public String displayForm(String className, String header, String format)
public String displayForm(String className, String header, String format, boolean linebreak)
public String displayForm(String className)
public String displayRendered(PropertyClass pclass, String prefix, Collection object) throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public String displayView(PropertyClass pclass, String prefix, Collection object)
public String displayEdit(PropertyClass pclass, String prefix, Collection object)
public String displayHidden(PropertyClass pclass, String prefix, Collection object)
public List<String> getIncludedPages()
public List<String> getIncludedMacros()
public List<String> getLinkedPages()
public Attachment getAttachment(String filename)
public List<org.suigeneris.jrcs.diff.delta.Delta> getContentDiff(Document origdoc, Document newdoc) throws com.xpn.xwiki.XWikiException, org.suigeneris.jrcs.diff.DifferentiationFailedException
com.xpn.xwiki.XWikiException
org.suigeneris.jrcs.diff.DifferentiationFailedException
public List<org.suigeneris.jrcs.diff.delta.Delta> getXMLDiff(Document origdoc, Document newdoc) throws com.xpn.xwiki.XWikiException, org.suigeneris.jrcs.diff.DifferentiationFailedException
com.xpn.xwiki.XWikiException
org.suigeneris.jrcs.diff.DifferentiationFailedException
public List<org.suigeneris.jrcs.diff.delta.Delta> getRenderedContentDiff(Document origdoc, Document newdoc) throws com.xpn.xwiki.XWikiException, org.suigeneris.jrcs.diff.DifferentiationFailedException
com.xpn.xwiki.XWikiException
org.suigeneris.jrcs.diff.DifferentiationFailedException
public List<com.xpn.xwiki.doc.MetaDataDiff> getMetaDataDiff(Document origdoc, Document newdoc) throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public List<List<com.xpn.xwiki.objects.ObjectDiff>> getObjectDiff(Document origdoc, Document newdoc)
public List<List<com.xpn.xwiki.objects.ObjectDiff>> getClassDiff(Document origdoc, Document newdoc)
public List<com.xpn.xwiki.doc.AttachmentDiff> getAttachmentDiff(Document origdoc, Document newdoc)
public List<org.suigeneris.jrcs.diff.delta.Delta> getLastChanges() throws com.xpn.xwiki.XWikiException, org.suigeneris.jrcs.diff.DifferentiationFailedException
com.xpn.xwiki.XWikiException
org.suigeneris.jrcs.diff.DifferentiationFailedException
public com.xpn.xwiki.stats.impl.DocumentStats getCurrentMonthPageStats(String action)
action
- the type of request for which to retrieve statistics: view, edit...
public com.xpn.xwiki.stats.impl.DocumentStats getCurrentMonthSpaceStats(String action)
action
- the type of request for which to retrieve statistics: view, edit...
public List<com.xpn.xwiki.stats.impl.RefererStats> getCurrentMonthRefStats()
public boolean checkAccess(String right)
public boolean hasAccessLevel(String level)
public boolean hasAccessLevel(String level, String user)
Api
hasAccessLevel
in class Api
level
- The name of the right to verify (eg "programming", "admin", "register", etc).user
- The document for which to verify the right.
public boolean getLocked()
public String getLockingUser()
public Date getLockingDate()
public Object get(String classOrFieldName)
public Object getValue(String fieldName)
public Object getValue(String fieldName, Object object)
public String getTextArea()
public Map<String,Map<String,Object>> getTOC(int init, int max, boolean numbered)
init
- an intial level where the TOC generation should start atmax
- maximum level TOC is generated fornumbered
- if should generate numbering for headings
public String getTags()
public List<String> getTagList()
public List<String> getTagsPossibleValues()
public void insertText(String text, String marker) throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public boolean equals(Object arg0)
equals
in class Object
public List<String> getBacklinks() throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public List<com.xpn.xwiki.doc.XWikiLink> getLinks() throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public List<DocumentSection> getSections() throws com.xpn.xwiki.XWikiException
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.
com.xpn.xwiki.XWikiException
public List<String> getChildren() throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public List<String> getChildren(int nb, int start) throws com.xpn.xwiki.XWikiException
nb
- The number of results to return.start
- The number of results to skip before we begin returning results.
com.xpn.xwiki.XWikiException
public String getDefaultEditMode() throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
- if an error happens when computing the edit modepublic String getDefaultEditURL() throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public String getEditURL(String action, String mode) throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public String getEditURL(String action, String mode, String language)
public boolean isCurrentUserCreator()
public boolean isCurrentUserPage()
public boolean isCurrentLocalUserPage()
public boolean isCreator(String username)
public void set(String fieldname, Object value)
public void set(String fieldname, Object value, Object obj)
public void setTitle(String title)
public void setCustomClass(String customClass)
public void setParent(String parent)
public void setContent(String content)
public void setSyntax(org.xwiki.rendering.syntax.Syntax syntax)
syntax
- the Syntax representing the syntax used for the current document's content.public void setSyntaxId(String syntaxId)
syntaxId
- the Syntax id representing the syntax used for the current document. For example "xwiki/1.0"
represents the first version XWiki syntax while "xwiki/2.0" represents version 2.0 of the XWiki
Syntax.public void setDefaultTemplate(String dtemplate)
public void setComment(String comment)
public void setMinorEdit(boolean isMinor)
public void save() throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public void save(String comment) throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public void save(String comment, boolean minorEdit) throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public void saveWithProgrammingRights() throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public void saveWithProgrammingRights(String comment) throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public void saveWithProgrammingRights(String comment, boolean minorEdit) throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public void saveAsAuthor() throws com.xpn.xwiki.XWikiException
content author
of the script calling this method has
permission to do so. The author of this document is also set to the said content author.
com.xpn.xwiki.XWikiException
- if script author is not allowed to save the document or if save operation fails.public void saveAsAuthor(String comment) throws com.xpn.xwiki.XWikiException
content author
of the script calling this method has
permission to do so. The author of this document is also set to the said content author.
comment
- The comment to display in document history (what did you change in the document)
com.xpn.xwiki.XWikiException
- if script author is not allowed to save the document or if save operation fails.public void saveAsAuthor(String comment, boolean minorEdit) throws com.xpn.xwiki.XWikiException
content author
of the script calling this method has
permission to do so. The author of this document is also set to the said content author.
comment
- The comment to display in document history (what did you change in the document)minorEdit
- Set true to advance the document version number by 0.1 or false to advance version to the next
integer + 0.1 eg: 25.1
com.xpn.xwiki.XWikiException
- if script author is not allowed to save the document or if save operation fails.protected void saveDocument(String comment, boolean minorEdit) throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public Object addObjectFromRequest() throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public Object addObjectFromRequest(String className) throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public List<Object> addObjectsFromRequest(String className) throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public Object addObjectFromRequest(String className, String prefix) throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public List<Object> addObjectsFromRequest(String className, String prefix) throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public Object updateObjectFromRequest(String className) throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public List<Object> updateObjectsFromRequest(String className) throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public Object updateObjectFromRequest(String className, String prefix) throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public List<Object> updateObjectsFromRequest(String className, String prefix) throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public boolean isAdvancedContent()
public boolean isProgrammaticContent()
public boolean removeObject(Object object)
object
- the object to remove
true
if the object was successfully removed, false
if the object was not found in the
current document.public boolean removeObjects(String className)
className
- The class name of the objects to be removed.
true
if the objects were successfully removed, false
if no object from the target class
was in the current document.protected void deleteDocument() throws com.xpn.xwiki.XWikiException
cloned
.
com.xpn.xwiki.XWikiException
public void delete() throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public void deleteAsAuthor() throws com.xpn.xwiki.XWikiException
content author
of the script calling this method has
permission to do so. The deleter is also set to the said content author.
com.xpn.xwiki.XWikiException
- if script author is not allowed to delete the document or if save operation fails.public void deleteWithProgrammingRights() throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public String getVersionHashCode()
public int addAttachments() throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public int addAttachments(String fieldName) throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public Attachment addAttachment(String fileName, InputStream iStream)
public Attachment addAttachment(String fileName, byte[] data)
public boolean validate() throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public boolean validate(String[] classNames) throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public String getValidationScript()
String
representation of the validation script, or an empty string if there is no such
script.public void setValidationScript(String validationScript)
validationScript
- The new validation script, which can be an empty string or null
if the
script should be removed.@Deprecated public void renameDocument(String newDocumentName) throws com.xpn.xwiki.XWikiException
rename(String)
instead
com.xpn.xwiki.XWikiException
public void rename(String newDocumentName) throws com.xpn.xwiki.XWikiException
rename(String, java.util.List, java.util.List)
for more details.
newDocumentName
- the new document name. If the space is not specified then defaults to the current space.
com.xpn.xwiki.XWikiException
- in case of an errorpublic void rename(org.xwiki.model.reference.DocumentReference newReference) throws com.xpn.xwiki.XWikiException
rename(String, java.util.List, java.util.List)
for more details.
newReference
- the reference to the new document
com.xpn.xwiki.XWikiException
- in case of an error@Deprecated public void renameDocument(String newDocumentName, List<String> backlinkDocumentNames) throws com.xpn.xwiki.XWikiException
rename(String, java.util.List)
instead
com.xpn.xwiki.XWikiException
public void rename(String newDocumentName, List<String> backlinkDocumentNames) throws com.xpn.xwiki.XWikiException
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".
newDocumentName
- the new document name. If the space is not specified then defaults to the current space.backlinkDocumentNames
- the list of documents to parse and for which links will be modified to point to the
new renamed document.
com.xpn.xwiki.XWikiException
- in case of an errorpublic void rename(String newDocumentName, List<String> backlinkDocumentNames, List<String> childDocumentNames) throws com.xpn.xwiki.XWikiException
rename(String, List)
but the list of documents having the current document as their parent is
passed in parameter.
newDocumentName
- the new document name. If the space is not specified then defaults to the current space.backlinkDocumentNames
- the list of documents to parse and for which links will be modified to point to the
new renamed document.childDocumentNames
- the list of documents whose parent field will be set to the new document name.
com.xpn.xwiki.XWikiException
- in case of an errorpublic void rename(org.xwiki.model.reference.DocumentReference newReference, List<org.xwiki.model.reference.DocumentReference> backlinkDocumentNames, List<org.xwiki.model.reference.DocumentReference> childDocumentNames) throws com.xpn.xwiki.XWikiException
rename(String, List)
but the list of documents having the current document as their parent is
passed in parameter.
newReference
- the reference to the new documentbacklinkDocumentNames
- the list of reference to documents to parse and for which links will be modified to
point to the new renamed documentchildDocumentNames
- the list of references to documents whose parent field will be set to the new document
reference
com.xpn.xwiki.XWikiException
- in case of an errorpublic Document getDocumentRevision(String revision) throws com.xpn.xwiki.XWikiException
revision
- version to access
com.xpn.xwiki.XWikiException
public Document getPreviousDocument() throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException
public boolean isMostRecent()
public String toString()
toString
in class Object
Object.toString()
public boolean convertSyntax(String targetSyntaxId) throws com.xpn.xwiki.XWikiException
targetSyntaxId
- the syntax to convert to (eg "xwiki/2.0", "xhtml/1.0", etc)
com.xpn.xwiki.XWikiException
- if an exception occurred during the conversion processpublic void dropPermissions()
Api.hasProgrammingRights()
will always return false.XWiki.getDocumentAsAuthor(org.xwiki.model.reference.DocumentReference)
,
XWiki.getDocumentAsAuthor(String)
, saveAsAuthor()
,
saveAsAuthor(String)
,
saveAsAuthor(String, boolean)
, and
deleteAsAuthor()
will perform all of their actions as if the document's
content author was the guest user (XWiki.XWikiGuest).
This sandboxing will expire at the end of the rendering cycle and can be suspended by
beginning a new rendering cycle. A rendering cycle can be begin by calling
getRenderedContent(String)
, display(String)
(or variations thereof)
or by invoking the include macro or using XWiki.includeTopic(String)
NOTE: Even if you include the same document, permissions will be regained. What this does is sandbox the remainder of the code on the page because although it can temporarily suspend the permissions drop, it cannot get itself to be executed with permissions because if it calls itself, it will hit the drop function first.
If you are interested in a more secure sandboxing method where code is guaranteed not
to have permissions for the remainder of the request, you should consider
Context.dropPermissions()
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |