RED-8951: made it possible to import entities with dictionary but hasDictionary=false #619
@ -171,7 +171,7 @@ public class EntityTypeImportService {
|
||||
private void addEntries(Map<String, List<String>> entries, Map<String, List<String>> deleteEntries, String typeId, String typeName, DictionaryEntryType dictionaryType) {
|
||||
|
||||
if (entries != null && !entries.isEmpty() && entries.get(typeName) != null && !entries.get(typeName).isEmpty()) {
|
||||
dictionaryManagementService.addEntries(typeId, entries.get(typeName), true, true, dictionaryType);
|
||||
dictionaryManagementService.addEntries(typeId, entries.get(typeName), true, true, dictionaryType, true);
|
||||
} else { // no entries, delete current entries
|
||||
List<String> existing = entryPersistenceService.getEntries(typeId, dictionaryType, null)
|
||||
.stream()
|
||||
|
||||
@ -237,6 +237,12 @@ public class DictionaryManagementService {
|
||||
|
||||
@Transactional
|
||||
public void addEntries(String typeId, List<String> entries, boolean removeCurrent, boolean ignoreInvalidEntries, DictionaryEntryType dictionaryEntryType) {
|
||||
addEntries(typeId, entries, removeCurrent, ignoreInvalidEntries, dictionaryEntryType, false);
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public void addEntries(String typeId, List<String> entries, boolean removeCurrent, boolean ignoreInvalidEntries, DictionaryEntryType dictionaryEntryType, boolean isImport) {
|
||||
|
||||
checkForDossierTypeExistenceAndCreate(typeId);
|
||||
|
||||
@ -258,7 +264,7 @@ public class DictionaryManagementService {
|
||||
|
||||
// To check whether the type exists, type should not be added into database implicitly by addEntry.
|
||||
Type typeResult = MagicConverter.convert(dictionaryPersistenceService.getType(typeId), Type.class);
|
||||
if (!typeResult.isHasDictionary()) {
|
||||
if (!typeResult.isHasDictionary() && !isImport) {
|
||||
throw new BadRequestException("Entity type does not have a dictionary");
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user