/** * Note that this method cannot be removed for now since it's used by Hibernate for loading a XWikiDocument. * * @deprecated since 2.2M1 used {@link #setDocumentReference(DocumentReference)} instead */ @Deprecated public void setSpace(String space) { if (space != null) { getDocumentReference().getLastSpaceReference().setName(space); // Clean the absolute parent reference cache to rebuild it next time getParentReference is called. this.parentReferenceCache = null; } }
/** * Note: BaseElement.setName() does not support setting reference anymore since 2.4M2. * * {@inheritDoc} * * @deprecated since 2.2M2 use {@link #setDocumentReference(org.xwiki.model.reference.DocumentReference)} */ @Deprecated @Override public void setName(String name) { DocumentReference reference = getDocumentReference(); if (reference != null) { // Make sure to not modify a reference that could comes from somewhere else reference = new DocumentReference(reference); EntityReference relativeReference = this.relativeEntityReferenceResolver.resolve(name, EntityType.DOCUMENT); reference.getLastSpaceReference().setName(relativeReference.extractReference(EntityType.SPACE).getName()); reference.setName(relativeReference.extractReference(EntityType.DOCUMENT).getName()); } else { reference = this.currentMixedDocumentReferenceResolver.resolve(name); } setDocumentReference(reference); }
/** * Note: BaseElement#setName() does not support setting reference anymore since 2.4M2. This was broken and * has been replaced by this overridden method. See XWIKI-5285 * * {@inheritDoc} * * @deprecated since 2.2M2 use {@link #setDocumentReference(org.xwiki.model.reference.DocumentReference)} */ @Deprecated @Override public void setName(String name) { if (this instanceof MetaClass || this instanceof PropertyMetaClass) { super.setName(name); } else { DocumentReference reference = getDocumentReference(); if (reference != null) { EntityReference relativeReference = this.relativeEntityReferenceResolver.resolve(name, EntityType.DOCUMENT); reference.getLastSpaceReference() .setName(relativeReference.extractReference(EntityType.SPACE).getName()); reference.setName(relativeReference.extractReference(EntityType.DOCUMENT).getName()); } else { reference = this.currentMixedDocumentReferenceResolver.resolve(name); } setDocumentReference(reference); } }