com.atlassian.jira.imports.project.mapper
Class AbstractMapper

java.lang.Object
  extended by com.atlassian.jira.imports.project.mapper.AbstractMapper
All Implemented Interfaces:
ProjectImportIdMapper
Direct Known Subclasses:
CustomFieldMapper, CustomFieldOptionMapper, IssueLinkTypeMapper, IssueTypeMapper, SimpleProjectImportIdMapperImpl, StatusMapper, UserMapper

public abstract class AbstractMapper
extends Object
implements ProjectImportIdMapper

Abstract mapper that will manage most of the generic data for mappers. Complicated mappers can extend this abstract class and provide public methods with required method signatures, which then maintain their special data and pass standard data to this mapper with the protected methods.

Since:
v3.13

Constructor Summary
AbstractMapper()
           
 
Method Summary
 void clearMappedValues()
          This will clear any mapped data that may have been entered into the mappers.
protected  void flagValueAsRequired(String oldId)
          This is an internal method for use by Mappers extending AbstractMapper and should not be called from other classes.
 Collection<String> getAllMappedIds()
          Returns a Collection of all the new IDs that are mapped to.
 String getDisplayName(String oldId)
          Returns a display name for the given old ID.
 String getKey(String oldId)
          Returns the registered "key" for the given old ID, or null if none is registered.
 String getMappedId(String oldId)
          Retrieves a String that corresponds to the id in the target JIRA system, null if none has been mapped.
 Collection<String> getRegisteredOldIds()
          Returns a collection of ID's as String objects identifying all objects of the appropriate type found in the import file.
 Collection<String> getRequiredOldIds()
          Returns a collection of ID's as String objects identifying objects from the import file that are required for the import.
 Collection<IdKeyPair> getValuesFromImport()
          Deprecated. Use getRegisteredOldIds(). Since 5.0
 void mapValue(String oldId, String newId)
          This method maps a value from the backup system to a valid value in the target system.
protected  void registerOldValue(String oldId, String oldKey)
          This is an internal method for use by Mappers extending AbstractMapper and should not be called from other classes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractMapper

public AbstractMapper()
Method Detail

getRequiredOldIds

public Collection<String> getRequiredOldIds()
Description copied from interface: ProjectImportIdMapper
Returns a collection of ID's as String objects identifying objects from the import file that are required for the import.

Specified by:
getRequiredOldIds in interface ProjectImportIdMapper
Returns:
a collection of ID's as String objects identifying objects from the import file that are required for the import.

getRegisteredOldIds

public Collection<String> getRegisteredOldIds()
Description copied from interface: ProjectImportIdMapper
Returns a collection of ID's as String objects identifying all objects of the appropriate type found in the import file. Note that that this should normally be a super set of the "required" ID's. Each of these ID's will have a unique key associated with it that can be used for mapping old ID's in the import file to "new" ID's in the current JIRA system. You can use the ProjectImportIdMapper.getKey(String) method to extract this key.

Specified by:
getRegisteredOldIds in interface ProjectImportIdMapper
Returns:
a collection of ID's as String objects identifying all objects of the appropriate type found in the import file.
See Also:
ProjectImportIdMapper.getRequiredOldIds(), ProjectImportIdMapper.getKey(String)

flagValueAsRequired

protected void flagValueAsRequired(String oldId)
This is an internal method for use by Mappers extending AbstractMapper and should not be called from other classes. MapperHandlers should call the public method specific to the concrete class they use.

Parameters:
oldId - The ID of the required object from the import file.

mapValue

public void mapValue(String oldId,
                     String newId)
Description copied from interface: ProjectImportIdMapper
This method maps a value from the backup system to a valid value in the target system.

Specified by:
mapValue in interface ProjectImportIdMapper
Parameters:
oldId - the string representation of the id of the backup value.
newId - the string representation of the id of the valid mapped value in the target system.

getMappedId

public String getMappedId(String oldId)
Description copied from interface: ProjectImportIdMapper
Retrieves a String that corresponds to the id in the target JIRA system, null if none has been mapped.

Specified by:
getMappedId in interface ProjectImportIdMapper
Parameters:
oldId - identifies the mapping we are looking for.
Returns:
String that corresponds to the id in the target JIRA system, null if none has been mapped.

getAllMappedIds

public Collection<String> getAllMappedIds()
Description copied from interface: ProjectImportIdMapper
Returns a Collection of all the new IDs that are mapped to.

Specified by:
getAllMappedIds in interface ProjectImportIdMapper
Returns:
a Collection of all the new IDs that are mapped to.

registerOldValue

protected void registerOldValue(String oldId,
                                String oldKey)
This is an internal method for use by Mappers extending AbstractMapper and should not be called from other classes. MapperHandlers should call the public method specific to the concrete class they use.

Parameters:
oldId - The ID of the required object from the import file.
oldKey - The unique key of the required object from the import file.

getDisplayName

public String getDisplayName(String oldId)
Description copied from interface: ProjectImportIdMapper
Returns a display name for the given old ID. This will normally be the registered key for that ID, but if no key was registered we return the ID in square brackets (eg "[1234]").

Specified by:
getDisplayName in interface ProjectImportIdMapper
Parameters:
oldId - The old ID.
Returns:
a display name for the given old ID.
See Also:
ProjectImportIdMapper.getKey(String)

getKey

public String getKey(String oldId)
Description copied from interface: ProjectImportIdMapper
Returns the registered "key" for the given old ID, or null if none is registered. This is the unique "name" that will be used for automatic mapping of objects in the import file to the objects in the current JIRA system.

Specified by:
getKey in interface ProjectImportIdMapper
Parameters:
oldId - The old ID.
Returns:
the registered "key" for the given old ID, or null if none is registered.
See Also:
ProjectImportIdMapper.getDisplayName(String), ProjectImportIdMapper.getRegisteredOldIds()

getValuesFromImport

@Deprecated
public Collection<IdKeyPair> getValuesFromImport()
Deprecated. Use getRegisteredOldIds(). Since 5.0

Returns a collection of IdKeyPair representing objects from the import file.

Specified by:
getValuesFromImport in interface ProjectImportIdMapper
Returns:
a collection of IdKeyPair representing objects from the import file.
See Also:
IdKeyPair

clearMappedValues

public void clearMappedValues()
Description copied from interface: ProjectImportIdMapper
This will clear any mapped data that may have been entered into the mappers. All registered values and values that have been flagged as required will not be changed. This method only affects the mapped data. It is used to re-map and re-validate the data after the user has made changes to the current configuration.

Specified by:
clearMappedValues in interface ProjectImportIdMapper


Copyright © 2002-2012 Atlassian. All Rights Reserved.