Fixing issue - files/images duplicated reading the section
This commit is contained in:
parent
dc439a2637
commit
8d47db8e83
|
@ -60,6 +60,7 @@ public class SectionViewer extends Composite {
|
||||||
boolean displayAsGallery = false;
|
boolean displayAsGallery = false;
|
||||||
for (SubDocumentView subDocumentView : subDocuments) {
|
for (SubDocumentView subDocumentView : subDocuments) {
|
||||||
if (subDocumentView.getListImages() != null && subDocumentView.getListImages().size() > 0) {
|
if (subDocumentView.getListImages() != null && subDocumentView.getListImages().size() > 0) {
|
||||||
|
GWT.log("Section with images: "+subDocumentView.getListImages());
|
||||||
displayAsGallery = true;
|
displayAsGallery = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -68,6 +69,7 @@ public class SectionViewer extends Composite {
|
||||||
boolean displayAsMapOfLayers = false;
|
boolean displayAsMapOfLayers = false;
|
||||||
for (SubDocumentView subDocumentView : subDocuments) {
|
for (SubDocumentView subDocumentView : subDocuments) {
|
||||||
if (subDocumentView.getListLayers() != null && subDocumentView.getListLayers().size() > 0) {
|
if (subDocumentView.getListLayers() != null && subDocumentView.getListLayers().size() > 0) {
|
||||||
|
GWT.log("Section with layers: "+subDocumentView.getListImages());
|
||||||
displayAsMapOfLayers = true;
|
displayAsMapOfLayers = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -271,8 +271,9 @@ public class Geoportal_JSON_Mapper {
|
||||||
for (Payload payload : listPayloads) {
|
for (Payload payload : listPayloads) {
|
||||||
PayloadDV payloadDV = ConvertToDataValueObjectModel.toPayloadDV(payload);
|
PayloadDV payloadDV = ConvertToDataValueObjectModel.toPayloadDV(payload);
|
||||||
filesetDV.addPayloadDV(payloadDV);
|
filesetDV.addPayloadDV(payloadDV);
|
||||||
listFiles.add(filesetDV);
|
|
||||||
}
|
}
|
||||||
|
listFiles.add(filesetDV);
|
||||||
|
|
||||||
// Reading Fileset _materializations
|
// Reading Fileset _materializations
|
||||||
// listLayers = readGcubeSDILayersForFileset(filesetJSONPath,
|
// listLayers = readGcubeSDILayersForFileset(filesetJSONPath,
|
||||||
|
@ -529,20 +530,37 @@ public class Geoportal_JSON_Mapper {
|
||||||
// Reading Fileset _payloads
|
// Reading Fileset _payloads
|
||||||
String filesetJSONPath = String.format("%s.%s", JSON_$_POINTER, filePath.getFieldName());
|
String filesetJSONPath = String.format("%s.%s", JSON_$_POINTER, filePath.getFieldName());
|
||||||
List<Payload> listPayloads = readPayloadsForFileset(filesetJSONPath, fromSectionDocJSON);
|
List<Payload> listPayloads = readPayloadsForFileset(filesetJSONPath, fromSectionDocJSON);
|
||||||
FilesetDV filesetDV = new FilesetDV();
|
if(LOG.isDebugEnabled()) {
|
||||||
filesetDV.setName(filePath.getGcubeProfileFieldName());
|
for (Payload payload : listPayloads) {
|
||||||
|
LOG.debug("read payload: " + payload);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FilesetDV filesetImages = new FilesetDV();
|
||||||
|
FilesetDV filesetFiles = new FilesetDV();
|
||||||
|
|
||||||
for (Payload payload : listPayloads) {
|
for (Payload payload : listPayloads) {
|
||||||
PayloadDV payloadDV = ConvertToDataValueObjectModel.toPayloadDV(payload);
|
PayloadDV payloadDV = ConvertToDataValueObjectModel.toPayloadDV(payload);
|
||||||
filesetDV.addPayloadDV(payloadDV);
|
//filesetDV.addPayloadDV(payloadDV);
|
||||||
boolean isImage = ImageDetector.isImage(payload.getMimetype());
|
boolean isImage = ImageDetector.isImage(payload.getMimetype());
|
||||||
|
|
||||||
if (isImage) {
|
if (isImage) {
|
||||||
listImages.add(filesetDV);
|
filesetImages.setName(filePath.getGcubeProfileFieldName());
|
||||||
|
filesetImages.addPayloadDV(payloadDV);
|
||||||
} else {
|
} else {
|
||||||
listFiles.add(filesetDV);
|
filesetFiles.addPayloadDV(payloadDV);
|
||||||
|
filesetFiles.setName(filePath.getGcubeProfileFieldName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Setting only if one element exists
|
||||||
|
if(filesetImages.getListPayload().size()>0) {
|
||||||
|
listImages.add(filesetImages);
|
||||||
|
}
|
||||||
|
if(filesetFiles.getListPayload().size()>0) {
|
||||||
|
listFiles.add(filesetFiles);
|
||||||
|
}
|
||||||
|
|
||||||
// Reading Fileset _materializations
|
// Reading Fileset _materializations
|
||||||
listLayers = readGcubeSDILayersForFileset(filesetJSONPath, fromSectionDocJSON);
|
listLayers = readGcubeSDILayersForFileset(filesetJSONPath, fromSectionDocJSON);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue