Package org.nuxeo.ecm.platform.tag
Class AbstractTagService
- java.lang.Object
-
- org.nuxeo.ecm.platform.tag.AbstractTagService
-
- All Implemented Interfaces:
TagService
- Direct Known Subclasses:
BridgeTagService
,FacetedTagService
,RelationTagService
public abstract class AbstractTagService extends Object implements TagService
- Since:
- 9.3
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
AbstractTagService.PAGE_PROVIDERS
-
Nested classes/interfaces inherited from interface org.nuxeo.ecm.platform.tag.TagService
TagService.Feature
-
-
Field Summary
Fields Modifier and Type Field Description static String
TAG_SANITIZATION_PROP
-
Fields inherited from interface org.nuxeo.ecm.platform.tag.TagService
ID
-
-
Constructor Summary
Constructors Constructor Description AbstractTagService()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
canUntag(CoreSession session, String docId, String label)
Returns whether or not the current session can untag tag on provided document.protected String
cleanLabel(String label, boolean allowEmpty, boolean allowPercent)
protected static String
cleanUsername(String username)
void
copyTags(CoreSession session, String srcDocId, String dstDocId)
Copy all the tags applied to the source document to the destination document.protected void
copyTags(CoreSession session, String srcDocId, String dstDocId, boolean removeExistingTags)
abstract void
doCopyTags(CoreSession session, String srcDocId, String dstDocId, boolean removeExistingTags)
abstract List<String>
doGetTagDocumentIds(CoreSession session, String label)
abstract Set<String>
doGetTags(CoreSession session, String docId)
abstract Set<String>
doGetTagSuggestions(CoreSession session, String label)
abstract void
doTag(CoreSession session, String docId, String label, String username)
abstract void
doUntag(CoreSession session, String docId, String label)
protected void
fireUpdateEvent(CoreSession session, String docId)
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>
getDocumentTags(CoreSession session, String docId, String username, boolean useCore)
Gets the tags applied to a document by a given user, or by all users.protected static List<Map<String,Serializable>>
getItems(String pageProviderName, CoreSession session, Object... params)
Returns results from calls toCoreSession.queryAndFetch(String, String, Object...)
using page providers.Set<String>
getSuggestions(CoreSession session, String label)
Gets suggestions for a given tag label prefix.List<Tag>
getSuggestions(CoreSession session, String label, String username)
Gets suggestions for a given tag label prefix.List<String>
getTagDocumentIds(CoreSession session, String label)
Gets the documents to which a tag is applied.List<String>
getTagDocumentIds(CoreSession session, String label, String username)
Gets the documents to which a tag is applied.Set<String>
getTags(CoreSession session, String docId)
Gets the tags applied to a document.boolean
isEnabled()
Defines if tag service is enable.protected boolean
isTagSanitizationEnabled()
void
removeTags(CoreSession session, String docId)
Removes all the tags applied to a document.void
replaceTags(CoreSession session, String srcDocId, String dstDocId)
Replace all the existing tags applied on the destination document by the ones applied on the source document.void
tag(CoreSession session, String docId, String label)
Tags a document with a given tag.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)
Untags a document of the given tagvoid
untag(CoreSession session, String docId, String label, String username)
Untags a document of the given tag-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.ecm.platform.tag.TagService
getTagCloud, hasFeature, supportsTag
-
-
-
-
Field Detail
-
TAG_SANITIZATION_PROP
public static final String TAG_SANITIZATION_PROP
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractTagService
public AbstractTagService()
-
-
Method Detail
-
isEnabled
public boolean isEnabled()
Description copied from interface:TagService
Defines if tag service is enable.- Specified by:
isEnabled
in interfaceTagService
- Returns:
- true if the underlying repository supports the tag feature
-
tag
public void tag(CoreSession session, String docId, String label)
Description copied from interface:TagService
Tags a document with a given tag.- Specified by:
tag
in interfaceTagService
- Parameters:
session
- the sessiondocId
- the document idlabel
- the tag
-
tag
public void tag(CoreSession session, String docId, String label, String username)
Description copied from interface:TagService
Tags a document with a given tag.- Specified by:
tag
in interfaceTagService
- Parameters:
session
- the sessiondocId
- the document idlabel
- the tagusername
- the user associated to the tagging
-
untag
public void untag(CoreSession session, String docId, String label)
Description copied from interface:TagService
Untags a document of the given tag- Specified by:
untag
in interfaceTagService
- Parameters:
session
- the sessiondocId
- the document idlabel
- the tag, ornull
for all tags
-
untag
public void untag(CoreSession session, String docId, String label, String username)
Description copied from interface:TagService
Untags a document of the given tag- Specified by:
untag
in interfaceTagService
- Parameters:
session
- the sessiondocId
- the document idlabel
- the tag, ornull
for all tagsusername
- the user associated to the tagging
-
canUntag
public boolean canUntag(CoreSession session, String docId, String label)
Description copied from interface:TagService
Returns whether or not the current session can untag tag on provided document.- Specified by:
canUntag
in interfaceTagService
- Parameters:
session
- the sessiondocId
- the document idlabel
- the tag, ornull
for all tags- Returns:
- whether or not the current session can untag provided document
-
getTags
public Set<String> getTags(CoreSession session, String docId)
Description copied from interface:TagService
Gets the tags applied to a document.- Specified by:
getTags
in interfaceTagService
- Parameters:
session
- the sessiondocId
- the document id- Returns:
- the list of tags
-
getDocumentTags
public List<Tag> getDocumentTags(CoreSession session, String docId, String username)
Description copied from interface:TagService
Gets the tags applied to a document by a given user, or by all users.- Specified by:
getDocumentTags
in interfaceTagService
- Parameters:
session
- the sessiondocId
- the document idusername
- the user name, ornull
for all users- Returns:
- the list of tags
-
getDocumentTags
public List<Tag> getDocumentTags(CoreSession session, String docId, String username, boolean useCore)
Description copied from interface:TagService
Gets the tags applied to a document by a given user, or by all users.Alternative method allowing to specify whether the core should be used for this query.
- Specified by:
getDocumentTags
in interfaceTagService
- Parameters:
session
- the sessiondocId
- the document idusername
- the user name, ornull
for all usersuseCore
- if true, the core should be used to retrieve tags.- Returns:
- the list of tags
-
removeTags
public void removeTags(CoreSession session, String docId)
Description copied from interface:TagService
Removes all the tags applied to a document.- Specified by:
removeTags
in interfaceTagService
-
copyTags
public void copyTags(CoreSession session, String srcDocId, String dstDocId)
Description copied from interface:TagService
Copy all the tags applied to the source document to the destination document.The tags are merged.
- Specified by:
copyTags
in interfaceTagService
srcDocId
- the source document iddstDocId
- the destination document id
-
copyTags
protected void copyTags(CoreSession session, String srcDocId, String dstDocId, boolean removeExistingTags)
-
replaceTags
public void replaceTags(CoreSession session, String srcDocId, String dstDocId)
Description copied from interface:TagService
Replace all the existing tags applied on the destination document by the ones applied on the source document.- Specified by:
replaceTags
in interfaceTagService
srcDocId
- the source document iddstDocId
- the destination document id
-
getTagDocumentIds
public List<String> getTagDocumentIds(CoreSession session, String label)
Description copied from interface:TagService
Gets the documents to which a tag is applied.- Specified by:
getTagDocumentIds
in interfaceTagService
- Parameters:
session
- the sessionlabel
- the tag- Returns:
- the set of document ids
-
getTagDocumentIds
public List<String> getTagDocumentIds(CoreSession session, String label, String username)
Description copied from interface:TagService
Gets the documents to which a tag is applied.- Specified by:
getTagDocumentIds
in interfaceTagService
- Parameters:
session
- the sessionlabel
- the tagusername
- the user name, ornull
for all users- Returns:
- the set of document ids
-
getSuggestions
public Set<String> getSuggestions(CoreSession session, String label)
Description copied from interface:TagService
Gets suggestions for a given tag label prefix.- Specified by:
getSuggestions
in interfaceTagService
- Parameters:
session
- the sessionlabel
- the tag label prefix- Returns:
- a list of tags
-
getSuggestions
public List<Tag> getSuggestions(CoreSession session, String label, String username)
Description copied from interface:TagService
Gets suggestions for a given tag label prefix.- Specified by:
getSuggestions
in interfaceTagService
- Parameters:
session
- the sessionlabel
- the tag label prefixusername
- the user name, ornull
for all users- Returns:
- a list of tags
-
isTagSanitizationEnabled
protected boolean isTagSanitizationEnabled()
-
doTag
public abstract void doTag(CoreSession session, String docId, String label, String username)
-
doUntag
public abstract void doUntag(CoreSession session, String docId, String label)
-
doGetTags
public abstract Set<String> doGetTags(CoreSession session, String docId)
-
doCopyTags
public abstract void doCopyTags(CoreSession session, String srcDocId, String dstDocId, boolean removeExistingTags)
-
doGetTagDocumentIds
public abstract List<String> doGetTagDocumentIds(CoreSession session, String label)
-
doGetTagSuggestions
public abstract Set<String> doGetTagSuggestions(CoreSession session, String label)
-
cleanLabel
protected String cleanLabel(String label, boolean allowEmpty, boolean allowPercent)
-
cleanUsername
protected static String cleanUsername(String username)
-
getItems
protected static List<Map<String,Serializable>> getItems(String pageProviderName, CoreSession session, Object... params)
Returns results from calls toCoreSession.queryAndFetch(String, String, Object...)
using page providers.- Since:
- 6.0
-
fireUpdateEvent
protected void fireUpdateEvent(CoreSession session, String docId)
-
-