public class DefaultVersionService extends Object implements VersionService
VersionService.AbstractVersionResult, VersionService.ArchiveVersionValidationResult, VersionService.CreateVersionValidationResult, VersionService.MoveVersionValidationResult, VersionService.ReasonsServiceResult<R,T>, VersionService.ReleaseVersionValidationResult, VersionService.ValidationResult, VersionService.VersionAction, VersionService.VersionBuilderValidationResult, VersionService.VersionExtractableField, VersionService.VersionResult, VersionService.VersionsResult
REMOVE
Constructor and Description |
---|
DefaultVersionService(VersionManager versionManager,
PermissionManager permissionManager,
IssueManager issueManager,
SearchService searchService,
I18nHelper.BeanFactory i18n,
DateFieldFormat dateFieldFormat,
ProjectManager projectManager) |
Modifier and Type | Method and Description |
---|---|
Version |
archiveVersion(VersionService.ArchiveVersionValidationResult result)
Takes a validation result and performs the archive operation.
|
ServiceOutcome<Version> |
create(ApplicationUser user,
VersionService.VersionBuilderValidationResult validationResult)
Creates a new
Version , based on the validation result from calling #validateCreate(User,
VersionBuilder) . |
Version |
createVersion(ApplicationUser user,
VersionService.CreateVersionValidationResult request)
Using the validation result from
#validateCreateVersion(User, com.atlassian.jira.project.Project, String,
String, String, Long) a new version will be created. |
DeleteVersionWithReplacementsParameterBuilder |
createVersionDeletaAndReplaceParameters(Version versionToDelete)
Create builder that for paramaters to remove version with swap (including custom fields)
|
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.
|
ServiceResult |
deleteVersionAndSwap(JiraServiceContext serviceContext,
DeleteVersionWithCustomFieldParameters parameters)
Remove specified version.
|
long |
getAffectsIssuesCount(Version version)
Return the count of Issues that have the "Affects Version" field set to version.
|
long |
getCustomFieldIssuesCount(Version version)
This method returns the total number of issues where this version is used in custom fields
|
Collection<CustomFieldWithVersionUsage> |
getCustomFieldsUsing(Version version)
This method returns usage information in custom fields for a given version.
|
long |
getFixIssuesCount(Version version)
Return the count of Issues Fixed in this version.
|
long |
getUnresolvedIssuesCount(ApplicationUser user,
Version version)
Return the count of Issues that are unresolved in this version.
|
VersionService.VersionResult |
getVersionById(ApplicationUser user,
Long versionId)
Used to retrieve a
Version object by version id. |
VersionService.VersionResult |
getVersionById(ApplicationUser user,
Project project,
Long versionId)
|
VersionService.VersionResult |
getVersionByProjectAndName(ApplicationUser user,
Project project,
String versionName)
|
VersionService.VersionsResult |
getVersionsByProject(ApplicationUser user,
Project project)
|
ServiceOutcome<Page<Version>> |
getVersionsByProject(ApplicationUser user,
Project project,
PageRequest pageRequest)
This method returns all versions for a given project.
|
ServiceOutcome<Page<Version>> |
getVersionsByProject(ApplicationUser user,
Project project,
PageRequest pageRequest,
io.atlassian.fugue.Option<OrderByRequest<VersionService.VersionExtractableField>> orderBy) |
ServiceOutcome<Page<Version>> |
getVersionsByProject(ApplicationUser user,
Project project,
PageRequest pageRequest,
OrderByRequest<VersionService.VersionExtractableField> orderBy)
This method returns all versions for a given project.
|
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(ApplicationUser directoryUser,
Version currentVersion,
Version newVersion)
Using the validation result from
#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.
|
VersionBuilder |
newVersionBuilder()
Creates a builder to be used when creating a new
Version . |
VersionBuilder |
newVersionBuilder(Version version)
Creates a builder to be used when updating an existing
Version . |
protected Date |
parseDate(ApplicationUser user,
com.atlassian.jira.bc.project.version.DefaultVersionService.DateField field,
String date)
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
#validateReleaseVersion(User, com.atlassian.jira.project.version.Version,
Date) a version will be released. |
ServiceOutcome<Version> |
setReleaseDate(ApplicationUser user,
Version version,
Date releaseDate)
Modify the release date of a version without performing a release/unrelease.
|
ServiceOutcome<Version> |
setReleaseDate(ApplicationUser user,
Version version,
String releaseDate)
Modify the release date of a version without performing a release/unrelease.
|
ServiceOutcome<Version> |
setVersionDetails(ApplicationUser 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
#validateUnreleaseVersion(User, com.atlassian.jira.project.version.Version,
Date) a version will be unreleased. |
ServiceOutcome<Version> |
update(ApplicationUser user,
VersionService.VersionBuilderValidationResult validationResult)
Updates the existing
Version , based on the validation result from calling #validateUpdate(User,
VersionBuilder) . |
VersionService.ArchiveVersionValidationResult |
validateArchiveVersion(ApplicationUser user,
Version version)
This method should be called before archiving a version.
|
VersionService.VersionBuilderValidationResult |
validateCreate(ApplicationUser user,
VersionBuilder versionBuilder)
Validates the creation of a new
Version object, specified with a VersionBuilder . |
VersionService.CreateVersionValidationResult |
validateCreateVersion(ApplicationUser 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(ApplicationUser user,
Project project,
String versionName,
String releaseDateStr,
String description,
Long scheduleAfterVersion)
This method needs to be called before creating a version to ensure all parameters are correct.
|
VersionService.MoveVersionValidationResult |
validateDecreaseVersionSequence(ApplicationUser 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(ApplicationUser 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(ApplicationUser user,
long versionId)
Validate Move a version to the end of the version sequence.
|
VersionService.MoveVersionValidationResult |
validateMoveToStartVersionSequence(ApplicationUser user,
long versionId)
Validate Move a version to the start of the version list.
|
VersionService.MoveVersionValidationResult |
validateMoveVersionAfter(ApplicationUser user,
long versionId,
Long scheduleAfterVersionId)
Validate Move a version after another version.
|
ServiceOutcome<Version> |
validateReleaseDate(ApplicationUser user,
Version version,
String releaseDate)
Validate the release date of a version without performing a release/unrelease.
|
VersionService.ReleaseVersionValidationResult |
validateReleaseVersion(ApplicationUser user,
Version version,
Date releaseDate)
This method needs to be called before releasing a version to ensure all parameters are correct.
|
VersionService.ReleaseVersionValidationResult |
validateReleaseVersion(ApplicationUser user,
Version version,
String releaseDate)
This method needs to be called before releasing a version to ensure all parameters are correct.
|
protected ServiceOutcome<Void> |
validateStartReleaseDates(ApplicationUser user,
com.atlassian.jira.bc.project.version.DefaultVersionService.DateField field,
Date startDate,
Date releaseDate) |
VersionService.ArchiveVersionValidationResult |
validateUnarchiveVersion(ApplicationUser user,
Version version)
This method should be called before unarchiving a version.
|
VersionService.ReleaseVersionValidationResult |
validateUnreleaseVersion(ApplicationUser user,
Version version,
Date releaseDate)
This method needs to be called before unreleasing a version to ensure all parameters are correct.
|
VersionService.ReleaseVersionValidationResult |
validateUnreleaseVersion(ApplicationUser user,
Version version,
String releaseDate)
This method needs to be called before unreleasing a version to ensure all parameters are correct.
|
VersionService.VersionBuilderValidationResult |
validateUpdate(ApplicationUser user,
VersionBuilder versionBuilder)
Validates the update of an existing
Version object, specified with a VersionBuilder . |
ErrorCollection |
validateVersionDetails(ApplicationUser user,
Version version,
String name,
String description)
Validate the name and description of a version, if you have edit permission.
|
public DefaultVersionService(VersionManager versionManager, PermissionManager permissionManager, IssueManager issueManager, SearchService searchService, I18nHelper.BeanFactory i18n, DateFieldFormat dateFieldFormat, ProjectManager projectManager)
public VersionService.VersionResult getVersionById(@Nullable ApplicationUser 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 versionpublic VersionService.VersionResult getVersionById(ApplicationUser 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@Nonnull public VersionService.VersionResult getVersionByProjectAndName(@Nullable ApplicationUser user, @Nonnull Project project, @Nonnull 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@Nonnull public VersionService.VersionsResult getVersionsByProject(@Nullable ApplicationUser user, @Nonnull 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@Nonnull public ServiceOutcome<Page<Version>> getVersionsByProject(@Nullable ApplicationUser user, @Nonnull Project project, @Nonnull PageRequest pageRequest)
VersionService
VersionService.getVersionsByProject(ApplicationUser, Project)
but the results
it returns are paged.
The user making the request must have the ADMIN, PROJECT_ADMIN or BROWSE project permissions for the project. Otherwise, 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 versionpageRequest
- details of a page to return (offset, max number of results)VersionService.getVersionsByProject(com.atlassian.jira.user.ApplicationUser, com.atlassian.jira.project.Project, com.atlassian.jira.util.PageRequest, com.atlassian.jira.util.OrderByRequest)
@Nonnull public ServiceOutcome<Page<Version>> getVersionsByProject(@Nullable ApplicationUser user, @Nonnull Project project, @Nonnull PageRequest pageRequest, @Nullable OrderByRequest<VersionService.VersionExtractableField> orderBy)
VersionService
It also provides the possibility to sort the results by the fields specified in the VersionService.VersionExtractableField
class.
The user making the request must have the ADMIN, PROJECT_ADMIN or BROWSE project permissions for the project. Otherwise, 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 versionpageRequest
- details of a page to return (offset, max number of results)orderBy
- details on how to order the resultsVersionService.getVersionsByProject(com.atlassian.jira.user.ApplicationUser, com.atlassian.jira.project.Project, com.atlassian.jira.util.PageRequest)
public ServiceOutcome<Version> setVersionDetails(ApplicationUser 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 versionpublic ErrorCollection validateVersionDetails(ApplicationUser 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 versionpublic ServiceOutcome<Version> setReleaseDate(ApplicationUser 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 usepublic ServiceOutcome<Version> validateReleaseDate(ApplicationUser 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 usepublic ServiceOutcome<Version> setReleaseDate(ApplicationUser 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 usepublic 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 DeleteVersionWithReplacementsParameterBuilder createVersionDeletaAndReplaceParameters(@Nonnull Version versionToDelete)
VersionService
createVersionDeletaAndReplaceParameters
in interface VersionService
versionToDelete
- version that will be deleted - mandatoryVersionService.deleteVersionAndSwap(JiraServiceContext, DeleteVersionWithCustomFieldParameters)
public ServiceResult deleteVersionAndSwap(@Nonnull JiraServiceContext serviceContext, @Nonnull DeleteVersionWithCustomFieldParameters parameters)
VersionService
DeleteVersionWithCustomFieldParameters
version will be completly removed from specific fields are replaced.deleteVersionAndSwap
in interface VersionService
serviceContext
- The context for this service call.parameters
- parameters build with builder obtained by VersionService.createVersionDeletaAndReplaceParameters(Version)
merge - if you want to replace all version references to given
version.
public 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(ApplicationUser user, Project project, String versionName, String releaseDateStr, String description, Long scheduleAfterVersion)
VersionService
Optional validation will be done for the release date, if provided. An error will be returned, if date format is valid.
The method will return a 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 versionreleaseDateStr
- 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(ApplicationUser user, Project project, String versionName, Date releaseDate, String description, Long scheduleAfterVersion)
VersionService
Optional validation will be done for the release date, if provided. An error will be returned, if date format is valid.
The method will return a 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(ApplicationUser user, VersionService.CreateVersionValidationResult request)
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 containing all required data@Nonnull public VersionService.ReleaseVersionValidationResult validateReleaseVersion(@Nullable ApplicationUser user, @Nonnull Version version, @Nullable Date releaseDate)
VersionService
The method will return a 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)@Nonnull public VersionService.ReleaseVersionValidationResult validateReleaseVersion(@Nullable ApplicationUser user, @Nonnull Version version, @Nullable String releaseDate)
VersionService
The method will return a 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)@Nonnull public VersionService.ReleaseVersionValidationResult validateUnreleaseVersion(@Nullable ApplicationUser user, @Nonnull Version version, @Nullable Date releaseDate)
VersionService
The method will return a 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)@Nonnull public VersionService.ReleaseVersionValidationResult validateUnreleaseVersion(@Nullable ApplicationUser user, @Nonnull Version version, @Nonnull String releaseDate)
VersionService
The method will return a 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)@Nonnull public VersionService.ArchiveVersionValidationResult validateArchiveVersion(@Nullable ApplicationUser user, @Nonnull Version version)
VersionService
The method also validates that the user passed in is either a global admin, or has project admin rights for the project that the version is linked to.
Finally, this method checks that the version that was passed in hasn't already been archived. If there's any errors, the validationResult will contain appropriate errors and wont be valid.
validateArchiveVersion
in interface VersionService
user
- The user performing this operationversion
- The version to be archived@Nonnull public VersionService.ArchiveVersionValidationResult validateUnarchiveVersion(@Nullable ApplicationUser user, @Nonnull Version version)
VersionService
The method also validates that the user passed in is either a global admin, or has project admin rights for the project that the version is linked to.
Finally, this method checks that the version that was passed is currently archived. If there's any errors, the validationResult will contain appropriate errors and wont be valid.
validateUnarchiveVersion
in interface VersionService
user
- The user performing this operationversion
- The version to be archivedpublic Version releaseVersion(VersionService.ReleaseVersionValidationResult result)
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 datapublic void moveUnreleasedToNewVersion(@Nullable ApplicationUser directoryUser, @Nonnull Version currentVersion, @Nonnull Version newVersion)
VersionService
#validateReleaseVersion(User, com.atlassian.jira.project.version.Version,
Date)
a version will be released. This method will throw an IllegalArgumentException if the provided data are
invalid and version could not be released.moveUnreleasedToNewVersion
in interface VersionService
directoryUser
- 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
#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 datapublic Version archiveVersion(VersionService.ArchiveVersionValidationResult result)
VersionService
archiveVersion
in interface VersionService
result
- The result from the validationpublic Version unarchiveVersion(VersionService.ArchiveVersionValidationResult result)
VersionService
unarchiveVersion
in interface VersionService
result
- The result from the validation@Nonnull public VersionService.MoveVersionValidationResult validateMoveToStartVersionSequence(@Nullable ApplicationUser user, long versionId)
VersionService
validateMoveToStartVersionSequence
in interface VersionService
user
- The user trying to move a version@Nonnull public VersionService.MoveVersionValidationResult validateIncreaseVersionSequence(@Nullable ApplicationUser user, long versionId)
VersionService
validateIncreaseVersionSequence
in interface VersionService
user
- The user trying to move a version@Nonnull public VersionService.MoveVersionValidationResult validateDecreaseVersionSequence(@Nullable ApplicationUser user, long versionId)
VersionService
validateDecreaseVersionSequence
in interface VersionService
user
- The user trying to move a version@Nonnull public VersionService.MoveVersionValidationResult validateMoveToEndVersionSequence(@Nullable ApplicationUser user, long versionId)
VersionService
validateMoveToEndVersionSequence
in interface VersionService
user
- The user trying to move a version@Nonnull public VersionService.MoveVersionValidationResult validateMoveVersionAfter(@Nullable ApplicationUser user, long versionId, @Nonnull 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 objectpublic 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
@Nonnull public Collection<CustomFieldWithVersionUsage> getCustomFieldsUsing(@Nonnull Version version)
VersionService
getCustomFieldsUsing
in interface VersionService
version
- The version that we want to get information about.public long getCustomFieldIssuesCount(@Nonnull Version version)
VersionService
getCustomFieldIssuesCount
in interface VersionService
version
- The version that we want to get information about.public long getUnresolvedIssuesCount(@Nullable ApplicationUser user, @Nonnull Version version)
VersionService
getUnresolvedIssuesCount
in interface VersionService
user
- the user trying to get the countversion
- which version to check for unresolved issues@Nonnull public VersionService.VersionBuilderValidationResult validateCreate(@Nullable ApplicationUser user, @Nonnull VersionBuilder versionBuilder)
VersionService
Version
object, specified with a VersionBuilder
.
This replaces the deprecated methods: #validateCreateVersion(User, Project, String, Date, String, Long)
and #validateCreateVersion(User, Project, String, String, String, Long)
.
validateCreate
in interface VersionService
user
- the user who is performing the createversionBuilder
- the builder which specified the new Version to be createdVersionService.newVersionBuilder()
@Nonnull public ServiceOutcome<Version> create(@Nullable ApplicationUser user, @Nonnull VersionService.VersionBuilderValidationResult validationResult)
VersionService
Version
, based on the validation result from calling #validateCreate(User,
VersionBuilder)
.create
in interface VersionService
user
- the uservalidationResult
- the result of validation#validateCreate(com.atlassian.crowd.embedded.api.User, VersionBuilder)
,
#validateCreate(com.atlassian.crowd.embedded.api.User, com.atlassian.jira.bc.project.version.VersionService.VersionBuilder)
public VersionBuilder newVersionBuilder(Version version)
VersionService
Version
. The builder encapsulates all the fields
which need to be specified on update.newVersionBuilder
in interface VersionService
version
- the Version object to updatefor creating a new version
,
for creating a new version
public VersionBuilder newVersionBuilder()
VersionService
Version
. The builder encapsulates all the fields which
need to be specified on create.newVersionBuilder
in interface VersionService
for updating an existing version
,
for updating an existing version
@Nonnull public VersionService.VersionBuilderValidationResult validateUpdate(@Nullable ApplicationUser user, @Nonnull VersionBuilder versionBuilder)
VersionService
Version
object, specified with a VersionBuilder
.
This replaces the deprecated methods: #validateReleaseDate(User, Version, String)
and #validateVersionDetails(User, Version, String, String)
.
validateUpdate
in interface VersionService
user
- the user who is performing the updateversionBuilder
- the builder which specified the update to the existing VersionVersionService.newVersionBuilder(com.atlassian.jira.project.version.Version)
,
#newBuilder(com.atlassian.jira.project.version.Version)
public ServiceOutcome<Version> update(ApplicationUser user, VersionService.VersionBuilderValidationResult validationResult)
VersionService
Version
, based on the validation result from calling #validateUpdate(User,
VersionBuilder)
.update
in interface VersionService
user
- the uservalidationResult
- the result of validation#validateUpdate(com.atlassian.crowd.embedded.api.User, VersionBuilder)
,
#validateUpdate(com.atlassian.crowd.embedded.api.User, com.atlassian.jira.bc.project.version.VersionService.VersionBuilder)
public ServiceOutcome<Page<Version>> getVersionsByProject(@Nullable ApplicationUser user, @Nonnull Project project, @Nonnull PageRequest pageRequest, io.atlassian.fugue.Option<OrderByRequest<VersionService.VersionExtractableField>> orderBy)
@Nullable protected Date parseDate(@Nullable ApplicationUser user, com.atlassian.jira.bc.project.version.DefaultVersionService.DateField field, String date) throws com.atlassian.jira.bc.project.version.DefaultVersionService.DateParseException
user
- the user who has provided the datefield
- a DateField instance containing information what kind of date we are parsingdate
- a string containing a datecom.atlassian.jira.bc.project.version.DefaultVersionService.DateParseException
- if there is a problem
parsing the date stringprotected ServiceOutcome<Void> validateStartReleaseDates(ApplicationUser user, com.atlassian.jira.bc.project.version.DefaultVersionService.DateField field, Date startDate, Date releaseDate)
Copyright © 2002-2019 Atlassian. All Rights Reserved.