From 8e9ecfe58c825b1b79008dff12a2fae3d9b42731 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Thu, 28 Feb 2019 08:38:00 +0000 Subject: [PATCH] refers_to can be null while publishing legacy records refs #13347 git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/grsf-publisher-ws@177329 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../grsf_publish_ws/utils/CommonServiceUtils.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/CommonServiceUtils.java b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/CommonServiceUtils.java index 69d951a..998c413 100644 --- a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/CommonServiceUtils.java +++ b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/CommonServiceUtils.java @@ -74,16 +74,18 @@ public class CommonServiceUtils { * Validate an aggregated GRSF record. TODO use @Valid tags * @throws Exception */ - public static void validateAggregatedRecord(Common record) throws Exception { + public static void validateAggregatedRecord(Common record, Sources sourceInPath) throws Exception { + + if(sourceInPath.equals(Sources.GRSF)) { + List refersToList = record.getRefersTo(); + if(refersToList == null || refersToList.isEmpty()) + throw new Exception("refers_to cannot be null/empty"); + } - List refersToList = record.getRefersTo(); String shortTitle = record.getShortName(); Boolean traceabilityFlag = record.isTraceabilityFlag(); Status status = record.getStatus(); - if(refersToList == null || refersToList.isEmpty()) - throw new Exception("refers_to cannot be null/empty"); - if(traceabilityFlag == null) throw new Exception("traceability_flag cannot be null"); @@ -508,7 +510,7 @@ public class CommonServiceUtils { addRecordToGroupSources(groups, new ArrayList(sourcesList), productType, sourceInPath); // validate - CommonServiceUtils.validateAggregatedRecord(record); + CommonServiceUtils.validateAggregatedRecord(record, sourceInPath); // set the domain record.setDomain(productType.getOrigName());