org.tm4j.topicmap.utils
Interface IDMappingStrategy

All Known Implementing Classes:
SimpleIDMappingStrategy

public interface IDMappingStrategy

This strategy interface is used by the TopicMapCopier object to determine how to map an ID value for a source object to the ID value to be assigned to the copied object. The object implementing this interface is also responsible for keeping track of the relationship between source and destination objects.


Method Summary
 java.lang.String generateID(java.lang.String sourceID, TopicMap destinationTM)
          This method is invoked to generate an ID for the destination object of a copy.
 java.lang.String getSourceID(java.lang.String destID)
          Returns the ID of the source TopicMapObject which was mapped to destID by the generateID()method.
 

Method Detail

generateID

public java.lang.String generateID(java.lang.String sourceID,
                                   TopicMap destinationTM)
                            throws TopicMapProcessingException
This method is invoked to generate an ID for the destination object of a copy.

Parameters:
sourceID - The ID of the source object being copied.
destinationTM - The TopicMap into which the destination object will be copied.
Returns:
The ID to be assigned to the destination object.
Throws:
TopicMapProcessingException - if the mapping cannot be achieved for some reason.

getSourceID

public java.lang.String getSourceID(java.lang.String destID)
Returns the ID of the source TopicMapObject which was mapped to destID by the generateID()method.

Parameters:
destID - The ID of the destination object of the copy
Returns:
The ID of the source object from which the destination ID was generated. Returns null if there is no such mapping.