public class DefaultVersionManager extends Object implements VersionManager
ALL_RELEASED_VERSIONS, ALL_UNRELEASED_VERSIONS, NO_VERSIONS| Constructor and Description | 
|---|
| DefaultVersionManager(IssueManager issueManager,
                     NodeAssociationStore nodeAssociationStore,
                     IssueIndexingService issueIndexService,
                     VersionStore versionStore,
                     com.atlassian.event.api.EventPublisher eventPublisher,
                     DbConnectionManager dbConnectionManager,
                     VersionCustomFieldStore versionCustomFieldStore) | 
| Modifier and Type | Method and Description | 
|---|---|
| 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  Versionobject. | 
| 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,
             org.ofbiz.core.entity.GenericValue project,
             Long scheduleAfterVersion)Deprecated. 
 since version 6.0 | 
| Version | createVersion(String name,
             Date releaseDate,
             String description,
             Long projectId,
             Long scheduleAfterVersion)Creates a new  Versionobject. | 
| 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,
             com.atlassian.fugue.Option<Version> affectsSwapVersion,
             com.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)Testing notes - side effects (reindexing, events) are tested in unitTest, actual version removal
 is tested in  com.atlassian.jira.webtests.ztests.bundledplugins2.rest.TestVersionResource. | 
| 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. | 
| protected IssueFactory | getIssueFactory()NB: This is done because we can't inject a  IssueFactory, this would cause circular dependency. | 
| 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)Retrieve a specific Version in a project given the project id, or  nullif no such version exists in
 that 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 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. | 
| 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(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 currentVersion,
               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. | 
| 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 scheduleAfterVersionId)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 | storeReorderedVersionList(List<Version> versions)Given a re-ordered list of versions, commit the changes to the backend datastore. | 
| void | swapVersionForRelatedIssues(ApplicationUser user,
                           Version version,
                           com.atlassian.fugue.Option<Version> affectsSwapVersion,
                           com.atlassian.fugue.Option<Version> fixSwapVersion)This method will update all issues that currently have  versionset as either affects or fix version to
 the newaffectsSwapVersionorfixSwapVersion | 
| Version | update(Version version)Persists updates to the specified version object. | 
| List<ChangeItemBean> | updateIssueAffectsVersions(Issue issue,
                          Collection<Version> newVersions) | 
| List<ChangeItemBean> | updateIssueFixVersions(Issue issue,
                      Collection<Version> newValue) | 
public DefaultVersionManager(IssueManager issueManager, NodeAssociationStore nodeAssociationStore, IssueIndexingService issueIndexService, VersionStore versionStore, com.atlassian.event.api.EventPublisher eventPublisher, DbConnectionManager dbConnectionManager, VersionCustomFieldStore versionCustomFieldStore)
@Deprecated public Version createVersion(String name, Date releaseDate, String description, org.ofbiz.core.entity.GenericValue project, Long scheduleAfterVersion) throws CreateException
CreateExceptionpublic Version createVersion(String name, Date releaseDate, String description, Long projectId, Long scheduleAfterVersion) throws CreateException
VersionManagerVersion object.createVersion in interface VersionManagername - 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
VersionManagerVersion object.createVersion in interface VersionManagername - 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
VersionManagerVersion.
 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 VersionManagername - 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 createCreateExceptionpublic Version moveToStartVersionSequence(Version version)
