On Tue, Jan 20, 2009 at 6:50 PM, Sergiu Dumitriu
<sergiu(a)xwiki.com> wrote:
Is this global? I mean, does it get all tags
found in the wiki, or just
the tags for the current document? I'd like to also have a method to get
tags for a document (+ for translations), since the getTags method does
not belong to the Document class (although it is part of the current
API, I'd like to see it removed in the new model). Maybe we should
deprecate it after we add this plugin/application.
It is global and was named getAllTags at first, ok to rename it.
What does "distinct" do? I'd rather
have a caseSensitive parameter, or
different methods for this.
Distinct was not about case but about tag occurences here which
appears to be misleading.
public
List<String> getPagesWithTag(String tag);
Pages? This is not our
terminology.
I hesitated for this. We're kind of mixing both and I tend to use page
everywhere since I vaguely remember we discussed in the past that in
the future we should move from Document to Page like we did (and do)
from Web to Space. Anyway I agree that it's not consistent with the
other APIs, I'll rename.
public
boolean renameTag(String tag, String newTag);
public boolean deleteTag(String tag);
What happens when the user does not have the
right to alter all the
documents, only some of them? Will the changes appear in whatsnew? Will
they create new versions? Will they change the author?
I check XWiki.hasAdminRights() in the API since I consider this as an
administration task.
Those renames create new minor versions thus not appearing in whats new.
We'd also need a method to get all tags with
their occurrence count (for
the tag cloud).
I did it with more logic on the velocity side (and with the 'distinct'
above) but this would be better.
So, how about this API:
- List<String> getAllTags() -> all wiki tags, case insensitive (CI)
- List<String> getAllTags(boolean caseInsensitive) -> all tags
At first I put a ignoreCase argument in getPagesWithTag, renameTag,
deleteTag .. then I decided not to take care of the case since this is
not something we usualy do in XWiki (document names for example) and
thought that if we really need it we could still have a global option
for this in the future.
- HashMap<String, Integer> getTagCount()
-> all wiki tags with
occurrence, CI
- HashMap<String, Integer> getTagCount(boolean caseInsensitive) -> all
wiki tags with occurrence
- List<String> getTagsForDocument(Document doc) -> document tags
--> Debate: XWikiDocument, Document or String? Or all?
I'd say juste a String ftm, aka fullName.
- boolean addTagToDocument(String tag, Document
doc) -> returns true if
the tag was successfully added, false if the tag was already associated.
Throws exceptions in other cases (not enough rights, db issues, etc). -
boolean removeTagFromDocument(String tag, Document doc) -> returns true
if the tag was successfully removed, false if the tag was not
associated. Throws exceptions in other cases (not enough rights, db
issues, etc).
- public List<String> getDocumentsWithTag(String tag)
- public boolean renameTag(String tag, String newTag)
- public boolean deleteTag(String tag)
Fine with this. Revised proposal:
List<String> getAllTags()
HashMap<String, Integer> getTagCount()
List<String> getDocumentsWithTag(String tag)
boolean renameTag(String tag, String newTag)
boolean deleteTag(String tag)
boolean addTagToDocument(String tag, String fullName)
boolean removeTagFromDocument(String tag,String fullName)
List<String> getTagsForDocument(String fullName)
Debate: how to identify a document
[snip]
I'm snipping the debate since I think it is related to a more broader
discussion about the new model.
Thanks,
JV.
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs