Class TerminologyEntryWriterImpl
- All Implemented Interfaces:
TerminologyEntryWriter
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.atlassian.jira.i18n.terminology.TerminologyEntryWriter
TerminologyEntryWriter.TerminologyValidationResult -
Constructor Summary
ConstructorsConstructorDescriptionTerminologyEntryWriterImpl(TerminologyEntryReader terminologyEntryReader, TerminologyEntryDao terminologyEntryDao, GlobalPermissionManager permissionManager, JiraAuthenticationContext jiraAuthenticationContext, TerminologyEntryValidator terminologyEntryValidator, com.atlassian.event.api.EventPublisher eventPublisher, FeatureManager featureManager, DataCenterOrDevModeCheck dataCenterOrDevModeCheck) -
Method Summary
Modifier and TypeMethodDescriptionvoidchangeTerminology(TerminologyEntryWriter.TerminologyValidationResult terminologyValidationResults) Update terminology with new name mapping.validateAndPrepareTerminologyChange(Collection<TerminologyEntry> terminologyEntries) Validate whether a new terminology entry can be created.
-
Constructor Details
-
TerminologyEntryWriterImpl
public TerminologyEntryWriterImpl(TerminologyEntryReader terminologyEntryReader, TerminologyEntryDao terminologyEntryDao, GlobalPermissionManager permissionManager, JiraAuthenticationContext jiraAuthenticationContext, TerminologyEntryValidator terminologyEntryValidator, com.atlassian.event.api.EventPublisher eventPublisher, FeatureManager featureManager, DataCenterOrDevModeCheck dataCenterOrDevModeCheck)
-
-
Method Details
-
validateAndPrepareTerminologyChange
public TerminologyEntryWriter.TerminologyValidationResult validateAndPrepareTerminologyChange(Collection<TerminologyEntry> terminologyEntries) Description copied from interface:TerminologyEntryWriterValidate whether a new terminology entry can be created. Provide data that can be used to create it. TheTerminologyEntryWriter.changeTerminology(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); }- Specified by:
validateAndPrepareTerminologyChangein interfaceTerminologyEntryWriter- Parameters:
terminologyEntries- a collection ofTerminologyEntryto be validated- Returns:
- The result that will contain
TerminologyEntryif validation was successful or errors otherwise.
-
changeTerminology
public void changeTerminology(TerminologyEntryWriter.TerminologyValidationResult terminologyValidationResults) Description copied from interface:TerminologyEntryWriterUpdate 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().- Specified by:
changeTerminologyin interfaceTerminologyEntryWriter- Parameters:
terminologyValidationResults- contains the entry to store. This must be taken fromTerminologyEntryWriter.validateAndPrepareTerminologyChange(java.util.Collection<com.atlassian.jira.i18n.terminology.TerminologyEntry>). ItsServiceResultImpl.isValid()must return true, otherwise this method will throwIllegalStateException.
-