Deserialization of layers done
This commit is contained in:
parent
805a3171e2
commit
ae92ea0c3d
|
@ -42,7 +42,7 @@ import org.gcube.application.geoportalcommon.shared.geoportal.config.FilePathDV;
|
|||
import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.PayloadDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.PayloadDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.AccessDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.AccountingInfoDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.BasicLifecycleInformationDV;
|
||||
|
|
|
@ -7,11 +7,15 @@ import java.io.InputStream;
|
|||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GeoServerPlatformInfoDV;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||
|
@ -87,5 +91,18 @@ public class SerializerUtil {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class GeoserverPlaformInfoJsonDeserializer extends JsonDeserializer<GeoServerPlatformInfoDV[]> {
|
||||
|
||||
@Override
|
||||
public GeoServerPlatformInfoDV[] deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
|
||||
LOG.info("Sono qui: " +jp.getValueAsString());
|
||||
return jp.readValueAs(GeoServerPlatformInfoDV[].class);
|
||||
//return jp.readValueAs(GeoServerPlatformInfoDV[].class);
|
||||
//List<GeoServerPlatformInfoDV> listPlatform = jp.readValueAs(new TypeReference<List<GeoServerPlatformInfoDV>>() {});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,9 +4,12 @@ import java.io.Serializable;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.BBOXDV;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class GCubeSDILayerDV implements Serializable {
|
||||
|
||||
public class GCubeSDILayer implements Serializable {
|
||||
|
||||
// TODO manage heterogeneus collection
|
||||
|
||||
|
@ -23,7 +26,7 @@ public class GCubeSDILayerDV implements Serializable {
|
|||
@JsonProperty(value = "_ogcLinks")
|
||||
private HashMap<String, String> ogcLinks;
|
||||
|
||||
public GCubeSDILayerDV() {
|
||||
public GCubeSDILayer() {
|
||||
|
||||
}
|
||||
|
||||
|
@ -62,7 +65,7 @@ public class GCubeSDILayerDV implements Serializable {
|
|||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("GCubeSDILayerDV [type=");
|
||||
builder.append("GCubeSDILayer [type=");
|
||||
builder.append(type);
|
||||
builder.append(", platformInfos=");
|
||||
builder.append(platformInfos);
|
|
@ -0,0 +1,56 @@
|
|||
package org.gcube.application.geoportalcommon.shared.geoportal.materialization;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.BBOXDV;
|
||||
|
||||
public class GCubeSDIViewerLayerDV implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 7987868754775312895L;
|
||||
private String type;
|
||||
private BBOXDV bbox;
|
||||
private HashMap<String, String> ogcLinks;
|
||||
|
||||
public GCubeSDIViewerLayerDV() {
|
||||
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public BBOXDV getBbox() {
|
||||
return bbox;
|
||||
}
|
||||
|
||||
public HashMap<String, String> getOgcLinks() {
|
||||
return ogcLinks;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public void setBbox(BBOXDV bbox) {
|
||||
this.bbox = bbox;
|
||||
}
|
||||
|
||||
public void setOgcLinks(HashMap<String, String> ogcLinks) {
|
||||
this.ogcLinks = ogcLinks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("GCubeSDIViewerLayerDV [type=");
|
||||
builder.append(type);
|
||||
builder.append(", bbox=");
|
||||
builder.append(bbox);
|
||||
builder.append(", ogcLinks=");
|
||||
builder.append(ogcLinks);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -17,14 +17,14 @@ public class GeoServerPlatformInfoDV implements Serializable {
|
|||
private String workspace;
|
||||
private String storeName;
|
||||
|
||||
public GeoServerPlatformInfoDV() {
|
||||
}
|
||||
|
||||
@JsonProperty(value = "_host")
|
||||
private String host;
|
||||
|
||||
private Map<String, String> ogcLinks;
|
||||
|
||||
public GeoServerPlatformInfoDV() {
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ public class IndexLayerDV implements Serializable {
|
|||
|
||||
@JsonProperty(value = "_type")
|
||||
private String type;
|
||||
private GCubeSDILayerDV layer;
|
||||
private GCubeSDILayer layer;
|
||||
private String indexName;
|
||||
private int records;
|
||||
private String flag;
|
||||
|
@ -30,11 +30,11 @@ public class IndexLayerDV implements Serializable {
|
|||
this.type = type;
|
||||
}
|
||||
|
||||
public GCubeSDILayerDV getLayer() {
|
||||
public GCubeSDILayer getLayer() {
|
||||
return layer;
|
||||
}
|
||||
|
||||
public void setLayer(GCubeSDILayerDV layer) {
|
||||
public void setLayer(GCubeSDILayer layer) {
|
||||
this.layer = layer;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package org.gcube.application.geoportalcommon.shared.geoportal.materialization;
|
||||
package org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.gcube.application.geoportalcommon.shared.geoportal.materialization;
|
||||
package org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
|
@ -1,4 +1,4 @@
|
|||
package org.gcube.application.geoportalcommon.shared.geoportal.materialization;
|
||||
package org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package org.gcube.application.geoportalcommon.shared.geoportal.view;
|
||||
|
||||
public interface CheckEmpty {
|
||||
|
||||
public boolean isEmpty();
|
||||
|
||||
}
|
|
@ -4,7 +4,7 @@ import java.io.Serializable;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SectionView implements Serializable {
|
||||
public class SectionView implements Serializable, CheckEmpty {
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -17,6 +17,19 @@ public class SectionView implements Serializable {
|
|||
public SectionView() {
|
||||
|
||||
}
|
||||
|
||||
public boolean isEmpty(){
|
||||
if (listSubDocuments == null)
|
||||
return true;
|
||||
|
||||
for (SubDocumentView subDocumentView : listSubDocuments) {
|
||||
boolean isEmpty = subDocumentView.isEmpty();
|
||||
if(isEmpty)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getSectionTitle() {
|
||||
return sectionTitle;
|
||||
|
|
|
@ -3,12 +3,11 @@ package org.gcube.application.geoportalcommon.shared.geoportal.view;
|
|||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.FilesetDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDILayerDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.FilesetDV;
|
||||
|
||||
public class SubDocumentView implements Serializable, CheckEmpty {
|
||||
|
||||
public class SubDocumentView implements Serializable {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -18,12 +17,30 @@ public class SubDocumentView implements Serializable {
|
|||
|
||||
private List<FilesetDV> listFiles;
|
||||
private List<FilesetDV> listImages;
|
||||
private List<GCubeSDILayerDV> listLayers;
|
||||
private List<GCubeSDIViewerLayerDV> listLayers;
|
||||
|
||||
public SubDocumentView() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
|
||||
if (metadataAsJSON != null && !metadataAsJSON.isEmpty())
|
||||
return false;
|
||||
|
||||
if (listFiles != null && !listFiles.isEmpty())
|
||||
return false;
|
||||
|
||||
if (listImages != null && !listImages.isEmpty())
|
||||
return false;
|
||||
|
||||
if (listLayers != null && !listLayers.isEmpty())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getMetadataAsJSON() {
|
||||
return metadataAsJSON;
|
||||
}
|
||||
|
@ -36,7 +53,7 @@ public class SubDocumentView implements Serializable {
|
|||
return listImages;
|
||||
}
|
||||
|
||||
public List<GCubeSDILayerDV> getListLayers() {
|
||||
public List<GCubeSDIViewerLayerDV> getListLayers() {
|
||||
return listLayers;
|
||||
}
|
||||
|
||||
|
@ -52,7 +69,7 @@ public class SubDocumentView implements Serializable {
|
|||
this.listImages = listImages;
|
||||
}
|
||||
|
||||
public void setListLayers(List<GCubeSDILayerDV> listLayers) {
|
||||
public void setListLayers(List<GCubeSDIViewerLayerDV> listLayers) {
|
||||
this.listLayers = listLayers;
|
||||
}
|
||||
|
||||
|
@ -71,5 +88,4 @@ public class SubDocumentView implements Serializable {
|
|||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue