Interface VersionManager
- All Known Implementing Classes:
DefaultVersionManager
,MockVersionManager
@PublicApi
public interface VersionManager
Manager responsible for JIRA versions.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionarchiveVersion
(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.createVersion
(String name, Date releaseDate, String description, Long projectId, Long scheduleAfterVersion) Deprecated.createVersion
(String name, Date startDate, Date releaseDate, String description, Long projectId, Long scheduleAfterVersion) Deprecated.Since JIRA version 7.0.1, this is deprecated on favour ofcreateVersion(String, java.util.Date, java.util.Date, String, Long, Long, boolean)
which lets you specify therelease
attribute value for the newVersion
object.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 latervoid
deleteAllVersions
(Long projectId) Deletes all versions in given project.void
deleteAndRemoveFromIssues
(ApplicationUser user, Version versionToRemove) This method deletes a version and additionally (unlinkedeleteVersion(com.atlassian.jira.project.version.Version)
) removes it from all issues that reference it.void
deleteVersion
(Version version) Removes a specific version from the system.void
deleteVersionAndSwap
(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) long
getCustomFieldIssuesCount
(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 oneint
getVersion
(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 ofVersion
s matching the ids passed in.getVersionsArchived
(Project project) Return all archived versions for a particular project.getVersionsByName
(String versionName) Return a collection ofVersion
s 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 earlierboolean
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<Issue> 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.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 haveversion
set as either affects or fix version to the newaffectsSwapVersion
orfixSwapVersion
Persists updates to the specified version object.updateIssueAffectsVersions
(Issue issue, Collection<Version> newValue) updateIssueFixVersions
(Issue issue, Collection<Version> newValue)
-
Field Details
-
NO_VERSIONS
Used to represent empty version fields- See Also:
-
ALL_UNRELEASED_VERSIONS
Used to retrieve all unreleased versions- See Also:
-
ALL_RELEASED_VERSIONS
Used to retrieve all released versions- See Also:
-
-
Method Details
-
createVersion
Version createVersion(String name, Date releaseDate, String description, Long projectId, Long scheduleAfterVersion) throws CreateException Deprecated.Since JIRA version 7.0.1, this is deprecated on favour ofcreateVersion(String, java.util.Date, java.util.Date, String, Long, Long, boolean)
which lets you specify thestartDate
andrelease
attribute values for the newVersion
object.Creates a newVersion
object.- 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
@Deprecated Version createVersion(String name, Date startDate, Date releaseDate, String description, Long projectId, Long scheduleAfterVersion) throws CreateException Deprecated.Since JIRA version 7.0.1, this is deprecated on favour ofcreateVersion(String, java.util.Date, java.util.Date, String, Long, Long, boolean)
which lets you specify therelease
attribute value for the newVersion
object.Creates a newVersion
object.- 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.- Since:
- v6.0
-
createVersion
Version createVersion(String name, Date startDate, Date releaseDate, String description, Long projectId, Long scheduleAfterVersion, boolean released) throws CreateException Creates a newVersion
. This method differs fromcreateVersion(String, java.util.Date, java.util.Date, String, Long, Long)
in that it lets you specify the value for the attributerelease
.- 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 therelease
attribute value for the version object to create- Returns:
- The created version object
- Throws:
CreateException
- Since:
- v7.0.1
-
moveToStartVersionSequence
Move a version to the start of the version list- Parameters:
version
- the Version to move
-
increaseVersionSequence
Move a version to have a lower sequence number - ie make it earlier- Parameters:
version
- the Version
-
decreaseVersionSequence
Move a version to have a higher sequence number - ie make it later- Parameters:
version
- the Version
-
moveToEndVersionSequence
Move a version to the end of the version sequence- Parameters:
version
- the Version
-
moveVersionAfter
Move a version after another version- Parameters:
version
- version to reschedulescheduleAfterVersion
- id of the version to schedule after the given version object
-
deleteVersion
Removes a specific version from the system.- Parameters:
version
- The version to be removed.- See Also:
-
deleteAllVersions
Deletes all versions in given project. Note that this method will not fire a VersionDeleteEvent upon deletion of a version.- Parameters:
projectId
- the id of project in which versions will be deleted.
-
editVersionDetails
Updates details of an existing version.- Parameters:
version
- The version to updatename
- The new version name, cannot be empty.description
- The description of this version.- Throws:
IllegalArgumentException
- If the name is not set, or already exists.
-
isDuplicateName
Check that the version name we are changing to is not a duplicate.- 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
Used to release or unrelease a version, depending on the release flag.- Parameters:
version
- Version to be released (or unreleased)release
- True to release a version. False to 'unrelease' a version
-
releaseVersions
Used to release versions depending on the release flag.- Parameters:
versions
- Collection ofVersion
srelease
- True to release a version. False to 'unrelease' a version
-
moveIssuesToNewVersion
void moveIssuesToNewVersion(List<Issue> issues, Version currentVersion, Version swapToVersion) throws IndexException Swaps the list of issues supplied from one Fix version to another.- 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
Method used to archive and un-archive a number of versions.- Parameters:
idsToArchive
- Archive all these VersionsidsToUnarchive
- Unarchive these Versions
-
archiveVersion
Archive/Un-archive a single version depending on the archive flag.- Parameters:
version
- the Version to archive or unarchivearchive
- new archive value
-
getVersionsUnarchived
Return all un-archived versions for a particular project- Parameters:
projectId
- id of the project.- Returns:
- A collection of
Version
s - Since:
- v3.10
-
getVersionsArchived
Return all archived versions for a particular project.- Parameters:
project
- the Project- Returns:
- Archived versions for this project.
-
update
Persists updates to the specified version object.- Parameters:
version
- the version- Returns:
- the updated version
- Since:
- 6.0
-
editVersionReleaseDate
Update the release date of a version.- Parameters:
version
- the Version to editduedate
- new release date
-
editVersionStartDate
Updates the start date of a version- Parameters:
version
- the version to editstartDate
- new start date- Since:
- v6.0
-
editVersionStartReleaseDate
Updates the start and release date of a version- Parameters:
version
- the version to editstartDate
- new start datereleaseDate
- new release date- Since:
- v6.0
-
isVersionOverDue
Checks 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()).- Parameters:
version
- the Version- Returns:
- True if the version is overdue. (i.e. releaseDate is before last midnight)
-
getVersions
Return a list of Versions for the given project.- Parameters:
projectId
- the Project- Returns:
- a list of Versions for the given project.
- See Also:
-
getVersions
Return a list of Versions for the given project.- Parameters:
projectId
- the ProjectincludeArchived
- whether or not to include archived versions- Returns:
- a list of Versions for the given project.
- See Also:
-
getVersions
Return a list of Versions for the given project.- Parameters:
project
- the Project- Returns:
- a list of Versions for the given project.
- See Also:
-
getVersionsByName
Return a collection ofVersion
s that have the specified name.- Parameters:
versionName
- the name of the version (case-insensitive)- Returns:
- a Collection of Version objects. Never null.
-
getVersions
Return a collection ofVersion
s matching the ids passed in.- Parameters:
ids
- Version IDs- Returns:
- a collection of
Version
s matching the ids passed in.
-
getVersion
Returns a single version.- Parameters:
id
- the Version ID- Returns:
- A
Version
object.
-
getVersion
Search for a version by projectID and name.- Parameters:
projectId
- the ProjectversionName
- the Version name- Returns:
- A
Version
object.
-
getVersionsUnreleased
Gets a list of un-released versions for a particular project.- Parameters:
projectId
- The id of the project for which to return versionsincludeArchived
- True if archived versions should be included- Returns:
- A Collection of
Version
s, never null - Since:
- v3.10
-
getVersionsReleased
Gets a list of released versions for a project. This list will include archived versions if the 'includeArchived' flag is set to true.- Parameters:
projectId
- project idincludeArchived
- flag to indicate whether to include archived versions in the result.- Returns:
- A collection of
Version
objects
-
getVersionsReleasedDesc
Gets 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.- Parameters:
projectId
- project idincludeArchived
- flag to indicate whether to include archived versions in the result.- Returns:
- A collection of
Version
objects
-
getOtherVersions
Return all other versions in the project except this one- Parameters:
version
- the Version- Returns:
- all other versions in the project except this one
-
getOtherUnarchivedVersions
Return all unarchived versions except this one- Parameters:
version
- the Version- Returns:
- all unarchived versions except this one
-
getIssuesWithFixVersion
Return all the issues in which the fix for version matches the specified version.- Parameters:
version
- the fixed for version.- Returns:
- all the issues in which the fix for version matches the specified version.
- Since:
- v5.0
-
getIssuesWithAffectsVersion
Return all the issues in which the affected version matches the specified version.- Parameters:
version
- the affected version.- Returns:
- all the issues in which the affected version matches the specified version.
- Since:
- v5.0
-
getIssueIdsWithAffectsVersion
Return all the issues in which the affects version matches the specified version.- Parameters:
version
- the affects version.- Returns:
- all the issues in which the affects version matches the specified version.
- Since:
- v6.1
-
getIssueIdsWithFixVersion
Return all the issues in which the fix version matches the specified version.- Parameters:
version
- the fix version.- Returns:
- all the issues in which the fix version matches the specified version.
- Since:
- v6.1
-
getAffectedVersionsFor
Get all affected versions of the specified issue.- Parameters:
issue
- the issue- Returns:
- all affected versions of the specified issue.
-
updateIssueAffectsVersions
-
updateIssueFixVersions
-
getFixVersionsFor
Get all fix for versions of the specified issue.- Parameters:
issue
- the Issue- Returns:
- all fix for versions of the specified issue.
-
getAllVersions
Collection<Version> getAllVersions()- Returns:
- all versions in JIRA. Never null.
-
getTotalVersionCount
int getTotalVersionCount()- Returns:
- count of all versions.
-
getAllVersionsForProjects
Collection<Version> getAllVersionsForProjects(Collection<Project> projects, boolean includeArchived) Returns all versions that belong to the passed projects.- Parameters:
projects
- projects to search inincludeArchived
- whether or not to include archived versions- Returns:
- all versions that belong to passed projects. Never null.
-
getAllVersionsReleased
- Parameters:
includeArchived
- whether or not to include archived versions- Returns:
- all released versions in JIRA. Never null.
-
getAllVersionsUnreleased
- Parameters:
includeArchived
- whether or not to include archived versions- Returns:
- all released versions in JIRA. Never null.
-
swapVersionForRelatedIssues
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 haveversion
set as either affects or fix version to the newaffectsSwapVersion
orfixSwapVersion
Both
affectsSwapVersion
orfixSwapVersion
may be undefined in which case theversion
will simply be removed from the issue.- 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
void merge(ApplicationUser user, @Nonnull Version versionToDelete, @Nonnull Version versionToMergeTo) This method will perform a version merge.versionToDelete
is a version that will be deleted completely. All issues will have this version replaced withversionToMergeTo
.- 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
This method deletes a version and additionally (unlinkedeleteVersion(com.atlassian.jira.project.version.Version)
) removes it from all issues that reference it.- Parameters:
user
- User that will perform the update of issues.versionToRemove
- Version to be deleted.
-
getCustomFieldsUsing
This method gives information about usage of given version in custom fields.- Parameters:
version
- The version that we want to get information about.- Returns:
- collection of version usage for each custom fields.
- Since:
- 7.0.10
-
getCustomFieldIssuesCount
This method gives total number of issues where this version is used in custom fields.- Parameters:
version
- The version that we want to get information about.- Returns:
- collection of version usage for each custom fields.
- Since:
- 7.0.10
-
deleteVersionAndSwap
void deleteVersionAndSwap(ApplicationUser applicationUser, DeleteVersionWithCustomFieldParameters parameters) Remove specified version. According to information inDeleteVersionWithCustomFieldParameters
version will be completly removed from specific fields are replaced.- Parameters:
applicationUser
- The user for this callparameters
- parameters build with builder obtained byVersionService.createVersionDeletaAndReplaceParameters(Version)
- Since:
- 7.0.10
- See Also:
-
createVersion(String, java.util.Date, java.util.Date, String, Long, Long, boolean)
which lets you specify thestartDate
andrelease
attribute values for the newVersion
object.