/** * @return the document's space + page name (eg "space.page") * @deprecated since 2.2M1 use {@link #getDocumentReference()} instead */ @Deprecated public String getFullName() { return this.localEntityReferenceSerializer.serialize(getDocumentReference()); }
/** * @return the docoument's wiki + space + page name (eg "wiki:space.page") * @deprecated since 2.2M1 use {@link #getDocumentReference()} instead */ @Deprecated public String getPrefixedFullName() { return this.defaultEntityReferenceSerializer.serialize(getDocumentReference()); }
/** * @since 2.2M1 */ public void setXClass(BaseClass xwikiClass) { xwikiClass.setDocumentReference(getDocumentReference()); this.xClass = xwikiClass; }
/** * return the name of a document. for exemple if the fullName of a document is "MySpace.Mydoc", the name is MyDoc. * * @return the name of the document */ public String getName() { return this.doc.getDocumentReference().getName(); }
/** * Get the complete fullName of the document. The real full name of the document containing the name of the wiki * where the document is stored. For a document stored in the wiki "xwiki", in space "MySpace", named "MyDoc", its * complete full name is "xwiki:MySpace.MyDoc". * * @return The complete fullName of the document. * @since XWiki Core 1.1.2, XWiki Core 1.2M2 */ public String getPrefixedFullName() { return this.defaultEntityReferenceSerializer.serialize(this.doc.getDocumentReference()); }
/** * @deprecated since 2.2M1 use {@link #getXObject()} instead */ @Deprecated public BaseObject getxWikiObject() { return getXObject(getDocumentReference()); }
/** * @since 2.3M1 */ public DocumentReference getDocumentReference() { // Clone the document reference since it can be modified return new DocumentReference(this.doc.getDocumentReference()); }
private String extractWikiId(XWikiDocument document) { String wikiId = null; String pageName = document.getDocumentReference().getName(); if (pageName.startsWith(VALID_PAGE_PREFIX)) { wikiId = StringUtils.removeStart(pageName, VALID_PAGE_PREFIX).toLowerCase(); } return wikiId; }
/** * @deprecated since 2.2M2 use {@link #newXObject(EntityReference, XWikiContext)} */ @Deprecated public BaseObject newObject(String className, XWikiContext context) throws XWikiException { return newXObject( this.xClassEntityReferenceResolver.resolve(className, EntityType.DOCUMENT, getDocumentReference()), context); }
/** * @deprecated since 2.2M1 use {@link #createXObject(EntityReference, XWikiContext)} instead */ @Deprecated public int createNewObject(String className, XWikiContext context) throws XWikiException { return createXObject( this.xClassEntityReferenceResolver.resolve(className, EntityType.DOCUMENT, getDocumentReference()), context); }
/** * @deprecated since 2.2M2 use {@link #updateXObjectFromRequest(EntityReference, String, int, XWikiContext)} */ @Deprecated public BaseObject updateObjectFromRequest(String className, String prefix, int num, XWikiContext context) throws XWikiException { return updateXObjectFromRequest( this.xClassEntityReferenceResolver.resolve(className, EntityType.DOCUMENT, getDocumentReference()), prefix, num, context); }
/** * @deprecated since 2.2M2 use {@link #setIntValue(EntityReference, String, int)} instead */ @Deprecated public void setIntValue(String className, String fieldName, int value) { setIntValue(this.xClassEntityReferenceResolver.resolve(className, EntityType.DOCUMENT, getDocumentReference()), fieldName, value); }
@Override public Iterator<ConfigurationSource> iterator() { XWikiContext xcontext = this.xcontextProvider.get(); if (xcontext != null) { XWikiDocument currentDocument = xcontext.getDoc(); if (currentDocument != null) { return new SpaceIterator(currentDocument.getDocumentReference().getLastSpaceReference()); } } return Collections.<ConfigurationSource>emptyList().iterator(); }
/** * return the name of the space of the document for example if the fullName of a document is "MySpace.Mydoc", the * name is MySpace. * * @return the name of the space of the document */ public String getSpace() { return this.doc.getDocumentReference().getLastSpaceReference().getName(); }
/** * @since 2.2M1 */ public BaseClass getXClass() { if (this.xClass == null) { this.xClass = new BaseClass(); this.xClass.setDocumentReference(getDocumentReference()); } return this.xClass; }
private Pair<String, String> fetchFromGroup(XWikiDocument document) { BaseObject groupObject = document.getXObject(GROUP_OBJECT_REFERENCE); String email = groupObject.getStringValue("contact"); String name = document.getDocumentReference().getName(); return Pair.of(name, email); } }
/** * Transforms a XClass reference relative to this document into an absolute reference. */ private DocumentReference resolveClassReference(EntityReference reference) { DocumentReference defaultReference = new DocumentReference(getDocumentReference().getWikiReference().getName(), XWiki.SYSTEM_SPACE, getDocumentReference().getName()); return this.explicitReferenceDocumentReferenceResolver.resolve(reference, defaultReference); }
private void clearCacheFromColorTheme(XWikiDocument document) { ColorThemeReference colorThemeReference = colorThemeReferenceFactory.createReference(document.getDocumentReference()); lessResourcesCache.clearFromColorTheme(colorThemeReference); colorThemeCache.clearFromColorTheme(colorThemeReference); } }
private void clearCacheFromSkin(XWikiDocument document) { SkinReference skinReference = skinReferenceFactory.createReference(document.getDocumentReference()); lessResourcesCache.clearFromSkin(skinReference); colorThemeCache.clearFromSkin(skinReference); } }
public XWikiDocument getDocument(XWikiDocument doc, XWikiContext context) throws XWikiException { String database = context.getDatabase(); try { if (doc.getDocumentReference().getWikiReference().getName() != null) { context.setDatabase(doc.getDocumentReference().getWikiReference().getName()); } return getStore().loadXWikiDoc(doc, context); } finally { context.setDatabase(database); } }