com.atlassian.jira.project.version
Class DefaultVersionManager

java.lang.Object
  extended by com.atlassian.jira.project.version.DefaultVersionManager
All Implemented Interfaces:
VersionManager

public class DefaultVersionManager
extends Object
implements VersionManager


Field Summary
protected  com.atlassian.core.ofbiz.association.AssociationManager associationManager
           
protected  CacheManager cacheManager
           
protected  CollectionReorderer collectionReorderer
           
protected  IssueIndexManager issueIndexManager
           
protected  IssueManager issueManager
           
protected  ProjectManager projectManager
           
protected  VersionStore versionStore
           
 
Fields inherited from interface com.atlassian.jira.project.version.VersionManager
ALL_RELEASED_VERSIONS, ALL_UNRELEASED_VERSIONS, NO_VERSIONS
 
Constructor Summary
DefaultVersionManager(IssueManager issueManager, CacheManager cacheManager, CollectionReorderer collectionReorderer, com.atlassian.core.ofbiz.association.AssociationManager associationManager, IssueIndexManager issueIndexManager, ProjectManager projectManager, VersionStore versionStore)
           
 
Method Summary
 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, org.ofbiz.core.entity.GenericValue project, Long scheduleAfterVersion)
          Creates a new Version object.
 Version createVersion(String name, 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(String actionType, Version version, String affectsAction, Long affectsSwapVersionId, String fixAction, Long fixSwapVersionId)
          Deprecated. since v3.13. Use VersionService.delete(com.atlassian.jira.bc.JiraServiceContext , com.atlassian.jira.bc.project.version.VersionService.ValidationResult) instead.
 void deleteVersion(Version version)
          Removes a specific version from the system.
 void editVersionDetails(Version version, String versionName, String description, org.ofbiz.core.entity.GenericValue project)
          Updates details for an existing version.
 void editVersionReleaseDate(Version version, Date duedate)
          Update the release date of a version.
 Collection<Version> getAffectedVersionsByIssue(org.ofbiz.core.entity.GenericValue issue)
           
 Collection<org.ofbiz.core.entity.GenericValue> getAffectsIssues(Version version)
          Return 'Affects' Issues
 Collection<org.ofbiz.core.entity.GenericValue> getAllAffectedIssues(Collection<Version> versions)
          Return all Issues that are assoicated with the specified versions
 Collection<Version> getAllVersions()
           
 Collection<Version> getAllVersionsReleased(boolean includeArchived)
           
 Collection<Version> getAllVersionsUnreleased(boolean includeArchived)
           
 Collection<org.ofbiz.core.entity.GenericValue> getFixIssues(Version version)
          Return Fix Issues
 Collection<Version> getFixVersionsByIssue(org.ofbiz.core.entity.GenericValue issue)
           
 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(org.ofbiz.core.entity.GenericValue project, String versionName)
          Retrieve a specific Version in a project, or null if no such version exists in that project.
 Version getVersion(Long id)
          Returns a single version.
 Version getVersion(Long projectId, String versionName)
          Retrieve a specific Version in a project given the project id, or null if no such version exists in that project.
 List<Version> getVersions(org.ofbiz.core.entity.GenericValue project)
          Gets all the versions for a project.
 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 a project.
 Collection<Version> getVersionsArchived(org.ofbiz.core.entity.GenericValue projectGV)
          Return all archived versions for a particular project.
protected  Collection<Version> getVersionsByIssue(org.ofbiz.core.entity.GenericValue issue, String relationName)
           
 Collection<Version> getVersionsByName(String versionName)
          Return a collection of Versions that have the specified name.
 Collection<Version> getVersionsReleased(org.ofbiz.core.entity.GenericValue project, boolean includeArchived)
          Gets a list of released versions for a project.
 Collection<Version> getVersionsReleased(Long projectId, boolean includeArchived)
          Gets a list of released versions for a project.
 Collection<Version> getVersionsReleasedDesc(org.ofbiz.core.entity.GenericValue project, boolean includeArchived)
          Gets a list of released versions for a project in reverse order.
 Collection<Version> getVersionsReleasedDesc(Long projectId, boolean includeArchived)
          Gets a list of released versions for a project in reverse order.
 Collection<Version> getVersionsUnarchived(org.ofbiz.core.entity.GenericValue projectGV)
          Return all un-archived versions for a particular project
 Collection<Version> getVersionsUnarchived(Long projectId)
          Return all un-archived versions for a particular project
 Collection<Version> getVersionsUnreleased(org.ofbiz.core.entity.GenericValue project, boolean includeArchived)
          Gets a list of un-released 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 isVersionOverDue(Version version)
          Checks to see if a version is overdue.
 void moveIssuesToNewVersion(List issues, Version currentVersion, Version swapToVersion)
          Swaps the list of issues supplied from one 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 scheduleAfterVersionId)
          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.
 void storeReorderedVersionList(List<Version> versions)
          Given a re-ordered list of versions, commit the changes to the backend datastore.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

