Added some comments to have a better understanding of what the code does
This commit is contained in:
parent
c59d38e02e
commit
b476646875
|
@ -482,24 +482,39 @@ public class CommonServiceUtils {
|
|||
|
||||
// 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
|
||||
|
||||
// In web.xml a parameter indicates the Admin VRE as full path.
|
||||
if(context.equals((String) contextServlet.getInitParameter(HelperMethods.MANAGE_CONTEX_KEY))) {
|
||||
|
||||
// If we are in Admin VRE and the source is GRSF
|
||||
if(sourceInPath.equals(Sources.GRSF)) {
|
||||
|
||||
// RefersTo cannot be empty or null in GRSF_Admin for a GRSF record
|
||||
List<RefersToBean> refersTo = record.getRefersTo();
|
||||
if(refersTo == null || refersTo.isEmpty())
|
||||
throw new Exception("refers_to is empty for a GRSF record");
|
||||
|
||||
|
||||
// For each RefersTo a Resource is created in the record. The resource point to the referred record.
|
||||
// We have also to set database sources
|
||||
|
||||
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) {
|
||||
|
||||
String sourceOrganization = "";
|
||||
// String sourceOrganization = getRecordOrganization(refersToBean.getId(), apiKey, context);
|
||||
|
||||
// Here there is a lookup to the referred records.
|
||||
// getRecordOrganization read the record and get the organization
|
||||
// String sourceOrganization = getRecordOrganization(refersToBean.getId(), apiKey, context);
|
||||
|
||||
resources.add(new ResourceBean(refersToBean.getUrl(), sourceOrganization, "", null, username, null,
|
||||
null));
|
||||
sourcesList.add(sourceOrganization.toLowerCase());
|
||||
|
||||
|
||||
// concatenating the organization in a string which provide the databaseSource value :O
|
||||
// Better using a list
|
||||
databaseSource += sourceOrganization + " ";
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue