Class MockVersionManager
java.lang.Object
com.atlassian.jira.project.version.MockVersionManager
- All Implemented Interfaces:
VersionManager
-
Field Summary
Fields inherited from interface com.atlassian.jira.project.version.VersionManager
ALL_RELEASED_VERSIONS, ALL_UNRELEASED_VERSIONS, NO_VERSIONS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(MockVersion version) archiveVersion(Version version, boolean archive) Archive/Un-archive a single version depending on the archive flag.voidarchiveVersions(String[] idsToArchive, String[] idsToUnarchive) Method used to archive and un-archive a number of versions.createVersion(String name, Date releaseDate, String description, Long projectId, Long scheduleAfterVersion) Creates a newVersionobject.createVersion(String name, Date startDate, Date releaseDate, String description, Long projectId, Long scheduleAfterVersion) Creates a newVersionobject.createVersion(String name, Date startDate, Date releaseDate, String description, Long projectId, Long scheduleAfterVersion, boolean released) Creates a newVersion.decreaseVersionSequence(Version version) Move a version to have a higher sequence number - ie make it latervoiddeleteAllVersions(Long projectId) Deletes all versions in given project.voiddeleteAndRemoveFromIssues(ApplicationUser user, Version versionToRemove) This method deletes a version and additionally (unlinkeVersionManager.deleteVersion(com.atlassian.jira.project.version.Version)) removes it from all issues that reference it.voiddeleteVersion(Version version) Removes a specific version from the system.voiddeleteVersionAndSwap(ApplicationUser applicationUser, DeleteVersionWithCustomFieldParameters parameters) Remove specified version.editVersionDetails(Version version, String name, String description) Updates details of an existing version.editVersionReleaseDate(Version version, Date duedate) Update the release date of a version.editVersionStartDate(Version version, Date startDate) Updates the start date of a versioneditVersionStartReleaseDate(Version version, Date startDate, Date releaseDate) Updates the start and release date of a versiongetAffectedVersionsFor(Issue issue) Get all affected versions of the specified issue.getAllVersionsForProjects(Collection<Project> projects, boolean includeArchived) Returns all versions that belong to the passed projects.getAllVersionsReleased(boolean includeArchived) getAllVersionsUnreleased(boolean includeArchived) longgetCustomFieldIssuesCount(Version version) This method gives total number of issues where this version is used in custom fields.getCustomFieldsUsing(Version version) This method gives information about usage of given version in custom fields.getFixVersionsFor(Issue issue) Get all fix for versions of the specified issue.getIssueIdsWithAffectsVersion(Version version) Return all the issues in which the affects version matches the specified version.getIssueIdsWithFixVersion(Version version) Return all the issues in which the fix version matches the specified version.getIssuesWithAffectsVersion(Version version) Return all the issues in which the affected version matches the specified version.getIssuesWithFixVersion(Version version) Return all the issues in which the fix for version matches the specified version.getOtherUnarchivedVersions(Version version) Return all unarchived versions except this onegetOtherVersions(Version version) Return all other versions in the project except this oneintgetVersion(Long id) Returns a single version.getVersion(Long projectId, String versionName) Search for a version by projectID and name.getVersions(Project project) Return a list of Versions for the given project.getVersions(Long projectId) Return a list of Versions for the given project.getVersions(Long projectId, boolean includeArchived) Return a list of Versions for the given project.getVersions(List<Long> ids) Return a collection ofVersions matching the ids passed in.getVersionsArchived(Project project) Return all archived versions for a particular project.getVersionsByName(String versionName) Return a collection ofVersions that have the specified name.getVersionsReleased(Long projectId, boolean includeArchived) Gets a list of released versions for a project.getVersionsReleasedDesc(Long projectId, boolean includeArchived) Gets a list of released versions for a project in reverse order.getVersionsUnarchived(Long projectId) Return all un-archived versions for a particular projectgetVersionsUnreleased(Long projectId, boolean includeArchived) Gets a list of un-released versions for a particular project.increaseVersionSequence(Version version) Move a version to have a lower sequence number - ie make it earlierbooleanisDuplicateName(Version version, String name) Check that the version name we are changing to is not a duplicate.booleanisVersionOverDue(Version version) Checks to see if a version is overdue.voidmerge(ApplicationUser user, Version versionToDelete, Version versionToMergeTo) This method will perform a version merge.voidmoveIssuesToNewVersion(List issues, Version currentVersion, Version swapToVersion) Swaps the list of issues supplied from one Fix version to another.moveToEndVersionSequence(Version version) Move a version to the end of the version sequencemoveToStartVersionSequence(Version version) Move a version to the start of the version listmoveVersionAfter(Version version, Long scheduleAfterVersion) Move a version after another versionreleaseVersion(Version version, boolean release) Used to release or unrelease a version, depending on the release flag.releaseVersions(Collection<Version> versions, boolean release) Used to release versions depending on the release flag.voidswapVersionForRelatedIssues(ApplicationUser user, Version version, io.atlassian.fugue.Option<Version> affectsSwapVersion, io.atlassian.fugue.Option<Version> fixSwapVersion) This method will update all issues that currently haveversionset as either affects or fix version to the newaffectsSwapVersionorfixSwapVersionPersists updates to the specified version object.updateIssueAffectsVersions(Issue issue, Collection<Version> newValue) updateIssueFixVersions(Issue issue, Collection<Version> newValue)
-
Constructor Details
-
MockVersionManager
public MockVersionManager()
-
-
Method Details
-
createVersion
public Version createVersion(String name, Date releaseDate, String description, Long projectId, Long scheduleAfterVersion) throws CreateException Description copied from interface:VersionManagerCreates a newVersionobject.- Specified by:
createVersionin interfaceVersionManager- Parameters:
name- the NamereleaseDate- date of release or null if not released.description- the DescriptionprojectId- the id of the Project of the version.scheduleAfterVersion- id of the version after which this should be sequenced or null.- Returns:
- the new Version.
- Throws:
CreateException- If there was a problem creating the version.
-
createVersion
public Version createVersion(String name, Date startDate, Date releaseDate, String description, Long projectId, Long scheduleAfterVersion) throws CreateException Description copied from interface:VersionManagerCreates a newVersionobject.- Specified by:
createVersionin interfaceVersionManager- Parameters:
name- the NamestartDate- start date of the version or nullreleaseDate- date of release or null if not released.description- the DescriptionprojectId- the id of the Project of the version.scheduleAfterVersion- id of the version after which this should be sequenced or null.- Returns:
- the new Version.
- Throws:
CreateException- If there was a problem creating the version.
-
createVersion
public Version createVersion(String name, Date startDate, Date releaseDate, String description, Long projectId, Long scheduleAfterVersion, boolean released) throws CreateException Description copied from interface:VersionManagerCreates a newVersion. This method differs fromVersionManager.createVersion(String, java.util.Date, java.util.Date, String, Long, Long)in that it lets you specify the value for the attributerelease.- Specified by:
createVersionin interfaceVersionManager- Parameters:
name- Name of the versionstartDate- Start date of the versionreleaseDate- Release date for the versiondescription- Version descriptionprojectId- The numeric id of the project this version belongsscheduleAfterVersion- Numeric id of the version to schedule after the given version objectreleased- Sets thereleaseattribute value for the version object to create- Returns:
- The created version object
- Throws:
CreateException
-
moveToStartVersionSequence
Description copied from interface:VersionManagerMove a version to the start of the version list- Specified by:
moveToStartVersionSequencein interfaceVersionManager- Parameters:
version- the Version to move
-
increaseVersionSequence
Description copied from interface:VersionManagerMove a version to have a lower sequence number - ie make it earlier- Specified by:
increaseVersionSequencein interfaceVersionManager- Parameters:
version- the Version
-
decreaseVersionSequence
Description copied from interface:VersionManagerMove a version to have a higher sequence number - ie make it later- Specified by:
decreaseVersionSequencein interfaceVersionManager- Parameters:
version- the Version
-
moveToEndVersionSequence
Description copied from interface:VersionManagerMove a version to the end of the version sequence- Specified by:
moveToEndVersionSequencein interfaceVersionManager- Parameters:
version- the Version
-
moveVersionAfter
Description copied from interface:VersionManagerMove a version after another version- Specified by:
moveVersionAfterin interfaceVersionManager- Parameters:
version- version to reschedulescheduleAfterVersion- id of the version to schedule after the given version object
-
deleteVersion
Description copied from interface:VersionManagerRemoves a specific version from the system.- Specified by:
deleteVersionin interfaceVersionManager- Parameters:
version- The version to be removed.- See Also:
-
deleteAllVersions
Description copied from interface:VersionManagerDeletes all versions in given project. Note that this method will not fire a VersionDeleteEvent upon deletion of a version.- Specified by:
deleteAllVersionsin interfaceVersionManager- Parameters:
projectId- the id of project in which versions will be deleted.
-
update
Description copied from interface:VersionManagerPersists updates to the specified version object.- Specified by:
updatein interfaceVersionManager- Parameters:
version- the version- Returns:
- the updated version
-
editVersionDetails
Description copied from interface:VersionManagerUpdates details of an existing version.- Specified by:
editVersionDetailsin interfaceVersionManager- Parameters:
version- The version to updatename- The new version name, cannot be empty.description- The description of this version.
-
isDuplicateName
Description copied from interface:VersionManagerCheck that the version name we are changing to is not a duplicate.- Specified by:
isDuplicateNamein interfaceVersionManager- Parameters:
version- The version to updatename- The new name for the version- Returns:
- true if there is already a version with that name for the project
-
releaseVersion
Description copied from interface:VersionManagerUsed to release or unrelease a version, depending on the release flag.- Specified by:
releaseVersionin interfaceVersionManager- Parameters:
version- Version to be released (or unreleased)release- True to release a version. False to 'unrelease' a version
-
releaseVersions
Description copied from interface:VersionManagerUsed to release versions depending on the release flag.- Specified by:
releaseVersionsin interfaceVersionManager- Parameters:
versions- Collection ofVersionsrelease- True to release a version. False to 'unrelease' a version
-
moveIssuesToNewVersion
public void moveIssuesToNewVersion(List issues, Version currentVersion, Version swapToVersion) throws IndexException Description copied from interface:VersionManagerSwaps the list of issues supplied from one Fix version to another.- Specified by:
moveIssuesToNewVersionin interfaceVersionManager- Parameters:
issues- the IssuescurrentVersion- Current fix version they will be swapped fromswapToVersion- New fix version they will be swapped to.- Throws:
IndexException- if an error occurs will indexing these new issue values.
-
archiveVersions
Description copied from interface:VersionManagerMethod used to archive and un-archive a number of versions.- Specified by:
archiveVersionsin interfaceVersionManager- Parameters:
idsToArchive- Archive all these VersionsidsToUnarchive- Unarchive these Versions
-
archiveVersion
Description copied from interface:VersionManagerArchive/Un-archive a single version depending on the archive flag.- Specified by:
archiveVersionin interfaceVersionManager- Parameters:
version- the Version to archive or unarchivearchive- new archive value
-
getVersionsUnarchived
Description copied from interface:VersionManagerReturn all un-archived versions for a particular project- Specified by:
getVersionsUnarchivedin interfaceVersionManager- Parameters:
projectId- id of the project.- Returns:
- A collection of
Versions
-
getVersionsArchived
Description copied from interface:VersionManagerReturn all archived versions for a particular project.- Specified by:
getVersionsArchivedin interfaceVersionManager- Parameters:
project- the Project- Returns:
- Archived versions for this project.
-
editVersionStartDate
Description copied from interface:VersionManagerUpdates the start date of a version- Specified by:
editVersionStartDatein interfaceVersionManager- Parameters:
version- the version to editstartDate- new start date
-
editVersionReleaseDate
Description copied from interface:VersionManagerUpdate the release date of a version.- Specified by:
editVersionReleaseDatein interfaceVersionManager- Parameters:
version- the Version to editduedate- new release date
-
editVersionStartReleaseDate
Description copied from interface:VersionManagerUpdates the start and release date of a version- Specified by:
editVersionStartReleaseDatein interfaceVersionManager- Parameters:
version- the version to editstartDate- new start datereleaseDate- new release date
-
isVersionOverDue
Description copied from interface:VersionManagerChecks to see if a version is overdue. Note: This method checks if the due date set for a version is previous to last midnight. (not now()).- Specified by:
isVersionOverDuein interfaceVersionManager- Parameters:
version- the Version- Returns:
- True if the version is overdue. (i.e. releaseDate is before last midnight)
-
getVersions
Description copied from interface:VersionManagerReturn a list of Versions for the given project.- Specified by:
getVersionsin interfaceVersionManager- Parameters:
projectId- the Project- Returns:
- a list of Versions for the given project.
- See Also:
-
getVersions
Description copied from interface:VersionManagerReturn a list of Versions for the given project.- Specified by:
getVersionsin interfaceVersionManager- Parameters:
projectId- the ProjectincludeArchived- whether or not to include archived versions- Returns:
- a list of Versions for the given project.
- See Also:
-
getVersions
Description copied from interface:VersionManagerReturn a list of Versions for the given project.- Specified by:
getVersionsin interfaceVersionManager- Parameters:
project- the Project- Returns:
- a list of Versions for the given project.
- See Also:
-
getVersionsByName
Description copied from interface:VersionManagerReturn a collection ofVersions that have the specified name.- Specified by:
getVersionsByNamein interfaceVersionManager- Parameters:
versionName- the name of the version (case-insensitive)- Returns:
- a Collection of Version objects. Never null.
-
getVersions
Description copied from interface:VersionManagerReturn a collection ofVersions matching the ids passed in.- Specified by:
getVersionsin interfaceVersionManager- Parameters:
ids- Version IDs- Returns:
- a collection of
Versions matching the ids passed in.
-
getVersion
Description copied from interface:VersionManagerReturns a single version.- Specified by:
getVersionin interfaceVersionManager- Parameters:
id- the Version ID- Returns:
- A
Versionobject.
-
getVersion
Description copied from interface:VersionManagerSearch for a version by projectID and name.- Specified by:
getVersionin interfaceVersionManager- Parameters:
projectId- the ProjectversionName- the Version name- Returns:
- A
Versionobject.
-
getVersionsUnreleased
Description copied from interface:VersionManagerGets a list of un-released versions for a particular project.- Specified by:
getVersionsUnreleasedin interfaceVersionManager- Parameters:
projectId- The id of the project for which to return versionsincludeArchived- True if archived versions should be included- Returns:
- A Collection of
Versions, never null
-
getVersionsReleased
Description copied from interface:VersionManagerGets a list of released versions for a project. This list will include archived versions if the 'includeArchived' flag is set to true.- Specified by:
getVersionsReleasedin interfaceVersionManager- Parameters:
projectId- project idincludeArchived- flag to indicate whether to include archived versions in the result.- Returns:
- A collection of
Versionobjects
-
getVersionsReleasedDesc
Description copied from interface:VersionManagerGets a list of released versions for a project in reverse order. This list will include archived versions if the 'includeArchived' flag is set to true.- Specified by:
getVersionsReleasedDescin interfaceVersionManager- Parameters:
projectId- project idincludeArchived- flag to indicate whether to include archived versions in the result.- Returns:
- A collection of
Versionobjects
-
getOtherVersions
Description copied from interface:VersionManagerReturn all other versions in the project except this one- Specified by:
getOtherVersionsin interfaceVersionManager- Parameters:
version- the Version- Returns:
- all other versions in the project except this one
-
getOtherUnarchivedVersions
Description copied from interface:VersionManagerReturn all unarchived versions except this one- Specified by:
getOtherUnarchivedVersionsin interfaceVersionManager- Parameters:
version- the Version- Returns:
- all unarchived versions except this one
-
getIssuesWithFixVersion
Description copied from interface:VersionManagerReturn all the issues in which the fix for version matches the specified version.- Specified by:
getIssuesWithFixVersionin interfaceVersionManager- Parameters:
version- the fixed for version.- Returns:
- all the issues in which the fix for version matches the specified version.
-
getIssuesWithAffectsVersion
Description copied from interface:VersionManagerReturn all the issues in which the affected version matches the specified version.- Specified by:
getIssuesWithAffectsVersionin interfaceVersionManager- Parameters:
version- the affected version.- Returns:
- all the issues in which the affected version matches the specified version.
-
getIssueIdsWithAffectsVersion
Description copied from interface:VersionManagerReturn all the issues in which the affects version matches the specified version.- Specified by:
getIssueIdsWithAffectsVersionin interfaceVersionManager- Parameters:
version- the affects version.- Returns:
- all the issues in which the affects version matches the specified version.
-
getIssueIdsWithFixVersion
Description copied from interface:VersionManagerReturn all the issues in which the fix version matches the specified version.- Specified by:
getIssueIdsWithFixVersionin interfaceVersionManager- Parameters:
version- the fix version.- Returns:
- all the issues in which the fix version matches the specified version.
-
getAffectedVersionsFor
Description copied from interface:VersionManagerGet all affected versions of the specified issue.- Specified by:
getAffectedVersionsForin interfaceVersionManager- Parameters:
issue- the issue- Returns:
- all affected versions of the specified issue.
-
updateIssueAffectsVersions
- Specified by:
updateIssueAffectsVersionsin interfaceVersionManager
-
updateIssueFixVersions
- Specified by:
updateIssueFixVersionsin interfaceVersionManager
-
getFixVersionsFor
Description copied from interface:VersionManagerGet all fix for versions of the specified issue.- Specified by:
getFixVersionsForin interfaceVersionManager- Parameters:
issue- the Issue- Returns:
- all fix for versions of the specified issue.
-
getAllVersions
- Specified by:
getAllVersionsin interfaceVersionManager- Returns:
- all versions in JIRA. Never null.
-
getTotalVersionCount
public int getTotalVersionCount()- Specified by:
getTotalVersionCountin interfaceVersionManager- Returns:
- count of all versions.
-
getAllVersionsForProjects
public Collection<Version> getAllVersionsForProjects(Collection<Project> projects, boolean includeArchived) Description copied from interface:VersionManagerReturns all versions that belong to the passed projects.- Specified by:
getAllVersionsForProjectsin interfaceVersionManager- Parameters:
projects- projects to search inincludeArchived- whether or not to include archived versions- Returns:
- all versions that belong to passed projects. Never null.
-
getAllVersionsReleased
- Specified by:
getAllVersionsReleasedin interfaceVersionManager- Parameters:
includeArchived- whether or not to include archived versions- Returns:
- all released versions in JIRA. Never null.
-
getAllVersionsUnreleased
- Specified by:
getAllVersionsUnreleasedin interfaceVersionManager- Parameters:
includeArchived- whether or not to include archived versions- Returns:
- all released versions in JIRA. Never null.
-
swapVersionForRelatedIssues
public void swapVersionForRelatedIssues(ApplicationUser user, Version version, io.atlassian.fugue.Option<Version> affectsSwapVersion, io.atlassian.fugue.Option<Version> fixSwapVersion) Description copied from interface:VersionManagerThis method will update all issues that currently haveversionset as either affects or fix version to the newaffectsSwapVersionorfixSwapVersionBoth
affectsSwapVersionorfixSwapVersionmay be undefined in which case theversionwill simply be removed from the issue.- Specified by:
swapVersionForRelatedIssuesin interfaceVersionManager- Parameters:
user- The user that will be used to update related issuesversion- The version to remove from issuesaffectsSwapVersion- Affects version to replace version with. May be undefined to simply remove the version.fixSwapVersion- Fix version to replace version with. May be undefined to simply remove the version.- See Also:
-
merge
public void merge(ApplicationUser user, @Nonnull Version versionToDelete, @Nonnull Version versionToMergeTo) Description copied from interface:VersionManagerThis method will perform a version merge.versionToDeleteis a version that will be deleted completely. All issues will have this version replaced withversionToMergeTo.- Specified by:
mergein interfaceVersionManager- Parameters:
user- The user that will be used to update related issuesversionToDelete- Version that will be deletedversionToMergeTo- All issues will have deleted version replaced with this one
-
deleteAndRemoveFromIssues
Description copied from interface:VersionManagerThis method deletes a version and additionally (unlinkeVersionManager.deleteVersion(com.atlassian.jira.project.version.Version)) removes it from all issues that reference it.- Specified by:
deleteAndRemoveFromIssuesin interfaceVersionManager- Parameters:
user- User that will perform the update of issues.versionToRemove- Version to be deleted.
-
getCustomFieldsUsing
@Nonnull public Collection<CustomFieldWithVersionUsage> getCustomFieldsUsing(@Nonnull Version version) Description copied from interface:VersionManagerThis method gives information about usage of given version in custom fields.- Specified by:
getCustomFieldsUsingin interfaceVersionManager- Parameters:
version- The version that we want to get information about.- Returns:
- collection of version usage for each custom fields.
-
getCustomFieldIssuesCount
Description copied from interface:VersionManagerThis method gives total number of issues where this version is used in custom fields.- Specified by:
getCustomFieldIssuesCountin interfaceVersionManager- Parameters:
version- The version that we want to get information about.- Returns:
- collection of version usage for each custom fields.
-
deleteVersionAndSwap
public void deleteVersionAndSwap(ApplicationUser applicationUser, DeleteVersionWithCustomFieldParameters parameters) Description copied from interface:VersionManagerRemove specified version. According to information inDeleteVersionWithCustomFieldParametersversion will be completly removed from specific fields are replaced.- Specified by:
deleteVersionAndSwapin interfaceVersionManager- Parameters:
applicationUser- The user for this callparameters- parameters build with builder obtained byVersionService.createVersionDeletaAndReplaceParameters(Version)- See Also:
-
add
-