public class NameableNameGenerator<I extends Nameable> extends java.lang.Object implements NodeNameGenerator<I>
Nameable
items. The name and title can each have two variants,
depending on the node type of the parent node.
If the parent node is a folder-type node, the name
is generated as prefix.item-id
and the
title is the name of the item, eg. Nameable.getName()
.
If the parent node is an item-type node, the name is only the namePrefix and the title is the title prefix combined with the name of the item.
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
namePrefix |
private java.lang.String |
titlePrefix |
Constructor and Description |
---|
NameableNameGenerator(java.lang.String namePrefix,
java.lang.String titlePrefix)
Create a new name generator.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getDeniedNodeName(Node parentNode)
Generate a name for a node when the item exists, but
the current user doesn't have permission to access read
the item.
|
java.lang.String |
getDeniedNodeTitle(Node parentNode)
Generate a title for a node when the item exists, but
the current user doesn't have permission to access read
the item.
|
java.lang.String |
getMissingNodeName(Node parentNode)
Generate a name for a node when the item is missing.
|
java.lang.String |
getMissingNodeTitle(Node parentNode)
Generate a title for a node when the item is missing.
|
java.lang.String |
getNodeName(I item,
Node parentNode)
Generate a name for the new node that is about to be
created.
|
java.lang.String |
getNodeTitle(I item,
Node parentNode)
Generate a title for the new node that is about to be
created.
|
private java.lang.String namePrefix
private java.lang.String titlePrefix
public NameableNameGenerator(java.lang.String namePrefix, java.lang.String titlePrefix)
namePrefix
- The prefix to use in node namestitlePrefix
- The prefix to use in node titlespublic java.lang.String getNodeName(I item, Node parentNode)
NodeNameGenerator
getNodeName
in interface NodeNameGenerator<I extends Nameable>
item
- The item that is attached to the node (never null)parentNode
- The parent node of the new nodepublic java.lang.String getNodeTitle(I item, Node parentNode)
NodeNameGenerator
getNodeTitle
in interface NodeNameGenerator<I extends Nameable>
item
- The item that is attached to the node (never null)parentNode
- The parent node of the new nodepublic java.lang.String getDeniedNodeName(Node parentNode)
NodeNameGenerator
getDeniedNodeName
in interface NodeNameGenerator<I extends Nameable>
parentNode
- The parent nodepublic java.lang.String getDeniedNodeTitle(Node parentNode)
NodeNameGenerator
getDeniedNodeTitle
in interface NodeNameGenerator<I extends Nameable>
parentNode
- The parent nodepublic java.lang.String getMissingNodeName(Node parentNode)
NodeNameGenerator
getMissingNodeName
in interface NodeNameGenerator<I extends Nameable>
parentNode
- The parent nodepublic java.lang.String getMissingNodeTitle(Node parentNode)
NodeNameGenerator
getMissingNodeTitle
in interface NodeNameGenerator<I extends Nameable>
parentNode
- The parent node