@ExperimentalApi @ParametersAreNonnullByDefault public interface TerminologyEntryWriter
Modifier and Type | Interface and Description |
---|---|
static class |
TerminologyEntryWriter.TerminologyValidationResult
A simple object that holds the result of validation whether new terminology entry can be created.
|
Modifier and Type | Method and Description |
---|---|
void |
changeTerminology(TerminologyEntryWriter.TerminologyValidationResult terminologyValidationResult)
Update terminology with new name mapping.
|
TerminologyEntryWriter.TerminologyValidationResult |
validateAndPrepareTerminologyChange(Collection<TerminologyEntry> terminologyEntries)
Validate whether a new terminology entry can be created.
|
TerminologyEntryWriter.TerminologyValidationResult validateAndPrepareTerminologyChange(Collection<TerminologyEntry> terminologyEntries)
changeTerminology(com.atlassian.jira.i18n.terminology.TerminologyEntryWriter.TerminologyValidationResult)
method should only be called if ServiceResultImpl.isValid()
is true.
Provided names are changed to lowercase and trimmed from whitespaces.
Firstly permissions are checked. If a user has no rights to create terminology entry a general error with
ErrorCollection.Reason.FORBIDDEN
is returned.
Secondly, provided data is validated. All found errors are returned, their fields (see ErrorCollection
)
are set to originalName
, newName
or newNamePlural
depending on which field is affected.
Usage example:
final TerminologyValidationResult result = terminologyEntryWriter.validateAndPrepareTerminologyChange(terminologyEntryList);
if (result.isValid()) {
terminologyEntryWriter.changeTerminology(result);
}
terminologyEntries
- a collection of TerminologyEntry
to be validatedTerminologyEntry
if validation was successful or errors otherwise.void changeTerminology(TerminologyEntryWriter.TerminologyValidationResult terminologyValidationResult)
TerminologyEntry.getOriginalName()
) will be visible as new name
(see TerminologyEntry.getNewName()
and TerminologyEntry.getNewNamePlural()
).
Names that are possible to be changed are defined in 'sprint' or 'epic'.
If you would like to get back to default name for the entry, you need to provide a TerminologyEntry
with TerminologyEntry.getNewName()
equal to TerminologyEntry.getOriginalName()
.
terminologyValidationResult
- contains the entry to store. This must be taken from validateAndPrepareTerminologyChange(java.util.Collection<com.atlassian.jira.i18n.terminology.TerminologyEntry>)
.
Its ServiceResultImpl.isValid()
must return true, otherwise
this method will throw IllegalStateException
.Copyright © 2002-2023 Atlassian. All Rights Reserved.