@PublicApi public interface

VersionManager

com.atlassian.jira.project.version.VersionManager
Known Indirect Subclasses

@PublicApi

This interface is designed for plugins to consume (call its methods).

Clients of @PublicApi can expect that programs compiled against a given version will remain binary compatible with later versions of the @PublicApi as per each product's API policy as long as the client does not implement/extend @PublicApi interfaces or classes (refer to each product's API policy for the exact guarantee---usually binary compatibility is guaranteed at least across minor versions).

Note: since @PublicApi interfaces and classes are not designed to be implemented or extended by clients, we may perform certain types of binary-incompatible changes to these classes and interfaces, but these will not affect well-behaved clients that do not extend/implement these types (in general, only classes and interfaces annotated with @PublicSpi are safe to extend/implement).

Class Overview

Manager responsible for JIRA versions.

Summary

Constants
String ALL_RELEASED_VERSIONS Used to retrieve all released versions
String ALL_UNRELEASED_VERSIONS Used to retrieve all unreleased versions
String NO_VERSIONS Used to represent empty version fields
Public Methods
void 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 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)
Creates a new Version object.
void decreaseVersionSequence(Version version)
Move a version to have a higher sequence number - ie make it later
void deleteVersion(Version version)
Removes a specific version from the system.
void editVersionDetails(Version version, String name, String description)
Updates details of an existing version.
@Deprecated void editVersionDetails(Version version, String name, String description, GenericValue project)
This method is deprecated. use editVersionDetails(Version, String, String) instead. since 5.0
void editVersionReleaseDate(Version version, Date duedate)
Update the release date of a version.
void editVersionStartDate(Version version, Date startDate)
Updates the start date of a version
void editVersionStartReleaseDate(Version version, Date startDate, Date releaseDate)
Updates the start and release date of a version
@Deprecated Collection<Version> getAffectedVersionsByIssue(GenericValue issue)
This method is deprecated. use getAffectedVersionsFor(com.atlassian.jira.issue.Issue) instead. since 5.0
Collection<Version> getAffectedVersionsFor(Issue issue)
Get all affected versions of the specified issue.
@Deprecated Collection<GenericValue> getAffectsIssues(Version version)
This method is deprecated. use getIssuesWithAffectsVersion(Version) instead. since 5.0
@Deprecated Collection<GenericValue> getAllAffectedIssues(Collection<Version> versions)
This method is deprecated. use getIssueIdsWithAffectsVersion(Version) and getIssueIdsWithFixVersion(Version) instead. since 5.0
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)
@Deprecated Collection<GenericValue> getFixIssues(Version version)
This method is deprecated. use getIssuesWithFixVersion(Version) instead. since 5.0
@Deprecated Collection<Version> getFixVersionsByIssue(GenericValue issue)
This method is deprecated. use getFixVersionsFor(com.atlassian.jira.issue.Issue) instead. since 5.0
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
Version getVersion(Long projectId, String versionName)
Search for a version by projectID and name.
Version getVersion(Long id)
Returns a single version.
List<Version> getVersions(Project project)
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(GenericValue project)
This method is deprecated. Use getVersions(Long) or getVersions(Project) instead. Since 2006.
Collection<Version> getVersions(List<Long> ids)
Return a collection of Versions matching the ids passed in.
List<Version> getVersions(Long projectId)
Return a list of Versions for the given project.
Collection<Version> getVersionsArchived(Project project)
Return all archived versions for a particular project.
Collection<Version> getVersionsArchived(GenericValue projectGV)
This method is deprecated. Use getVersionsArchived(Project) instead. Since v5.0.
Collection<Version> getVersionsByName(String versionName)
Return a collection of Versions that have the specified name.
Collection<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.
void 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.
@Deprecated boolean isDuplicateName(Version version, String name, GenericValue project)
This method is deprecated. use isDuplicateName(Version, String) instead. since 5.0
boolean isVersionOverDue(Version version)
Checks to see if a version is overdue.
void moveIssuesToNewVersion(List<GenericValue> issues, Version currentVersion, Version swapToVersion)
Swaps the list of issues supplied from one Fix version to another.
void moveToEndVersionSequence(Version version)
Move a version to the end of the version sequence
void moveToStartVersionSequence(Version version)
Move a version to the start of the version list
void moveVersionAfter(Version version, Long scheduleAfterVersion)
Move a version after another version
void releaseVersion(Version version, boolean release)
Used to release or unrelease a version, depending on the release flag.
void releaseVersions(Collection<Version> versions, boolean release)
Used to release versions depending on the release flag.
Version update(Version version)
Persists updates to the specified version object.

Constants

public static final String ALL_RELEASED_VERSIONS

Used to retrieve all released versions

Constant Value: "-3"

public static final String ALL_UNRELEASED_VERSIONS

Used to retrieve all unreleased versions

Constant Value: "-2"

public static final String NO_VERSIONS