VersionManagermoveToStartVersionSequence in interface VersionManagerversion - the Version to movepublic Version increaseVersionSequence(Version version)
VersionManagerincreaseVersionSequence in interface VersionManagerversion - the Versionpublic Version decreaseVersionSequence(Version version)
VersionManagerdecreaseVersionSequence in interface VersionManagerversion - the Versionpublic Version moveToEndVersionSequence(Version version)
VersionManagermoveToEndVersionSequence in interface VersionManagerversion - the Versionpublic Version moveVersionAfter(Version version, Long scheduleAfterVersionId)
VersionManagermoveVersionAfter in interface VersionManagerversion - version to reschedulescheduleAfterVersionId - id of the version to schedule after the given version objectpublic void deleteVersion(Version version)
VersionManagerdeleteVersion in interface VersionManagerversion - The version to be removed.VersionManager.deleteAndRemoveFromIssues(com.atlassian.jira.user.ApplicationUser, Version)public void deleteVersion(ApplicationUser applicationUser, Version versionToDelete, com.atlassian.fugue.Option<Version> affectsSwapVersion, com.atlassian.fugue.Option<Version> fixSwapVersion)
VersionManagerversionToDelete 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 VersionManagerapplicationUser - 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)
VersionManagerdeleteAllVersions in interface VersionManagerprojectId - the id of project in which versions will be deleted.public Version update(Version version)
VersionManagerupdate in interface VersionManagerversion - the versionpublic Version editVersionDetails(Version version, String name, String description)
VersionManagereditVersionDetails in interface VersionManagerversion - The version to updatename - The new version name, cannot be empty.description - The description of this version.public Version releaseVersion(Version version, boolean release)
VersionManagerreleaseVersion in interface VersionManagerversion - 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)
VersionManagerreleaseVersions in interface VersionManagerversions - Collection of Versionsrelease - True to release a version. False to 'unrelease' a versionpublic void moveIssuesToNewVersion(List<Issue> issues, Version currentVersion, Version swapToVersion) throws IndexException
VersionManagermoveIssuesToNewVersion in interface VersionManagerissues - 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)
VersionManagerarchiveVersions in interface VersionManageridsToArchive - Archive all these VersionsidsToUnarchive - Unarchive these Versionspublic Version archiveVersion(Version version, boolean archive)
VersionManagerarchiveVersion in interface VersionManagerversion - the Version to archive or unarchivearchive - new archive valuepublic Version editVersionReleaseDate(Version version, Date duedate)
VersionManagereditVersionReleaseDate in interface VersionManagerversion - the Version to editduedate - new release datepublic Version editVersionStartDate(Version version, Date startDate)
VersionManagereditVersionStartDate in interface VersionManagerversion - the version to editstartDate - new start datepublic Version editVersionStartReleaseDate(Version version, Date startDate, Date releaseDate)
VersionManagereditVersionStartReleaseDate in interface VersionManagerversion - the version to editstartDate - new start datereleaseDate - new release datepublic boolean isVersionOverDue(Version version)
VersionManagerisVersionOverDue in interface VersionManagerversion - the Versionpublic Collection<Version> getVersionsUnarchived(Long projectId)
VersionManagergetVersionsUnarchived in interface VersionManagerprojectId - id of the project.Versionspublic Collection<Version> getVersionsArchived(Project project)
VersionManagergetVersionsArchived in interface VersionManagerproject - the Projectpublic List<Version> getVersions(Long projectId)
VersionManagergetVersions in interface VersionManagerprojectId - the ProjectVersionManager.getVersions(Project)public List<Version> getVersions(Long projectId, boolean includeArchived)
VersionManagergetVersions in interface VersionManagerprojectId - the ProjectincludeArchived - whether or not to include archived versionsVersionManager.getVersions(Project)public List<Version> getVersions(Project project)
VersionManagergetVersions in interface VersionManagerproject - the ProjectVersionManager.getVersions(Long)public Collection<Version> getVersionsByName(String versionName)
VersionManagerVersions that have the specified name.getVersionsByName in interface VersionManagerversionName - the name of the version (case-insensitive)public Collection<Version> getAffectedVersionsFor(Issue issue)
VersionManagergetAffectedVersionsFor in interface VersionManagerissue - the issuepublic List<ChangeItemBean> updateIssueAffectsVersions(Issue issue, Collection<Version> newVersions)
updateIssueAffectsVersions in interface VersionManagerpublic List<ChangeItemBean> updateIssueFixVersions(Issue issue, Collection<Version> newValue)
updateIssueFixVersions in interface VersionManagerpublic Collection<Version> getFixVersionsFor(Issue issue)
VersionManagergetFixVersionsFor in interface VersionManagerissue - the Issuepublic Collection<Version> getAllVersions()
getAllVersions in interface VersionManagerpublic int getTotalVersionCount()
getTotalVersionCount in interface VersionManagerpublic Collection<Version> getAllVersionsForProjects(Collection<Project> projects, boolean includeArchived)
VersionManagergetAllVersionsForProjects in interface VersionManagerprojects - projects to search inincludeArchived - whether or not to include archived versionspublic Collection<Version> getAllVersionsReleased(boolean includeArchived)
getAllVersionsReleased in interface VersionManagerincludeArchived - whether or not to include archived versionspublic Collection<Version> getAllVersionsUnreleased(boolean includeArchived)
getAllVersionsUnreleased in interface VersionManagerincludeArchived - whether or not to include archived versionspublic void merge(ApplicationUser user, @Nonnull Version versionToDelete, @Nonnull Version versionToMergeTo)
VersionManagerversionToDelete is a version that will be deleted completely.
 All issues will have this version replaced with versionToMergeTo.merge in interface VersionManageruser - 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)
