Class DefaultPrioritySchemeService
java.lang.Object
com.atlassian.jira.issue.fields.config.DefaultPrioritySchemeService
- All Implemented Interfaces:
PrioritySchemeService
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.atlassian.jira.issue.fields.config.PrioritySchemeService
PrioritySchemeService.PrioritySchemeData -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultPrioritySchemeService(GlobalPermissionManager globalPermissionManager, PrioritySchemeManager prioritySchemeManager, ProjectService projectService, I18nHelper i18nHelper, PrioritySchemeMigratorFinder prioritySchemeMigratorFinder, FeatureManager featureManager) -
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 blockMigration) 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_PROJECTpermissiongetSchemes(ApplicationUser user) Gets all priority schemes.booleanhasAnyNotPossibleToAssociateProject(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.PrioritySchemeDatacan 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.
-
Field Details
-
PROJECT_ACTION_PERMISSION
-
-
Constructor Details
-
DefaultPrioritySchemeService
public DefaultPrioritySchemeService(GlobalPermissionManager globalPermissionManager, PrioritySchemeManager prioritySchemeManager, ProjectService projectService, I18nHelper i18nHelper, PrioritySchemeMigratorFinder prioritySchemeMigratorFinder, FeatureManager featureManager)
-
-
Method Details
-
assignProjects
public ServiceOutcome<FieldConfigScheme> assignProjects(@Nonnull ApplicationUser user, @Nullable FieldConfigScheme priorityFieldConfig, @Nonnull Collection<Project> projects) throws NoPermissionException Description copied from interface:PrioritySchemeServiceAssociates projects with a priority scheme.- Specified by:
assignProjectsin interfacePrioritySchemeService- 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:
ServiceOutcomewith affectedFieldConfigScheme- Throws:
NoPermissionException
-
assignProject
public ServiceOutcome<FieldConfigScheme> assignProject(@Nonnull ApplicationUser user, @Nullable FieldConfigScheme priorityFieldConfig, @Nonnull Project project) Description copied from interface:PrioritySchemeServiceAssociates a project with a priority scheme.- Specified by:
assignProjectin interfacePrioritySchemeService- Parameters:
user- Application userpriorityFieldConfig- the priority scheme. Should the scheme be null - association with default scheme is assumed.project- the project- Returns:
ServiceOutcomewith affectedFieldConfigScheme
-
assignProject
public ServiceOutcome<FieldConfigScheme> assignProject(@Nonnull ApplicationUser user, @Nullable Long schemeId, @Nonnull io.atlassian.fugue.Either<Long, String> projectKeyOrId, boolean blockMigration) Description copied from interface:PrioritySchemeServiceAssociates a project with a priority scheme.- Specified by:
assignProjectin interfacePrioritySchemeService- Parameters:
user- Application userschemeId- id of the priority scheme.projectKeyOrId- key of id of the projectblockMigration- whether validation should fail if migration is needed- Returns:
ServiceOutcomewith affectedFieldConfigScheme
-
unassignProject
public ServiceOutcome<FieldConfigScheme> unassignProject(@Nonnull ApplicationUser user, @Nonnull Long schemeId, @Nonnull io.atlassian.fugue.Either<Long, String> projectKeyOrId) Description copied from interface:PrioritySchemeServiceDeassociates a project from a priority scheme.- Specified by:
unassignProjectin interfacePrioritySchemeService- Parameters:
user- Application userschemeId- id of the priority scheme.projectKeyOrId- key or id of the project- Returns:
ServiceOutcomewith affectedFieldConfigScheme
-
editScheme
public ServiceOutcome<FieldConfigScheme> editScheme(@Nonnull ApplicationUser user, @Nonnull FieldConfigScheme priorityFieldConfig, @Nonnull List<String> optionIds, @Nullable String defaultOption) throws NoPermissionException Description copied from interface:PrioritySchemeServiceUpdates the scheme wih given data.- Specified by:
editSchemein interfacePrioritySchemeService- 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:
ServiceOutcomewith affectedFieldConfigScheme- Throws:
NoPermissionException
-
editScheme
public ServiceOutcome<FieldConfigScheme> editScheme(@Nonnull ApplicationUser user, @Nonnull PrioritySchemeService.PrioritySchemeData data, boolean failIfMigrationNeeded) Description copied from interface:PrioritySchemeServiceUpdates the scheme wih given data.- Specified by:
editSchemein interfacePrioritySchemeService- Parameters:
user- Application userdata- priority scheme datafailIfMigrationNeeded- whether validation should fail if migration is needed- Returns:
ServiceOutcomewith affectedFieldConfigScheme
-
deleteScheme
Description copied from interface:PrioritySchemeServiceDeletes the scheme and associates it's project with the default priority scheme.- Specified by:
deleteSchemein interfacePrioritySchemeService- Parameters:
user- Application userid- id of the priority scheme to delete. The default priority scheme can not be deleted.- Returns:
- result of operation
-
deleteScheme
public ServiceResult deleteScheme(@Nonnull ApplicationUser user, @Nonnull FieldConfigScheme priorityFieldConfig) throws NoPermissionException Description copied from interface:PrioritySchemeServiceDeletes the scheme and associates it's project with the default priority scheme.- Specified by:
deleteSchemein interfacePrioritySchemeService- Parameters:
user- Application userpriorityFieldConfig- the priority scheme to delete. The default priority scheme can not be deleted.- Returns:
- result of operation
- Throws:
NoPermissionException
-
createScheme
public ServiceOutcome<FieldConfigScheme> createScheme(@Nonnull ApplicationUser user, @Nonnull PrioritySchemeService.PrioritySchemeData prioritySchemeData) Description copied from interface:PrioritySchemeServiceCreates the scheme wih given data.- Specified by:
createSchemein interfacePrioritySchemeService- Parameters:
user- Application userprioritySchemeData- data of the priority scheme to create.- Returns:
ServiceOutcomewith newly createdFieldConfigScheme
-
schemeDataValidate
public ServiceResult schemeDataValidate(ApplicationUser user, PrioritySchemeService.PrioritySchemeData prioritySchemeData) Description copied from interface:PrioritySchemeServiceValidates if passedPrioritySchemeService.PrioritySchemeDatacan be used to create/edit priority scheme.- Specified by:
schemeDataValidatein interfacePrioritySchemeService- Parameters:
user- Application user- Returns:
- result of validation
-
getScheme
Description copied from interface:PrioritySchemeServiceGets the scheme wih given id.- Specified by:
getSchemein interfacePrioritySchemeService- Parameters:
user- Application userid- id of the priority scheme to get.- Returns:
ServiceOutcomewithFieldConfigScheme
-
getSchemes
Description copied from interface:PrioritySchemeServiceGets all priority schemes.- Specified by:
getSchemesin interfacePrioritySchemeService- Parameters:
user- Application user- Returns:
ServiceOutcomewith collection ofFieldConfigScheme
-
getSchemeForProject
public ServiceOutcome<FieldConfigScheme> getSchemeForProject(@Nonnull ApplicationUser user, @Nonnull io.atlassian.fugue.Either<Long, String> projectKeyOrId) Description copied from interface:PrioritySchemeServiceGets the scheme for given project key. User has to have either global administrator permission or be project admin for passed project.- Specified by:
getSchemeForProjectin interfacePrioritySchemeService- Parameters:
user- Application userprojectKeyOrId- key or id of the project to get scheme for.- Returns:
ServiceOutcomewithFieldConfigSchemeassociated with provided project
-
getSchemeOptionsForProject
public ServiceOutcome<Set<Priority>> getSchemeOptionsForProject(@Nonnull ApplicationUser user, @Nonnull io.atlassian.fugue.Either<Long, String> projectKeyOrId) Description copied from interface:PrioritySchemeServiceReturns collection of priorities configured in given project's scheme User has to havecom.atlassian.jira.bc.project.ProjectAction.VIEW_PROJECTpermission- Specified by:
getSchemeOptionsForProjectin interfacePrioritySchemeService- Parameters:
user-ApplicationUsercurrent userprojectKeyOrId- key or id of the project to get scheme for.- Returns:
ServiceOutcomewith Set ofPriorityassociated with provided project
-
filterProjectsNotPossibleToAssociate
Description copied from interface:PrioritySchemeServiceFilters out projects which shouldn't be associated to priority scheme (e.g. Service Desk projects)- Specified by:
filterProjectsNotPossibleToAssociatein interfacePrioritySchemeService- Parameters:
projects- projects to be filtered- Returns:
- filtered list of projects
-
hasAnyNotPossibleToAssociateProject
Description copied from interface:PrioritySchemeServiceChecks if in given list there is at least one not able to associate project (e.g. Service Desk project)- Specified by:
hasAnyNotPossibleToAssociateProjectin interfacePrioritySchemeService- Parameters:
projects- list of projects- Returns:
- true if there is at least one project which we can't associate to priority scheme. False otherwise.
-