Hi Denis On Fri, Dec 23, 2011 at 3:53 PM, Denis Gervalle <[email protected]> wrote:
+0, but note that if we finally introduce Locales in reference, this new function is useless.
In my previous try to do so, it seems to me that the best way to manage the "default" document is to not introduce any Locale in its reference, which made it the default one, and ensure its reference stay stable even when its language is later changed.
But this may became weird if we now have some function that provide translated version by default.
We can/should change the implementation of DAB#getDocument(DocumentReference) after we introduce the Locale information in DocumentReference so that it returns: * the translated document if the Locale is specified in the document reference * the default document otherwise At this point we can deprecate DAB#getDefaultDocument(DocumentReference) because it becomes indeed useless.
Doesn't we need to further think about how we expect to work with references with Locale and prepare existing API to be consistant with that new direction ?
I agree. I can wait until we agree on the right way to handle Locale information inside document references. (in my case the code that needs the default translation is already depending on the old core so I can access it through XWiki#getDocument(DocumentReference)) Thanks, Marius
On Fri, Dec 23, 2011 at 12:58, Thomas Mortagne <[email protected]>wrote:
+1
On Fri, Dec 23, 2011 at 10:57 AM, Marius Dumitru Florea <[email protected]> wrote:
Hi devs,
The default implementation of DocumentAccessBridge#getDocument(DocumentReference) has been modified a few months ago [1] 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].
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.
Thanks, Marius
[1] https://github.com/xwiki/xwiki-platform/commit/f1188a7be56600aa975d7ccc747a2... _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Denis Gervalle SOFTEC sa - CEO eGuilde sarl - CTO _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs