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
feature/17695
Luca Frosini 5 years ago
parent c309404ce6
commit 8e9ecfe58c

@ -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<RefersToBean> refersToList = record.getRefersTo();
if(refersToList == null || refersToList.isEmpty())
throw new Exception("refers_to cannot be null/empty");
}
List<RefersToBean> 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());

Loading…
Cancel
Save