@ParametersAreNonnullByDefault public class TerminologyEntryWriterImpl extends Object implements TerminologyEntryWriter
TerminologyEntryWriter.TerminologyValidationResult| Constructor and Description |
|---|
TerminologyEntryWriterImpl(TerminologyEntryReader terminologyEntryReader,
TerminologyEntryDao terminologyEntryDao,
GlobalPermissionManager permissionManager,
JiraAuthenticationContext jiraAuthenticationContext,
TerminologyEntryValidator terminologyEntryValidator,
com.atlassian.event.api.EventPublisher eventPublisher,
FeatureManager featureManager,
DataCenterOrDevModeCheck dataCenterOrDevModeCheck) |
| Modifier and Type | Method and Description |
|---|---|
void |
changeTerminology(TerminologyEntryWriter.TerminologyValidationResult terminologyValidationResults)
Update terminology with new name mapping.
|
TerminologyEntryWriter.TerminologyValidationResult |
validateAndPrepareTerminologyChange(Collection<TerminologyEntry> terminologyEntries)
Validate whether a new terminology entry can be created.
|
public TerminologyEntryWriterImpl(TerminologyEntryReader terminologyEntryReader, TerminologyEntryDao terminologyEntryDao, GlobalPermissionManager permissionManager, JiraAuthenticationContext jiraAuthenticationContext, TerminologyEntryValidator terminologyEntryValidator, com.atlassian.event.api.EventPublisher eventPublisher, FeatureManager featureManager, DataCenterOrDevModeCheck dataCenterOrDevModeCheck)
public TerminologyEntryWriter.TerminologyValidationResult validateAndPrepareTerminologyChange(Collection<TerminologyEntry> terminologyEntries)
TerminologyEntryWriterTerminologyEntryWriter.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);
}
validateAndPrepareTerminologyChange in interface TerminologyEntryWriterterminologyEntries - a collection of TerminologyEntry to be validatedTerminologyEntry if validation was successful or errors otherwise.public void changeTerminology(TerminologyEntryWriter.TerminologyValidationResult terminologyValidationResults)
TerminologyEntryWriterTerminologyEntry.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().
changeTerminology in interface TerminologyEntryWriterterminologyValidationResults - contains the entry to store. This must be taken from TerminologyEntryWriter.validateAndPrepareTerminologyChange(java.util.Collection<com.atlassian.jira.i18n.terminology.TerminologyEntry>).
Its ServiceResultImpl.isValid() must return true, otherwise
this method will throw IllegalStateException.Copyright © 2002-2024 Atlassian. All Rights Reserved.