|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.jira.util.MantisImportBean
public class MantisImportBean
Mantis importer.
Nested Class Summary | |
---|---|
static class |
MantisImportBean.DefaultMappingBean
Class mapping Mantis ids (see lang/strings_english.txt in the Mantis source) to JIRA IDs |
protected static interface |
MantisImportBean.MappingBean
|
static class |
MantisImportBean.UserRole
|
Field Summary | |
---|---|
static Integer |
MANTIS_CF_TYPE_CHECKBOX
|
static Integer |
MANTIS_CF_TYPE_DATE
|
static Integer |
MANTIS_CF_TYPE_EMAIL
|
static Integer |
MANTIS_CF_TYPE_ENUM
|
static Integer |
MANTIS_CF_TYPE_FLOAT
|
static Integer |
MANTIS_CF_TYPE_LIST
|
static Integer |
MANTIS_CF_TYPE_MULTILIST
|
static Integer |
MANTIS_CF_TYPE_NUMERIC
|
static Integer |
MANTIS_CF_TYPE_STRING
|
static String |
MANTIS_ID_CF_NAME
|
static DecimalFormat |
MANTIS_ID_FORMAT
|
static String |
MANTIS_ID_TYPE
|
static Map |
MANTIS_TO_JIRA_CF_SEARCHER_MAPPINGS
Mapping from Mantis custom field types (Integers) to JIRA custom field searchers (Strings). |
static Map |
MANTIS_TO_JIRA_CF_TYPE_MAPPINGS
Mapping from Mantis custom field types (Integers) to JIRA custom field types (Strings). |
Constructor Summary | |
---|---|
MantisImportBean(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,
ProjectService projectService,
UserUtil userUtil)
|
Method Summary | |
---|---|
String |
cleanMantisFilename(String filename)
Return a clean filename from Mantis |
protected static void |
closePS(PreparedStatement ps)
|
protected void |
createChangeHistory(int bug_id,
org.ofbiz.core.entity.GenericValue issue)
Store the original mantis bug id in the change history. |
protected boolean |
createComponent(String projectName,
String componentName,
String description)
|
protected void |
createMantisIdCustomFieldValue(int bug_id,
org.ofbiz.core.entity.GenericValue issue)
|
protected boolean |
createProject(String product,
String description)
|
protected User |
createUser(String mantisEmail,
String mantisUsername,
int mantisUserid,
String fullName,
String password)
|
protected boolean |
createVersion(String project,
String versionName)
|
void |
doImport(MantisImportBean.MappingBean mappingBean,
DatabaseConnectionBean connectionBean,
boolean enableNotifications,
boolean reuseExistingUsers,
boolean addToDevelopersGroup,
boolean reindex,
String[] projectNames,
User importer)
Main method of this bean. |
String |
escapeMantisString(String str)
|
static Map |
getAllMantisProjects(DatabaseConnectionBean connectionBean)
Get a map of available Mantis projects and their id's. |
String |
getFullNameFromEmail(String email,
String username)
Infers the user's full name from other information. |
String |
getImportLog()
|
protected int |
getMantisFeaturePriority()
In Mantis, 'features' are just 'bugs' with a priority of 'feature'. |
Integer |
getMantisIdFromString(String s)
Return an integer prefix of a string, if any. |
protected String |
getMantisUsername(ResultSet resultSet)
Return a JIRA username from a row in the Mantis user table. |
Set |
getNonExistentAssociatedUsers(DatabaseConnectionBean connectionBean,
String[] projectNames)
This method will determine all the users that will need to exist in JIRA to successfully import the specified projects and will return the users that do not yet exist. |
String |
getProjectKey(String name)
|
String |
getProjectList(String[] selectList)
Generate SQL-friendly quoted comma-separated list of projects. |
protected void |
importAttachments(Connection conn,
PreparedStatement attachPrepStatement,
int bug_id,
org.ofbiz.core.entity.GenericValue issue)
|
protected void |
importComments(Connection conn,
int bug_id,
org.ofbiz.core.entity.GenericValue issue)
|
protected void |
importComponents(Connection conn,
String projectName,
int projectId)
|
protected org.ofbiz.core.entity.GenericValue |
importIssue(ResultSet resultSet,
Connection conn,
ResultSet textResultSet,
String projectName)
Import an issue from Mantis |
protected void |
importIssues(Connection conn,
String projectName,
int projectId)
|
protected void |
importProjects(Connection conn,
String[] selectedProjects,
String selectedProjectsDisplay)
|
protected void |
importUser(Connection conn,
int mantisId)
|
protected void |
importVersions(Connection conn,
String projectName,
int projectId)
|
protected void |
log(String s)
|
protected void |
logAttachmentLocation(String diskfile,
File jiraAttachFile)
Hook for recording which Mantis attachment filename maps to which JIRA attachment filename. |
protected Map |
retrieveImportedIssues()
Return a map of mantisKey (Integer) -> Jira Issues Id (Integer). |
String |
rewriteMantisBuglinksInText(String str)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Integer MANTIS_CF_TYPE_STRING
public static final Integer MANTIS_CF_TYPE_NUMERIC
public static final Integer MANTIS_CF_TYPE_FLOAT
public static final Integer MANTIS_CF_TYPE_ENUM
public static final Integer MANTIS_CF_TYPE_EMAIL
public static final Integer MANTIS_CF_TYPE_CHECKBOX
public static final Integer MANTIS_CF_TYPE_LIST
public static final Integer MANTIS_CF_TYPE_MULTILIST
public static final Integer MANTIS_CF_TYPE_DATE
public static final Map MANTIS_TO_JIRA_CF_TYPE_MAPPINGS
public static final Map MANTIS_TO_JIRA_CF_SEARCHER_MAPPINGS
public static final String MANTIS_ID_CF_NAME
public static final DecimalFormat MANTIS_ID_FORMAT
public static final String MANTIS_ID_TYPE
Constructor Detail |
---|
public MantisImportBean(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, ProjectService projectService, UserUtil userUtil)
Method Detail |
---|
public static Map getAllMantisProjects(DatabaseConnectionBean connectionBean) throws SQLException
connectionBean
- connection bean
SQLException
- if database problem occurspublic 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
mappingBean
- Mappings from Mantis to JIRA, including project key, statuses, etcenableNotifications
- Whether to send email notifications for newly created issuesreuseExistingUsers
- 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' groupreindex
- Whether to reindex after the importprojectNames
- Array of Mantis project names to importimporter
- User doing the import
Exception
IndexException
org.ofbiz.core.entity.GenericEntityException
public Set getNonExistentAssociatedUsers(DatabaseConnectionBean connectionBean, String[] projectNames)
connectionBean
- initialized connection beanprojectNames
- the projects, by bugzilla project name, that you want to import.
public String getProjectList(String[] selectList)
protected void importIssues(Connection conn, String projectName, int projectId) throws Exception, com.opensymphony.workflow.InvalidRoleException, com.opensymphony.workflow.InvalidInputException, CreateException, SQLException
Exception
com.opensymphony.workflow.InvalidRoleException
com.opensymphony.workflow.InvalidInputException
CreateException
SQLException
protected org.ofbiz.core.entity.GenericValue importIssue(ResultSet resultSet, Connection conn, ResultSet textResultSet, String projectName) throws Exception, com.opensymphony.workflow.InvalidRoleException, com.opensymphony.workflow.InvalidInputException, CreateException, SQLException
resultSet
- mantis_bug_table rowconn
- JDBC ConnectiontextResultSet
- mantis_bug_text_table rowprojectName
- Name of issue's project
Exception
com.opensymphony.workflow.InvalidRoleException
com.opensymphony.workflow.InvalidInputException
CreateException
SQLException
protected int getMantisFeaturePriority()
public String escapeMantisString(String str)
public String rewriteMantisBuglinksInText(String str)
public Integer getMantisIdFromString(String s)
protected void importComments(Connection conn, int bug_id, org.ofbiz.core.entity.GenericValue issue) throws Exception, org.ofbiz.core.entity.GenericEntityException
Exception
org.ofbiz.core.entity.GenericEntityException
protected void createChangeHistory(int bug_id, org.ofbiz.core.entity.GenericValue issue) throws Exception
Exception
protected void createMantisIdCustomFieldValue(int bug_id, org.ofbiz.core.entity.GenericValue issue) throws Exception
Exception
protected Map retrieveImportedIssues() throws org.ofbiz.core.entity.GenericEntityException
org.ofbiz.core.entity.GenericEntityException
protected void importComponents(Connection conn, String projectName, int projectId) throws SQLException, org.ofbiz.core.entity.GenericEntityException
SQLException
org.ofbiz.core.entity.GenericEntityException
protected boolean createComponent(String projectName, String componentName, String description) throws org.ofbiz.core.entity.GenericEntityException
org.ofbiz.core.entity.GenericEntityException
protected void importVersions(Connection conn, String projectName, int projectId) throws SQLException, org.ofbiz.core.entity.GenericEntityException
SQLException
org.ofbiz.core.entity.GenericEntityException
protected boolean createVersion(String project, String versionName) throws org.ofbiz.core.entity.GenericEntityException
org.ofbiz.core.entity.GenericEntityException
protected void importProjects(Connection conn, String[] selectedProjects, String selectedProjectsDisplay) throws Exception, org.ofbiz.core.entity.GenericEntityException, com.opensymphony.workflow.InvalidInputException
Exception
org.ofbiz.core.entity.GenericEntityException
com.opensymphony.workflow.InvalidInputException
protected boolean createProject(String product, String description) throws org.ofbiz.core.entity.GenericEntityException
org.ofbiz.core.entity.GenericEntityException
protected void importUser(Connection conn, int mantisId) throws SQLException
SQLException
protected String getMantisUsername(ResultSet resultSet) throws SQLException
CustomMantisImportBean
for an example.
SQLException
protected User createUser(String mantisEmail, String mantisUsername, int mantisUserid, String fullName, String password)
protected void importAttachments(Connection conn, PreparedStatement attachPrepStatement, int bug_id, org.ofbiz.core.entity.GenericValue issue) throws Exception
Exception
public String cleanMantisFilename(String filename)
protected void logAttachmentLocation(String diskfile, File jiraAttachFile) throws IOException
IOException
public String getProjectKey(String name)
public String getFullNameFromEmail(String email, String username)
protected void log(String s)
protected static void closePS(PreparedStatement ps)
public String getImportLog()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |