Patched code to use "database_sources" field as source of information for sources for GRSF VRE.
In GRSF_Admin the sources are calculated using the referTo field. see #12861 git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/grsf-publisher-ws@176223 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
04c91b534d
commit
a39731a785
|
@ -469,6 +469,8 @@ public class CommonServiceUtils {
|
||||||
Map<String,List<String>> customFields, Set<String> groups, List<ResourceBean> resources, String username,
|
Map<String,List<String>> customFields, Set<String> groups, List<ResourceBean> resources, String username,
|
||||||
String futureTitle) throws Exception {
|
String futureTitle) throws Exception {
|
||||||
|
|
||||||
|
Set<String> sourcesList = new HashSet<String>();
|
||||||
|
|
||||||
// validate the record if it is a GRSF one and set the record type and in manage context
|
// validate the record if it is a GRSF one and set the record type and in manage context
|
||||||
// Status field is needed only in the Manage context for GRSF records
|
// Status field is needed only in the Manage context for GRSF records
|
||||||
if(context.equals((String) contextServlet.getInitParameter(HelperMethods.MANAGE_CONTEX_KEY))) {
|
if(context.equals((String) contextServlet.getInitParameter(HelperMethods.MANAGE_CONTEX_KEY))) {
|
||||||
|
@ -478,8 +480,6 @@ 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");
|
||||||
|
|
||||||
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) {
|
||||||
|
@ -493,13 +493,22 @@ public class CommonServiceUtils {
|
||||||
// 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()));
|
||||||
|
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
// I'm not in GRSF Admin so the groups must be added using databaseSources
|
||||||
|
|
||||||
|
List<Resource<Sources>> databaseSources = record.getDatabaseSources();
|
||||||
|
for(Resource<Sources> source : databaseSources) {
|
||||||
|
Sources sourceName = source.getName();
|
||||||
|
sourcesList.add(sourceName.getOrigName().toLowerCase());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 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, new ArrayList(sourcesList), productType, sourceInPath);
|
addRecordToGroupSources(groups, new ArrayList(sourcesList), productType, sourceInPath);
|
||||||
|
|
||||||
// validate
|
// validate
|
||||||
CommonServiceUtils.validateAggregatedRecord(record);
|
CommonServiceUtils.validateAggregatedRecord(record);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// set the domain
|
// set the domain
|
||||||
record.setDomain(productType.getOrigName());
|
record.setDomain(productType.getOrigName());
|
||||||
|
|
Loading…
Reference in New Issue