[xwiki-devs] [PROPOSAL] Add support for the reference locale in XWiki#getDocument/exist
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. -- Thomas Mortagne
On Sun, Jun 23, 2013 at 5:19 PM, Thomas Mortagne <[email protected]> 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.
-- Thomas Mortagne
In the meantime I did what I did not want to do: do my own exist request on solr side. -- Thomas Mortagne
Hi, On Jun 23, 2013, at 5:19 PM, Thomas Mortagne <[email protected]> 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
On Tue, Jul 2, 2013 at 1:46 PM, Vincent Massol <[email protected]> wrote:
Hi,
On Jun 23, 2013, at 5:19 PM, Thomas Mortagne <[email protected]> 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?
Yes.
Thanks -Vincent
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne
participants (2)
-
Thomas Mortagne -
Vincent Massol