本文整理了Java中com.xpn.xwiki.api.Document.getVersion()
方法的一些代码示例,展示了Document.getVersion()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Document.getVersion()
方法的具体详情如下:
包路径:com.xpn.xwiki.api.Document
类名称:Document
方法名:getVersion
[英]Get a string representing the current version of the document.
[中]获取表示文档当前版本的字符串。
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
protected String getDefaultDescription(Document doc, Map<String, Object> params, XWikiContext context)
{
XWiki xwiki = context.getWiki();
String author = xwiki.getUserName(doc.getAuthor(), null, false, context);
// the description format should be taken from a resource bundle, and thus localized
String descFormat = "Version %1$s edited by %2$s on %3$s";
return String.format(descFormat, new Object[] {doc.getVersion(), author, doc.getDate()});
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-rest-server
private static Link getObjectLink(ObjectFactory objectFactory, URI baseUri, Document doc, BaseObject xwikiObject,
boolean useVersion, String relation)
{
String objectUri;
if (useVersion) {
objectUri =
UriBuilder.fromUri(baseUri).path(ObjectAtPageVersionResource.class).build(doc.getWiki(),
doc.getSpace(), doc.getName(), doc.getVersion(), xwikiObject.getClassName(),
xwikiObject.getNumber()).toString();
} else {
objectUri =
UriBuilder.fromUri(baseUri).path(ObjectResource.class).build(doc.getWiki(), doc.getSpace(),
doc.getName(), xwikiObject.getClassName(), xwikiObject.getNumber()).toString();
}
Link objectLink = objectFactory.createLink();
objectLink.setHref(objectUri);
objectLink.setRel(relation);
return objectLink;
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-rest-server
@GET
public Object getObject(@PathParam("wikiName") String wikiName, @PathParam("spaceName") String spaceName,
@PathParam("pageName") String pageName, @PathParam("version") String version,
@PathParam("className") String className, @PathParam("objectNumber") Integer objectNumber)
throws XWikiException
{
DocumentInfo documentInfo = getDocumentInfo(wikiName, spaceName, pageName, null, version, true, false);
Document doc = documentInfo.getDocument();
XWikiDocument xwikiDocument =
Utils.getXWiki(componentManager).getDocument(doc.getPrefixedFullName(),
Utils.getXWikiContext(componentManager));
xwikiDocument =
Utils.getXWiki(componentManager).getDocument(xwikiDocument, doc.getVersion(),
Utils.getXWikiContext(componentManager));
com.xpn.xwiki.objects.BaseObject baseObject = xwikiDocument.getObject(className, objectNumber);
if (baseObject == null) {
throw new WebApplicationException(Status.NOT_FOUND);
}
return DomainObjectFactory.createObject(objectFactory, uriInfo.getBaseUri(), Utils
.getXWikiContext(componentManager), doc, baseObject, true);
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-rest-server
public static ObjectSummary createObjectSummary(ObjectFactory objectFactory, URI baseUri,
XWikiContext xwikiContext, Document doc, BaseObject xwikiObject, boolean useVersion) throws XWikiException
{
ObjectSummary objectSummary = objectFactory.createObjectSummary();
fillObjectSummary(objectSummary, objectFactory, baseUri, doc, xwikiObject);
Link objectLink = getObjectLink(objectFactory, baseUri, doc, xwikiObject, useVersion, Relations.OBJECT);
objectSummary.getLinks().add(objectLink);
String propertiesUri;
if (useVersion) {
propertiesUri =
UriBuilder.fromUri(baseUri).path(ObjectPropertiesAtPageVersionResource.class).build(doc.getWiki(),
doc.getSpace(), doc.getName(), doc.getVersion(), xwikiObject.getClassName(),
xwikiObject.getNumber()).toString();
} else {
propertiesUri =
UriBuilder.fromUri(baseUri).path(ObjectPropertiesResource.class).build(doc.getWiki(), doc.getSpace(),
doc.getName(), xwikiObject.getClassName(), xwikiObject.getNumber()).toString();
}
Link propertyLink = objectFactory.createLink();
propertyLink.setHref(propertiesUri);
propertyLink.setRel(Relations.PROPERTIES);
objectSummary.getLinks().add(propertyLink);
return objectSummary;
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
public List<Delta> getXMLDiff(Document origdoc, Document newdoc) throws XWikiException,
DifferentiationFailedException
{
try {
if ((origdoc == null) && (newdoc == null)) {
return Collections.emptyList();
}
if (origdoc == null) {
return this.doc.getXMLDiff(new XWikiDocument(newdoc.getDocumentReference()), newdoc.doc,
getXWikiContext());
}
if (newdoc == null) {
return this.doc.getXMLDiff(origdoc.doc, new XWikiDocument(origdoc.getDocumentReference()),
getXWikiContext());
}
return this.doc.getXMLDiff(origdoc.doc, newdoc.doc, getXWikiContext());
} catch (Exception e) {
java.lang.Object[] args = {origdoc.getFullName(), origdoc.getVersion(), newdoc.getVersion()};
List list = new ArrayList();
XWikiException xe =
new XWikiException(XWikiException.MODULE_XWIKI_DIFF, XWikiException.ERROR_XWIKI_DIFF_XML_ERROR,
"Error while making xml diff of {0} between version {1} and version {2}", e, args);
String errormsg = Util.getHTMLExceptionMessage(xe, getXWikiContext());
list.add(errormsg);
return list;
}
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-rest-server
Utils.getXWikiContext(componentManager));
xwikiDocument =
Utils.getXWiki(componentManager).getDocument(xwikiDocument, doc.getVersion(),
Utils.getXWikiContext(componentManager));
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
public List<MetaDataDiff> getMetaDataDiff(Document origdoc, Document newdoc) throws XWikiException
{
try {
if ((origdoc == null) && (newdoc == null)) {
return Collections.emptyList();
}
if (origdoc == null) {
return this.doc.getMetaDataDiff(new XWikiDocument(newdoc.getDocumentReference()), newdoc.doc,
getXWikiContext());
}
if (newdoc == null) {
return this.doc.getMetaDataDiff(origdoc.doc, new XWikiDocument(origdoc.getDocumentReference()),
getXWikiContext());
}
return this.doc.getMetaDataDiff(origdoc.doc, newdoc.doc, getXWikiContext());
} catch (Exception e) {
java.lang.Object[] args = {origdoc.getFullName(), origdoc.getVersion(), newdoc.getVersion()};
List list = new ArrayList();
XWikiException xe =
new XWikiException(XWikiException.MODULE_XWIKI_DIFF, XWikiException.ERROR_XWIKI_DIFF_METADATA_ERROR,
"Error while making meta data diff of {0} between version {1} and version {2}", e, args);
String errormsg = Util.getHTMLExceptionMessage(xe, getXWikiContext());
list.add(errormsg);
return list;
}
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
public List<List<ObjectDiff>> getClassDiff(Document origdoc, Document newdoc) throws XWikiException
{
try {
if ((origdoc == null) && (newdoc == null)) {
return Collections.emptyList();
}
if (origdoc == null) {
return this.doc.getClassDiff(new XWikiDocument(newdoc.getDocumentReference()), newdoc.doc,
getXWikiContext());
}
if (newdoc == null) {
return this.doc.getClassDiff(origdoc.doc, new XWikiDocument(origdoc.getDocumentReference()),
getXWikiContext());
}
return this.doc.getClassDiff(origdoc.doc, newdoc.doc, getXWikiContext());
} catch (Exception e) {
java.lang.Object[] args = {origdoc.getFullName(), origdoc.getVersion(), newdoc.getVersion()};
List list = new ArrayList();
XWikiException xe =
new XWikiException(XWikiException.MODULE_XWIKI_DIFF, XWikiException.ERROR_XWIKI_DIFF_CLASS_ERROR,
"Error while making class diff of {0} between version {1} and version {2}", e, args);
String errormsg = Util.getHTMLExceptionMessage(xe, getXWikiContext());
list.add(errormsg);
return list;
}
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
public List<List<ObjectDiff>> getObjectDiff(Document origdoc, Document newdoc) throws XWikiException
{
try {
if ((origdoc == null) && (newdoc == null)) {
return Collections.emptyList();
}
if (origdoc == null) {
return this.doc.getObjectDiff(new XWikiDocument(newdoc.getDocumentReference()), newdoc.doc,
getXWikiContext());
}
if (newdoc == null) {
return this.doc.getObjectDiff(origdoc.doc, new XWikiDocument(origdoc.getDocumentReference()),
getXWikiContext());
}
return this.doc.getObjectDiff(origdoc.doc, newdoc.doc, getXWikiContext());
} catch (Exception e) {
java.lang.Object[] args = {origdoc.getFullName(), origdoc.getVersion(), newdoc.getVersion()};
List list = new ArrayList();
XWikiException xe =
new XWikiException(XWikiException.MODULE_XWIKI_DIFF, XWikiException.ERROR_XWIKI_DIFF_OBJECT_ERROR,
"Error while making meta object diff of {0} between version {1} and version {2}", e, args);
String errormsg = Util.getHTMLExceptionMessage(xe, getXWikiContext());
list.add(errormsg);
return list;
}
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
public List<Delta> getRenderedContentDiff(Document origdoc, Document newdoc) throws XWikiException,
DifferentiationFailedException
{
try {
if ((origdoc == null) && (newdoc == null)) {
return Collections.emptyList();
}
if (origdoc == null) {
return this.doc.getRenderedContentDiff(new XWikiDocument(newdoc.getDocumentReference()),
newdoc.doc, getXWikiContext());
}
if (newdoc == null) {
return this.doc.getRenderedContentDiff(origdoc.doc, new XWikiDocument(origdoc.getDocumentReference()),
getXWikiContext());
}
return this.doc.getRenderedContentDiff(origdoc.doc, newdoc.doc, getXWikiContext());
} catch (Exception e) {
java.lang.Object[] args = {origdoc.getFullName(), origdoc.getVersion(), newdoc.getVersion()};
List list = new ArrayList();
XWikiException xe =
new XWikiException(XWikiException.MODULE_XWIKI_DIFF, XWikiException.ERROR_XWIKI_DIFF_RENDERED_ERROR,
"Error while making rendered diff of {0} between version {1} and version {2}", e, args);
String errormsg = Util.getHTMLExceptionMessage(xe, getXWikiContext());
list.add(errormsg);
return list;
}
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
public List<AttachmentDiff> getAttachmentDiff(Document origdoc, Document newdoc) throws XWikiException
{
try {
if ((origdoc == null) && (newdoc == null)) {
return Collections.emptyList();
}
if (origdoc == null) {
return this.doc.getAttachmentDiff(new XWikiDocument(newdoc.getDocumentReference()), newdoc.doc,
getXWikiContext());
}
if (newdoc == null) {
return this.doc.getAttachmentDiff(origdoc.doc,
new XWikiDocument(origdoc.getDocumentReference()), getXWikiContext());
}
return this.doc.getAttachmentDiff(origdoc.doc, newdoc.doc, getXWikiContext());
} catch (Exception e) {
java.lang.Object[] args =
{(origdoc != null) ? origdoc.getFullName() : null, (origdoc != null) ? origdoc.getVersion() : null,
(newdoc != null) ? newdoc.getVersion() : null};
List list = new ArrayList();
XWikiException xe =
new XWikiException(XWikiException.MODULE_XWIKI_DIFF, XWikiException.ERROR_XWIKI_DIFF_ATTACHMENT_ERROR,
"Error while making attachment diff of {0} between version {1} and version {2}", e, args);
String errormsg = Util.getHTMLExceptionMessage(xe, getXWikiContext());
list.add(errormsg);
return list;
}
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
public List<Delta> getContentDiff(Document origdoc, Document newdoc) throws XWikiException,
DifferentiationFailedException
{
try {
if ((origdoc == null) && (newdoc == null)) {
return Collections.emptyList();
}
if (origdoc == null) {
return this.doc.getContentDiff(new XWikiDocument(newdoc.getDocumentReference()), newdoc.doc,
getXWikiContext());
}
if (newdoc == null) {
return this.doc.getContentDiff(origdoc.doc, new XWikiDocument(origdoc.getDocumentReference()),
getXWikiContext());
}
return this.doc.getContentDiff(origdoc.doc, newdoc.doc, getXWikiContext());
} catch (Exception e) {
java.lang.Object[] args = {origdoc.getFullName(), origdoc.getVersion(), newdoc.getVersion()};
List list = new ArrayList();
XWikiException xe =
new XWikiException(XWikiException.MODULE_XWIKI_DIFF, XWikiException.ERROR_XWIKI_DIFF_CONTENT_ERROR,
"Error while making content diff of {0} between version {1} and version {2}", e, args);
String errormsg = Util.getHTMLExceptionMessage(xe, getXWikiContext());
list.add(errormsg);
return list;
}
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-rest-server
Utils.getXWikiContext(componentManager));
xwikiDocument =
Utils.getXWiki(componentManager).getDocument(xwikiDocument, doc.getVersion(),
Utils.getXWikiContext(componentManager));
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-rest-server
commentsUri =
UriBuilder.fromUri(baseUri).path(CommentsVersionResource.class).build(doc.getWiki(),
doc.getSpace(), doc.getName(), doc.getVersion()).toString();
} else {
commentsUri =
attachmentsUri =
UriBuilder.fromUri(baseUri).path(AttachmentsAtPageVersionResource.class).build(doc.getWiki(),
doc.getSpace(), doc.getName(), doc.getVersion()).toString();
} else {
attachmentsUri =
objectsUri =
UriBuilder.fromUri(baseUri).path(ObjectsAtPageVersionResource.class).build(doc.getWiki(),
doc.getSpace(), doc.getName(), doc.getVersion()).toString();
} else {
objectsUri =
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-rest-server
propertyUri =
UriBuilder.fromUri(baseUri).path(ObjectPropertyAtPageVersionResource.class).build(doc.getWiki(),
doc.getSpace(), doc.getName(), doc.getVersion(), xwikiObject.getClassName(),
xwikiObject.getNumber(), propertyClass.getName()).toString();
} else {
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-rest-server
private static void fillAttachment(Attachment attachment, ObjectFactory objectFactory, URI baseUri,
com.xpn.xwiki.api.Attachment xwikiAttachment, String xwikiRelativeUrl, String xwikiAbsoluteUrl)
{
Document doc = xwikiAttachment.getDocument();
attachment.setId(String.format("%s@%s", doc.getPrefixedFullName(), xwikiAttachment.getFilename()));
attachment.setName(xwikiAttachment.getFilename());
attachment.setSize(xwikiAttachment.getFilesize());
attachment.setVersion(xwikiAttachment.getVersion());
attachment.setPageId(doc.getPrefixedFullName());
attachment.setPageVersion(doc.getVersion());
attachment.setMimeType(xwikiAttachment.getMimeType());
attachment.setAuthor(xwikiAttachment.getAuthor());
Calendar calendar = Calendar.getInstance();
calendar.setTime(xwikiAttachment.getDate());
attachment.setDate(calendar);
attachment.setXwikiRelativeUrl(xwikiRelativeUrl);
attachment.setXwikiAbsoluteUrl(xwikiAbsoluteUrl);
String pageUri =
UriBuilder.fromUri(baseUri).path(PageResource.class).build(doc.getWiki(), doc.getSpace(), doc.getName())
.toString();
Link pageLink = objectFactory.createLink();
pageLink.setHref(pageUri);
pageLink.setRel(Relations.PAGE);
attachment.getLinks().add(pageLink);
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-rest-server
fillPageSummary(page, objectFactory, baseUri, doc, useVersion, xwikiApi);
page.setVersion(doc.getVersion());
page.setMajorVersion(doc.getRCSVersion().at(0));
page.setMinorVersion(doc.getRCSVersion().at(1));
代码示例来源:origin: org.xwiki.platform/xwiki-platform-search-lucene-api
searchResult.setSpace(spaceName);
searchResult.setPageName(pageName);
searchResult.setVersion(doc.getVersion());
内容来源于网络,如有侵权,请联系作者删除!