org.itracker.services.util
Class ImportExportUtilities

java.lang.Object
  extended by org.itracker.services.util.ImportExportUtilities
All Implemented Interfaces:
ImportExportTags

public class ImportExportUtilities
extends Object
implements ImportExportTags

FIXME: This is not XML, this is string concatenating/parsing. Use proper SAX Handler or remove this unsave code. see java.xml.parsers for more information.

This class provides functionality needed to import and export issues and their associated data as XML. This xml provides all the data necessary to import the issues into another instance of ITracker or some other issue tracking tool.


Field Summary
static int IMPORT_STAT_FIELDS
           
static int IMPORT_STAT_ISSUES
           
static int IMPORT_STAT_NEW
           
static int IMPORT_STAT_PROJECTS
           
static int IMPORT_STAT_RESOLUTIONS
           
static int IMPORT_STAT_REUSED
           
static int IMPORT_STAT_SEVERITIES
           
static int IMPORT_STAT_STATUSES
           
static int IMPORT_STAT_USERS
           
 
Fields inherited from interface org.itracker.services.util.ImportExportTags
ATTR_BIT, ATTR_CREATOR_ID, ATTR_DATE, ATTR_ID, ATTR_NAME, ATTR_ORDER, ATTR_STATUS, ATTR_SYSTEMID, ATTR_VALUE, DATE_FORMATTER, EXPORT_LOCALE, EXPORT_LOCALE_STRING, TAG_COMPONENT, TAG_COMPONENT_DESCRIPTION, TAG_COMPONENT_ID, TAG_COMPONENT_NAME, TAG_COMPONENTS, TAG_CONFIGURATION, TAG_CONFIGURATION_VERSION, TAG_CREATE_DATE, TAG_CREATOR, TAG_CUSTOM_FIELD, TAG_CUSTOM_FIELD_DATEFORMAT, TAG_CUSTOM_FIELD_LABEL, TAG_CUSTOM_FIELD_OPTION, TAG_CUSTOM_FIELD_REQUIRED, TAG_CUSTOM_FIELD_SORTOPTIONS, TAG_CUSTOM_FIELD_TYPE, TAG_CUSTOM_FIELDS, TAG_EMAIL, TAG_FIRST_NAME, TAG_HISTORY_ENTRY, TAG_ISSUE, TAG_ISSUE_ATTACHMENT, TAG_ISSUE_ATTACHMENT_CREATOR, TAG_ISSUE_ATTACHMENT_DESCRIPTION, TAG_ISSUE_ATTACHMENT_FILENAME, TAG_ISSUE_ATTACHMENT_ORIGFILE, TAG_ISSUE_ATTACHMENT_SIZE, TAG_ISSUE_ATTACHMENT_TYPE, TAG_ISSUE_ATTACHMENTS, TAG_ISSUE_COMPONENTS, TAG_ISSUE_DESCRIPTION, TAG_ISSUE_FIELD, TAG_ISSUE_FIELDS, TAG_ISSUE_HISTORY, TAG_ISSUE_PROJECT, TAG_ISSUE_RESOLUTION, TAG_ISSUE_SEVERITY, TAG_ISSUE_STATUS, TAG_ISSUE_VERSIONS, TAG_ISSUES, TAG_LAST_MODIFIED, TAG_LAST_NAME, TAG_LOGIN, TAG_OWNER, TAG_PROJECT, TAG_PROJECT_DESCRIPTION, TAG_PROJECT_FIELD_ID, TAG_PROJECT_FIELDS, TAG_PROJECT_NAME, TAG_PROJECT_OPTIONS, TAG_PROJECT_OWNER_ID, TAG_PROJECT_OWNERS, TAG_PROJECT_STATUS, TAG_PROJECTS, TAG_RESOLUTION, TAG_RESOLUTIONS, TAG_ROOT, TAG_SEVERITIES, TAG_SEVERITY, TAG_STATUS, TAG_STATUSES, TAG_SUPER_USER, TAG_TARGET_VERSION_ID, TAG_USER, TAG_USER_STATUS, TAG_USERS, TAG_VERSION, TAG_VERSION_DESCRIPTION, TAG_VERSION_ID, TAG_VERSION_NUMBER, TAG_VERSIONS
 
Constructor Summary
ImportExportUtilities()
           
 
Method Summary
static void export(AbstractEntity o, OutputStream os)
           
