map results as OPRs in case of missing //CobjCategory/@type and the vocabulary dnet:result_typologies doesn't resolve the super type

This commit is contained in:
Claudio Atzori 2020-07-20 19:01:10 +02:00
parent 32f5e466e3
commit ebf60020ac
1 changed files with 9 additions and 2 deletions

View File

@ -93,9 +93,16 @@ public abstract class AbstractMdRecordToOafMapper {
.stream()
.map(i -> i.getInstancetype().getClassid())
.findFirst()
.map(s -> UNKNOWN.equalsIgnoreCase(s) ? "0000" : s)
.orElse("0000"); // Unknown
Qualifier resultType = vocs.getSynonymAsQualifier(ModelConstants.DNET_RESULT_TYPOLOGIES, instanceType);
return resultType.getClassid();
return Optional
.ofNullable(vocs.getSynonymAsQualifier(ModelConstants.DNET_RESULT_TYPOLOGIES, instanceType))
.map(q -> q.getClassid())
.orElse("0000");
/*
* .orElseThrow( () -> new IllegalArgumentException( String.format("'%s' not mapped in %s", instanceType,
* DNET_RESULT_TYPOLOGIES)));
*/
}
return type;