-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into hotfix/NP-47931-parent-scientific
# Conflicts: # search-commons/src/main/java/no/unit/nva/search/resource/ResourceParameter.java # search-commons/src/test/resources/resource_urls.json
- Loading branch information
Showing
11 changed files
with
1,474 additions
and
271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
search-commons/src/main/java/no/unit/nva/search/resource/ContributorCopyMutator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package no.unit.nva.search.resource; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import com.fasterxml.jackson.databind.node.ObjectNode; | ||
|
||
import no.unit.nva.search.common.records.JsonNodeMutator; | ||
|
||
public class ContributorCopyMutator implements JsonNodeMutator { | ||
|
||
public static final String CONTRIBUTORS_PREVIEW = "contributorsPreview"; | ||
public static final String ENTITY_DESCRIPTION = "entityDescription"; | ||
public static final String CONTRIBUTORS = "contributors"; | ||
|
||
@Override | ||
public JsonNode transform(JsonNode source) { | ||
var contributorsPreview = source.path(ENTITY_DESCRIPTION).path(CONTRIBUTORS_PREVIEW); | ||
if (!contributorsPreview.isMissingNode()) { | ||
var entityDescription = (ObjectNode) source.path(ENTITY_DESCRIPTION); | ||
entityDescription.put(CONTRIBUTORS, contributorsPreview); | ||
} | ||
return source; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.