Class NameHelper
java.lang.Object
org.ametys.plugins.repository.jcr.NameHelper
Helper for implementing
TraversableAmetysObject
stored in JCR.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Mode of computation for the name if it already exists in JCR. -
Method Summary
Modifier and TypeMethodDescriptionstatic String
filterName
(String name) Filter a name for using it into an URI.static String
getUniqueAmetysObjectName
(TraversableAmetysObject parent, String baseName) Get a unique child ametys object name under a traversable ametys object.static String
getUniqueAmetysObjectName
(TraversableAmetysObject parent, String baseName, NameHelper.NameComputationMode computationMode, boolean mayBeSuffixed) Get a unique child ametys object name under a traversable ametys object.
-
Method Details
-
filterName
Filter a name for using it into an URI.- Parameters:
name
- the name to filter.- Returns:
- the name filtered.
-
getUniqueAmetysObjectName
Get a unique child ametys object name under a traversable ametys object. Default parameters: Incremental mode, may not be suffixed. The name is filtered and suffixed if necessary. If a suffix is already present, it is removed to be replaced by another one.- Parameters:
parent
- The parentbaseName
- The base name- Returns:
- A unique ametys object name (for the given parent)
-
getUniqueAmetysObjectName
public static String getUniqueAmetysObjectName(TraversableAmetysObject parent, String baseName, NameHelper.NameComputationMode computationMode, boolean mayBeSuffixed) Get a unique child ametys object name under a traversable ametys object. The name is filtered and suffixed if necessary. If a suffix is already present, it is removed to be replaced by another one.- Parameters:
parent
- The parentbaseName
- The base namecomputationMode
- The computation mode of the name: incremental (old method) or generated keymayBeSuffixed
-true
to consider that the given base name may already contains a suffix, it will be removed if needed- Returns:
- A unique ametys object name (for the given parent)
-