com.atlassian.jira.imports.project.core
Class ProjectImportResultsImpl

java.lang.Object
  extended by com.atlassian.jira.imports.project.core.ProjectImportResultsImpl
All Implemented Interfaces:
ProjectImportResults

public class ProjectImportResultsImpl
extends Object
implements ProjectImportResults

Since:
v3.13

Constructor Summary
ProjectImportResultsImpl(long startTime, int expectedIssuesCreatedCount, int expectedUsersCreatedCount, int expectedAttachmentsCreatedCount, I18nHelper i18n)
           
 
Method Summary
 boolean abortImport()
          Returns false if the number of allowed errors have been exceeded, true otherwise
 void addError(String error)
          Adds the given Error message to the error list.
 int getAttachmentsCreatedCount()
          Returns the number of created attachments.
 List<String> getErrors()
          Returns a list of all the errors that were added to this result object.
 int getExpectedAttachmentsCreatedCount()
          Returns the number of attachments the import expected it could create before doing the actual import.
 int getExpectedIssuesCreatedCount()
          Returns the number of issues the import expected it could create before doing the actual import.
 int getExpectedUsersCreatedCount()
          Returns the number of users the import expected it could create before doing the actual import.
 int getGroupsCreatedCountForRole(String roleName)
          Returns the count of all groups added to the specified role
 I18nHelper getI18n()
          Returns the I18nHelper associated with this Project Import.
 long getImportDuration()
          This uses the start time and the end time to determine how long the actual import took.
 Project getImportedProject()
          Returns the created/updated project that the import imported into.
 int getIssuesCreatedCount()
          Returns the number of created issues.
 Collection<String> getRoles()
          Returns the role names of all roles that have had a group or user added to it.
 int getUsersCreatedCount()
          Returns the number of created users.
 int getUsersCreatedCountForRole(String roleName)
          Returns the count of all users added to the specified role
 void incrementAttachmentsCreatedCount()
          Adds to the count of created attachments.
 void incrementIssuesCreatedCount()
          Adds to the count of created issues.
 void incrementRoleGroupCreatedCount(String roleName)
          Should be called to increment the count of groups added to a specific role.
 void incrementRoleUserCreatedCount(String roleName)
          Should be called to increment the count of users added to a specific role.
 void incrementUsersCreatedCount()
          Adds to the count of created users.
 boolean isImportCompleted()
          Returns true if the import completed all steps of the import, false otherwise.
 void setEndTime(long endTime)
          The time, as milliseconds, that the import ended.
 void setImportCompleted(boolean importCompleted)
          Should be called with true if all steps of the import were able to proceed (i.e.
 void setImportedProject(Project importedProject)
          Sets the imported project, this is the project that exists in JIRA.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProjectImportResultsImpl

public ProjectImportResultsImpl(long startTime,
                                int expectedIssuesCreatedCount,
                                int expectedUsersCreatedCount,
                                int expectedAttachmentsCreatedCount,
                                I18nHelper i18n)
Method Detail

getImportDuration

public long getImportDuration()
Description copied from interface: ProjectImportResults
This uses the start time and the end time to determine how long the actual import took.

Specified by:
getImportDuration in interface ProjectImportResults
Returns:
number of milliseconds the import took to run.
See Also:
ProjectImportResults.setEndTime(long)

setEndTime

public void setEndTime(long endTime)
Description copied from interface: ProjectImportResults
The time, as milliseconds, that the import ended. This must be set in order to get the import duration.

Specified by:
setEndTime in interface ProjectImportResults
Parameters:
endTime - the time the import has stopped in milliseconds
See Also:
ProjectImportResults.getImportDuration()

incrementRoleUserCreatedCount

public void incrementRoleUserCreatedCount(String roleName)
Description copied from interface: ProjectImportResults
Should be called to increment the count of users added to a specific role.

Specified by:
incrementRoleUserCreatedCount in interface ProjectImportResults
Parameters:
roleName - uniquely identifies the project role by its human readable name, this should not be the role id.
See Also:
ProjectImportResults.getUsersCreatedCountForRole(String), ProjectImportResults.incrementRoleGroupCreatedCount(String)

incrementRoleGroupCreatedCount

public void incrementRoleGroupCreatedCount(String roleName)
Description copied from interface: ProjectImportResults
Should be called to increment the count of groups added to a specific role.

Specified by:
incrementRoleGroupCreatedCount in interface ProjectImportResults
Parameters:
roleName - uniquely identifies the project role by its human readable name, this should not be the role id.
See Also:
ProjectImportResults.getGroupsCreatedCountForRole(String), ProjectImportResults.incrementRoleUserCreatedCount(String)

getRoles

public Collection<String> getRoles()
Description copied from interface: ProjectImportResults
Returns the role names of all roles that have had a group or user added to it.

Specified by:
getRoles in interface ProjectImportResults
Returns:
the role names of all roles that have had a group or user added to it.

getGroupsCreatedCountForRole

public int getGroupsCreatedCountForRole(String roleName)
Description copied from interface: ProjectImportResults
Returns the count of all groups added to the specified role

Specified by:
getGroupsCreatedCountForRole in interface ProjectImportResults
Parameters:
roleName - the role you want the count for, this should be the role name as provided in the increment method
Returns:
the count of all groups added to the specified role

getUsersCreatedCountForRole

public int getUsersCreatedCountForRole(String roleName)
Description copied from interface: ProjectImportResults
Returns the count of all users added to the specified role

Specified by:
getUsersCreatedCountForRole in interface ProjectImportResults
Parameters:
roleName - the role you want the count for, this should be the role name as provided in the increment method
Returns:
the count of all users added to the specified role

addError

public void addError(String error)
Description copied from interface: ProjectImportResults
Adds the given Error message to the error list. If the error limit is reached, then we throw an AbortImportException to stop the import.

Specified by:
addError in interface ProjectImportResults
Parameters:
error - the error message.

getErrors

public List<String> getErrors()
Description copied from interface: ProjectImportResults
Returns a list of all the errors that were added to this result object.

Specified by:
getErrors in interface ProjectImportResults
Returns:
a list of all the errors that were added to this result object.

isImportCompleted

public boolean isImportCompleted()
Description copied from interface: ProjectImportResults
Returns true if the import completed all steps of the import, false otherwise. This method can return true and the getErrors can return errors. This will not return true if the errors went over the allowable threshold, and the Import was aborted.

Specified by:
isImportCompleted in interface ProjectImportResults
Returns:
true if the import completed all steps of the import, false otherwise.

incrementIssuesCreatedCount

public void incrementIssuesCreatedCount()
Description copied from interface: ProjectImportResults
Adds to the count of created issues.

Specified by:
incrementIssuesCreatedCount in interface ProjectImportResults

incrementUsersCreatedCount

public void incrementUsersCreatedCount()
Description copied from interface: ProjectImportResults
Adds to the count of created users.

Specified by:
incrementUsersCreatedCount in interface ProjectImportResults

incrementAttachmentsCreatedCount

public void incrementAttachmentsCreatedCount()
Description copied from interface: ProjectImportResults
Adds to the count of created attachments.

Specified by:
incrementAttachmentsCreatedCount in interface ProjectImportResults

getIssuesCreatedCount

public int getIssuesCreatedCount()
Description copied from interface: ProjectImportResults
Returns the number of created issues.

Specified by:
getIssuesCreatedCount in interface ProjectImportResults
Returns:
the number of created issues.

getUsersCreatedCount

public int getUsersCreatedCount()
Description copied from interface: ProjectImportResults
Returns the number of created users.

Specified by:
getUsersCreatedCount in interface ProjectImportResults
Returns:
the number of created users.

getAttachmentsCreatedCount

public int getAttachmentsCreatedCount()
Description copied from interface: ProjectImportResults
Returns the number of created attachments.

Specified by:
getAttachmentsCreatedCount in interface ProjectImportResults
Returns:
the number of created attachments.

getExpectedIssuesCreatedCount

public int getExpectedIssuesCreatedCount()
Description copied from interface: ProjectImportResults
Returns the number of issues the import expected it could create before doing the actual import.

Specified by:
getExpectedIssuesCreatedCount in interface ProjectImportResults
Returns:
the number of issues the import expected it could create before doing the actual import.

getExpectedUsersCreatedCount

public int getExpectedUsersCreatedCount()
Description copied from interface: ProjectImportResults
Returns the number of users the import expected it could create before doing the actual import.

Specified by:
getExpectedUsersCreatedCount in interface ProjectImportResults
Returns:
the number of users the import expected it could create before doing the actual import.

getExpectedAttachmentsCreatedCount

public int getExpectedAttachmentsCreatedCount()
Description copied from interface: ProjectImportResults
Returns the number of attachments the import expected it could create before doing the actual import.

Specified by:
getExpectedAttachmentsCreatedCount in interface ProjectImportResults
Returns:
the number of attachments the import expected it could create before doing the actual import.

setImportCompleted

public void setImportCompleted(boolean importCompleted)
Description copied from interface: ProjectImportResults
Should be called with true if all steps of the import were able to proceed (i.e. no AbortImportException was thrown).

Specified by:
setImportCompleted in interface ProjectImportResults
Parameters:
importCompleted - true if completed, false otherwise.

getImportedProject

public Project getImportedProject()
Description copied from interface: ProjectImportResults
Returns the created/updated project that the import imported into.

Specified by:
getImportedProject in interface ProjectImportResults
Returns:
the created/updated project that the import imported into.

setImportedProject

public void setImportedProject(Project importedProject)
Description copied from interface: ProjectImportResults
Sets the imported project, this is the project that exists in JIRA.

Specified by:
setImportedProject in interface ProjectImportResults
Parameters:
importedProject - the imported project, this is the project that exists in JIRA.

getI18n

public I18nHelper getI18n()
Description copied from interface: ProjectImportResults
Returns the I18nHelper associated with this Project Import. This can be used to localise error messages before they are added in this ProjectImportResult.

Specified by:
getI18n in interface ProjectImportResults
Returns:
the I18nHelper associated with this Project Import.

abortImport

public boolean abortImport()
Description copied from interface: ProjectImportResults
Returns false if the number of allowed errors have been exceeded, true otherwise

Specified by:
abortImport in interface ProjectImportResults
Returns:
false if the number of allowed errors have been exceeded, true otherwise


Copyright © 2002-2012 Atlassian. All Rights Reserved.