Interface PrioritySchemeService
- All Known Implementing Classes:
DefaultPrioritySchemeService
public interface PrioritySchemeService
Responsible for properly handling data when project is re-assigned to another priority scheme or the scheme is deleted.
- Since:
- 7.7
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionassignProject
(ApplicationUser user, FieldConfigScheme priorityFieldConfig, Project project) Associates a project with a priority scheme.assignProject
(ApplicationUser user, Long schemeId, io.atlassian.fugue.Either<Long, String> projectKeyOrId, boolean failIfMigrationNeeded) Associates a project with a priority scheme.assignProjects
(ApplicationUser user, FieldConfigScheme priorityFieldConfig, Collection<Project> projects) Associates projects with a priority scheme.createScheme
(ApplicationUser user, PrioritySchemeService.PrioritySchemeData prioritySchemeData) Creates the scheme wih given data.deleteScheme
(ApplicationUser user, FieldConfigScheme priorityFieldConfig) Deletes the scheme and associates it's project with the default priority scheme.deleteScheme
(ApplicationUser user, Long id) Deletes the scheme and associates it's project with the default priority scheme.editScheme
(ApplicationUser user, FieldConfigScheme priorityFieldConfig, List<String> optionIds, String defaultOption) Updates the scheme wih given data.editScheme
(ApplicationUser user, PrioritySchemeService.PrioritySchemeData data, boolean failIfMigrationNeeded) Updates the scheme wih given data.filterProjectsNotPossibleToAssociate
(List<Project> projects) Filters out projects which shouldn't be associated to priority scheme (e.g.getScheme
(ApplicationUser user, Long id) Gets the scheme wih given id.getSchemeForProject
(ApplicationUser user, io.atlassian.fugue.Either<Long, String> projectKeyOrId) Gets the scheme for given project key.getSchemeOptionsForProject
(ApplicationUser user, io.atlassian.fugue.Either<Long, String> projectKeyOrId) Returns collection of priorities configured in given project's scheme User has to havecom.atlassian.jira.bc.project.ProjectAction.VIEW_PROJECT
permissiongetSchemes
(ApplicationUser user) Gets all priority schemes.boolean
hasAnyNotPossibleToAssociateProject
(Collection<Project> projects) Checks if in given list there is at least one not able to associate project (e.g.schemeDataValidate
(ApplicationUser user, PrioritySchemeService.PrioritySchemeData prioritySchemeData) Validates if passedPrioritySchemeService.PrioritySchemeData
can be used to create/edit priority scheme.unassignProject
(ApplicationUser user, Long schemeId, io.atlassian.fugue.Either<Long, String> projectKeyOrId) Deassociates a project from a priority scheme.
-
Method Details
-
assignProjects
ServiceOutcome<FieldConfigScheme> assignProjects(@Nonnull ApplicationUser user, @Nullable FieldConfigScheme priorityFieldConfig, @Nonnull Collection<Project> projects) Associates projects with a priority scheme.- Parameters:
user
- Application userpriorityFieldConfig
- the priority scheme. Should the scheme be null - association with default scheme is assumed.projects
- the Collection of projects to assign- Returns:
ServiceOutcome
with affectedFieldConfigScheme
-
assignProject
ServiceOutcome<FieldConfigScheme> assignProject(@Nonnull ApplicationUser user, @Nullable FieldConfigScheme priorityFieldConfig, @Nonnull Project project) Associates a project with a priority scheme.- Parameters:
user
- Application userpriorityFieldConfig
- the priority scheme. Should the scheme be null - association with default scheme is assumed.project
- the project- Returns:
ServiceOutcome
with affectedFieldConfigScheme
-
assignProject
ServiceOutcome<FieldConfigScheme> assignProject(@Nonnull ApplicationUser user, @Nullable Long schemeId, @Nonnull io.atlassian.fugue.Either<Long, String> projectKeyOrId, boolean failIfMigrationNeeded) Associates a project with a priority scheme.- Parameters:
user
- Application userschemeId
- id of the priority scheme.projectKeyOrId
- key of id of the projectfailIfMigrationNeeded
- whether validation should fail if migration is needed- Returns:
ServiceOutcome
with affectedFieldConfigScheme
-
unassignProject
ServiceOutcome<FieldConfigScheme> unassignProject(@Nonnull ApplicationUser user, @Nullable Long schemeId, @Nonnull io.atlassian.fugue.Either<Long, String> projectKeyOrId) Deassociates a project from a priority scheme.- Parameters:
user
- Application userschemeId
- id of the priority scheme.projectKeyOrId
- key or id of the project- Returns:
ServiceOutcome
with affectedFieldConfigScheme
-
editScheme
ServiceOutcome<FieldConfigScheme> editScheme(@Nonnull ApplicationUser user, @Nonnull FieldConfigScheme priorityFieldConfig, @Nonnull List<String> optionIds, String defaultOption) Updates the scheme wih given data.- Parameters:
user
- Application userpriorityFieldConfig
- the priority scheme to edit. The default priority scheme can not be edited.optionIds
- new list of priorities in the schemedefaultOption
- default priority of the scheme- Returns:
ServiceOutcome
with affectedFieldConfigScheme
-
editScheme
ServiceOutcome<FieldConfigScheme> editScheme(@Nonnull ApplicationUser user, @Nonnull PrioritySchemeService.PrioritySchemeData data, boolean failIfMigrationNeeded) Updates the scheme wih given data.- Parameters:
user
- Application userdata
- priority scheme datafailIfMigrationNeeded
- whether validation should fail if migration is needed- Returns:
ServiceOutcome
with affectedFieldConfigScheme
-
deleteScheme
ServiceResult deleteScheme(@Nonnull ApplicationUser user, @Nonnull FieldConfigScheme priorityFieldConfig) Deletes the scheme and associates it's project with the default priority scheme.- Parameters:
user
- Application userpriorityFieldConfig
- the priority scheme to delete. The default priority scheme can not be deleted.- Returns:
- result of operation
-
deleteScheme
Deletes the scheme and associates it's project with the default priority scheme.- Parameters:
user
- Application userid
- id of the priority scheme to delete. The default priority scheme can not be deleted.- Returns:
- result of operation
-
createScheme
ServiceOutcome<FieldConfigScheme> createScheme(@Nonnull ApplicationUser user, @Nonnull PrioritySchemeService.PrioritySchemeData prioritySchemeData) Creates the scheme wih given data.- Parameters:
user
- Application userprioritySchemeData
- data of the priority scheme to create.- Returns:
ServiceOutcome
with newly createdFieldConfigScheme
-
getScheme
Gets the scheme wih given id.- Parameters:
user
- Application userid
- id of the priority scheme to get.- Returns:
ServiceOutcome
withFieldConfigScheme
-
getSchemes
Gets all priority schemes.- Parameters:
user
- Application user- Returns:
ServiceOutcome
with collection ofFieldConfigScheme
-
schemeDataValidate
ServiceResult schemeDataValidate(ApplicationUser user, PrioritySchemeService.PrioritySchemeData prioritySchemeData) Validates if passedPrioritySchemeService.PrioritySchemeData
can be used to create/edit priority scheme.- Parameters:
user
- Application userprioritySchemeData
-- Returns:
- result of validation
-
getSchemeForProject
ServiceOutcome<FieldConfigScheme> getSchemeForProject(@Nonnull ApplicationUser user, @Nonnull io.atlassian.fugue.Either<Long, String> projectKeyOrId) Gets the scheme for given project key. User has to have either global administrator permission or be project admin for passed project.- Parameters:
user
- Application userprojectKeyOrId
- key or id of the project to get scheme for.- Returns:
ServiceOutcome
withFieldConfigScheme
associated with provided project
-
getSchemeOptionsForProject
ServiceOutcome<Set<Priority>> getSchemeOptionsForProject(@Nonnull ApplicationUser user, @Nonnull io.atlassian.fugue.Either<Long, String> projectKeyOrId) Returns collection of priorities configured in given project's scheme User has to havecom.atlassian.jira.bc.project.ProjectAction.VIEW_PROJECT
permission- Parameters:
user
-ApplicationUser
current userprojectKeyOrId
- key or id of the project to get scheme for.- Returns:
ServiceOutcome
with Set ofPriority
associated with provided project
-
filterProjectsNotPossibleToAssociate
Filters out projects which shouldn't be associated to priority scheme (e.g. Service Desk projects)- Parameters:
projects
- projects to be filtered- Returns:
- filtered list of projects
-
hasAnyNotPossibleToAssociateProject
Checks if in given list there is at least one not able to associate project (e.g. Service Desk project)- Parameters:
projects
- list of projects- Returns:
- true if there is at least one project which we can't associate to priority scheme. False otherwise.
-