|
|
|
@ -469,6 +469,8 @@ public class CommonServiceUtils {
|
|
|
|
|
Map<String,List<String>> customFields, Set<String> groups, List<ResourceBean> resources, String username,
|
|
|
|
|
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
|
|
|
|
|
// Status field is needed only in the Manage context for GRSF records
|
|
|
|
|
if(context.equals((String) contextServlet.getInitParameter(HelperMethods.MANAGE_CONTEX_KEY))) {
|
|
|
|
@ -478,8 +480,6 @@ public class CommonServiceUtils {
|
|
|
|
|
if(refersTo == null || refersTo.isEmpty())
|
|
|
|
|
throw new Exception("refers_to is empty for a GRSF record");
|
|
|
|
|
|
|
|
|
|
Set<String> sourcesList = new HashSet<String>();
|
|
|
|
|
|
|
|
|
|
String databaseSource = "";
|
|
|
|
|
// 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) {
|
|
|
|
@ -493,14 +493,23 @@ public class CommonServiceUtils {
|
|
|
|
|
// create the Database Source information
|
|
|
|
|
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
|
|
|
|
|
addRecordToGroupSources(groups, new ArrayList(sourcesList), productType, sourceInPath);
|
|
|
|
|
|
|
|
|
|
// validate
|
|
|
|
|
CommonServiceUtils.validateAggregatedRecord(record);
|
|
|
|
|
}
|
|
|
|
|
}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
|
|
|
|
|
addRecordToGroupSources(groups, new ArrayList(sourcesList), productType, sourceInPath);
|
|
|
|
|
|
|
|
|
|
// validate
|
|
|
|
|
CommonServiceUtils.validateAggregatedRecord(record);
|
|
|
|
|
|
|
|
|
|
// set the domain
|
|
|
|
|
record.setDomain(productType.getOrigName());
|
|
|
|
|
|
|
|
|
|