static String exportIssues(List<Issue> issues, SystemConfiguration config)
          Takes an array of IssueModels and exports them as XML suitable for import into another instance of ITracker, or another issue tracking tool.
static String exportModel(AbstractEntity abstractBean)
          Returns the appropriate XML block for a given model.
static String getConfigurationXML(SystemConfiguration config)
          Generates an XML block that encapsulates the system configuration for import or export.
static String getIssueXML(Issue issue)
          Generates an XML block that encapsulates an issue for import or export.
static String getProjectXML(Project project)
          Generates an XML block that encapsulates a project for import or export.
static String getUserXML(User user)
          Generates an XML block that encapsulates a user for import or export.
static AbstractEntity[] importIssues(String xml)
          Takes an XML file matching the ITracker import/export DTD and returns an array of AbstractBean objects.
static AbstractEntity importXml(InputSource is)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IMPORT_STAT_NEW

public static final int IMPORT_STAT_NEW
See Also:
Constant Field Values

IMPORT_STAT_REUSED

public static final int IMPORT_STAT_REUSED
See Also:
Constant Field Values

IMPORT_STAT_USERS

public static final int IMPORT_STAT_USERS
See Also:
Constant Field Values

IMPORT_STAT_PROJECTS

public static final int IMPORT_STAT_PROJECTS
See Also:
Constant Field Values

IMPORT_STAT_ISSUES

public static final int IMPORT_STAT_ISSUES
See Also:
Constant Field Values

IMPORT_STAT_STATUSES

public static final int IMPORT_STAT_STATUSES
See Also:
Constant Field Values

IMPORT_STAT_SEVERITIES

public static final int IMPORT_STAT_SEVERITIES
See Also:
Constant Field Values

IMPORT_STAT_RESOLUTIONS

public static final int IMPORT_STAT_RESOLUTIONS
See Also:
Constant Field Values

IMPORT_STAT_FIELDS

public static final int IMPORT_STAT_FIELDS
See Also:
Constant Field Values
Constructor Detail

ImportExportUtilities

public ImportExportUtilities()
Method Detail

importIssues

public static AbstractEntity[] importIssues(String xml)
                                     throws ImportExportException
Takes an XML file matching the ITracker import/export DTD and returns an array of AbstractBean objects. The array will contain all of the projects, components versions, users, custom fields, and issues contained in the XML.

Parameters:
xml - an xml string to import
Throws:
ImportExportException - thrown if the xml can not be parsed into the appropriate objects

importXml

public static AbstractEntity importXml(InputSource is)
                                throws Exception
Throws:
Exception

export

public static void export(AbstractEntity o,
                          OutputStream os)
                   throws Exception
Throws:
Exception

exportIssues

public static String exportIssues(List<Issue> issues,
                                  SystemConfiguration config)
                           throws ImportExportException
Takes an array of IssueModels and exports them as XML suitable for import into another instance of ITracker, or another issue tracking tool.

Parameters:
issues - an array of Issue objects to export
Throws:
ImportExportException - thrown if the array of issues can not be exported

exportModel

public static String exportModel(AbstractEntity abstractBean)
                          throws ImportExportException
Returns the appropriate XML block for a given model.

Parameters:
model - a model that extends AbstractBean
Throws:
ImportExportException - thrown if the given model can not be exported

getIssueXML

public static String getIssueXML(Issue issue)
Generates an XML block that encapsulates an issue for import or export. This function will not generate the XML for other models needed for a complete import or export.

Parameters:
issue - an Issue to generate the XML for
Returns:
a String containing the XML for the issue

getProjectXML

public static String getProjectXML(Project project)
Generates an XML block that encapsulates a project for import or export. This function will not generate the XML for other models needed for a complete import or export.

Parameters:
project - a Project to generate the XML for
Returns:
a String containing the XML for the project

getUserXML

public static String getUserXML(User user)
Generates an XML block that encapsulates a user for import or export. This function will not generate the XML for other models needed for a complete import or export.

Parameters:
user - a User to generate the XML for
Returns:
a String containing the XML for the user

getConfigurationXML

public static String getConfigurationXML(SystemConfiguration config)
Generates an XML block that encapsulates the system configuration for import or export. This function will not generate the XML for other models needed for a complete import or export.

Parameters:
user - a SystemConfiguration to generate the XML for
Returns:
a String containing the XML for the configuration


Copyright © 2002-2012 itracker. All Rights Reserved.