|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.atlassian.jira.bc.project.version.DefaultVersionService
public class DefaultVersionService
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.atlassian.jira.bc.project.version.VersionService |
---|
VersionService.AbstractVersionResult, VersionService.ArchiveVersionValidationResult, VersionService.CreateVersionValidationResult, VersionService.MoveVersionValidationResult, VersionService.ReleaseVersionValidationResult, VersionService.ValidationResult, VersionService.VersionAction, VersionService.VersionResult, VersionService.VersionsResult |
Field Summary |
---|
Fields inherited from interface com.atlassian.jira.bc.project.version.VersionService |
---|
REMOVE |
Constructor Summary | |
---|---|
DefaultVersionService(VersionManager versionManager,
PermissionManager permissionManager,
IssueManager issueManager,
IssueIndexManager issueIndexManager,
SearchProvider searchProvider,
IssueFactory issueFactory,
I18nHelper.BeanFactory i18n,
DateFieldFormat dateFieldFormat,
com.atlassian.event.api.EventPublisher eventPublisher)
|
Method Summary | |
---|---|
Version |
archiveVersion(VersionService.ArchiveVersionValidationResult result)
Takes a validation result and performs the archive operation. |
Version |
createVersion(com.atlassian.crowd.embedded.api.User user,
VersionService.CreateVersionValidationResult request)
Using the validation result from VersionService.validateCreateVersion(User, com.atlassian.jira.project.Project,
String, String, String, Long) a new version will be created. |
void |
decreaseVersionSequence(VersionService.MoveVersionValidationResult moveVersionValidationResult)
Move a version to have a higher sequence number - ie make it later. |
void |
delete(JiraServiceContext context,
VersionService.ValidationResult result)
Deletes a version from a project. |
long |
getAffectsIssuesCount(Version version)
Return the count of Issues that affect this version. |
long |
getFixIssuesCount(Version version)
Return the count of Issues Fixed in this version. |
long |
getUnresolvedIssuesCount(com.atlassian.crowd.embedded.api.User user,
Version version)
Return the count of Issues that are unresolved in this version. |
VersionService.VersionResult |
getVersionById(com.atlassian.crowd.embedded.api.User user,
Long versionId)
Used to retrieve a Version object by version id. |
VersionService.VersionResult |
getVersionById(com.atlassian.crowd.embedded.api.User user,
Project project,
Long versionId)
Used to retrieve a Version object by version id within project
specified by Project object. |
VersionService.VersionResult |
getVersionByProjectAndName(com.atlassian.crowd.embedded.api.User user,
Project project,
String versionName)
Used to retrieve a Version object by version name within project
specified by Project object. |
VersionService.VersionsResult |
getVersionsByProject(com.atlassian.crowd.embedded.api.User user,
Project project)
Used to retrieve a Version collection within project
specified by Project object. |
void |
increaseVersionSequence(VersionService.MoveVersionValidationResult moveVersionValidationResult)
Move a version to have a lower sequence number - ie make it earlier. |
boolean |
isOverdue(Version version)
Is the passed version overdue? This method does no permission checks on the passed version. |
void |
merge(JiraServiceContext context,
VersionService.ValidationResult result)
Merges a version into another, then removes the original version. |
void |
moveToEndVersionSequence(VersionService.MoveVersionValidationResult moveVersionValidationResult)
Move a version to the end of the version sequence. |
void |
moveToStartVersionSequence(VersionService.MoveVersionValidationResult moveVersionValidationResult)
Move a version to the start of the version list. |
void |
moveUnreleasedToNewVersion(com.atlassian.crowd.embedded.api.User user,
Version currentVersion,
Version newVersion)
Using the validation result from VersionService.validateReleaseVersion(User,
com.atlassian.jira.project.version.Version, Date) a version will be released. |
void |
moveVersionAfter(VersionService.MoveVersionValidationResult moveVersionValidationResult)
Move a version after another version. |
protected Date |
parseDate(com.atlassian.crowd.embedded.api.User user,
String releaseDate)
Parses a string release date into a Date object, throwing an exception if there is a problem parsing the string. |
Version |
releaseVersion(VersionService.ReleaseVersionValidationResult result)
Using the validation result from VersionService.validateReleaseVersion(User,
com.atlassian.jira.project.version.Version, Date) a version will be released. |
ServiceOutcome<Version> |
setReleaseDate(com.atlassian.crowd.embedded.api.User user,
Version version,
Date releaseDate)
Modify the release date of a version without performing a release/unrelease. |
ServiceOutcome<Version> |
setReleaseDate(com.atlassian.crowd.embedded.api.User user,
Version version,
String releaseDate)
Modify the release date of a version without performing a release/unrelease. |
ServiceOutcome<Version> |
setVersionDetails(com.atlassian.crowd.embedded.api.User user,
Version version,
String name,
String description)
Set the name and description of a version, if you have edit permission. |
Version |
unarchiveVersion(VersionService.ArchiveVersionValidationResult result)
Takes a validation result and performs the unarchive operation. |
Version |
unreleaseVersion(VersionService.ReleaseVersionValidationResult result)
Using the validation result from VersionService.validateUnreleaseVersion(User,
com.atlassian.jira.project.version.Version, Date) a version will be unreleased. |
VersionService.ArchiveVersionValidationResult |
validateArchiveVersion(com.atlassian.crowd.embedded.api.User user,
Version version)
This method should be called before archiving a version. |
VersionService.CreateVersionValidationResult |
validateCreateVersion(com.atlassian.crowd.embedded.api.User user,
Project project,
String versionName,
Date releaseDate,
String description,
Long scheduleAfterVersion)
This method needs to be called before creating a version to ensure all parameters are correct. |
VersionService.CreateVersionValidationResult |
validateCreateVersion(com.atlassian.crowd.embedded.api.User user,
Project project,
String versionName,
String releaseDate,
String description,
Long scheduleAfterVersion)
This method needs to be called before creating a version to ensure all parameters are correct. |
VersionService.MoveVersionValidationResult |
validateDecreaseVersionSequence(com.atlassian.crowd.embedded.api.User user,
long versionId)
Validate Move a version to have a higher sequence number - ie make it later. |
VersionService.ValidationResult |
validateDelete(JiraServiceContext context,
Long versionId,
VersionService.VersionAction affectsAction,
VersionService.VersionAction fixAction)
Validates an attempt to delete a version from a project. |
VersionService.MoveVersionValidationResult |
validateIncreaseVersionSequence(com.atlassian.crowd.embedded.api.User user,
long versionId)
Validate Move a version to have a lower sequence number - ie make it earlier. |
VersionService.ValidationResult |
validateMerge(JiraServiceContext context,
Long versionId,
Long swapVersionId)
Implementation is the same as deleting, with the actions set to SWAP and the swapVersionId being passed as both Affects Version swap and Fix Version swap |
VersionService.MoveVersionValidationResult |
validateMoveToEndVersionSequence(com.atlassian.crowd.embedded.api.User user,
long versionId)
Validate Move a version to the end of the version sequence. |
VersionService.MoveVersionValidationResult |
validateMoveToStartVersionSequence(com.atlassian.crowd.embedded.api.User user,
long versionId)
Validate Move a version to the start of the version list. |
VersionService.MoveVersionValidationResult |
validateMoveVersionAfter(com.atlassian.crowd.embedded.api.User user,
long versionId,
Long scheduleAfterVersionId)
Validate Move a version after another version. |
ServiceOutcome<Version> |
validateReleaseDate(com.atlassian.crowd.embedded.api.User user,
Version version,
String releaseDate)
Validate the release date of a version without performing a release/unrelease. |
VersionService.ReleaseVersionValidationResult |
validateReleaseVersion(com.atlassian.crowd.embedded.api.User user,
Version version,
Date releaseDate)
This method needs to be called before releasing a version to ensure all parameters are correct. |
VersionService.ReleaseVersionValidationResult |
validateReleaseVersion(com.atlassian.crowd.embedded.api.User user,
Version version,
String releaseDate)
This method needs to be called before releasing a version to ensure all parameters are correct. |
VersionService.ArchiveVersionValidationResult |
validateUnarchiveVersion(com.atlassian.crowd.embedded.api.User user,
Version version)
This method should be called before unarchiving a version. |
VersionService.ReleaseVersionValidationResult |
validateUnreleaseVersion(com.atlassian.crowd.embedded.api.User user,
Version version,
Date releaseDate)
This method needs to be called before unreleasing a version to ensure all parameters are correct. |
VersionService.ReleaseVersionValidationResult |
validateUnreleaseVersion(com.atlassian.crowd.embedded.api.User user,
Version version,
String releaseDate)
This method needs to be called before unreleasing a version to ensure all parameters are correct. |
ErrorCollection |
validateVersionDetails(com.atlassian.crowd.embedded.api.User user,
Version version,
String name,
String description)
Validate the name and description of a version, if you have edit permission. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultVersionService(VersionManager versionManager, PermissionManager permissionManager, IssueManager issueManager, IssueIndexManager issueIndexManager, SearchProvider searchProvider, IssueFactory issueFactory, I18nHelper.BeanFactory i18n, DateFieldFormat dateFieldFormat, com.atlassian.event.api.EventPublisher eventPublisher)
Method Detail |
---|
public VersionService.VersionResult getVersionById(com.atlassian.crowd.embedded.api.User user, Project project, Long versionId)
VersionService
Version
object by version id within project
specified by Project
object.
This method returns a VersionService.VersionResult
.
The version will be null if no version for the id specified can be found, or if the user making the request
does not have the ADMIN, PROJECT_ADMIN or BROWSE project permission for the project.
In both of these cases, the errorCollection in the result object will contain an appropriate error message.
getVersionById
in interface VersionService
user
- The user trying to get a versionproject
- The project object containing requested versionversionId
- The id of requested version
public VersionService.VersionResult getVersionById(com.atlassian.crowd.embedded.api.User user, Long versionId)
VersionService
Version
object by version id.
This method returns a VersionService.VersionResult
.
The version will be null if no version for the id specified can be found, or if the user making the request
does not have the ADMIN, PROJECT_ADMIN or BROWSE project permission for the project.
In both of these cases, the errorCollection in the result object will contain an appropriate error message.
getVersionById
in interface VersionService
user
- The user trying to get a versionversionId
- The id of requested version
public VersionService.VersionResult getVersionByProjectAndName(com.atlassian.crowd.embedded.api.User user, Project project, String versionName)
VersionService
Version
object by version name within project
specified by Project
object.
This method returns a VersionService.VersionResult
.
The version will be null if no version for the versionName specified can be found, or if the user making the request
does not have the ADMIN, PROJECT_ADMIN or BROWSE project permission for the project.
In both of these cases, the errorCollection in the result object will contain an appropriate error message.
getVersionByProjectAndName
in interface VersionService
user
- The user trying to get a versionproject
- The project object containing requested versionversionName
- The name of requested version
public VersionService.VersionsResult getVersionsByProject(com.atlassian.crowd.embedded.api.User user, Project project)
VersionService
Version
collection within project
specified by Project
object.
This method returns a VersionService.VersionsResult
.
The versions collection will be empty if the user making the request
does not have the ADMIN, PROJECT_ADMIN or BROWSE project permission for the project.
In this case, the errorCollection in the result object will contain an appropriate error message.
getVersionsByProject
in interface VersionService
user
- The user trying to get a versionproject
- The project object containing requested version
public ServiceOutcome<Version> setVersionDetails(com.atlassian.crowd.embedded.api.User user, Version version, String name, String description)
VersionService
setVersionDetails
in interface VersionService
user
- the user who is performing the edit operationversion
- the version that they want to editname
- the new name for the version (must not be null or already in use)description
- the new description for the version
public ErrorCollection validateVersionDetails(com.atlassian.crowd.embedded.api.User user, Version version, String name, String description)
VersionService
validateVersionDetails
in interface VersionService
user
- the user who is performing the edit operationversion
- the version that they want to editname
- the new name for the version (must not be null or already in use)description
- the new description for the version
public ServiceOutcome<Version> setReleaseDate(com.atlassian.crowd.embedded.api.User user, Version version, Date releaseDate)
VersionService
setReleaseDate
in interface VersionService
user
- the user who is changing the release dateversion
- the version they want to modifyreleaseDate
- the new release date to use
public ServiceOutcome<Version> validateReleaseDate(com.atlassian.crowd.embedded.api.User user, Version version, String releaseDate)
VersionService
validateReleaseDate
in interface VersionService
user
- the user who is changing the release dateversion
- the version they want to modifyreleaseDate
- the new release date to use
public ServiceOutcome<Version> setReleaseDate(com.atlassian.crowd.embedded.api.User user, Version version, String releaseDate)
VersionService
setReleaseDate
in interface VersionService
user
- the user who is changing the release dateversion
- the version they want to modifyreleaseDate
- the new release date to use
public VersionService.ValidationResult validateDelete(JiraServiceContext context, Long versionId, VersionService.VersionAction affectsAction, VersionService.VersionAction fixAction)
VersionService
validateDelete
in interface VersionService
context
- The context for this service call.versionId
- The id of the version to be deleted.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
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
VersionService.ValidationResult
object which contains the version to delete, and the versions to swap to for
Affects and Fix versions, or null if the action to be taken is VersionKeys.REMOVE_ACTION
public void delete(JiraServiceContext context, VersionService.ValidationResult result)
VersionService
delete
in interface VersionService
context
- The context for this service call.result
- The result of validation, which contains the version to be deleted, and the swap versions for
Affects and Fix fieldspublic VersionService.ValidationResult validateMerge(JiraServiceContext context, Long versionId, Long swapVersionId)
validateMerge
in interface VersionService
context
- The context for this service call.versionId
- The original version to be merged and removed.swapVersionId
- The target version of the merge operation. Must be from the same project.
VersionService.ValidationResult
object which contains the version to delete, and the versions to swap to for
Affects and Fix versions, or null if the action to be taken is VersionKeys.REMOVE_ACTION
public void merge(JiraServiceContext context, VersionService.ValidationResult result)
VersionService
merge
in interface VersionService
context
- The context for this service call.result
- The result of validation, which contains the version to be deleted, and the swap versions for
Affects and Fix fieldspublic VersionService.CreateVersionValidationResult validateCreateVersion(com.atlassian.crowd.embedded.api.User user, Project project, String versionName, String releaseDate, String description, Long scheduleAfterVersion)
VersionService
VersionService.CreateVersionValidationResult
which contains an ErrorCollection with any potential errors and all the version's details.
validateCreateVersion
in interface VersionService
user
- The user trying to create a versionproject
- The project object containing requested versionversionName
- The name of created versionreleaseDate
- The release date for a version (optional)description
- The description for a version (optional)scheduleAfterVersion
- The version after which created version should be scheduled (optional)
public VersionService.CreateVersionValidationResult validateCreateVersion(com.atlassian.crowd.embedded.api.User user, Project project, String versionName, Date releaseDate, String description, Long scheduleAfterVersion)
VersionService
VersionService.CreateVersionValidationResult
which contains an ErrorCollection with any potential errors and all the version's details.
validateCreateVersion
in interface VersionService
user
- The user trying to create a versionproject
- The project object containing requested versionversionName
- The name of created versionreleaseDate
- The release date for a version (optional)description
- The description for a version (optional)scheduleAfterVersion
- The version after which created version should be scheduled (optional)
public Version createVersion(com.atlassian.crowd.embedded.api.User user, VersionService.CreateVersionValidationResult request)
VersionService
VersionService.validateCreateVersion(User, com.atlassian.jira.project.Project,
String, String, String, Long)
a new version will be created. This method will throw an RuntimeException if
the version could not be created.
createVersion
in interface VersionService
user
- The user trying to get a versionrequest
- The VersionService.CreateVersionValidationResult
object
containg all required data
public VersionService.ReleaseVersionValidationResult validateReleaseVersion(com.atlassian.crowd.embedded.api.User user, Version version, Date releaseDate)
VersionService
VersionService.ReleaseVersionValidationResult
which contains an ErrorCollection with any potential errors and all the version's details.
validateReleaseVersion
in interface VersionService
user
- The user trying to release a versionversion
- The version to releasereleaseDate
- The version release date (optional)
public VersionService.ReleaseVersionValidationResult validateReleaseVersion(com.atlassian.crowd.embedded.api.User user, Version version, String releaseDate)
VersionService
VersionService.ReleaseVersionValidationResult
which contains an ErrorCollection with any potential errors and all the version's details.
validateReleaseVersion
in interface VersionService
user
- The user trying to release a versionversion
- The version to releasereleaseDate
- The version release date (optional)
public VersionService.ReleaseVersionValidationResult validateUnreleaseVersion(com.atlassian.crowd.embedded.api.User user, Version version, Date releaseDate)
VersionService
VersionService.ReleaseVersionValidationResult
which contains an ErrorCollection with any potential errors and all the version's details.
validateUnreleaseVersion
in interface VersionService
user
- The user trying to unrelease a versionversion
- The version to releasereleaseDate
- The version release date (optional)
public VersionService.ReleaseVersionValidationResult validateUnreleaseVersion(com.atlassian.crowd.embedded.api.User user, Version version, String releaseDate)
VersionService
VersionService.ReleaseVersionValidationResult
which contains an ErrorCollection with any potential errors and all the version's details.
validateUnreleaseVersion
in interface VersionService
user
- The user trying to unrelease a versionversion
- The version to releasereleaseDate
- The version release date (optional)
public VersionService.ArchiveVersionValidationResult validateArchiveVersion(com.atlassian.crowd.embedded.api.User user, Version version)
VersionService
validateArchiveVersion
in interface VersionService
user
- The user performing this operationversion
- The version to be archived
public VersionService.ArchiveVersionValidationResult validateUnarchiveVersion(com.atlassian.crowd.embedded.api.User user, Version version)
VersionService
validateUnarchiveVersion
in interface VersionService
user
- The user performing this operationversion
- The version to be archived
public Version releaseVersion(VersionService.ReleaseVersionValidationResult result)
VersionService
VersionService.validateReleaseVersion(User,
com.atlassian.jira.project.version.Version, Date)
a version will be released.
This method will throw an IllegalArgumentException if the provied data are invalid and version could not be released.
releaseVersion
in interface VersionService
result
- a ReleaseVersionValidationResult containg required data
public void moveUnreleasedToNewVersion(com.atlassian.crowd.embedded.api.User user, Version currentVersion, Version newVersion)
VersionService
VersionService.validateReleaseVersion(User,
com.atlassian.jira.project.version.Version, Date)
a version will be released.
This method will throw an IllegalArgumentException if the provied data are invalid and version could not be released.
moveUnreleasedToNewVersion
in interface VersionService
user
- The user trying to release a versioncurrentVersion
- The current version being released.newVersion
- The version to move issues to.public Version unreleaseVersion(VersionService.ReleaseVersionValidationResult result)
VersionService
VersionService.validateUnreleaseVersion(User,
com.atlassian.jira.project.version.Version, Date)
a version will be unreleased.
This method will throw an IllegalArgumentException if the provied data are invalid and version could not be unreleased.
unreleaseVersion
in interface VersionService
result
- a ReleaseVersionValidationResult containg required data
public Version archiveVersion(VersionService.ArchiveVersionValidationResult result)
VersionService
archiveVersion
in interface VersionService
result
- The result from the validation
public Version unarchiveVersion(VersionService.ArchiveVersionValidationResult result)
VersionService
unarchiveVersion
in interface VersionService
result
- The result from the validation
public VersionService.MoveVersionValidationResult validateMoveToStartVersionSequence(com.atlassian.crowd.embedded.api.User user, long versionId)
VersionService
validateMoveToStartVersionSequence
in interface VersionService
user
- The user trying to move a version
public VersionService.MoveVersionValidationResult validateIncreaseVersionSequence(com.atlassian.crowd.embedded.api.User user, long versionId)
VersionService
validateIncreaseVersionSequence
in interface VersionService
user
- The user trying to move a version
public VersionService.MoveVersionValidationResult validateDecreaseVersionSequence(com.atlassian.crowd.embedded.api.User user, long versionId)
VersionService
validateDecreaseVersionSequence
in interface VersionService
user
- The user trying to move a version
public VersionService.MoveVersionValidationResult validateMoveToEndVersionSequence(com.atlassian.crowd.embedded.api.User user, long versionId)
VersionService
validateMoveToEndVersionSequence
in interface VersionService
user
- The user trying to move a version
public VersionService.MoveVersionValidationResult validateMoveVersionAfter(com.atlassian.crowd.embedded.api.User user, long versionId, Long scheduleAfterVersionId)
VersionService
validateMoveVersionAfter
in interface VersionService
user
- The user trying to move a versionversionId
- version to reschedulescheduleAfterVersionId
- id of the version to schedule after the given version object
public void moveToStartVersionSequence(VersionService.MoveVersionValidationResult moveVersionValidationResult)
VersionService
moveToStartVersionSequence
in interface VersionService
moveVersionValidationResult
- Move Version Validation Resultpublic void increaseVersionSequence(VersionService.MoveVersionValidationResult moveVersionValidationResult)
VersionService
increaseVersionSequence
in interface VersionService
moveVersionValidationResult
- Move Version Validation Resultpublic void decreaseVersionSequence(VersionService.MoveVersionValidationResult moveVersionValidationResult)
VersionService
decreaseVersionSequence
in interface VersionService
moveVersionValidationResult
- Move Version Validation Resultpublic void moveToEndVersionSequence(VersionService.MoveVersionValidationResult moveVersionValidationResult)
VersionService
moveToEndVersionSequence
in interface VersionService
moveVersionValidationResult
- Move Version Validation Resultpublic void moveVersionAfter(VersionService.MoveVersionValidationResult moveVersionValidationResult)
VersionService
moveVersionAfter
in interface VersionService
moveVersionValidationResult
- Move Version Validation Resultpublic boolean isOverdue(Version version)
VersionService
isOverdue
in interface VersionService
version
- the version to check.
public long getFixIssuesCount(Version version)
VersionService
getFixIssuesCount
in interface VersionService
public long getAffectsIssuesCount(Version version)
VersionService
getAffectsIssuesCount
in interface VersionService
public long getUnresolvedIssuesCount(com.atlassian.crowd.embedded.api.User user, Version version)
VersionService
getUnresolvedIssuesCount
in interface VersionService
user
- the user trying to release the versionversion
- which version to check for unresolved issues
@Nullable protected Date parseDate(com.atlassian.crowd.embedded.api.User user, String releaseDate) throws com.atlassian.jira.bc.project.version.DefaultVersionService.ReleaseDateParseException
user
- the user who has provided the datereleaseDate
- a string containing a release date
com.atlassian.jira.bc.project.version.DefaultVersionService.ReleaseDateParseException
- if there is a
problem parsing the date string
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |