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

java.lang.Object
  extended by com.atlassian.jira.imports.project.mapper.AbstractMapper
      extended by com.atlassian.jira.imports.project.mapper.CustomFieldMapper
All Implemented Interfaces:
ProjectImportIdMapper

@PublicApi
public class CustomFieldMapper
extends AbstractMapper
implements ProjectImportIdMapper

Mapper for Custom Fields. This Mapper collects information about which custom fields are "in-use" in the backup projects data. The mapper also records what the issue type is for the issue's which contain the custom field data.

Since:
v3.13

Constructor Summary
CustomFieldMapper()
           
 
Method Summary
 boolean equals(Object o)
           
 void flagIssueTypeInUse(String oldIssueId, String oldIssueTypeId)
          This method is called when we parse the entities.
 void flagValueAsRequired(String oldCustomFieldId, String oldIssueId)
          This method is called when we parse the entities.
 String getIssueTypeForIssue(String issueId)
          Get the issue type in use for the provided issue id.
 Collection getIssueTypeIdsForRequiredCustomField(String customFieldId)
          Will return a collection of issue type ids that are in use on issues that have values for the specified custom field id.
 int hashCode()
           
 void ignoreCustomField(String customFieldId)
           
 boolean isIgnoredCustomField(String customFieldId)
           
 void registerIssueTypesInUse()
          Associates issue types to custom fields.
 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.
 String toString()
           
 
Methods inherited from class com.atlassian.jira.imports.project.mapper.AbstractMapper
clearMappedValues, flagValueAsRequired, getAllMappedIds, getDisplayName, getKey, getMappedId, getRegisteredOldIds, getRequiredOldIds, getValuesFromImport, mapValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.atlassian.jira.imports.project.mapper.ProjectImportIdMapper
clearMappedValues, getAllMappedIds, getDisplayName, getKey, getMappedId, getRegisteredOldIds, getRequiredOldIds, getValuesFromImport, mapValue
 

Constructor Detail

CustomFieldMapper

public CustomFieldMapper()
Method Detail

getIssueTypeIdsForRequiredCustomField

public Collection getIssueTypeIdsForRequiredCustomField(String customFieldId)
Will return a collection of issue type ids that are in use on issues that have values for the specified custom field id.

Parameters:
customFieldId - the custom field id
Returns:
collection of issue type ids that are in use on issues that have values for the specified custom field id

flagValueAsRequired

public void flagValueAsRequired(String oldCustomFieldId,
                                String oldIssueId)
This method is called when we parse the entities. At this stage, we don't know what Issue Type the issue is, so we temporarily store a mapping of Issue IDs -> Custom Fields. Once the whole parse is done, the registerIssueTypesInUse() method should be called to associate issuetypes to custom fields.

Parameters:
oldCustomFieldId - The old CustomFieldId from the backup XML.
oldIssueId - The old issue ID from the backup XML.
See Also:
flagIssueTypeInUse(String, String)

flagIssueTypeInUse

public void flagIssueTypeInUse(String oldIssueId,
                               String oldIssueTypeId)
This method is called when we parse the entities. It simply populates the issueToIssueTypeCache for the registerIssueTypesInUse() method.

Parameters:
oldIssueId - The old issue ID from the backup XML.
oldIssueTypeId - The old issue type ID from the backup XML.
See Also:
flagValueAsRequired(String, String)

registerIssueTypesInUse

public void registerIssueTypesInUse()
Associates issue types to custom fields. This should be called after the parse of all entities is done to give all the custom field values (there may be more than just entities) a chance to register themselves.


registerOldValue

public void registerOldValue(String oldId,
                             String oldKey)
Description copied from class: AbstractMapper
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.

Overrides:
registerOldValue in class AbstractMapper
Parameters:
oldId - The ID of the required object from the import file.
oldKey - The unique key of the required object from the import file.

getIssueTypeForIssue

public String getIssueTypeForIssue(String issueId)
Get the issue type in use for the provided issue id.

Parameters:
issueId - the issue id whose issue type you want to find
Returns:
the "old" issue type id that is in use by the issue in the backup data, null if the issue type has not been flagged as in use by a custom field value.
See Also:
flagIssueTypeInUse(String, String)

isIgnoredCustomField

public boolean isIgnoredCustomField(String customFieldId)

ignoreCustomField

public void ignoreCustomField(String customFieldId)

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2002-2013 Atlassian. All Rights Reserved.