fixed error for mapping of open access color

This commit is contained in:
Miriam Baglioni 2024-01-08 11:54:33 +01:00
parent 4f01c5b046
commit 53257bc041
2 changed files with 19 additions and 1 deletions

View File

@ -56,7 +56,7 @@ public class ResultMapper implements Serializable {
out.setGreen(input.getIsGreen());
out.setInDiamondJournal(input.getIsInDiamondJournal());
out.setPubliclyFunded(input.getPubliclyFunded());
out.setOpenAccessColor(OpenAccessColor.valueOf(input.getOpenAccessColor().name()));
mapOpenAccessColor(out, input);
mapDescription(out, input);
mapEmbargo(out, input);
mapFormat(out, input);
@ -86,6 +86,23 @@ public class ResultMapper implements Serializable {
}
private static void mapOpenAccessColor(Result out, eu.dnetlib.dhp.schema.oaf.Result input) {
if (Optional.ofNullable(input.getOpenAccessColor()).isPresent())
switch (input.getOpenAccessColor()) {
case bronze:
out.setOpenAccessColor(OpenAccessColor.bronze);
break;
case gold:
out.setOpenAccessColor(OpenAccessColor.gold);
break;
case hybrid:
out.setOpenAccessColor(OpenAccessColor.hybrid);
break;
}
out.setOpenAccessColor(OpenAccessColor.valueOf(input.getOpenAccessColor().name()));
}
private static void mapContext(Map<String, String> communityMap, CommunityResult out,
eu.dnetlib.dhp.schema.oaf.Result input) {
Set<String> communities = communityMap.keySet();

File diff suppressed because one or more lines are too long