Package org.ametys.cms.tag.jcr
Class TaggableAmetysObjectHelper
- java.lang.Object
-
- org.ametys.cms.tag.jcr.TaggableAmetysObjectHelper
-
public final class TaggableAmetysObjectHelper extends Object
Helper class which provides methods to manage tags onJCRAmetysObject
s.
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_METADATA_TAGS
Constant for tags metadata.
-
Constructor Summary
Constructors Modifier Constructor Description private
TaggableAmetysObjectHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static Node
getNode(JCRAmetysObject object)
Get an object's base node.static Set<String>
getTags(JCRAmetysObject object)
Retrieve the tags of aJCRAmetysObject
.static Set<String>
getTags(JCRAmetysObject object, String metadataName)
Retrieve the tags of aJCRAmetysObject
.static void
tag(JCRAmetysObject object, String tag)
Tag aJCRAmetysObject
.static void
tag(JCRAmetysObject object, String tag, String metadataName)
Tag aJCRAmetysObject
.static void
untag(JCRAmetysObject object, String tag)
Remove a tag on aJCRAmetysObject
.static void
untag(JCRAmetysObject object, String tag, String metadataName)
Remove a tag on aJCRAmetysObject
.
-
-
-
Field Detail
-
DEFAULT_METADATA_TAGS
public static final String DEFAULT_METADATA_TAGS
Constant for tags metadata.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TaggableAmetysObjectHelper
private TaggableAmetysObjectHelper()
-
-
Method Detail
-
getTags
public static Set<String> getTags(JCRAmetysObject object) throws AmetysRepositoryException
Retrieve the tags of aJCRAmetysObject
.- Parameters:
object
- theJCRAmetysObject
to tag.- Returns:
- the object tags.
- Throws:
AmetysRepositoryException
- if failed to tag Ametys object
-
getTags
public static Set<String> getTags(JCRAmetysObject object, String metadataName) throws AmetysRepositoryException
Retrieve the tags of aJCRAmetysObject
.- Parameters:
object
- theJCRAmetysObject
to tag.metadataName
- The name of the metadata holding the tags- Returns:
- the object tags.
- Throws:
AmetysRepositoryException
- if failed to tag Ametys object
-
tag
public static void tag(JCRAmetysObject object, String tag) throws AmetysRepositoryException
Tag aJCRAmetysObject
.- Parameters:
object
- theJCRAmetysObject
to tag.tag
- the tag to put on the object.- Throws:
AmetysRepositoryException
- if an error occurs.
-
tag
public static void tag(JCRAmetysObject object, String tag, String metadataName) throws AmetysRepositoryException
Tag aJCRAmetysObject
.- Parameters:
object
- theJCRAmetysObject
to tag.tag
- the tag to put on the object.metadataName
- The name of the metadata holding the tags- Throws:
AmetysRepositoryException
- if an error occurs.
-
untag
public static void untag(JCRAmetysObject object, String tag) throws AmetysRepositoryException
Remove a tag on aJCRAmetysObject
.- Parameters:
object
- theJCRAmetysObject
to tag.tag
- the tag to remove on the object.- Throws:
AmetysRepositoryException
- if an error occurs.
-
untag
public static void untag(JCRAmetysObject object, String tag, String metadataName) throws AmetysRepositoryException
Remove a tag on aJCRAmetysObject
.- Parameters:
object
- theJCRAmetysObject
to tag.tag
- the tag to remove on the object.metadataName
- The name of the metadata holding the tags- Throws:
AmetysRepositoryException
- if an error occurs.
-
getNode
protected static Node getNode(JCRAmetysObject object)
Get an object's base node.- Parameters:
object
- the object which node to get.- Returns:
- the object's base node.
-
-