Skip to content

Commit

Permalink
UBO-378 Simplified control flow
Browse files Browse the repository at this point in the history
  • Loading branch information
Possommi committed Dec 6, 2024
1 parent 88a4704 commit 34776df
Showing 1 changed file with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,17 @@ public static String getEnricherId(Element formInput) {
.filter(element -> !element.getText().isEmpty())
.findFirst();

String enrchrIdOrEnrchmntSrcs = dataSource.isPresent() ? dataSource.get().getText() : null;
if (enrchrIdOrEnrchmntSrcs != null) {
if (MCRConfiguration2
.getString("MCR.MODS.EnrichmentResolver.DataSources." + enrchrIdOrEnrchmntSrcs)
.isPresent()) {
return enrchrIdOrEnrchmntSrcs;
} else {
String property = "MCR.MODS.EnrichmentResolver.DataSources." + DEFAULT_CONFIG_ID;
MCRConfiguration2.set(property, dataSource.get().getText());
return DEFAULT_CONFIG_ID;
}
if (dataSource.isEmpty()) {
return null;
}

String dataSrcTxt = dataSource.get().getText();
if (MCRConfiguration2.getString("MCR.MODS.EnrichmentResolver.DataSources." + dataSrcTxt).isPresent()) {
return dataSrcTxt;
} else {
String property = "MCR.MODS.EnrichmentResolver.DataSources." + DEFAULT_CONFIG_ID;
MCRConfiguration2.set(property, dataSource.get().getText());
return DEFAULT_CONFIG_ID;
}
return null;
}
}

0 comments on commit 34776df

Please sign in to comment.