Used to represent empty version fields

Constant Value: "-1"

Public Methods

public void archiveVersion (Version version, boolean archive)

Archive/Un-archive a single version depending on the archive flag.

Parameters
version the Version to archive or unarchive
archive new archive value

public void archiveVersions (String[] idsToArchive, String[] idsToUnarchive)

Method used to archive and un-archive a number of versions.

Parameters
idsToArchive Archive all these Versions
idsToUnarchive Unarchive these Versions

public Version createVersion (String name, Date releaseDate, String description, Long projectId, Long scheduleAfterVersion)

Creates a new Version object.

Parameters
name the Name
releaseDate date of release or null if not released.
description the Description
projectId 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.

public Version createVersion (String name, Date startDate, Date releaseDate, String description, Long projectId, Long scheduleAfterVersion)

Creates a new Version object.

Parameters
name the Name
startDate start date of the version or null
releaseDate date of release or null if not released.
description the Description
projectId 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.

public void decreaseVersionSequence (Version version)

Move a version to have a higher sequence number - ie make it later

Parameters
version the Version

public void deleteVersion (Version version)

Removes a specific version from the system.

Parameters
version The version to be removed.

public void editVersionDetails (Version version, String name, String description)

Updates details of an existing version.

Parameters
version The version to update
name The new version name, cannot be empty.
description The description of this version.
Throws
IllegalArgumentException If the name is not set, or already exists.

@Deprecated public void editVersionDetails (Version version, String name, String description, GenericValue project)

This method is deprecated.
use editVersionDetails(Version, String, String) instead. since 5.0

Updates details for an existing version.

Parameters
version The version to update
name new name
description new description
project Used to check for duplicate version names in a project.
Throws
IllegalArgumentException If the name is not set, or already exists.

public void editVersionReleaseDate (Version version, Date duedate)

Update the release date of a version.

Parameters
version the Version to edit
duedate new release date

public void editVersionStartDate (Version version, Date startDate)

Updates the start date of a version

Parameters
version the version to edit
startDate new start date

public void editVersionStartReleaseDate (Version version, Date startDate, Date releaseDate)

Updates the start and release date of a version

Parameters
version the version to edit
startDate new start date
releaseDate new release date

@Deprecated public Collection<Version> getAffectedVersionsByIssue (GenericValue issue)

This method is deprecated.
use getAffectedVersionsFor(com.atlassian.jira.issue.Issue) instead. since 5.0

Parameters
issue the Issue
Returns
  • A collection of 'affects' Versions for an issue.

public Collection<Version> getAffectedVersionsFor (Issue issue)

Get all affected versions of the specified issue.

Parameters
issue the issue
Returns
  • all affected versions of the specified issue.

@Deprecated public Collection<GenericValue> getAffectsIssues (Version version)

This method is deprecated.
use getIssuesWithAffectsVersion(Version) instead. since 5.0

Return 'Affects' Issues

Parameters
version the Version
Returns
  • A collection of issue GenericValues

@Deprecated public Collection<GenericValue> getAllAffectedIssues (Collection<Version> versions)

This method is deprecated.
use getIssueIdsWithAffectsVersion(Version) and getIssueIdsWithFixVersion(Version) instead. since 5.0

Return all Issues that are associated with the specified versions

Parameters
versions a collection of Version objects
Returns
  • A collection of issue GenericValues

public Collection<Version> getAllVersions ()

Returns
  • all versions in JIRA. Never null.

public Collection<Version> getAllVersionsForProjects (Collection<Project> projects, boolean includeArchived)

Returns all versions that belong to the passed projects.

Parameters
projects projects to search in
includeArchived whether or not to include archived versions
Returns
  • all versions that belong to passed projects. Never null.

public Collection<Version> getAllVersionsReleased (boolean includeArchived)

Parameters
includeArchived whether or not to include archived versions
Returns
  • all released versions in JIRA. Never null.

public Collection<Version> getAllVersionsUnreleased (boolean includeArchived)

Parameters
includeArchived whether or not to include archived versions
Returns
  • all released versions in JIRA. Never null.

@Deprecated public Collection<GenericValue> getFixIssues (Version version)

This method is deprecated.
use getIssuesWithFixVersion(Version) instead. since 5.0

Return Fix Issues

Parameters
version the Version
Returns
  • A collection of issue GenericValues

@Deprecated public Collection<Version> getFixVersionsByIssue (GenericValue issue)

This method is deprecated.
use getFixVersionsFor(com.atlassian.jira.issue.Issue) instead. since 5.0

Parameters
issue the Issue
Returns
  • A collection of 'fix for' Versions for an issue.

public Collection<Version> getFixVersionsFor (Issue issue)

Get all fix for versions of the specified issue.

Parameters
issue the Issue
Returns
  • all fix for versions of the specified issue.

public Collection<Long> getIssueIdsWithAffectsVersion (Version version)

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.