issueManager

protected final IssueManager issueManager

cacheManager

protected final CacheManager cacheManager

collectionReorderer

protected final CollectionReorderer collectionReorderer

associationManager

protected final com.atlassian.core.ofbiz.association.AssociationManager associationManager

issueIndexManager

protected final IssueIndexManager issueIndexManager

projectManager

protected final ProjectManager projectManager

versionStore

protected final VersionStore versionStore
Constructor Detail

DefaultVersionManager

public DefaultVersionManager(IssueManager issueManager,
                             CacheManager cacheManager,
                             CollectionReorderer collectionReorderer,
                             com.atlassian.core.ofbiz.association.AssociationManager associationManager,
                             IssueIndexManager issueIndexManager,
                             ProjectManager projectManager,
                             VersionStore versionStore)
Method Detail

createVersion

public Version createVersion(String name,
                             Date releaseDate,
                             String description,
                             org.ofbiz.core.entity.GenericValue project,
                             Long scheduleAfterVersion)
                      throws CreateException
Description copied from interface: VersionManager
Creates a new Version object.

Specified by:
createVersion in interface VersionManager
releaseDate - date of release or null if not released.
project - the GenericValue 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 releaseDate,
                             String description,
                             Long projectId,
                             Long scheduleAfterVersion)
                      throws CreateException
Description copied from interface: VersionManager
Creates a new Version object. Takes a project ID instead of a project GenericValue.

Specified by:
createVersion in interface VersionManager
releaseDate - date of release or null if not released.
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.

moveToStartVersionSequence

public void moveToStartVersionSequence(Version version)
Description copied from interface: VersionManager
Move a version to the start of the version list

Specified by:
moveToStartVersionSequence in interface VersionManager

increaseVersionSequence

public void increaseVersionSequence(Version version)
Description copied from interface: VersionManager
Move a version to have a lower sequence number - ie make it earlier

Specified by:
increaseVersionSequence in interface VersionManager

decreaseVersionSequence

public void decreaseVersionSequence(Version version)
Description copied from interface: VersionManager
Move a version to have a higher sequence number - ie make it later

Specified by:
decreaseVersionSequence in interface VersionManager

moveToEndVersionSequence

public void moveToEndVersionSequence(Version version)
Description copied from interface: VersionManager
Move a version to the end of the version sequence

Specified by:
moveToEndVersionSequence in interface VersionManager

moveVersionAfter

public void moveVersionAfter(Version version,
                             Long scheduleAfterVersionId)
Description copied from interface: VersionManager
Move a version after another version

Specified by:
moveVersionAfter in interface VersionManager
Parameters:
version - version to reschedule
scheduleAfterVersionId - id of the version to schedule after the given version object

deleteVersion

public void deleteVersion(String actionType,
                          Version version,
                          String affectsAction,
                          Long affectsSwapVersionId,
                          String fixAction,
                          Long fixSwapVersionId)
Deprecated. since v3.13. Use VersionService.delete(com.atlassian.jira.bc.JiraServiceContext , com.atlassian.jira.bc.project.version.VersionService.ValidationResult) instead.

This method is used by the merge and delete actions. The action type needs to be specified as the action params are validated differently.

Specified by:
deleteVersion in interface VersionManager
Parameters:
actionType - See VersionKeys.DELETE_ACTION,VersionKeys.MERGE_ACTION
version - The version to delete.
affectsAction - Used to decide whether to move all the issues to a different 'affects' version or just remove them. See VersionKeys.REMOVE_ACTION, VersionKeys.SWAP_ACTION
affectsSwapVersionId - The new affects version to move issues to.
fixAction - Used to decide wether to move all the issues to a different 'fix' version or just remove them. See VersionKeys.REMOVE_ACTION, VersionKeys.SWAP_ACTION
fixSwapVersionId - The new fix version to move issues to.

deleteVersion

public void deleteVersion(Version version)
Description copied from interface: VersionManager
Removes a specific version from the system.

Specified by:
deleteVersion in interface VersionManager
Parameters:
version - The version to be removed.

editVersionDetails

public void editVersionDetails(Version version,
                               String versionName,
                               String description,
                               org.ofbiz.core.entity.GenericValue project)
Description copied from interface: VersionManager
Updates details for an existing version.

Specified by:
editVersionDetails in interface VersionManager
Parameters:
version - The version to update
project - Used to check for duplicate version names in a project.

releaseVersion

public void releaseVersion(Version version,
                           boolean release)
Description copied from interface: VersionManager
Used to release or unrelease a version, depending on the release flag.

