minor fix on refers_to empty field when grsf records are going to be published

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/grsf-publisher-ws@149333 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2017-06-07 09:51:12 +00:00
parent 6d76255071
commit 679e6097d8
2 changed files with 10 additions and 2 deletions

View File

@ -196,6 +196,8 @@ public class GrsfPublisherFisheryService {
// manage the refers to
if(sourceInPath.equals(Sources.GRSF)){
List<RefersToBean> refersTo = record.getRefersTo();
if(refersTo == null || refersTo.isEmpty())
throw new Exception("refers_to is empty");
for (RefersToBean refersToBean : refersTo) {
resources.add(new ResourceBean(refersToBean.getUrl(), "Source of item " + futureTitle + " in the catalogue has id: "
+ refersToBean.getId(), "Information of a source of the item " + futureTitle, null, username, null, null));
@ -270,7 +272,8 @@ public class GrsfPublisherFisheryService {
// add the "Product URL" to the field
Map<String, List<String>> addField = new HashMap<String, List<String>>();
addField.put(CommonServiceUtils.ITEM_URL_FIELD, Arrays.asList(itemUrl));
String modifiedUUIDKey = namespaces.containsKey(CommonServiceUtils.ITEM_URL_FIELD) ? namespaces.get(CommonServiceUtils.ITEM_URL_FIELD) : CommonServiceUtils.ITEM_URL_FIELD;
addField.put(modifiedUUIDKey, Arrays.asList(itemUrl));
catalogue.patchProductCustomFields(id, apiKey, addField);
if(!groups.isEmpty()){

View File

@ -187,6 +187,10 @@ public class GrsfPublisherStockService {
if(sourceInPath.equals(Sources.GRSF)){
List<RefersToBean> refersTo = record.getRefersTo();
if(refersTo == null || refersTo.isEmpty())
throw new Exception("refers_to is empty");
for (RefersToBean refersToBean : refersTo) {
resources.add(new ResourceBean(refersToBean.getUrl(), "Source of item " + futureTitle + " in the catalogue has id: "
+ refersToBean.getId(), "Information of a source of the item " + futureTitle, null, username, null, null));
@ -263,7 +267,8 @@ public class GrsfPublisherStockService {
// add the "Product URL" to the field
Map<String, List<String>> addField = new HashMap<String, List<String>>();
addField.put(CommonServiceUtils.ITEM_URL_FIELD, Arrays.asList(itemUrl));
String modifiedUUIDKey = namespaces.containsKey(CommonServiceUtils.ITEM_URL_FIELD) ? namespaces.get(CommonServiceUtils.ITEM_URL_FIELD) : CommonServiceUtils.ITEM_URL_FIELD;
addField.put(modifiedUUIDKey, Arrays.asList(itemUrl));
catalogue.patchProductCustomFields(id, apiKey, addField);
if(!groups.isEmpty()){