minor fixes
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/grsf-publisher-ws@158929 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
10bd220c53
commit
4b62e244cf
|
@ -412,22 +412,22 @@ public class CommonServiceUtils {
|
||||||
if(refersTo == null || refersTo.isEmpty())
|
if(refersTo == null || refersTo.isEmpty())
|
||||||
throw new Exception("refers_to is empty for a GRSF record");
|
throw new Exception("refers_to is empty for a GRSF record");
|
||||||
|
|
||||||
List<String> sourcesList = new ArrayList<String>();
|
Set<String> sourcesList = new HashSet<String>();
|
||||||
|
|
||||||
String databaseSource = "";
|
String databaseSource = "";
|
||||||
// we have the id within the catalog of this record. This means that we can retrieve the record and its system:type
|
// we have the id within the catalog of this record. This means that we can retrieve the record and its system:type
|
||||||
for (RefersToBean refersToBean : refersTo) {
|
for (RefersToBean refersToBean : refersTo) {
|
||||||
String sourceSysType = getSystemTypeValue(refersToBean.getId(), apiKey, context);
|
String sourceOrganization = getRecordOrganization(refersToBean.getId(), apiKey, context);
|
||||||
resources.add(new ResourceBean(refersToBean.getUrl(), sourceSysType , "", null, username, null, null));
|
resources.add(new ResourceBean(refersToBean.getUrl(), sourceOrganization , "", null, username, null, null));
|
||||||
sourcesList.add(sourceSysType.toLowerCase());
|
sourcesList.add(sourceOrganization.toLowerCase());
|
||||||
databaseSource += sourceSysType + " ";
|
databaseSource += sourceOrganization + " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
// create the Database Source information
|
// create the Database Source information
|
||||||
customFields.put(Constants.GRSF_DATABASE_SOURCE, Arrays.asList(databaseSource.trim()));
|
customFields.put(Constants.GRSF_DATABASE_SOURCE, Arrays.asList(databaseSource.trim()));
|
||||||
|
|
||||||
// append to groups: we need to add this record to the correspondent group of the sources
|
// append to groups: we need to add this record to the correspondent group of the sources
|
||||||
addRecordToGroupSources(groups, sourcesList, productType, sourceInPath);
|
addRecordToGroupSources(groups, new ArrayList(sourcesList), productType, sourceInPath);
|
||||||
|
|
||||||
// validate
|
// validate
|
||||||
CommonServiceUtils.validateAggregatedRecord(record);
|
CommonServiceUtils.validateAggregatedRecord(record);
|
||||||
|
@ -491,6 +491,18 @@ public class CommonServiceUtils {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getRecordOrganization(String itemIdOrName, String apiKey, String context) throws Exception{
|
||||||
|
|
||||||
|
DataCatalogue catalog = HelperMethods.getDataCatalogueRunningInstance(context);
|
||||||
|
CkanDataset dataset = catalog.getDataset(itemIdOrName, apiKey);
|
||||||
|
if(dataset == null)
|
||||||
|
throw new Exception("Unable to find record with id or name " + itemIdOrName);
|
||||||
|
else
|
||||||
|
return dataset.getOrganization().getTitle();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Actions to execute once the dataset has been updated or created.
|
* Actions to execute once the dataset has been updated or created.
|
||||||
* @param responseBean
|
* @param responseBean
|
||||||
|
|
Loading…
Reference in New Issue