VersionManagerVersionManager.deleteVersion(com.atlassian.jira.project.version.Version)) removes it from all issues that reference it.deleteAndRemoveFromIssues in interface VersionManageruser - User that will perform the update of issues.versionToRemove - Version to be deleted.public void swapVersionForRelatedIssues(ApplicationUser user, Version version, com.atlassian.fugue.Option<Version> affectsSwapVersion, com.atlassian.fugue.Option<Version> fixSwapVersion)
VersionManagerversion 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 VersionManageruser - 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)protected Collection<Version> getVersionsByIssue(org.ofbiz.core.entity.GenericValue issue, String relationName)
issue - the issuerelationName - IssueRelationConstants.VERSION or IssueRelationConstants.FIX_VERSION.Versions for this issue.public Collection<Version> getVersions(List<Long> ids)
VersionManagerVersions matching the ids passed in.getVersions in interface VersionManagerids - Version IDsVersions matching the ids passed in.public Collection<Version> getVersionsUnreleased(Long projectId, boolean includeArchived)
VersionManagergetVersionsUnreleased in interface VersionManagerprojectId - The id of the project for which to return versionsincludeArchived - True if archived versions should be includedVersions, never nullpublic Collection<Version> getVersionsReleased(Long projectId, boolean includeArchived)
VersionManagergetVersionsReleased in interface VersionManagerprojectId - project idincludeArchived - flag to indicate whether to include archived versions in the result.Version objectspublic Collection<Version> getVersionsReleasedDesc(Long projectId, boolean includeArchived)
VersionManagergetVersionsReleasedDesc in interface VersionManagerprojectId - project idincludeArchived - flag to indicate whether to include archived versions in the result.Version objectspublic Version getVersion(Long id)
VersionManagergetVersion in interface VersionManagerid - the Version IDVersion object.public Version getVersion(Long projectId, String versionName)
null if no such version exists in
 that project.getVersion in interface VersionManagerprojectId - the ProjectversionName - the Version nameVersion object.protected IssueFactory getIssueFactory()
IssueFactory, this would cause circular dependency.public Collection<Version> getOtherVersions(Version version)
getOtherVersions in interface VersionManagerversion - the Versionpublic Collection<Version> getOtherUnarchivedVersions(Version version)
getOtherUnarchivedVersions in interface VersionManagerversion - the Versionpublic Collection<Issue> getIssuesWithFixVersion(Version version)
VersionManagergetIssuesWithFixVersion in interface VersionManagerversion - the fixed for version.public Collection<Issue> getIssuesWithAffectsVersion(Version version)
VersionManagergetIssuesWithAffectsVersion in interface VersionManagerversion - the affected version.public Collection<Long> getIssueIdsWithAffectsVersion(@Nonnull Version version)
VersionManagergetIssueIdsWithAffectsVersion in interface VersionManagerversion - the affects version.public Collection<Long> getIssueIdsWithFixVersion(@Nonnull Version version)
VersionManagergetIssueIdsWithFixVersion in interface VersionManagerversion - the fix version.@Nonnull public Collection<CustomFieldWithVersionUsage> getCustomFieldsUsing(@Nonnull Version version)
VersionManagergetCustomFieldsUsing in interface VersionManagerversion - The version that we want to get information about.public long getCustomFieldIssuesCount(@Nonnull Version version)
VersionManagergetCustomFieldIssuesCount in interface VersionManagerversion - The version that we want to get information about.public void deleteVersionAndSwap(ApplicationUser applicationUser, DeleteVersionWithCustomFieldParameters parameters)
Testing notes - side effects (reindexing, events) are tested in unitTest, actual version removal
 is tested in com.atlassian.jira.webtests.ztests.bundledplugins2.rest.TestVersionResource.
deleteVersionAndSwap in interface VersionManagerapplicationUser - 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 boolean isDuplicateName(Version currentVersion, String name)
VersionManagerisDuplicateName in interface VersionManagercurrentVersion - The version to updatename - The new name for the versionCopyright © 2002-2018 Atlassian. All Rights Reserved.