com.ibm.portal.model.controller.context
Interface UniqueNameStrategy


public interface UniqueNameStrategy

A UniqueNameStrategy encapsulates algorithms for how unique names on nodes will be set within a controller.

This interface provides some default implementations that can be used. For all other cases an own implementation has to be provided.

A typical own implementation might for example choose to add a prefix or a suffix to the copied nodes, e. g. when a node with uniquename foo is copied the new node should get the unique name new_foo. Method getTargetUniqueName(String) could then be implemented as follows:

 public class MyUniqueNameStrategy implements UniqueNameStrategy {
    ...
    private static final String PREFIX = "new_";
    ...
    public String getTargetUniqueName(final String uniquename) {
       final StringBuilder sb = new StringBuilder(uniquename.length() + 4);
       sb.append(PREFIX);
       sb.append(uniquename);
       return sb.toString();
    }
    ...
 };
 

Since:
6.1.0.1
See Also:
ContentNodeCopyCreationContext
Note:
This interface is designed to be implemented by clients.

Field Summary
static UniqueNameStrategy IDENTITY
          Unique name strategy that returns the source node's unique name as the target's node unique node.
static UniqueNameStrategy NULL
          Unique name strategy that does not return a target unique name.
 
Method Summary
 java.lang.String getTargetUniqueName(java.lang.String uniquename)
          Retrieve the target unique name depending
 

Field Detail

IDENTITY

static final UniqueNameStrategy IDENTITY
Unique name strategy that returns the source node's unique name as the target's node unique node. In other words this strategy performs an identity transformation.


NULL

static final UniqueNameStrategy NULL
Unique name strategy that does not return a target unique name. As a consequence the new (copied) nodes will not get a unique name.

Method Detail

getTargetUniqueName

java.lang.String getTargetUniqueName(java.lang.String uniquename)
Retrieve the target unique name depending

Parameters:
uniquename - the input unique name of the template node which is to be copied, may be null in case when the template node did not have a unique name.
Returns:
The unique name of the new node. Returns null if the new node should not have a unique name.