Specified by:
releaseVersion in interface VersionManager
Parameters:
version - Version to be released (or unreleased)
release - True to release a version. False to 'unrelease' a version

releaseVersions

public void releaseVersions(Collection<Version> versions,
                            boolean release)
Description copied from interface: VersionManager
Used to release versions depending on the release flag.

Specified by:
releaseVersions in interface VersionManager
Parameters:
versions - Collection of Versions
release - 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: VersionManager
Swaps the list of issues supplied from one version to another.

Specified by:
moveIssuesToNewVersion in interface VersionManager
Throws:
IndexException

archiveVersions

public void archiveVersions(String[] idsToArchive,
                            String[] idsToUnarchive)
Description copied from interface: VersionManager
Method used to archive and un-archive a number of versions.

Specified by:
archiveVersions in interface VersionManager

archiveVersion

public void archiveVersion(Version version,
                           boolean archive)
Description copied from interface: VersionManager
Archive/Un-archive a single version depending on the archive flag.

Specified by:
archiveVersion in interface VersionManager

editVersionReleaseDate

public void editVersionReleaseDate(Version version,
                                   Date duedate)
Description copied from interface: VersionManager
Update the release date of a version.

Specified by:
editVersionReleaseDate in interface VersionManager

isVersionOverDue

public boolean isVersionOverDue(Version version)
Description copied from interface: VersionManager
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()).

Specified by:
isVersionOverDue in interface VersionManager
Returns:
True if the version is overdue. (i.e. releaseDate is before last midnight)

getVersionsUnarchived

public Collection<Version> getVersionsUnarchived(Long projectId)
Description copied from interface: VersionManager
Return all un-archived versions for a particular project

Specified by:
getVersionsUnarchived in interface VersionManager
Parameters:
projectId - id of the project.
Returns:
A collection of Versions

getVersionsUnarchived

public Collection<Version> getVersionsUnarchived(org.ofbiz.core.entity.GenericValue projectGV)
Description copied from interface: VersionManager
Return all un-archived versions for a particular project

Specified by:
getVersionsUnarchived in interface VersionManager
Returns:
A collection of Versions

getVersionsArchived

public Collection<Version> getVersionsArchived(org.ofbiz.core.entity.GenericValue projectGV)
Description copied from interface: VersionManager
Return all archived versions for a particular project.

Specified by:
getVersionsArchived in interface VersionManager
Returns:
A collections of Versions

getVersions

public List<Version> getVersions(org.ofbiz.core.entity.GenericValue project)
Description copied from interface: VersionManager
Gets all the versions for a project.

Specified by:
getVersions in interface VersionManager
Returns:
a List of Version objects.

getVersions

public List<Version> getVersions(Long projectId)
Description copied from interface: VersionManager
Return a list of Versions for a project.

Specified by:
getVersions in interface VersionManager
Returns:
a List of Version objects.

getVersionsByName

public Collection<Version> getVersionsByName(String versionName)
Description copied from interface: VersionManager
Return a collection of Versions that have the specified name.

Specified by:
getVersionsByName in interface VersionManager
Parameters:
versionName - the name of the version (case-insensitive)
Returns:
a Collection of Version objects. Never null.

getAffectedVersionsByIssue

public Collection<Version> getAffectedVersionsByIssue(org.ofbiz.core.entity.GenericValue issue)
Specified by:
getAffectedVersionsByIssue in interface VersionManager
Returns:
A collection of Versions for an issue.

getFixVersionsByIssue

public Collection<Version> getFixVersionsByIssue(org.ofbiz.core.entity.GenericValue issue)
Specified by:
getFixVersionsByIssue in interface VersionManager
Returns:
A collection of Versions for an issue.

getAllVersions

public Collection<Version> getAllVersions()
Specified by:
getAllVersions in interface VersionManager
Returns:
all versions in JIRA. Never null.

getAllVersionsReleased

public Collection<Version> getAllVersionsReleased(boolean includeArchived)
Specified by:
getAllVersionsReleased in interface VersionManager
Parameters:
includeArchived - whether or not to include archived versions
Returns:
all released versions in JIRA. Never null.

getAllVersionsUnreleased

public Collection<Version> getAllVersionsUnreleased(boolean includeArchived)
Specified by:
getAllVersionsUnreleased in interface VersionManager
Parameters:
includeArchived - whether or not to include archived versions
Returns:
all released versions in JIRA. Never null.

getVersionsByIssue

protected Collection<Version> getVersionsByIssue(org.ofbiz.core.entity.GenericValue issue,
                                                 String relationName)
Parameters:
issue - the issue
relationName - IssueRelationConstants.VERSION or IssueRelationConstants.FIX_VERSION.
Returns:
A collection of Versions for this issue.

