public class MockVersionManager extends Object implements VersionManager
ALL_RELEASED_VERSIONS, ALL_UNRELEASED_VERSIONS, NO_VERSIONS
Constructor and Description |
---|
MockVersionManager() |
Modifier and Type | Method and Description |
---|---|
void |
add(MockVersion version) |
Version |
archiveVersion(Version version,
boolean archive)
Archive/Un-archive a single version depending on the archive flag.
|
void |
archiveVersions(String[] idsToArchive,
String[] idsToUnarchive)
Method used to archive and un-archive a number of versions.
|
Version |
createVersion(String name,
Date startDate,
Date releaseDate,
String description,
Long projectId,
Long scheduleAfterVersion)
Creates a new
Version object. |
Version |
createVersion(String name,
Date startDate,
Date releaseDate,
String description,
Long projectId,
Long scheduleAfterVersion,
boolean released)
Creates a new
Version . |
Version |
createVersion(String name,
Date releaseDate,
String description,
Long projectId,
Long scheduleAfterVersion)
Creates a new
Version object. |
Version |
decreaseVersionSequence(Version version)
Move a version to have a higher sequence number - ie make it later
|
void |
deleteAllVersions(Long projectId)
Deletes all versions in given project.
|
void |
deleteAndRemoveFromIssues(ApplicationUser user,
Version versionToRemove)
This method deletes a version and additionally (unlinke
VersionManager.deleteVersion(com.atlassian.jira.project.version.Version) ) removes it from all issues that reference it. |
void |
deleteVersion(ApplicationUser applicationUser,
Version versionToDelete,
io.atlassian.fugue.Option<Version> affectsSwapVersion,
io.atlassian.fugue.Option<Version> fixSwapVersion)
Removes a specific version from the system.
|
void |
deleteVersion(Version version)
Removes a specific version from the system.
|
void |
deleteVersionAndSwap(ApplicationUser applicationUser,
DeleteVersionWithCustomFieldParameters parameters)
Remove specified version.
|
Version |
editVersionDetails(Version version,
String name,
String description)
Updates details of an existing version.
|
Version |
editVersionReleaseDate(Version version,
Date duedate)
Update the release date of a version.
|
Version |
editVersionStartDate(Version version,
Date startDate)
Updates the start date of a version
|
Version |
editVersionStartReleaseDate(Version version,
Date startDate,
Date releaseDate)
Updates the start and release date of a version
|
Collection<Version> |
getAffectedVersionsFor(Issue issue)
Get all affected versions of the specified issue.
|
Collection<Version> |
getAllVersions() |
Collection<Version> |
getAllVersionsForProjects(Collection<Project> projects,
boolean includeArchived)
Returns all versions that belong to the passed projects.
|
Collection<Version> |
getAllVersionsReleased(boolean includeArchived) |
Collection<Version> |
getAllVersionsUnreleased(boolean includeArchived) |
long |
getCustomFieldIssuesCount(Version version)
This method gives total number of issues where this version is used in custom fields.
|
Collection<CustomFieldWithVersionUsage> |
getCustomFieldsUsing(Version version)
This method gives information about usage of given version in custom fields.
|
Collection<Version> |
getFixVersionsFor(Issue issue)
Get all fix for versions of the specified issue.
|
Collection<Long> |
getIssueIdsWithAffectsVersion(Version version)
Return all the issues in which the affects version matches the specified version.
|
Collection<Long> |
getIssueIdsWithFixVersion(Version version)
Return all the issues in which the fix version matches the specified version.
|
Collection<Issue> |
getIssuesWithAffectsVersion(Version version)
Return all the issues in which the affected version matches the specified version.
|
Collection<Issue> |
getIssuesWithFixVersion(Version version)
Return all the issues in which the fix for version matches the specified version.
|
Collection<Version> |
getOtherUnarchivedVersions(Version version)
Return all unarchived versions except this one
|
Collection<Version> |
getOtherVersions(Version version)
Return all other versions in the project except this one
|
int |
getTotalVersionCount() |
Version |
getVersion(Long id)
Returns a single version.
|
Version |
getVersion(Long projectId,
String versionName)
Search for a version by projectID and name.
|
Collection<Version> |
getVersions(List<Long> ids)
Return a collection of
Version s matching the ids passed in. |
List<Version> |
getVersions(Long projectId)
Return a list of Versions for the given project.
|
List<Version> |
getVersions(Long projectId,
boolean includeArchived)
Return a list of Versions for the given project.
|
List<Version> |
getVersions(Project project)
Return a list of Versions for the given project.
|
Collection<Version> |
getVersionsArchived(Project project)
Return all archived versions for a particular project.
|
Collection<Version> |
getVersionsByName(String versionName)
Return a collection of
Version s that have the specified name. |
List<Version> |
getVersionsReleased(Long projectId,
boolean includeArchived)
Gets a list of released versions for a project.
|
Collection<Version> |
getVersionsReleasedDesc(Long projectId,
boolean includeArchived)
Gets a list of released versions for a project in reverse order.
|
Collection<Version> |
getVersionsUnarchived(Long projectId)
Return all un-archived versions for a particular project
|
Collection<Version> |
getVersionsUnreleased(Long projectId,
boolean includeArchived)
Gets a list of un-released versions for a particular project.
|
Version |
increaseVersionSequence(Version version)
Move a version to have a lower sequence number - ie make it earlier
|
boolean |
isDuplicateName(Version version,
String name)
Check that the version name we are changing to is not a duplicate.
|
boolean |
isVersionOverDue(Version version)
Checks to see if a version is overdue.
|
void |
merge(ApplicationUser user,
Version versionToDelete,
Version versionToMergeTo)
This method will perform a version merge.
|
void |
moveIssuesToNewVersion(List issues,
Version currentVersion,
Version swapToVersion)
Swaps the list of issues supplied from one Fix version to another.
|
Version |
moveToEndVersionSequence(Version version)
Move a version to the end of the version sequence
|
Version |
moveToStartVersionSequence(Version version)
Move a version to the start of the version list
|
Version |
moveVersionAfter(Version version,
Long scheduleAfterVersion)
Move a version after another version
|
Version |
releaseVersion(Version version,
boolean release)
Used to release or unrelease a version, depending on the release flag.
|
Collection<Version> |
releaseVersions(Collection<Version> versions,
boolean release)
Used to release versions depending on the release flag.
|
void |
swapVersionForRelatedIssues(ApplicationUser user,
Version version,
io.atlassian.fugue.Option<Version> affectsSwapVersion,
io.atlassian.fugue.Option<Version> fixSwapVersion)
This method will update all issues that currently have
version set as either affects or fix version to
the new affectsSwapVersion or fixSwapVersion |
Version |
update(Version version)
Persists updates to the specified version object.
|
List<ChangeItemBean> |
updateIssueAffectsVersions(Issue issue,
Collection<Version> newValue) |
List<ChangeItemBean> |
updateIssueFixVersions(Issue issue,
Collection<Version> newValue) |
public Version createVersion(String name, Date releaseDate, String description, Long projectId, Long scheduleAfterVersion) throws CreateException
VersionManager
Version
object.createVersion
in interface VersionManager
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.CreateException
- If there was a problem creating the version.public Version createVersion(String name, Date startDate, Date releaseDate, String description, Long projectId, Long scheduleAfterVersion) throws CreateException
VersionManager
Version
object.createVersion
in interface VersionManager
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.CreateException
- If there was a problem creating the version.public Version createVersion(String name, Date startDate, Date releaseDate, String description, Long projectId, Long scheduleAfterVersion, boolean released) throws CreateException
VersionManager
Version
.
This method differs from VersionManager.createVersion(String, java.util.Date, java.util.Date, String, Long, Long)
in
that it lets you specify the value for the attribute release
.createVersion
in interface VersionManager
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 the release
attribute value for the version object to createCreateException
public Version moveToStartVersionSequence(Version version)
VersionManager
moveToStartVersionSequence
in interface VersionManager
version
- the Version to movepublic Version increaseVersionSequence(Version version)
VersionManager
increaseVersionSequence
in interface VersionManager
version
- the Versionpublic Version decreaseVersionSequence(Version version)
VersionManager
decreaseVersionSequence
in interface VersionManager
version
- the Versionpublic Version moveToEndVersionSequence(Version version)
VersionManager
moveToEndVersionSequence
in interface VersionManager
version
- the Versionpublic Version moveVersionAfter(Version version, Long scheduleAfterVersion)
VersionManager
moveVersionAfter
in interface VersionManager
version
- version to reschedulescheduleAfterVersion
- id of the version to schedule after the given version objectpublic void deleteVersion(Version version)
VersionManager
deleteVersion
in interface VersionManager
version
- The version to be removed.VersionManager.deleteAndRemoveFromIssues(com.atlassian.jira.user.ApplicationUser, Version)
public void deleteVersion(ApplicationUser applicationUser, Version versionToDelete, io.atlassian.fugue.Option<Version> affectsSwapVersion, io.atlassian.fugue.Option<Version> fixSwapVersion)
VersionManager
versionToDelete
is the version which is going to be removed.
If affectsSwapVersion
is defined, then issues with versionToDelete
as a value of Affects Version/s
system field will use affectsSwapVersion
instead.
Similarly, fixSwapVersion
will replace versionToDelete
as a value in Fix Version/s system field.deleteVersion
in interface VersionManager
applicationUser
- the user that will be used to update related issuesversionToDelete
- the version to be deletedaffectsSwapVersion
- the version which replaces the version to be deleted as Affected Version/s.fixSwapVersion
- the version which replaces the version to be deleted as Fix Version/s.public void deleteAllVersions(@Nonnull Long projectId)
VersionManager
deleteAllVersions
in interface VersionManager
projectId
- the id of project in which versions will be deleted.public Version update(Version version)
VersionManager
update
in interface VersionManager
version
- the versionpublic Version editVersionDetails(Version version, String name, String description)
VersionManager
editVersionDetails
in interface VersionManager
version
- The version to updatename
- The new version name, cannot be empty.description
- The description of this version.public boolean isDuplicateName(Version version, String name)
VersionManager
isDuplicateName
in interface VersionManager
version
- The version to updatename
- The new name for the versionpublic Version releaseVersion(Version version, boolean release)
VersionManager
releaseVersion
in interface VersionManager
version
- Version to be released (or unreleased)release
- True to release a version. False to 'unrelease' a versionpublic Collection<Version> releaseVersions(Collection<Version> versions, boolean release)
VersionManager
releaseVersions
in interface VersionManager
versions
- Collection of Version
srelease
- True to release a version. False to 'unrelease' a versionpublic void moveIssuesToNewVersion(List issues, Version currentVersion, Version swapToVersion) throws IndexException
VersionManager
moveIssuesToNewVersion
in interface VersionManager
issues
- the IssuescurrentVersion
- Current fix version they will be swapped fromswapToVersion
- New fix version they will be swapped to.IndexException
- if an error occurs will indexing these new issue values.public void archiveVersions(String[] idsToArchive, String[] idsToUnarchive)
VersionManager
archiveVersions
in interface VersionManager
idsToArchive
- Archive all these VersionsidsToUnarchive
- Unarchive these Versionspublic Version archiveVersion(Version version, boolean archive)
VersionManager
archiveVersion
in interface VersionManager
version
- the Version to archive or unarchivearchive
- new archive valuepublic Collection<Version> getVersionsUnarchived(Long projectId)
VersionManager
getVersionsUnarchived
in interface VersionManager
projectId
- id of the project.Version
spublic Collection<Version> getVersionsArchived(Project project)
VersionManager
getVersionsArchived
in interface VersionManager
project
- the Projectpublic Version editVersionStartDate(Version version, Date startDate)
VersionManager
editVersionStartDate
in interface VersionManager
version
- the version to editstartDate
- new start datepublic Version editVersionReleaseDate(Version version, Date duedate)
VersionManager
editVersionReleaseDate
in interface VersionManager
version
- the Version to editduedate
- new release datepublic Version editVersionStartReleaseDate(Version version, Date startDate, Date releaseDate)
VersionManager
editVersionStartReleaseDate
in interface VersionManager
version
- the version to editstartDate
- new start datereleaseDate
- new release datepublic boolean isVersionOverDue(Version version)
VersionManager
isVersionOverDue
in interface VersionManager
version
- the Versionpublic List<Version> getVersions(Long projectId)
VersionManager
getVersions
in interface VersionManager
projectId
- the ProjectVersionManager.getVersions(Project)
public List<Version> getVersions(Long projectId, boolean includeArchived)
VersionManager
getVersions
in interface VersionManager
projectId
- the ProjectincludeArchived
- whether or not to include archived versionsVersionManager.getVersions(Project)
public List<Version> getVersions(Project project)
VersionManager
getVersions
in interface VersionManager
project
- the ProjectVersionManager.getVersions(Long)
public Collection<Version> getVersionsByName(String versionName)
VersionManager
Version
s that have the specified name.getVersionsByName
in interface VersionManager
versionName
- the name of the version (case-insensitive)public Collection<Version> getVersions(List<Long> ids)
VersionManager
Version
s matching the ids passed in.getVersions
in interface VersionManager
ids
- Version IDsVersion
s matching the ids passed in.public Version getVersion(Long id)
VersionManager
getVersion
in interface VersionManager
id
- the Version IDVersion
object.public Version getVersion(Long projectId, String versionName)
VersionManager
getVersion
in interface VersionManager
projectId
- the ProjectversionName
- the Version nameVersion
object.public Collection<Version> getVersionsUnreleased(Long projectId, boolean includeArchived)
VersionManager
getVersionsUnreleased
in interface VersionManager
projectId
- The id of the project for which to return versionsincludeArchived
- True if archived versions should be includedVersion
s, never nullpublic List<Version> getVersionsReleased(Long projectId, boolean includeArchived)
VersionManager
getVersionsReleased
in interface VersionManager
projectId
- project idincludeArchived
- flag to indicate whether to include archived versions in the result.Version
objectspublic Collection<Version> getVersionsReleasedDesc(Long projectId, boolean includeArchived)
VersionManager
getVersionsReleasedDesc
in interface VersionManager
projectId
- project idincludeArchived
- flag to indicate whether to include archived versions in the result.Version
objectspublic Collection<Version> getOtherVersions(Version version)
VersionManager
getOtherVersions
in interface VersionManager
version
- the Versionpublic Collection<Version> getOtherUnarchivedVersions(Version version)
VersionManager
getOtherUnarchivedVersions
in interface VersionManager
version
- the Versionpublic Collection<Issue> getIssuesWithFixVersion(Version version)
VersionManager
getIssuesWithFixVersion
in interface VersionManager
version
- the fixed for version.public Collection<Issue> getIssuesWithAffectsVersion(Version version)
VersionManager
getIssuesWithAffectsVersion
in interface VersionManager
version
- the affected version.public Collection<Long> getIssueIdsWithAffectsVersion(@Nonnull Version version)
VersionManager
getIssueIdsWithAffectsVersion
in interface VersionManager
version
- the affects version.public Collection<Long> getIssueIdsWithFixVersion(@Nonnull Version version)
VersionManager
getIssueIdsWithFixVersion
in interface VersionManager
version
- the fix version.public Collection<Version> getAffectedVersionsFor(Issue issue)
VersionManager
getAffectedVersionsFor
in interface VersionManager
issue
- the issuepublic List<ChangeItemBean> updateIssueAffectsVersions(Issue issue, Collection<Version> newValue)
updateIssueAffectsVersions
in interface VersionManager
public List<ChangeItemBean> updateIssueFixVersions(Issue issue, Collection<Version> newValue)
updateIssueFixVersions
in interface VersionManager
public Collection<Version> getFixVersionsFor(Issue issue)
VersionManager
getFixVersionsFor
in interface VersionManager
issue
- the Issuepublic Collection<Version> getAllVersions()
getAllVersions
in interface VersionManager
public int getTotalVersionCount()
getTotalVersionCount
in interface VersionManager
public Collection<Version> getAllVersionsForProjects(Collection<Project> projects, boolean includeArchived)
VersionManager
getAllVersionsForProjects
in interface VersionManager
projects
- projects to search inincludeArchived
- whether or not to include archived versionspublic Collection<Version> getAllVersionsReleased(boolean includeArchived)
getAllVersionsReleased
in interface VersionManager
includeArchived
- whether or not to include archived versionspublic Collection<Version> getAllVersionsUnreleased(boolean includeArchived)
getAllVersionsUnreleased
in interface VersionManager
includeArchived
- whether or not to include archived versionspublic void swapVersionForRelatedIssues(ApplicationUser user, Version version, io.atlassian.fugue.Option<Version> affectsSwapVersion, io.atlassian.fugue.Option<Version> fixSwapVersion)
VersionManager
version
set as either affects or fix version to
the new affectsSwapVersion
or fixSwapVersion
Both affectsSwapVersion
or fixSwapVersion
may be undefined in which case the version
will
simply be removed from the issue.
swapVersionForRelatedIssues
in interface VersionManager
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.VersionManager.merge(com.atlassian.jira.user.ApplicationUser, com.atlassian.jira.project.version.Version, com.atlassian.jira.project.version.Version)
,
VersionManager.deleteAndRemoveFromIssues(com.atlassian.jira.user.ApplicationUser, com.atlassian.jira.project.version.Version)
public void merge(ApplicationUser user, @Nonnull Version versionToDelete, @Nonnull Version versionToMergeTo)
VersionManager
versionToDelete
is a version that will be deleted completely.
All issues will have this version replaced with versionToMergeTo
.merge
in interface VersionManager
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 onepublic void deleteAndRemoveFromIssues(ApplicationUser user, @Nonnull Version versionToRemove)
VersionManager
VersionManager.deleteVersion(com.atlassian.jira.project.version.Version)
) removes it from all issues that reference it.deleteAndRemoveFromIssues
in interface VersionManager
user
- User that will perform the update of issues.versionToRemove
- Version to be deleted.@Nonnull public Collection<CustomFieldWithVersionUsage> getCustomFieldsUsing(@Nonnull Version version)
VersionManager
getCustomFieldsUsing
in interface VersionManager
version
- The version that we want to get information about.public long getCustomFieldIssuesCount(@Nonnull Version version)
VersionManager
getCustomFieldIssuesCount
in interface VersionManager
version
- The version that we want to get information about.public void deleteVersionAndSwap(ApplicationUser applicationUser, DeleteVersionWithCustomFieldParameters parameters)
VersionManager
DeleteVersionWithCustomFieldParameters
version will be completly removed from specific fields are replaced.deleteVersionAndSwap
in interface VersionManager
applicationUser
- The user for this callparameters
- parameters build with builder obtained by
VersionService.createVersionDeletaAndReplaceParameters(Version)
merge - if you want to replace all version references to given
version.
public void add(MockVersion version)
Copyright © 2002-2019 Atlassian. All Rights Reserved.