Skip to content

Commit

Permalink
UBO-378 Updated javadoc in EnrichmentConfigMgr
Browse files Browse the repository at this point in the history
  • Loading branch information
Possommi committed Dec 5, 2024
1 parent b6c70ab commit 88a4704
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ private EnrichmentConfigMgr() {

/**
* Retrieves the enricher id from the import list form element.
* If the value of the DataSource element is a valid enrichment config id that id is returned. Otherwise,
* it assumed a list of enrichment sources e.g. <em>GBV Unpaywall ...</em> is provided. In that case a new
* configuration with id <code>custom</code> is created and the returned id will be <code>custom</code>.
*
* @param formInput the form input (usually provided by import-list.xed)
*
Expand All @@ -29,10 +32,12 @@ public static String getEnricherId(Element formInput) {
.filter(element -> !element.getText().isEmpty())
.findFirst();

String enricherId = dataSource.isPresent() ? dataSource.get().getText() : null;
if (enricherId != null) {
if (MCRConfiguration2.getString("MCR.MODS.EnrichmentResolver.DataSources." + enricherId).isPresent()) {
return enricherId;
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());
Expand Down

0 comments on commit 88a4704

Please sign in to comment.