Interface TerminologyEntryWriter
- All Known Implementing Classes:
TerminologyEntryWriterImpl
- Since:
- v8.14
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classA simple object that holds the result of validation whether new terminology entry can be created. -
Method Summary
Modifier and TypeMethodDescriptionvoidchangeTerminology(TerminologyEntryWriter.TerminologyValidationResult terminologyValidationResult) Update terminology with new name mapping.validateAndPrepareTerminologyChange(Collection<TerminologyEntry> terminologyEntries) Validate whether a new terminology entry can be created.
-
Method Details
-
validateAndPrepareTerminologyChange
TerminologyEntryWriter.TerminologyValidationResult validateAndPrepareTerminologyChange(Collection<TerminologyEntry> terminologyEntries) Validate whether a new terminology entry can be created. Provide data that can be used to create it. ThechangeTerminology(com.atlassian.jira.i18n.terminology.TerminologyEntryWriter.TerminologyValidationResult)method should only be called ifServiceResultImpl.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.FORBIDDENis returned.Secondly, provided data is validated. All found errors are returned, their fields (see
ErrorCollection) are set tooriginalName,newNameornewNamePluraldepending on which field is affected.Usage example:
final TerminologyValidationResult result = terminologyEntryWriter.validateAndPrepareTerminologyChange(terminologyEntryList); if (result.isValid()) { terminologyEntryWriter.changeTerminology(result); }- Parameters:
terminologyEntries- a collection ofTerminologyEntryto be validated- Returns:
- The result that will contain
TerminologyEntryif validation was successful or errors otherwise.
-
changeTerminology
void changeTerminology(TerminologyEntryWriter.TerminologyValidationResult terminologyValidationResult) Update terminology with new name mapping. All occurrences of original name (seeTerminologyEntry.getOriginalName()) will be visible as new name (seeTerminologyEntry.getNewName()andTerminologyEntry.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
TerminologyEntrywithTerminologyEntry.getNewName()equal toTerminologyEntry.getOriginalName().- Parameters:
terminologyValidationResult- contains the entry to store. This must be taken fromvalidateAndPrepareTerminologyChange(java.util.Collection<com.atlassian.jira.i18n.terminology.TerminologyEntry>). ItsServiceResultImpl.isValid()must return true, otherwise this method will throwIllegalStateException.
-