getVersions

public Collection<Version> getVersions(List<Long> ids)
Description copied from interface: VersionManager
Return a collection of Versions matching the ids passed in.

Specified by:
getVersions in interface VersionManager
Returns:

getVersionsUnreleased

public Collection<Version> getVersionsUnreleased(org.ofbiz.core.entity.GenericValue project,
                                                 boolean includeArchived)
Description copied from interface: VersionManager
Gets a list of un-released versions for a particular project.

Specified by:
getVersionsUnreleased in interface VersionManager
Returns:
A collection of Versions

getVersionsUnreleased

public Collection<Version> getVersionsUnreleased(Long projectId,
                                                 boolean includeArchived)
Description copied from interface: VersionManager
Gets a list of un-released versions for a particular project.

Specified by:
getVersionsUnreleased in interface VersionManager
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

getVersionsReleased

public Collection<Version> getVersionsReleased(org.ofbiz.core.entity.GenericValue project,
                                               boolean includeArchived)
Description copied from interface: VersionManager
Gets a list of released versions for a project. This list will include archived versions if the 'includeArchived' flag is set to true.

Specified by:
getVersionsReleased in interface VersionManager
Parameters:
project - project generic value
includeArchived - flag to indicate whether to include archived versions in the result.
Returns:
A collection of Version objects

getVersionsReleased

public Collection<Version> getVersionsReleased(Long projectId,
                                               boolean includeArchived)
Description copied from interface: VersionManager
Gets a list of released versions for a project. This list will include archived versions if the 'includeArchived' flag is set to true.

Specified by:
getVersionsReleased in interface VersionManager
Parameters:
projectId - project id
includeArchived - flag to indicate whether to include archived versions in the result.
Returns:
A collection of Version objects

getVersionsReleasedDesc

public Collection<Version> getVersionsReleasedDesc(org.ofbiz.core.entity.GenericValue project,
                                                   boolean includeArchived)
Description copied from interface: VersionManager
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.

Specified by:
getVersionsReleasedDesc in interface VersionManager
Parameters:
project - project generic value
includeArchived - flag to indicate whether to include archived versions in the result.
Returns:
A collection of Version objects

getVersionsReleasedDesc

public Collection<Version> getVersionsReleasedDesc(Long projectId,
                                                   boolean includeArchived)
Description copied from interface: VersionManager
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.

Specified by:
getVersionsReleasedDesc in interface VersionManager
Parameters:
projectId - project id
includeArchived - flag to indicate whether to include archived versions in the result.
Returns:
A collection of Version objects

getVersion

public Version getVersion(Long id)
Description copied from interface: VersionManager
Returns a single version.

Specified by:
getVersion in interface VersionManager
Returns:
A Version object.

getVersion

public Version getVersion(org.ofbiz.core.entity.GenericValue project,
                          String versionName)
Retrieve a specific Version in a project, or null if no such version exists in that project.

Specified by:
getVersion in interface VersionManager
Returns:
A Version object.

getVersion

public Version getVersion(Long projectId,
                          String versionName)
Retrieve a specific Version in a project given the project id, or null if no such version exists in that project.

Specified by:
getVersion in interface VersionManager
Returns:
A Version object.

getAllAffectedIssues

public Collection<org.ofbiz.core.entity.GenericValue> getAllAffectedIssues(Collection<Version> versions)
Description copied from interface: VersionManager
Return all Issues that are assoicated with the specified versions

Specified by:
getAllAffectedIssues in interface VersionManager
Parameters:
versions - a collection of Version objects
Returns:
A collection of issue GenericValues

getOtherVersions

public Collection<Version> getOtherVersions(Version version)
Return all other versions in the project except this one

Specified by:
getOtherVersions in interface VersionManager
Returns:

getOtherUnarchivedVersions

public Collection<Version> getOtherUnarchivedVersions(Version version)
Return all unarchived versions except this one

Specified by:
getOtherUnarchivedVersions in interface VersionManager
Returns:

getFixIssues

public Collection<org.ofbiz.core.entity.GenericValue> getFixIssues(Version version)
Description copied from interface: VersionManager
Return Fix Issues

Specified by:
getFixIssues in interface VersionManager
Returns:
A collection of issue GenericValues

getAffectsIssues

public Collection<org.ofbiz.core.entity.GenericValue> getAffectsIssues(Version version)
Description copied from interface: VersionManager
Return 'Affects' Issues

Specified by:
getAffectsIssues in interface VersionManager
Returns:
A collection of issue GenericValues

storeReorderedVersionList

public void storeReorderedVersionList(List<Version> versions)
Given a re-ordered list of versions, commit the changes to the backend datastore.



Copyright © 2002-2009 Atlassian. All Rights Reserved.