Made elastic dmp mapping more safe

This commit is contained in:
George Kalampokis 2020-04-16 18:32:47 +03:00
parent 2ba3f11687
commit 91fc1bc5b1
1 changed files with 3 additions and 1 deletions

View File

@ -242,7 +242,9 @@ public class Dmp implements ElasticEntity<Dmp> {
this.id = UUID.fromString((String) fields.get(MapKey.ID.getName()));
this.label = (String) fields.get(MapKey.LABEL.getName());
this.description = (String) fields.get(MapKey.DESCRIPTION.getName());
this.groupId = UUID.fromString((String) fields.get(MapKey.GROUPID.getName()));
if (fields.get(MapKey.GROUPID.getName()) != null) {
this.groupId = UUID.fromString((String) fields.get(MapKey.GROUPID.getName()));
}
this.status = Short.valueOf(fields.get(MapKey.STATUS.getName()).toString());
if (fields.get(MapKey.TEMPLATES.getName()) != null) {
this.templates = ((List<HashMap<String, Object>>) fields.get(MapKey.TEMPLATES.getName())).stream().map(hashMap -> new DatasetTempalate().fromElasticEntity(hashMap)).collect(Collectors.toList());