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
           
 
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 getAffectedVersionsByIssue(org.ofbiz.core.entity.GenericValue issue)
           
 Collection getAffectsIssues(Version version)
          Return 'Affects' Issues
 Collection getAllAffectedIssues(Collection versions)
          Return all Issues that are assoicated with the specified versions
 Collection getFixIssues(Version version)
          Return Fix Issues
 Collection getFixVersionsByIssue(org.ofbiz.core.entity.GenericValue issue)
           
 Collection getOtherUnarchivedVersions(Version version)
          Return all unarchived versions except this one
 Collection 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 getVersions(org.ofbiz.core.entity.GenericValue project)
          Gets all the versions for a project.
 Collection getVersions(List ids)
          Return a collection of Versions matching the ids passed in.
 List getVersions(Long projectId)
          Return a list of Versions for a project.
 Collection getVersionsArchived(org.ofbiz.core.entity.GenericValue projectGV)
          Return all archived versions for a particular project.
protected  Collection getVersionsByIssue(org.ofbiz.core.entity.GenericValue issue, String relationName)
           
 Collection getVersionsReleased(org.ofbiz.core.entity.GenericValue project, boolean includeArchived)
          Gets a list of released versions for a project.
 Collection getVersionsReleased(Long projectId, boolean includeArchived)
          Gets a list of released versions for a project.
 Collection getVersionsReleasedDesc(org.ofbiz.core.entity.GenericValue project, boolean includeArchived)
          Gets a list of released versions for a project in reverse order.
 Collection getVersionsReleasedDesc(Long projectId, boolean includeArchived)
          Gets a list of released versions for a project in reverse order.
 Collection getVersionsUnarchived(org.ofbiz.core.entity.GenericValue projectGV)
          Return all un-archived versions for a particular project
 Collection getVersionsUnarchived(Long projectId)
          Return all un-archived versions for a particular project
 Collection getVersionsUnreleased(org.ofbiz.core.entity.GenericValue project, boolean includeArchived)
          Gets a list of un-released versions for a particular project.
 Collection 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 releaseVersions(Collection versions, boolean release)
          Used to release versions depending on the release flag.
 void storeReorderedVersionList(List 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,
                             org.ofbiz.core.entity.GenericEntityException
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.
org.ofbiz.core.entity.GenericEntityException - If there was a problem creating the version.

createVersion

public Version createVersion(String name,
                             Date releaseDate,
                             String description,
                             Long projectId,
                             Long scheduleAfterVersion)
                      throws CreateException,
                             org.ofbiz.core.entity.GenericEntityException
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.
org.ofbiz.core.entity.GenericEntityException - 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.

releaseVersions

public void releaseVersions(Collection 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 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 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 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 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 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.

getAffectedVersionsByIssue

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

getFixVersionsByIssue

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

getVersionsByIssue

protected Collection 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 getVersions(List 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 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 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 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 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 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 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 getAllAffectedIssues(Collection 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 getOtherVersions(Version version)
Return all other versions in the project except this one

Specified by:
getOtherVersions in interface VersionManager
Returns:

getOtherUnarchivedVersions

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

Specified by:
getOtherUnarchivedVersions in interface VersionManager
Returns:

getFixIssues

public Collection 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 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 versions)
Given a re-ordered list of versions, commit the changes to the backend datastore.



Copyright © 2002-2009 Atlassian. All Rights Reserved.