Hi,
On Jun 23, 2013, at 5:19 PM, Thomas Mortagne <thomas.mortagne(a)xwiki.com> wrote:
Hi devs,
While working on XWIKI-9200 (which is done expect for that little
question ;)) I found that there is no API to check if a document exist
in specific language. You have to do a custom query.
Since I would like to make my code as readable as possible and
considering that we will have to do it eventually anyway here it is:
two choices:
1) add support for reference locale in XWiki#exist and
XWiki#getDocument as well as XWikiHibernateStore#exists. Both
XWikiHibernateStore#loadXWikiDoc and XWikiCacheStore are already
taking into account the locale since they are based on the id (so this
would also be about consistency)
2) introduce new methods like XWiki#existsWithLocale,
XWiki#getDocumentWithLocale and XWikiStoreInterface#existsWithLocale
(and the corresponding implementations)
WDYT ?
2) is obviously the safest but I can't find method names I like. I
would be OK with 1) if everyone is strongly for it but it's probably a
bit dangerous so my vote goes to 2) for now.
+1 for 1) with a note in the RN to explain the change of behavior. I don't think it
changes much in practice, right? In the majority of the cases the result would be the
same, it's only if the user of the API had set a locale in the reference object that
it would change, am I correct?
Thanks
-Vincent