Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.platform.tag
Class TagServiceImpl

java.lang.Object
  extended by org.nuxeo.runtime.model.DefaultComponent
      extended by org.nuxeo.ecm.platform.tag.TagServiceImpl
All Implemented Interfaces:
TagService, Adaptable, Component, Extensible

public class TagServiceImpl
extends DefaultComponent
implements TagService

The implementation of the tag service.


Field Summary
static String NXTAG
           
 
Fields inherited from interface org.nuxeo.ecm.platform.tag.TagService
ID
 
Constructor Summary
TagServiceImpl()
           
 
Method Summary
 List<Tag> getDocumentTags(CoreSession session, String docId, String username)
          Gets the tags applied to a document by a given user, or by all users.
 List<Tag> getSuggestions(CoreSession session, String label, String username)
          Gets suggestions for a given tag label prefix.
 List<Tag> getTagCloud(CoreSession session, String docId, String username, Boolean normalize)
          Gets the tag cloud for a set of documents (tags with weight corresponding to their popularity).
 List<String> getTagDocumentIds(CoreSession session, String label, String username)
          Gets the documents to which a tag is applied.
 boolean isEnabled()
          Defines if tag service is enable.
static void normalizeCloud(List<Tag> cloud, int min, int max, boolean linear)
           
 void tag(CoreSession session, String docId, String label, String username)
          Tags a document with a given tag.
 void untag(CoreSession session, String docId, String label, String username)
          Untags a document of the given tag
 
Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
activate, applicationStarted, deactivate, getAdapter, registerContribution, registerExtension, unregisterContribution, unregisterExtension
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NXTAG

public static final String NXTAG
See Also:
Constant Field Values
Constructor Detail

TagServiceImpl

public TagServiceImpl()
Method Detail

isEnabled

public boolean isEnabled()
Description copied from interface: TagService
Defines if tag service is enable.

Specified by:
isEnabled in interface TagService
Returns:
true if the underlying repository supports the tag feature

tag

public void tag(CoreSession session,
                String docId,
                String label,
                String username)
         throws ClientException
Description copied from interface: TagService
Tags a document with a given tag.

Specified by:
tag in interface TagService
Parameters:
session - the session
docId - the document id
label - the tag
username - the user associated to the tagging
Throws:
ClientException

untag

public void untag(CoreSession session,
                  String docId,
                  String label,
                  String username)
           throws ClientException
Description copied from interface: TagService
Untags a document of the given tag

Specified by:
untag in interface TagService
Parameters:
session - the session
docId - the document id
label - the tag, or null for all tags
username - the user associated to the tagging
Throws:
ClientException

getDocumentTags

public List<Tag> getDocumentTags(CoreSession session,
                                 String docId,
                                 String username)
                          throws ClientException
Description copied from interface: TagService
Gets the tags applied to a document by a given user, or by all users.

Specified by:
getDocumentTags in interface TagService
Parameters:
session - the session
docId - the document id
username - the user name, or null for all users
Returns:
the list of tags
Throws:
ClientException

getTagDocumentIds

public List<String> getTagDocumentIds(CoreSession session,
                                      String label,
                                      String username)
                               throws ClientException
Description copied from interface: TagService
Gets the documents to which a tag is applied.

Specified by:
getTagDocumentIds in interface TagService
Parameters:
session - the session
label - the tag
username - the user name, or null for all users
Returns:
the set of document ids
Throws:
ClientException

getTagCloud

public List<Tag> getTagCloud(CoreSession session,
                             String docId,
                             String username,
                             Boolean normalize)
                      throws ClientException
Description copied from interface: TagService
Gets the tag cloud for a set of documents (tags with weight corresponding to their popularity).

If a docId is passed, only documents under it are considered, otherwise all documents in the database are used.

The cloud is returned unsorted.

Specified by:
getTagCloud in interface TagService
Parameters:
session - the session
docId - the document id under which to look, or null for all documents
username - the user name, or null for all users
normalize - null for no weight normalization (a count is returned), FALSE for 0-100 normalization, TRUE for logarithmic 0-100 normalization
Returns:
the cloud (a list of weighted tags)
Throws:
ClientException

normalizeCloud

public static void normalizeCloud(List<Tag> cloud,
                                  int min,
                                  int max,
                                  boolean linear)

getSuggestions

public List<Tag> getSuggestions(CoreSession session,
                                String label,
                                String username)
                         throws ClientException
Description copied from interface: TagService
Gets suggestions for a given tag label prefix.

Specified by:
getSuggestions in interface TagService
Parameters:
session - the session
label - the tag label prefix
username - the user name, or null for all users
Returns:
a list of tags
Throws:
ClientException

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.