Identification References
This commit is contained in:
parent
2e6fa21426
commit
d6521900b5
|
@ -228,7 +228,7 @@ public class SimpleLifeCycleManager extends AbstractLifeCycleManager implements
|
||||||
case OK : {
|
case OK : {
|
||||||
info.setLastOperationStatus(LifecycleInformation.Status.OK);
|
info.setLastOperationStatus(LifecycleInformation.Status.OK);
|
||||||
if(toHandle instanceof IndexDocumentReport)
|
if(toHandle instanceof IndexDocumentReport)
|
||||||
toUpdate.setToSetSpatialReference(((IndexDocumentReport)toHandle).getToSetSpatialReference());
|
toUpdate.setToSetIdentificationReferences(((IndexDocumentReport)toHandle).getToSetIdentificationReferences());
|
||||||
// Propagate changes for further processings
|
// Propagate changes for further processings
|
||||||
toUpdate.getTheRequest().getDocument().setTheDocument(toHandle.getResultingDocument());
|
toUpdate.getTheRequest().getDocument().setTheDocument(toHandle.getResultingDocument());
|
||||||
toUpdate.setToSetLifecycleInformation(toHandle.getToSetLifecycleInformation());
|
toUpdate.setToSetLifecycleInformation(toHandle.getToSetLifecycleInformation());
|
||||||
|
|
|
@ -9,8 +9,12 @@ import org.gcube.application.cms.plugins.faults.InvalidPluginRequestException;
|
||||||
import org.gcube.application.cms.plugins.faults.PluginExecutionException;
|
import org.gcube.application.cms.plugins.faults.PluginExecutionException;
|
||||||
import org.gcube.application.cms.plugins.requests.BaseExecutionRequest;
|
import org.gcube.application.cms.plugins.requests.BaseExecutionRequest;
|
||||||
import org.gcube.application.geoportal.common.model.document.Project;
|
import org.gcube.application.geoportal.common.model.document.Project;
|
||||||
|
import org.gcube.application.geoportal.common.model.document.identification.IdentificationReference;
|
||||||
import org.gcube.application.geoportal.common.model.document.lifecycle.LifecycleInformation;
|
import org.gcube.application.geoportal.common.model.document.lifecycle.LifecycleInformation;
|
||||||
import org.gcube.application.geoportal.common.model.document.temporal.TemporalReference;
|
import org.gcube.application.geoportal.common.model.document.identification.TemporalReference;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@ -23,9 +27,13 @@ public class DocumentHandlingReport<T extends BaseExecutionRequest> extends Repo
|
||||||
Document resultingDocument;
|
Document resultingDocument;
|
||||||
LifecycleInformation toSetLifecycleInformation;
|
LifecycleInformation toSetLifecycleInformation;
|
||||||
|
|
||||||
|
protected List<IdentificationReference> toSetIdentificationReferences=null;
|
||||||
|
|
||||||
TemporalReference toSetTemporalReference;
|
public DocumentHandlingReport<T> addIdentificationReference(IdentificationReference toAdd){
|
||||||
Document toSetSpatialReference;
|
if(toSetIdentificationReferences == null) toSetIdentificationReferences = new ArrayList<>();
|
||||||
|
toSetIdentificationReferences.add(toAdd);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public DocumentHandlingReport(@NonNull T theRequest) throws InvalidPluginRequestException {
|
public DocumentHandlingReport(@NonNull T theRequest) throws InvalidPluginRequestException {
|
||||||
|
@ -77,8 +85,8 @@ public class DocumentHandlingReport<T extends BaseExecutionRequest> extends Repo
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(toSetSpatialReference != null) toReturn.setSpatialReference(toSetSpatialReference);
|
if(toSetIdentificationReferences!=null)
|
||||||
if(toSetTemporalReference != null) toReturn.setTemporalReference(toSetTemporalReference);
|
toReturn.setIdentificationReferences(toSetIdentificationReferences);
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,25 +9,28 @@ import org.gcube.application.cms.plugins.faults.InvalidPluginRequestException;
|
||||||
import org.gcube.application.cms.plugins.faults.PluginExecutionException;
|
import org.gcube.application.cms.plugins.faults.PluginExecutionException;
|
||||||
import org.gcube.application.cms.plugins.requests.IndexDocumentRequest;
|
import org.gcube.application.cms.plugins.requests.IndexDocumentRequest;
|
||||||
import org.gcube.application.geoportal.common.model.document.Project;
|
import org.gcube.application.geoportal.common.model.document.Project;
|
||||||
import org.gcube.application.geoportal.common.model.document.temporal.TemporalReference;
|
import org.gcube.application.geoportal.common.model.document.identification.IdentificationReference;
|
||||||
|
import org.gcube.application.geoportal.common.model.document.identification.TemporalReference;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
public class IndexDocumentReport extends DocumentHandlingReport<IndexDocumentRequest> {
|
public class IndexDocumentReport extends DocumentHandlingReport<IndexDocumentRequest> {
|
||||||
|
|
||||||
public TemporalReference toSetTemporalReference;
|
// protected List<IdentificationReference> toSetIndexReferences=new ArrayList<>();
|
||||||
public Document toSetSpatialReference;
|
|
||||||
|
|
||||||
|
|
||||||
public IndexDocumentReport(@NonNull IndexDocumentRequest theRequest) throws InvalidPluginRequestException {
|
public IndexDocumentReport(@NonNull IndexDocumentRequest theRequest) throws InvalidPluginRequestException {
|
||||||
super(theRequest);
|
super(theRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public Project prepareResult() throws JsonProcessingException, PluginExecutionException {
|
// public Project prepareResult() throws JsonProcessingException, PluginExecutionException {
|
||||||
Project toReturn= super.prepareResult();
|
// Project toReturn= super.prepareResult();
|
||||||
if(toSetSpatialReference != null) toReturn.setSpatialReference(toSetSpatialReference);
|
// if(toSetSpatialReference != null) toReturn.setSpatialReference(toSetSpatialReference);
|
||||||
if(toSetTemporalReference != null) toReturn.setTemporalReference(toSetTemporalReference);
|
// if(toSetTemporalReference != null) toReturn.setTemporalReference(toSetTemporalReference);
|
||||||
return toReturn;
|
// return toReturn;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,13 +2,11 @@ package org.gcube.application.cms.plugins.reports;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import org.bson.Document;
|
|
||||||
import org.gcube.application.cms.plugins.faults.InvalidPluginRequestException;
|
import org.gcube.application.cms.plugins.faults.InvalidPluginRequestException;
|
||||||
import org.gcube.application.cms.plugins.faults.PluginExecutionException;
|
import org.gcube.application.cms.plugins.faults.PluginExecutionException;
|
||||||
import org.gcube.application.cms.plugins.requests.EventExecutionRequest;
|
import org.gcube.application.cms.plugins.requests.EventExecutionRequest;
|
||||||
import org.gcube.application.cms.plugins.requests.StepExecutionRequest;
|
import org.gcube.application.cms.plugins.requests.StepExecutionRequest;
|
||||||
import org.gcube.application.geoportal.common.model.document.Project;
|
import org.gcube.application.geoportal.common.model.document.Project;
|
||||||
import org.gcube.application.geoportal.common.model.document.temporal.TemporalReference;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -1,15 +1,18 @@
|
||||||
package org.gcube.application.geoportal.common.model.document;
|
package org.gcube.application.geoportal.common.model.document;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.vdurmont.semver4j.Semver;
|
import com.vdurmont.semver4j.Semver;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import org.bson.Document;
|
import org.bson.Document;
|
||||||
import org.gcube.application.geoportal.common.model.document.accounting.PublicationInfo;
|
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.lifecycle.LifecycleInformation;
|
import org.gcube.application.geoportal.common.model.document.lifecycle.LifecycleInformation;
|
||||||
import org.gcube.application.geoportal.common.model.document.temporal.TemporalReference;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
|
@ -26,8 +29,7 @@ public class Project {
|
||||||
public static final String PROFILE_VERSION="_profileVersion";
|
public static final String PROFILE_VERSION="_profileVersion";
|
||||||
public static final String LIFECYCLE_INFORMATION="_lifecycleInformation";
|
public static final String LIFECYCLE_INFORMATION="_lifecycleInformation";
|
||||||
public static final String RELATIONSHIPS="_relationships";
|
public static final String RELATIONSHIPS="_relationships";
|
||||||
public static final String SPATIAL_REFERENCE="_spatialReference";
|
public static final String IDENTIFICATION_REFERENCES="_identificationReferences";
|
||||||
public static final String TEMPORAL_REFERENCE="_temporalReference";
|
|
||||||
public static final String THE_DOCUMENT="_theDocument";
|
public static final String THE_DOCUMENT="_theDocument";
|
||||||
public static final String LOCK="_lock";
|
public static final String LOCK="_lock";
|
||||||
|
|
||||||
|
@ -52,14 +54,10 @@ public class Project {
|
||||||
private LifecycleInformation lifecycleInformation;
|
private LifecycleInformation lifecycleInformation;
|
||||||
|
|
||||||
@JsonProperty(RELATIONSHIPS)
|
@JsonProperty(RELATIONSHIPS)
|
||||||
private Relationship[] relationships;
|
private List<Relationship> relationships;
|
||||||
|
|
||||||
// Expected GEOJSON
|
@JsonProperty(IDENTIFICATION_REFERENCES)
|
||||||
@JsonProperty(SPATIAL_REFERENCE)
|
private List<IdentificationReference> identificationReferences;
|
||||||
private Document spatialReference;
|
|
||||||
|
|
||||||
@JsonProperty(TEMPORAL_REFERENCE)
|
|
||||||
private TemporalReference temporalReference;
|
|
||||||
|
|
||||||
@JsonProperty(THE_DOCUMENT)
|
@JsonProperty(THE_DOCUMENT)
|
||||||
private Document theDocument;
|
private Document theDocument;
|
||||||
|
@ -79,6 +77,15 @@ public class Project {
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
if (!(o instanceof Project)) return false;
|
if (!(o instanceof Project)) return false;
|
||||||
Project project = (Project) o;
|
Project project = (Project) o;
|
||||||
return Objects.equals(getId(), project.getId()) && Objects.equals(getVersion(), project.getVersion()) && Objects.equals(getInfo(), project.getInfo()) && Objects.equals(getProfileID(), project.getProfileID()) && Objects.equals(getProfileVersion(), project.getProfileVersion()) && Objects.equals(getLifecycleInformation(), project.getLifecycleInformation()) && Arrays.equals(getRelationships(), project.getRelationships()) && Objects.equals(getSpatialReference(), project.getSpatialReference()) && Objects.equals(getTemporalReference(), project.getTemporalReference()) && Objects.equals(getTheDocument(), project.getTheDocument());
|
return Objects.equals(getId(), project.getId()) && Objects.equals(getVersion(), project.getVersion()) && Objects.equals(getInfo(), project.getInfo()) && Objects.equals(getProfileID(), project.getProfileID()) && Objects.equals(getProfileVersion(), project.getProfileVersion()) && Objects.equals(getLifecycleInformation(), project.getLifecycleInformation()) && Objects.equals(getIdentificationReferences(), project.getIdentificationReferences()) && Objects.equals(getRelationships(), project.getRelationships()) && Objects.equals(getTheDocument(), project.getTheDocument());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
public List<IdentificationReference> getIdentificationReferenceByType(String type){
|
||||||
|
if(identificationReferences==null) return Collections.emptyList();
|
||||||
|
else return identificationReferences.stream()
|
||||||
|
.filter(item -> item.getType().equals(type)).collect(Collectors.toList());
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,10 +12,13 @@ public class Relationship {
|
||||||
|
|
||||||
public static final String RELATIONSHIP_NAME="_relationshipName";
|
public static final String RELATIONSHIP_NAME="_relationshipName";
|
||||||
public static final String TARGET_ID="_targetID";
|
public static final String TARGET_ID="_targetID";
|
||||||
|
public static final String TARGET_UCD="_targetUCD";
|
||||||
|
|
||||||
@JsonProperty(RELATIONSHIP_NAME)
|
@JsonProperty(RELATIONSHIP_NAME)
|
||||||
private String relationshipName;
|
private String relationshipName;
|
||||||
@JsonProperty(TARGET_ID)
|
@JsonProperty(TARGET_ID)
|
||||||
private String targetID;
|
private String targetID;
|
||||||
|
@JsonProperty(TARGET_ID)
|
||||||
|
private String targetUCD;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
package org.gcube.application.geoportal.common.model.document.identification;
|
||||||
|
|
||||||
|
public class CentroidRecordReference extends IdentificationReference{
|
||||||
|
|
||||||
|
public static final String CENTROID_RECORD_REFERENCE="CENTROID_RECORD_TYPE";
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package org.gcube.application.geoportal.common.model.document.identification;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.bson.Document;
|
||||||
|
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class IdentificationReference extends Document {
|
||||||
|
|
||||||
|
public static final String TYPE="_type";
|
||||||
|
|
||||||
|
public IdentificationReference(String type) {
|
||||||
|
setType(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
public String getType(){return super.getString(TYPE);}
|
||||||
|
@JsonIgnore
|
||||||
|
public void setType(String type){super.put(TYPE,type);}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package org.gcube.application.geoportal.common.model.document.identification;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@NoArgsConstructor
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class SpatialReference extends IdentificationReference{
|
||||||
|
|
||||||
|
public static final String SPATIAL_REFERENCE_TYPE="SPATIAL REFERENCE";
|
||||||
|
public static final String GEO_JSON="geoJSON";
|
||||||
|
|
||||||
|
|
||||||
|
public SpatialReference(Object geoJSON) {
|
||||||
|
setGeoJson(geoJSON);
|
||||||
|
setType(SPATIAL_REFERENCE_TYPE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
public Object getGeoJson(){return super.get(GEO_JSON);}
|
||||||
|
@JsonIgnore
|
||||||
|
public Object setGeoJson(Object geoJSON){return super.put(GEO_JSON,geoJSON);}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package org.gcube.application.geoportal.common.model.document.identification;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import org.bson.Document;
|
||||||
|
|
||||||
|
@ToString (callSuper = true)
|
||||||
|
public class TemporalReference extends IdentificationReference {
|
||||||
|
|
||||||
|
public static final String TEMPORAL_REFERENCE_TYPE="TEMPORAL_REFERENCE_TYPE";
|
||||||
|
}
|
|
@ -1,14 +0,0 @@
|
||||||
package org.gcube.application.geoportal.common.model.document.temporal;
|
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import org.bson.Document;
|
|
||||||
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@ToString
|
|
||||||
public class TemporalReference extends Document {
|
|
||||||
|
|
||||||
private String field;
|
|
||||||
}
|
|
|
@ -3,6 +3,7 @@ package org.gcube.application.geoportal.service.profiledDocuments;
|
||||||
import org.bson.Document;
|
import org.bson.Document;
|
||||||
import org.gcube.application.cms.serialization.Serialization;
|
import org.gcube.application.cms.serialization.Serialization;
|
||||||
import org.gcube.application.geoportal.common.model.document.Project;
|
import org.gcube.application.geoportal.common.model.document.Project;
|
||||||
|
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.lifecycle.LifecycleInformation;
|
||||||
import org.gcube.application.geoportal.common.model.useCaseDescriptor.Field;
|
import org.gcube.application.geoportal.common.model.useCaseDescriptor.Field;
|
||||||
import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest;
|
import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest;
|
||||||
|
@ -67,7 +68,7 @@ public class ProfiledConcessioniTests extends AbstractProfiledDocumentsTests{
|
||||||
doc=step(doc.getId(),approveDraftReq);
|
doc=step(doc.getId(),approveDraftReq);
|
||||||
System.out.println(doc);
|
System.out.println(doc);
|
||||||
assertTrue(doc.getLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK));
|
assertTrue(doc.getLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK));
|
||||||
assertTrue(doc.getSpatialReference()!=null);
|
assertTrue(doc.getIdentificationReferenceByType(SpatialReference.SPATIAL_REFERENCE_TYPE).size()==1);
|
||||||
System.out.println("Project "+doc.getId()+" published with spatial reference "+doc.getSpatialReference().toJson());
|
System.out.println("Project "+doc.getId()+" published with spatial reference "+doc.getIdentificationReferenceByType(SpatialReference.SPATIAL_REFERENCE_TYPE).get(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@ import org.gcube.application.cms.plugins.faults.InitializationException;
|
||||||
import org.gcube.application.cms.plugins.faults.InvalidPluginRequestException;
|
import org.gcube.application.cms.plugins.faults.InvalidPluginRequestException;
|
||||||
import org.gcube.application.cms.plugins.faults.InvalidProfileException;
|
import org.gcube.application.cms.plugins.faults.InvalidProfileException;
|
||||||
import org.gcube.application.cms.plugins.model.ComparableVersion;
|
import org.gcube.application.cms.plugins.model.ComparableVersion;
|
||||||
|
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.plugins.IndexerPluginDescriptor;
|
import org.gcube.application.geoportal.common.model.plugins.IndexerPluginDescriptor;
|
||||||
import org.gcube.application.geoportal.common.model.plugins.PluginDescriptor;
|
import org.gcube.application.geoportal.common.model.plugins.PluginDescriptor;
|
||||||
import org.gcube.application.cms.plugins.reports.IndexDocumentReport;
|
import org.gcube.application.cms.plugins.reports.IndexDocumentReport;
|
||||||
|
@ -121,31 +123,38 @@ public class SDIIndexerPlugin extends SDIAbstractPlugin implements IndexerPlugin
|
||||||
|
|
||||||
// ********************** EVALAUTE POSITION
|
// ********************** EVALAUTE POSITION
|
||||||
log.debug("indexing UseCaseDescriptor {} : Evaluating Centroid... ", useCaseDescriptor.getId());
|
log.debug("indexing UseCaseDescriptor {} : Evaluating Centroid... ", useCaseDescriptor.getId());
|
||||||
if(project.getSpatialReference()!=null){
|
SpatialReference reference =null;
|
||||||
log.debug("Using user defined spatial reference "+ project.getSpatialReference());
|
List<IdentificationReference> refs=project.getIdentificationReferenceByType(SpatialReference.SPATIAL_REFERENCE_TYPE);
|
||||||
|
if(!refs.isEmpty()){
|
||||||
|
|
||||||
GeoJsonObject object = Serialization.convert(project.getSpatialReference(), GeoJsonObject.class);
|
// Use existing Reference
|
||||||
|
|
||||||
GCubeSDILayer.BBOX bbox= GCubeSDILayer.BBOX.fromGeoJSON( object.getBbox());
|
reference = Serialization.convert(refs.get(0), SpatialReference.class);
|
||||||
|
|
||||||
log.info("Found declared BBOX {} ",bbox);
|
log.debug("Using user defined spatial reference " + reference);
|
||||||
Double pointX=(bbox.getMaxX()-bbox.getMinX());
|
|
||||||
Double pointY = bbox.getMaxY()-bbox.getMinY();
|
GeoJsonObject object = Serialization.convert(reference.getGeoJson(), GeoJsonObject.class);
|
||||||
String wkt = String .format("POINT (%1$f %2$f) ",
|
|
||||||
|
GCubeSDILayer.BBOX bbox = GCubeSDILayer.BBOX.fromGeoJSON(object.getBbox());
|
||||||
|
|
||||||
|
log.info("Found declared BBOX {} ", bbox);
|
||||||
|
Double pointX = (bbox.getMaxX() - bbox.getMinX());
|
||||||
|
Double pointY = bbox.getMaxY() - bbox.getMinY();
|
||||||
|
String wkt = String.format("POINT (%1$f %2$f) ",
|
||||||
pointX, pointY);
|
pointX, pointY);
|
||||||
|
|
||||||
|
|
||||||
centroidDoc.put("geom",wkt);
|
centroidDoc.put("geom", wkt);
|
||||||
|
|
||||||
|
|
||||||
throw new Exception("Not yet implemented");
|
throw new Exception("Not yet implemented");
|
||||||
}else {
|
} else{
|
||||||
|
// unable to use current Spatial reference, try evaluating it
|
||||||
log.debug("UseCaseDescriptor {} : Getting evaluation paths from useCaseDescriptor.. ", useCaseDescriptor.getId());
|
log.debug("UseCaseDescriptor {} : Getting evaluation paths from useCaseDescriptor.. ", useCaseDescriptor.getId());
|
||||||
List bboxEvaluationPaths = profileConfiguration.get("bboxEvaluation",List.class);
|
List bboxEvaluationPaths = profileConfiguration.get("bboxEvaluation",List.class);
|
||||||
if(bboxEvaluationPaths==null || bboxEvaluationPaths.isEmpty())
|
if(bboxEvaluationPaths==null || bboxEvaluationPaths.isEmpty())
|
||||||
throw new Exception("Missing configuration bboxEvaluation");
|
throw new Exception("Missing configuration bboxEvaluation");
|
||||||
|
|
||||||
GCubeSDILayer.BBOX toSet = null;
|
GCubeSDILayer.BBOX toSet = null;
|
||||||
for(Object pathObj : bboxEvaluationPaths){
|
for(Object pathObj : bboxEvaluationPaths){
|
||||||
log.debug("UseCaseDescriptor {} : Evaluating path {} ", useCaseDescriptor.getId(),pathObj);
|
log.debug("UseCaseDescriptor {} : Evaluating path {} ", useCaseDescriptor.getId(),pathObj);
|
||||||
List<Object> bboxObjects = documentNavigator.getByPath(pathObj.toString());
|
List<Object> bboxObjects = documentNavigator.getByPath(pathObj.toString());
|
||||||
|
@ -153,7 +162,7 @@ public class SDIIndexerPlugin extends SDIAbstractPlugin implements IndexerPlugin
|
||||||
for(Object bboxObject : bboxObjects) {
|
for(Object bboxObject : bboxObjects) {
|
||||||
log.info("Matched path {}, value is {} ",pathObj.toString(),bboxObject);
|
log.info("Matched path {}, value is {} ",pathObj.toString(),bboxObject);
|
||||||
GCubeSDILayer.BBOX box = Serialization.convert(bboxObject, GCubeSDILayer.BBOX.class);
|
GCubeSDILayer.BBOX box = Serialization.convert(bboxObject, GCubeSDILayer.BBOX.class);
|
||||||
|
|
||||||
if(toSet == null) toSet = box;
|
if(toSet == null) toSet = box;
|
||||||
if(box.getMaxX()>toSet.getMaxX()) toSet.setMaxX(box.getMaxX());
|
if(box.getMaxX()>toSet.getMaxX()) toSet.setMaxX(box.getMaxX());
|
||||||
if(box.getMaxY()>toSet.getMaxY()) toSet.setMaxY(box.getMaxY());
|
if(box.getMaxY()>toSet.getMaxY()) toSet.setMaxY(box.getMaxY());
|
||||||
|
@ -166,7 +175,6 @@ public class SDIIndexerPlugin extends SDIAbstractPlugin implements IndexerPlugin
|
||||||
if(toSet == null)
|
if(toSet == null)
|
||||||
throw new IndexingException("No BBOX has been found on paths : "+bboxEvaluationPaths);
|
throw new IndexingException("No BBOX has been found on paths : "+bboxEvaluationPaths);
|
||||||
|
|
||||||
|
|
||||||
Double pointX=(toSet.getMaxX()-toSet.getMinX());
|
Double pointX=(toSet.getMaxX()-toSet.getMinX());
|
||||||
Double pointY = toSet.getMaxY()-toSet.getMinY();
|
Double pointY = toSet.getMaxY()-toSet.getMinY();
|
||||||
log.info("Evaluated BBOX {} ",toSet);
|
log.info("Evaluated BBOX {} ",toSet);
|
||||||
|
@ -176,14 +184,15 @@ public class SDIIndexerPlugin extends SDIAbstractPlugin implements IndexerPlugin
|
||||||
|
|
||||||
centroidDoc.put("geom",wkt);
|
centroidDoc.put("geom",wkt);
|
||||||
|
|
||||||
Point toSetSpatialReference = new Point();
|
Point toSetgeoJSON = new Point();
|
||||||
LngLatAlt pointCoordinates = new LngLatAlt();
|
LngLatAlt pointCoordinates = new LngLatAlt();
|
||||||
pointCoordinates.setLongitude(pointX);
|
pointCoordinates.setLongitude(pointX);
|
||||||
pointCoordinates.setLatitude(pointY);
|
pointCoordinates.setLatitude(pointY);
|
||||||
toSetSpatialReference.setCoordinates(pointCoordinates);
|
toSetgeoJSON.setCoordinates(pointCoordinates);
|
||||||
|
toSetgeoJSON.setBbox(toSet.asGeoJSONArray());
|
||||||
|
reference = new SpatialReference(toSetgeoJSON);
|
||||||
|
|
||||||
toSetSpatialReference.setBbox(toSet.asGeoJSONArray());
|
report.addIdentificationReference(reference);
|
||||||
report.setToSetSpatialReference(Serialization.asDocument(toSetSpatialReference));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -288,7 +297,7 @@ public class SDIIndexerPlugin extends SDIAbstractPlugin implements IndexerPlugin
|
||||||
fields.add(new PostgisTable.Field(m.getName(), PostgisTable.FieldType.valueOf(m.getType())));
|
fields.add(new PostgisTable.Field(m.getName(), PostgisTable.FieldType.valueOf(m.getType())));
|
||||||
});
|
});
|
||||||
|
|
||||||
return fields;
|
return fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ import org.gcube.application.geoportal.common.model.document.Project;
|
||||||
import org.gcube.application.geoportal.common.model.document.filesets.sdi.GCubeSDILayer;
|
import org.gcube.application.geoportal.common.model.document.filesets.sdi.GCubeSDILayer;
|
||||||
import org.gcube.application.geoportal.common.model.document.filesets.Materialization;
|
import org.gcube.application.geoportal.common.model.document.filesets.Materialization;
|
||||||
import org.gcube.application.geoportal.common.model.document.filesets.sdi.GeoServerPlatform;
|
import org.gcube.application.geoportal.common.model.document.filesets.sdi.GeoServerPlatform;
|
||||||
|
import org.gcube.application.geoportal.common.model.document.identification.SpatialReference;
|
||||||
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
|
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
|
||||||
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
|
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
|
||||||
import org.gcube.application.geoportal.common.utils.Files;
|
import org.gcube.application.geoportal.common.utils.Files;
|
||||||
|
@ -50,7 +51,7 @@ public class IndexerTest extends BasicPluginTest {
|
||||||
System.out.println("Response is "+Serialization.write(response));
|
System.out.println("Response is "+Serialization.write(response));
|
||||||
|
|
||||||
assertTrue(response.getStatus().equals(Report.Status.OK));
|
assertTrue(response.getStatus().equals(Report.Status.OK));
|
||||||
assertTrue(response.prepareResult().getSpatialReference()!=null);
|
assertTrue(response.prepareResult().getIdentificationReferenceByType(SpatialReference.SPATIAL_REFERENCE_TYPE).size()==1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
{
|
||||||
|
"_id" : "MOSI",
|
||||||
|
"_version" : "1.0.0",
|
||||||
|
"_name" : "GNA : MOSI",
|
||||||
|
|
||||||
|
"_description" : "Modulistica siti",
|
||||||
|
"_creationInfo": {
|
||||||
|
"_user" : {
|
||||||
|
"_username": "fabio.sinibaldi"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"_schema" :{ "title" : {"_min" : 1},
|
||||||
|
"section" : { "_max" : 1, "_min" : 1,
|
||||||
|
"_children" : [
|
||||||
|
{"fileset" :{"_type" : "RegisteredFileSet", "_min": 1}},
|
||||||
|
{"title" : {"_min" : 1}}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"_dataAccessPolicies" : [
|
||||||
|
{"_policy" : {"_read" : "own", "_write" : "own"}, "_roles":[]},
|
||||||
|
{"_policy" : {"_read" : "any", "_write" : "none"}, "_roles":["Guest"],
|
||||||
|
"_enforcer": {"_filter" : "{\"_lifecycleInformation._phase\" : {\"$eq\" : \"PUBLISHED\"}}"}},
|
||||||
|
{"_policy" : {"_read" : "any", "_write" : "none"}, "_roles":["Editor"]},
|
||||||
|
{"_policy" : {"_read" : "any", "_write" : "any"}, "_roles":["Admin"]}
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
"_handlers" : [
|
||||||
|
{
|
||||||
|
"_id" : "DEFAULT-SINGLE-STEP",
|
||||||
|
"_type" : "LifecycleManagement",
|
||||||
|
"_configuration" : {
|
||||||
|
"step_access" : [
|
||||||
|
{"STEP" : "PUBLISH", "roles" :[]}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in New Issue