public class PrioritySchemeManagerImpl extends Object implements PrioritySchemeManager
Constructor and Description |
---|
PrioritySchemeManagerImpl(FieldConfigSchemeManager fieldConfigSchemeManager,
OptionSetManager optionSetManager,
GenericConfigManager genericConfigManager,
ConstantsManager constantsManager,
com.atlassian.event.api.EventPublisher eventPublisher,
FeatureManager featureManager,
ProjectManager projectManager) |
Modifier and Type | Method and Description |
---|---|
void |
addOptionToDefault(String optionId)
Adds the
optionId to the default priority scheme. |
void |
assignProject(FieldConfigScheme priorityFieldConfig,
Project project)
Associates a project with a priority scheme.
|
void |
assignProjects(FieldConfigScheme priorityFieldConfig,
Set<Project> projects)
Associates multiple projects with a priority scheme.
|
FieldConfigScheme |
createWithDefaultMapping(String name,
String description,
List<String> optionIds)
Creates a new
FieldConfigScheme with a default mapping to FieldConfig . |
void |
delete(FieldConfigScheme fieldConfigScheme)
Removes
FieldConfigScheme . |
Collection<FieldConfigScheme> |
getAllRelatedSchemes(String optionId)
Retrieves all schemes that have
optionId as part of its options. |
List<FieldConfigScheme> |
getAllSchemes()
Retrieves all priority schemes and sorts them.
|
String |
getDefaultOption(FieldConfig fieldConfig)
Returns the ID of the default
Priority for a given fieldConfig . |
String |
getDefaultOption(IssueContext issueContext)
Retrieves the ID of the default
Priority for FieldConfig relevant to a passed issueContext for a priority system field. |
FieldConfigScheme |
getDefaultScheme()
Retrieves the default global priority scheme which contains all priorities.
|
FieldConfig |
getFieldConfigForDefaultMapping(FieldConfigScheme fieldConfigScheme)
Retrieves
FieldConfig that is used for a default mapping for a passed fieldConfigScheme . |
List<String> |
getOptions(FieldConfig fieldConfig)
Retrieves a list of priority IDs configured for a passed
fieldConfig . |
List<String> |
getOptions(IssueContext issueContext)
Retrieves a list of priority IDs configured for a passed
issueContext . |
Collection<Priority> |
getPrioritiesFromIds(Collection<String> priorityIds)
Converts a collection of priority IDs to a collection of
Priority . |
Priority |
getPriority(String priorityId)
Converts
priorityId to Priority value. |
Set<Project> |
getProjectsWithScheme(FieldConfigScheme fieldConfigScheme)
Retrieves all projects associated with a scheme.
|
FieldConfigScheme |
getScheme(Long id)
Gets
FieldConfigScheme by id . |
FieldConfigScheme |
getScheme(Project project)
Gets
FieldConfigScheme for given project . |
boolean |
isDefaultScheme(FieldConfigScheme fieldConfigScheme)
Checks if a passed
fieldConfigScheme is the default priority scheme. |
void |
removeOptionFromAllSchemes(String optionId)
Removes a priority ID from all priority schemes that have the passed
optionId as part of its options. |
void |
setDefaultOption(FieldConfig fieldConfig,
String optionId)
Sets default priority ID for given
FieldConfigScheme . |
void |
setOptions(FieldConfig fieldConfig,
List<String> optionIds)
Sets priority IDs for
fieldConfig . |
void |
unassignProject(FieldConfigScheme scheme,
Project project)
Removes a project from a priority scheme.
|
void |
unassignProjects(FieldConfigScheme scheme,
Set<Project> projects)
Removes multiple projects from a priority scheme.
|
FieldConfigScheme |
updateWithDefaultMapping(FieldConfigScheme fieldConfigScheme,
List<String> optionIds)
Updates
FieldConfigScheme with provided data and options (priority IDs). |
public PrioritySchemeManagerImpl(FieldConfigSchemeManager fieldConfigSchemeManager, OptionSetManager optionSetManager, GenericConfigManager genericConfigManager, ConstantsManager constantsManager, com.atlassian.event.api.EventPublisher eventPublisher, FeatureManager featureManager, ProjectManager projectManager)
public FieldConfigScheme getScheme(Project project)
PrioritySchemeManager
FieldConfigScheme
for given project
.getScheme
in interface PrioritySchemeManager
project
- ProjectFieldConfigScheme
associated with given project
public FieldConfigScheme getScheme(Long id)
PrioritySchemeManager
FieldConfigScheme
by id
.getScheme
in interface PrioritySchemeManager
id
- scheme idFieldConfigScheme
public FieldConfigScheme getDefaultScheme()
PrioritySchemeManager
getDefaultScheme
in interface PrioritySchemeManager
FieldConfigScheme
public List<FieldConfigScheme> getAllSchemes()
PrioritySchemeManager
getAllSchemes
in interface PrioritySchemeManager
public boolean isDefaultScheme(FieldConfigScheme fieldConfigScheme)
PrioritySchemeManager
fieldConfigScheme
is the default priority scheme.isDefaultScheme
in interface PrioritySchemeManager
fieldConfigScheme
- Field config scheme in questionfieldConfigScheme
is default one, false otherwise.public String getDefaultOption(IssueContext issueContext)
PrioritySchemeManager
Priority
for FieldConfig
relevant to a passed issueContext
for a priority system field.
If no default priority is defined for FieldConfig
then middle priority of all priorities assigned to that FieldConfig
is returned.getDefaultOption
in interface PrioritySchemeManager
issueContext
- IssueContext
to obtain default value forPriority
for issueContext
public String getDefaultOption(FieldConfig fieldConfig)
PrioritySchemeManager
Priority
for a given fieldConfig
.getDefaultOption
in interface PrioritySchemeManager
fieldConfig
- the field configuration scheme of interestPriority
for this fieldConfig
public void setDefaultOption(FieldConfig fieldConfig, String optionId)
PrioritySchemeManager
FieldConfigScheme
.setDefaultOption
in interface PrioritySchemeManager
fieldConfig
- FieldConfig
for which set the default optionoptionId
- Priority id. Pass null
to remove default priority from fieldConfig
.public List<String> getOptions(IssueContext issueContext)
PrioritySchemeManager
issueContext
.
If null
is passed for issueContext
then priority ids for default scheme are returned.getOptions
in interface PrioritySchemeManager
issueContext
- Issue context eg. ProjectContext
issueContext
.public List<String> getOptions(FieldConfig fieldConfig)
PrioritySchemeManager
fieldConfig
.
If null
is passed as fieldConfig
then empty list is returned.getOptions
in interface PrioritySchemeManager
fieldConfig
- FieldConfig
to obtain list of priority id from.fieldConfig
public void setOptions(FieldConfig fieldConfig, List<String> optionIds)
PrioritySchemeManager
fieldConfig
.setOptions
in interface PrioritySchemeManager
fieldConfig
- FieldConfig
to set list of priority id for.optionIds
- List of priority ids.public FieldConfigScheme createWithDefaultMapping(@Nonnull String name, String description, List<String> optionIds)
PrioritySchemeManager
FieldConfigScheme
with a default mapping to FieldConfig
.
Also creates options in OPTION_CONFIGURATION
table.
Triggers PrioritySchemeCreatedEvent
.createWithDefaultMapping
in interface PrioritySchemeManager
name
- Scheme namedescription
- Scheme descriptionoptionIds
- Collection of priority idspublic FieldConfigScheme updateWithDefaultMapping(FieldConfigScheme fieldConfigScheme, List<String> optionIds)
PrioritySchemeManager
FieldConfigScheme
with provided data and options (priority IDs).
Default FieldConfig
for FieldConfigScheme
is used.
Triggers PrioritySchemeUpdatedEvent
.updateWithDefaultMapping
in interface PrioritySchemeManager
fieldConfigScheme
- Field config scheme to updateoptionIds
- Collection of priority idspublic FieldConfig getFieldConfigForDefaultMapping(FieldConfigScheme fieldConfigScheme)
PrioritySchemeManager
FieldConfig
that is used for a default mapping for a passed fieldConfigScheme
.getFieldConfigForDefaultMapping
in interface PrioritySchemeManager
FieldConfig
for default mapping for fieldConfigScheme
public void delete(FieldConfigScheme fieldConfigScheme)
PrioritySchemeManager
FieldConfigScheme
.
Triggers PrioritySchemeDeletedEvent
.delete
in interface PrioritySchemeManager
fieldConfigScheme
- FieldConfigScheme
to deletepublic void addOptionToDefault(String optionId)
PrioritySchemeManager
optionId
to the default priority scheme.addOptionToDefault
in interface PrioritySchemeManager
optionId
- priority idpublic void removeOptionFromAllSchemes(String optionId)
PrioritySchemeManager
optionId
as part of its options.removeOptionFromAllSchemes
in interface PrioritySchemeManager
optionId
- Priority id to remove from all priority schemes.public Collection<FieldConfigScheme> getAllRelatedSchemes(String optionId)
PrioritySchemeManager
optionId
as part of its options.getAllRelatedSchemes
in interface PrioritySchemeManager
optionId
- Priority id being queriedFieldConfigScheme
objectspublic Priority getPriority(String priorityId)
PrioritySchemeManager
priorityId
to Priority
value.getPriority
in interface PrioritySchemeManager
priorityId
- Id of Priority
Priority
objectpublic Collection<Priority> getPrioritiesFromIds(Collection<String> priorityIds)
PrioritySchemeManager
Priority
. Priorities not found by id are skipped.getPrioritiesFromIds
in interface PrioritySchemeManager
priorityIds
- Collection of ids for Priority
Priority
objectspublic void assignProject(@Nonnull FieldConfigScheme priorityFieldConfig, @Nonnull Project project)
PrioritySchemeManager
PrioritySchemeManager.unassignProject(FieldConfigScheme, Project)
.
If this method is used on "default priority scheme" it will remove DB association that marks scheme as default thus it will break "default priority scheme".
When assigning multiple projects please use PrioritySchemeManager.assignProjects(FieldConfigScheme, Set)
instead of calling this method in a loop to achieve better performance.assignProject
in interface PrioritySchemeManager
priorityFieldConfig
- the schemeproject
- the projectpublic void assignProjects(@Nonnull FieldConfigScheme priorityFieldConfig, @Nonnull Set<Project> projects)
PrioritySchemeManager
PrioritySchemeManager.unassignProject(FieldConfigScheme, Project)
.
If this method is used on "default priority scheme" it will remove DB association that marks scheme as default thus it will break "default priority scheme".assignProjects
in interface PrioritySchemeManager
priorityFieldConfig
- the schemeprojects
- the projects@Nonnull public Set<Project> getProjectsWithScheme(@Nonnull FieldConfigScheme fieldConfigScheme)
PrioritySchemeManager
getProjectsWithScheme
in interface PrioritySchemeManager
fieldConfigScheme
- the schemeProject
with the given scheme (possibly empty)public void unassignProject(@Nonnull FieldConfigScheme scheme, @Nonnull Project project)
PrioritySchemeManager
PrioritySchemeManager.unassignProjects(FieldConfigScheme, Set)
instead of calling this method in a loop to achieve better performance.unassignProject
in interface PrioritySchemeManager
scheme
- the schemeproject
- the projectpublic void unassignProjects(@Nonnull FieldConfigScheme scheme, @Nonnull Set<Project> projects)
PrioritySchemeManager
unassignProjects
in interface PrioritySchemeManager
scheme
- the schemeprojects
- the projectsCopyright © 2002-2019 Atlassian. All Rights Reserved.