Copyright© 2008-2022 Sitevision AB, all rights reserved.
@Requireable(value="MetadataDefinitionUtil") public interface MetadataDefinitionUtil
An instance of the Sitevision class implementing this interface can be obtained via
Utils.getMetadataDefinitionUtil()
.
See Utils
for how to obtain an instance of the Utils
interface.
Velocity example: This code gets all properties and nodes for a metadata definition named 'aMetadataName'.
#set ($page = ...)
#set ($definitionUtil = $sitevisionUtils.metadataDefinitionUtil)
#set($definition = $definitionUtil.getDefinition($page, 'aMetadataName'))
#set($nodes = $definition.getNodes())
#foreach($node in $nodes)
$node
#end
#set($properties = $definition.getProperties())
#foreach($property in $properties)
$property
#end
Modifier and Type | Method and Description |
---|---|
void |
addAlternative(Node aNode,
String aDefinitionName,
String aAlternativeName)
Add an alternative to a definition
|
Node |
getDefinition(Node aNode,
String aDefinitionName)
Gets a metadata definition as a
Node from a Node . |
Node |
getDefinition(Node aNode,
String aDefinitionName,
Node aDefaultValue)
Gets a metadata definition as a
Node from a Node with a fallback value if the definition does not exist. |
List<Node> |
getDefinitions(Node aNode)
Gets all metadata definitions available for the current user on a
Node |
void |
removeAlternative(Node aNode,
String aDefinitionName,
String aAlternativeName)
Remove an alternative from a definition
|
void |
renameAlternative(Node aNode,
String aDefinitionName,
String aAlternativeName,
String aNewAlternativeName)
Rename an alternative for a definition
|
Node getDefinition(Node aNode, String aDefinitionName)
Node
from a Node
.aNode
- the Node
that has a metadata definitionaDefinitionName
- the name of the metadata definitionaDefinitionName
as a Node
. If no definition exists or it is not a Node
, null
is returned.Node getDefinition(Node aNode, String aDefinitionName, Node aDefaultValue)
Node
from a Node
with a fallback value if the definition does not exist.aNode
- the Node
that has a metadata definitionaDefinitionName
- the name of the metadata definitionaDefaultValue
- fallback value if no definition existsaDefinitionName
as a Node
. If no definition exists or it is not a Node
,
aDefaultValue
is returned.List<Node> getDefinitions(Node aNode)
Node
aNode
- the Node
that has a metadata definitionaNode
, or empty listvoid addAlternative(Node aNode, String aDefinitionName, String aAlternativeName) throws RepositoryException
aNode
- the Node
where the metadata definition is locatedaDefinitionName
- the name of the metadata definition. May not be null
or whitespace onlyaAlternativeName
- the name of the alternative (case in-sensitive). May not be null
or whitespace onlyRepositoryException
- if aNode
is invalid,
if aNode
does not have a metadata definition named aDefinitionName
,
if it already contains an alternative named aAlternativeName
,
or if something else goes wrongvoid renameAlternative(Node aNode, String aDefinitionName, String aAlternativeName, String aNewAlternativeName) throws RepositoryException
aNode
- the Node
where the metadata definition is locatedaDefinitionName
- the name of the metadata definition. May not be null
or whitespace onlyaAlternativeName
- the name of the alternative (case in-sensitive). May not be null
or whitespace onlyaNewAlternativeName
- the new name of the alternative. May not be null
or whitespace onlyRepositoryException
- if aNode
is invalid,
if aNode
does not have a metadata definition named aDefinitionName
,
if it does not contain an alternative named aAlternativeName
,
if it already contains an alternative named aNewAlternativeName
,
or if something else goes wrongvoid removeAlternative(Node aNode, String aDefinitionName, String aAlternativeName) throws RepositoryException
aNode
- the Node
where the metadata definition is locatedaDefinitionName
- the name of the metadata definition. May not be null
or whitespace onlyaAlternativeName
- the name of the alternative (case in-sensitive). May not be null
or whitespace onlyRepositoryException
- if aNode
is invalid,
if aNode
does not have a metadata definition named aDefinitionName
,
if it does not contain an alternative named aAlternativeName
,
or if something else goes wrongSitevision - Portal and Content Management Made Easy
Sitevision is an advanced Java enterprise portal product and a portlet container (JSR 286) that implements Java Content Repository (JSR 283).
Copyright© 2008-2022 Sitevision AB, all rights reserved.