task_24166 #8

Merged
francesco.mangiacrapa merged 14 commits from task_24166 into master 2023-05-11 15:49:17 +02:00
2 changed files with 23 additions and 13 deletions
Showing only changes of commit 6b63090ec4 - Show all commits

View File

@ -23,6 +23,7 @@ import org.gcube.application.geoportal.common.model.document.access.Access;
import org.gcube.application.geoportal.common.model.document.accounting.AccountingInfo;
import org.gcube.application.geoportal.common.model.document.accounting.PublicationInfo;
import org.gcube.application.geoportal.common.model.document.identification.IdentificationReference;
import org.gcube.application.geoportal.common.model.document.identification.SpatialReference;
import org.gcube.application.geoportal.common.model.document.lifecycle.LifecycleInformation;
import org.gcube.application.geoportal.common.model.document.relationships.Relationship;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.HandlerDeclaration;
@ -527,8 +528,8 @@ public class ConvertToDataValueObjectModel {
project.getProfileVersion() != null ? project.getProfileVersion().getValue() : "");
theProject.setVersion(project.getVersion() != null ? project.getVersion().getValue() : "");
theProject.setTheDocument(toGenericDocumentDV(project.getId(), project.getTheDocument(), DocumentDV.class, projectReader.getListDocumentKeys(), projectReader.isIncludeFullDocumentMap()));
theProject.setTheDocument(toGenericDocumentDV(project.getId(), project.getTheDocument(), DocumentDV.class,
projectReader.getListDocumentKeys(), projectReader.isIncludeFullDocumentMap()));
List<Relationship> relations = project.getRelationships();
@ -608,18 +609,22 @@ public class ConvertToDataValueObjectModel {
return null;
GeoJSON geoJson = null;
try {
geoJson = new GeoJSON();
JSONObject jsonObject = new JSONObject(geoJSONObject).getJSONObject("geoJSON");
geoJson.setType(jsonObject.getString("type"));
geoJson.setBbox(GisUtil.fromJSONArray(jsonObject.getJSONArray("bbox")));
JSONObject jsonObject = new JSONObject(geoJSONObject).getJSONObject(SpatialReference.GEO_JSON);
geoJson.setType(jsonObject.getString(GeoJSON.TYPE));
geoJson.setBbox(GisUtil.fromJSONArray(jsonObject.getJSONArray(GeoJSON.BBOX)));
Crs crs = org.gcube.application.geoportal.client.utils.Serialization
.read(jsonObject.getJSONObject("crs").toString(), Crs.class);
.read(jsonObject.getJSONObject(GeoJSON.CRS).toString(), Crs.class);
geoJson.setCrs(crs);
geoJson.setGeoJSON(jsonObject.toString());
LOG.debug("toSpatialReference returning " + geoJson);
} catch (JSONException | IOException e) {
LOG.warn("Error on converting " + GeoJSON.class.getSimpleName() + " from : " + geoJSONObject, e);
LOG.warn("Error on converting " + GeoJSON.class.getSimpleName() + " from : " + geoJSONObject
+ ". Is it empty?");
LOG.debug("toSpatialReference error: ", e);
}
return geoJson;
@ -1003,10 +1008,11 @@ public class ConvertToDataValueObjectModel {
}
}
}
//Casting to String, in order to avoid GWT serialization issue, see #24537#note-9 and #24432
String valueString = value!=null?value+"":null;
// Casting to String, in order to avoid GWT serialization issue, see
// #24537#note-9 and #24432
String valueString = value != null ? value + "" : null;
documentAsMap.put(key, valueString);
return documentAsMap;
}

View File

@ -6,11 +6,15 @@ import org.gcube.application.geoportalcommon.shared.geoportal.materialization.in
public class GeoJSON implements Serializable {
public static final String TYPE = "type";
public static final String BBOX = "bbox";
public static final String CRS = "crs";
public static final String COORDINATES = "coordinates";
/**
*
*/
private static final long serialVersionUID = -7798331554142534921L;
private String type;
private Crs crs;
private BBOXDV bbox;
@ -18,7 +22,7 @@ public class GeoJSON implements Serializable {
public GeoJSON() {
}
}
public String getType() {
return type;