/** * @deprecated since 2.2M1 use {@link #getParentReference()} instead */ @Deprecated public XWikiDocument getParentDoc() { return new XWikiDocument(getParentReference()); }
/** * Create a {@link XWikiDocument} from xml {@link Document}. * * @param domDoc the xml {@link Document}. * @return the {@link XWikiDocument}. * @throws XWikiException error when creating the {@link XWikiDocument}. */ private XWikiDocument readFromXML(Document domDoc) throws XWikiException { XWikiDocument doc = new XWikiDocument(); doc.fromXML(domDoc, this.withVersions); return doc; }
@Override public T newXObjectDocument(XWikiContext context) throws XWikiException { return newXObjectDocument(new XWikiDocument(), 0, context); }
/** * Create a {@link XWikiDocument} from xml stream. * * @param is the xml stream. * @return the {@link XWikiDocument}. * @throws XWikiException error when creating the {@link XWikiDocument}. */ private XWikiDocument readFromXML(InputStream is) throws XWikiException { XWikiDocument doc = new XWikiDocument(); doc.fromXML(is, this.withVersions); return doc; }
/** * @deprecated since 2.2M1 use {@link #getDocument(DocumentReference, XWikiContext)} instead */ @Deprecated public XWikiDocument getDocument(String fullname, XWikiContext context) throws XWikiException { XWikiDocument doc = new XWikiDocument(); doc.setFullName(fullname, context); return getDocument(doc, context); }
public XWikiDocument getDocument() { if (this.document == null) { this.document = new XWikiDocument( new DocumentReference(SpacePreferencesConfigurationSource.DOCUMENT_NAME, this.reference)); } return this.document; }
/** * API to create an empty document * * @return an XWikiDocument wrapped in a Document */ public Document createDocument() { return new XWikiDocument().newDocument(getXWikiContext()); }
/** * @since 2.2M1 */ public XWikiDocument getDocument(DocumentReference reference, XWikiContext context) throws XWikiException { XWikiDocument doc = new XWikiDocument(reference); doc.setContentDirty(true); return getDocument(doc, context); }
/** * @since 2.5RC1 */ public String getAttachmentURL(String fullname, String filename, String queryString, XWikiContext context) throws XWikiException { XWikiDocument doc = new XWikiDocument(this.currentMixedDocumentReferenceResolver.resolve(fullname)); return doc.getAttachmentURL(filename, "download", queryString, context); }
public boolean updateDoc(String docFullName, int action, XWikiContext context) throws XWikiException { XWikiDocument doc = new XWikiDocument(); doc.setFullName(docFullName, context); return add(doc, action, context); }
public String getExternalAttachmentURL(String fullName, String filename, XWikiContext context) { XWikiDocument doc = new XWikiDocument(); doc.setFullName(fullName, context); return doc.getExternalAttachmentURL(filename, "download", context); }
@Override public XWikiDocument getXWikiDocument(XWikiDocument document) throws XWikiException, IOException { XWikiDocument result = document; if (result == null) { result = new XWikiDocument(); } result.fromXML(new DefaultFileInputSource(this.content), true); return result; } }
/** * @since 2.3M1 */ public void setPhonyDocument(DocumentReference reference, XWikiContext context, VelocityContext vcontext) { XWikiDocument doc = new XWikiDocument(reference); doc.setElements(XWikiDocument.HAS_ATTACHMENTS | XWikiDocument.HAS_OBJECTS); doc.setStore(getStore()); context.put("doc", doc); vcontext.put("doc", doc.newDocument(context)); vcontext.put("cdoc", vcontext.get("doc")); vcontext.put("tdoc", vcontext.get("doc")); }
public String getExternalURL(String fullname, String action, String querystring, XWikiContext context) throws XWikiException { XWikiDocument doc = new XWikiDocument(this.currentMixedDocumentReferenceResolver.resolve(fullname)); URL url = context.getURLFactory().createExternalURL(doc.getSpace(), doc.getName(), action, querystring, null, doc.getDatabase(), context); return url.toString(); }
public String getExternalURL(String fullname, String action, XWikiContext context) throws XWikiException { XWikiDocument doc = new XWikiDocument(this.currentMixedDocumentReferenceResolver.resolve(fullname)); URL url = context.getURLFactory().createExternalURL(doc.getSpace(), doc.getName(), action, null, null, doc.getDatabase(), context); return url.toString(); }
/** * <p> * Get the page id given its components. * </p> * @return The page id. */ public static String getPageId(String wikiName, String pageFullName) { XWikiDocument xwikiDocument = new XWikiDocument(); xwikiDocument.setDatabase(wikiName); xwikiDocument.setFullName(pageFullName); Document document = new Document(xwikiDocument, null); return document.getPrefixedFullName(); }
/** * @deprecated since 2.2.1 use {@link #getURL(DocumentReference, String, String, String, XWikiContext)} */ @Deprecated public String getURL(String fullname, String action, String queryString, String anchor, XWikiContext context) { XWikiDocument doc = new XWikiDocument(this.currentMixedDocumentReferenceResolver.resolve(fullname)); URL url = context.getURLFactory().createURL(doc.getSpace(), doc.getName(), action, queryString, anchor, doc.getDatabase(), context); return context.getURLFactory().getURL(url, context); }
/** * @see com.xpn.xwiki.api.XWiki#getDeletedDocuments(String, String) */ public XWikiDeletedDocument[] getDeletedDocuments(String fullname, String lang, XWikiContext context) throws XWikiException { if (hasRecycleBin(context)) { XWikiDocument doc = new XWikiDocument(this.currentMixedDocumentReferenceResolver.resolve(fullname)); doc.setLanguage(lang); return getRecycleBinStore().getAllDeletedDocuments(doc, context, true); } else { return null; } }
/** * @since 2.2.1 */ public String getURL(DocumentReference documentReference, String action, String queryString, String anchor, XWikiContext context) { XWikiDocument doc = new XWikiDocument(documentReference); URL url = context.getURLFactory().createURL(doc.getSpace(), doc.getName(), action, queryString, anchor, doc.getDatabase(), context); return context.getURLFactory().getURL(url, context); }
public String getParentURL(XWikiContext context) throws XWikiException { XWikiDocument doc = new XWikiDocument(getParentReference()); URL url = context.getURLFactory().createURL(doc.getSpace(), doc.getName(), "view", null, null, getDatabase(), context); return context.getURLFactory().getURL(url, context); }