On Dec 23, 2011, at 10:57 AM, Marius Dumitru Florea wrote:
Hi devs,
The default implementation of DocumentAccessBridge#getDocument(DocumentReference) has been modified a few months ago [1]
Actually this commit was just fixing a regression I had introduced. The change was done before: "This is a regression. This issue was first fixed in XWIKI-2892. The regression was introduced in XWIKI-5807 during a refactoring."
to return the translated document. As a consequence, currently there's no way to access the default translation of a document from a component without depending on the old core (i.e. without using XWiki.getDocument()). Thus I'm proposing to add:
/** * Retrieves the default translation of a document specified by its reference. * * @param documentReference a document reference * @return the default translation of the specified document * @throws Exception when the storage cannot be accessed * @since 3.4M1 */ DocumentModelBridge getDefaultDocument(DocumentReference documentReference) throws Exception;
to DocumentAccessBridge. The default implementation will do exactly what DocumentAccessBridge#getDocument(DocumentReference) was doing before [1].
Yep make sure that the old method calls the new one to not have duplication ;)
Note that the default translation of a document is important because it is the only one that provides the document objects. So if you want to access the objects of a document you have to do it through the default translation.
+1 Thanks -Vincent
Thanks, Marius
[1] https://github.com/xwiki/xwiki-platform/commit/f1188a7be56600aa975d7ccc747a2...