Class TaggableAmetysObjectHelper
java.lang.Object
org.ametys.plugins.repository.tag.TaggableAmetysObjectHelper
Helper class which provides methods to manage tags on
JCRAmetysObject
s.-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected static javax.jcr.Node
getNode
(JCRAmetysObject object) Get an object's base node.getTags
(JCRAmetysObject object) Retrieve the tags of aJCRAmetysObject
.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 Details
-
DEFAULT_METADATA_TAGS
Constant for tags metadata.- See Also:
-
-
Method Details
-
getTags
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
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
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
Get an object's base node.- Parameters:
object
- the object which node to get.- Returns:
- the object's base node.
-