public Collection<Long> getIssueIdsWithFixVersion (Version version)

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.

public Collection<Issue> getIssuesWithAffectsVersion (Version version)

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.

public Collection<Issue> getIssuesWithFixVersion (Version version)

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.

public Collection<Version> getOtherUnarchivedVersions (Version version)

Return all unarchived versions except this one

Parameters
version the Version
Returns
  • all unarchived versions except this one

public Collection<Version> getOtherVersions (Version version)

Return all other versions in the project except this one

Parameters
version the Version
Returns
  • all other versions in the project except this one

public Version getVersion (Long projectId, String versionName)

Search for a version by projectID and name.

Parameters
projectId the Project
versionName the Version name
Returns

public Version getVersion (Long id)

Returns a single version.

Parameters
id the Version ID
Returns

public List<Version> getVersions (Project project)

Return a list of Versions for the given project.

Parameters
project the Project
Returns
  • a list of Versions for the given project.

public List<Version> getVersions (Long projectId, boolean includeArchived)

Return a list of Versions for the given project.

Parameters
projectId the Project
includeArchived whether or not to include archived versions
Returns
  • a list of Versions for the given project.

public List<Version> getVersions (GenericValue project)

This method is deprecated.
Use getVersions(Long) or getVersions(Project) instead. Since 2006.

Gets all the versions for a project.

Parameters
project the Project
Returns
  • a List of Version objects.

public Collection<Version> getVersions (List<Long> ids)

Return a collection of Versions matching the ids passed in.

Parameters
ids Version IDs
Returns
  • a collection of Versions matching the ids passed in.

public List<Version> getVersions (Long projectId)

Return a list of Versions for the given project.

Parameters
projectId the Project
Returns
  • a list of Versions for the given project.

public Collection<Version> getVersionsArchived (Project project)

Return all archived versions for a particular project.

Parameters
project the Project
Returns
  • Archived versions for this project.

public Collection<Version> getVersionsArchived (GenericValue projectGV)

This method is deprecated.
Use getVersionsArchived(Project) instead. Since v5.0.

Return all archived versions for a particular project.

Parameters
projectGV the Project
Returns

public Collection<Version> getVersionsByName (String versionName)

Return a collection of Versions that have the specified name.

Parameters
versionName the name of the version (case-insensitive)
Returns
  • a Collection of Version objects. Never null.

public Collection<Version> getVersionsReleased (Long projectId, boolean includeArchived)

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 id
includeArchived flag to indicate whether to include archived versions in the result.
Returns

public Collection<Version> getVersionsReleasedDesc (Long projectId, boolean includeArchived)

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 id
includeArchived flag to indicate whether to include archived versions in the result.
Returns

public Collection<Version> getVersionsUnarchived (Long projectId)

Return all un-archived versions for a particular project

Parameters
projectId id of the project.
Returns

public Collection<Version> getVersionsUnreleased (Long projectId, boolean includeArchived)

Gets a list of un-released versions for a particular project.

Parameters
projectId The id of the project for which to return versions
includeArchived True if archived versions should be included
Returns
  • A Collection of Versions, never null

public void increaseVersionSequence (Version version)

Move a version to have a lower sequence number - ie make it earlier

Parameters
version the Version

public boolean isDuplicateName (Version version, String name)

Check that the version name we are changing to is not a duplicate.

Parameters
version The version to update
name The new name for the version
Returns
  • true if there is already a version with that name for the project

@Deprecated public boolean isDuplicateName (Version version, String name, GenericValue project)

This method is deprecated.
use isDuplicateName(Version, String) instead. since 5.0

Check that the version name we are changing to is not a duplicate.

Parameters
version The version to update
name The new name for the version
project Used to check for duplicate version names in a project.
Returns
  • true if there is already a version with that name for the project

public boolean isVersionOverDue (Version version)

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)

public void moveIssuesToNewVersion (List<GenericValue> issues, Version currentVersion, Version swapToVersion)

Swaps the list of issues supplied from one Fix version to another.

Parameters
issues the Issues
currentVersion Current fix version they will be swapped from
swapToVersion New fix version they will be swapped to.
Throws
IndexException if an error occurs will indexing these new issue values.

public void moveToEndVersionSequence (Version version)

Move a version to the end of the version sequence

Parameters
version the Version

public void moveToStartVersionSequence (Version version)

Move a version to the start of the version list

Parameters
version the Version to move

public void moveVersionAfter (Version version, Long scheduleAfterVersion)

Move a version after another version

Parameters
version version to reschedule
scheduleAfterVersion id of the version to schedule after the given version object

public void releaseVersion (Version version, boolean release)

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

public void releaseVersions (Collection<Version> versions, boolean release)

Used to release versions depending on the release flag.

Parameters
versions Collection of Versions
release True to release a version. False to 'unrelease' a version

public Version update (Version version)

Persists updates to the specified version object.

Parameters
version the version
Returns
  • the updated version