Class DefaultNodeNameGenerator
java.lang.Object
org.apache.sling.servlets.post.impl.helper.DefaultNodeNameGenerator
- All Implemented Interfaces:
NodeNameGenerator
Generates a node name based on a set of well-known request parameters
like title, description, etc.
See SLING-128.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetNodeName
(SlingHttpServletRequest request, String basePath, boolean requirePrefix, NodeNameGenerator defaultNodeNameGenerator) Get a "nice" node name, if possible, based on given requestprotected String
getValueToUse
(RequestParameterMap parameters, String paramName) Determine the value to use for the specified parameter.int
-
Field Details
-
DEFAULT_MAX_NAME_LENGTH
public static final int DEFAULT_MAX_NAME_LENGTH- See Also:
-
-
Constructor Details
-
DefaultNodeNameGenerator
public DefaultNodeNameGenerator() -
DefaultNodeNameGenerator
-
-
Method Details
-
getValueToUse
Determine the value to use for the specified parameter. This also considers the parameter with aSlingPostConstants.VALUE_FROM_SUFFIX
- Parameters:
parameters
- the map of request parametersparamName
- the parameter to get the value for- Returns:
- the value to use for the parameter or null if it could not be determined
-
getNodeName
public String getNodeName(SlingHttpServletRequest request, String basePath, boolean requirePrefix, NodeNameGenerator defaultNodeNameGenerator) Get a "nice" node name, if possible, based on given request- Specified by:
getNodeName
in interfaceNodeNameGenerator
- Parameters:
request
- the requestbasePath
- the base pathrequirePrefix
-true
if the parameter names for properties requires a prefixdefaultNodeNameGenerator
- a default generator- Returns:
- a nice node name
-
nextCounter
public int nextCounter()
-