com.atlassian.jira.util
Class CustomMantisImportBean

java.lang.Object
  extended by com.atlassian.jira.util.MantisImportBean
      extended by com.atlassian.jira.util.CustomMantisImportBean

public class CustomMantisImportBean
extends MantisImportBean

A variant of the MantisImportBean meeting some special customer requirements:

  1. A log (/tmp/attachments.txt) is kept of where attachments are created.
  2. Normally, features will be set to priority 'major'. In this importer, features are set to a custom priority, 'Mantis - Feature'.
  3. JIRA usernames are derived from the email address (from 'joe.bloggs@foo.com', we get 'joe.bloggs').


Nested Class Summary
 
Nested classes/interfaces inherited from class com.atlassian.jira.util.MantisImportBean
MantisImportBean.DefaultMappingBean, MantisImportBean.MappingBean, MantisImportBean.UserRole
 
Field Summary
 
Fields inherited from class com.atlassian.jira.util.MantisImportBean
importLog, MANTIS_CF_TYPE_CHECKBOX, MANTIS_CF_TYPE_DATE, MANTIS_CF_TYPE_EMAIL, MANTIS_CF_TYPE_ENUM, MANTIS_CF_TYPE_FLOAT, MANTIS_CF_TYPE_LIST, MANTIS_CF_TYPE_MULTILIST, MANTIS_CF_TYPE_NUMERIC, MANTIS_CF_TYPE_STRING, MANTIS_ID_CF_NAME, MANTIS_ID_FORMAT, MANTIS_ID_TYPE, mantisToJiraCFSearcherMappings, mantisToJiraCFTypeMappings
 
Constructor Summary
CustomMantisImportBean(IssueIndexManager indexManager, org.ofbiz.core.entity.GenericDelegator genericDelegator, ProjectManager projectManager, PermissionSchemeManager permissionSchemeManager, CacheManager cacheManager, IssueManager issueManager, VersionManager versionManager, ProjectComponentManager projectComponentManager, CustomFieldManager customFieldManager, IssueTypeScreenSchemeManager issueTypeScreenSchemeManager, PermissionManager permissionManager, OptionsManager optionsManager, ExternalUtils externalUtils, CommentManager commentManager, IssueFactory issueFactory)
           
 
Method Summary
 void doImport(MantisImportBean.MappingBean mappingBean, DatabaseConnectionBean connectionBean, boolean enableNotifications, boolean reuseExistingUsers, boolean addToDevelopersGroup, boolean reindex, String[] projectNames, User importer)
          Main method of this bean.
protected  int getMantisFeaturePriority()
          In Mantis, 'features' are just 'bugs' with a priority of 'feature'.
protected  String getMantisUsername(ResultSet resultSet)
          "We would like to have all user names follow the name.lastname convention ("joe.bloggs") even when in Mantis they may use shortcuts ("joe").
protected  void logAttachmentLocation(String diskfile, File jiraAttachFile)
          Hook for recording which Mantis attachment filename maps to which JIRA attachment filename.
protected  void resetAttachmentLog()
           
 
Methods inherited from class com.atlassian.jira.util.MantisImportBean
cleanMantisFilename, closePS, createChangeHistory, createComponent, createFixForVersionAssociation, createMantisIdCustomFieldValue, createProject, createUser, createVersion, escapeMantisString, getAllMantisProjects, getFullNameFromEmail, getImportLog, getMantisIdFromString, getNonExistentAssociatedUsers, getProjectKey, getProjectList, importAttachments, importComments, importComponents, importIssue, importIssues, importProjects, importUser, importVersions, log, retrieveImportedIssues, rewriteMantisBuglinksInText
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CustomMantisImportBean

public CustomMantisImportBean(IssueIndexManager indexManager,
                              org.ofbiz.core.entity.GenericDelegator genericDelegator,
                              ProjectManager projectManager,
                              PermissionSchemeManager permissionSchemeManager,
                              CacheManager cacheManager,
                              IssueManager issueManager,
                              VersionManager versionManager,
                              ProjectComponentManager projectComponentManager,
                              CustomFieldManager customFieldManager,
                              IssueTypeScreenSchemeManager issueTypeScreenSchemeManager,
                              PermissionManager permissionManager,
                              OptionsManager optionsManager,
                              ExternalUtils externalUtils,
                              CommentManager commentManager,
                              IssueFactory issueFactory)
Method Detail

doImport

public void doImport(MantisImportBean.MappingBean mappingBean,
                     DatabaseConnectionBean connectionBean,
                     boolean enableNotifications,
                     boolean reuseExistingUsers,
                     boolean addToDevelopersGroup,
                     boolean reindex,
                     String[] projectNames,
                     User importer)
              throws Exception,
                     IndexException,
                     org.ofbiz.core.entity.GenericEntityException
Description copied from class: MantisImportBean
Main method of this bean. Creates JIRA projects mirroring those found in a Mantis database.

Overrides:
doImport in class MantisImportBean
Parameters:
mappingBean - Mappings from Mantis to JIRA, including project key, statuses, etc
enableNotifications - Whether to send email notifications for newly created issues
reuseExistingUsers - Do we try to reuse existing users, or doImport a unique user for every Mantis user?
addToDevelopersGroup - Whether to add new users to the 'jira-developers' group
reindex - Whether to reindex after the import
projectNames - Array of Mantis project names to import
importer - User doing the import
Throws:
Exception
IndexException
org.ofbiz.core.entity.GenericEntityException

getMantisFeaturePriority

protected int getMantisFeaturePriority()
Description copied from class: MantisImportBean
In Mantis, 'features' are just 'bugs' with a priority of 'feature'. In JIRA we have a separate 'Feature' entity, which needs to be assigned a priority. This method chooses that default priority.

Overrides:
getMantisFeaturePriority in class MantisImportBean

getMantisUsername

protected String getMantisUsername(ResultSet resultSet)
                            throws SQLException
"We would like to have all user names follow the name.lastname convention ("joe.bloggs") even when in Mantis they may use shortcuts ("joe"). This is important as we have an increasing number of Daves and Stephens !"

Overrides:
getMantisUsername in class MantisImportBean
Throws:
SQLException

logAttachmentLocation

protected void logAttachmentLocation(String diskfile,
                                     File jiraAttachFile)
                              throws IOException
Description copied from class: MantisImportBean
Hook for recording which Mantis attachment filename maps to which JIRA attachment filename.

Overrides:
logAttachmentLocation in class MantisImportBean
Throws:
IOException

resetAttachmentLog

protected void resetAttachmentLog()


Copyright © 2002-2007 Atlassian. All Rights Reserved.