Support to Display Flag and CQL
This commit is contained in:
parent
0efb397af9
commit
40597d5769
|
@ -15,6 +15,11 @@ public class DBConstants {
|
|||
public static final String DEFAULT_GEOMETRY_COLUMN_NAME="geom";
|
||||
public static final String INTERNAL_ID="internal_id";
|
||||
|
||||
public static final String PROJECT_ID="projectid";
|
||||
|
||||
public static final String DISPLAYED="displayed_project";
|
||||
|
||||
|
||||
public static final String XCOORD_FIELD="xcoord";
|
||||
public static final String YCOORD_FIELD="ycoord";
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import org.gcube.application.geoportal.common.model.legacy.BBOX;
|
|||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.HashMap;
|
||||
|
@ -53,8 +54,9 @@ public class PostgisTable {
|
|||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum FieldType{
|
||||
public enum FieldType{
|
||||
INT("int",java.sql.Types.INTEGER),
|
||||
BOOLEAN("boolean", java.sql.Types.BOOLEAN),
|
||||
TEXT("text",java.sql.Types.LONGVARCHAR),
|
||||
FLOAT("float",java.sql.Types.FLOAT),
|
||||
GEOMETRY("",0),
|
||||
|
|
|
@ -5,6 +5,7 @@ import it.geosolutions.geoserver.rest.GeoServerRESTReader;
|
|||
import it.geosolutions.geoserver.rest.decoder.RESTFeatureType;
|
||||
import it.geosolutions.geoserver.rest.decoder.RESTLayer;
|
||||
import it.geosolutions.geoserver.rest.encoder.GSLayerEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.feature.GSAttributeEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.feature.GSFeatureTypeEncoder;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.bson.Document;
|
||||
|
@ -277,7 +278,11 @@ public class SDIManagerWrapper extends SDIManager{
|
|||
|
||||
}
|
||||
|
||||
private static class CQL_GS_Feature extends GSFeatureTypeEncoder{
|
||||
private static final String CQL = "CQL";
|
||||
public void setCQL(String cql){this.set(CQL,cql);}
|
||||
|
||||
}
|
||||
|
||||
public GCubeSDILayer configureCentroidLayer(String name, String workspace, String storeName, PostgisTable table, DatabaseConnection connection) throws SDIInteractionException {
|
||||
|
||||
|
@ -287,12 +292,15 @@ public class SDIManagerWrapper extends SDIManager{
|
|||
.setHost(getGeoserverHostName())
|
||||
.setLayerName(name);
|
||||
|
||||
GSFeatureTypeEncoder fte=new GSFeatureTypeEncoder();
|
||||
CQL_GS_Feature fte=new CQL_GS_Feature();
|
||||
fte.setAbstract("Centroid layer for "+name);
|
||||
fte.setEnabled(true);
|
||||
fte.setNativeCRS(WGS84_FULL);
|
||||
fte.setTitle(name);
|
||||
fte.setName(name);
|
||||
fte.setCQL(DBConstants.Defaults.DISPLAYED+" = true");
|
||||
|
||||
|
||||
|
||||
fte.setLatLonBoundingBox(-180.0, -90.0, 180.0, 90.0, WGS84_FULL);
|
||||
|
||||
|
@ -302,6 +310,8 @@ public class SDIManagerWrapper extends SDIManager{
|
|||
layerEncoder.setDefaultStyle(style);
|
||||
layerEncoder.setEnabled(true);
|
||||
layerEncoder.setQueryable(true);
|
||||
|
||||
|
||||
try {
|
||||
//Checking workspace
|
||||
createWorkspace(workspace);
|
||||
|
|
|
@ -14,6 +14,7 @@ import org.gcube.application.cms.plugins.reports.InitializationReport;
|
|||
import org.gcube.application.cms.plugins.reports.Report;
|
||||
import org.gcube.application.cms.plugins.requests.BaseRequest;
|
||||
import org.gcube.application.cms.plugins.requests.IndexDocumentRequest;
|
||||
import org.gcube.application.cms.sdi.engine.DBConstants;
|
||||
import org.gcube.application.cms.sdi.engine.PostgisIndexer;
|
||||
import org.gcube.application.cms.sdi.engine.PostgisTable;
|
||||
import org.gcube.application.cms.sdi.engine.bboxes.BBOXByCoordinatePaths;
|
||||
|
@ -121,7 +122,6 @@ public class SDIIndexerPlugin extends SDIAbstractPlugin implements IndexerPlugin
|
|||
log.debug("UseCaseDescriptor Configuration is {} ",profileConfiguration);
|
||||
|
||||
|
||||
|
||||
// ************* PREPARE RECORD
|
||||
|
||||
|
||||
|
@ -131,7 +131,10 @@ public class SDIIndexerPlugin extends SDIAbstractPlugin implements IndexerPlugin
|
|||
if(requestArguments.containsKey("centroidRecord"))
|
||||
centroidDoc.putAll(requestArguments.get("centroidRecords",Document.class));
|
||||
// DEFAULT VALUES
|
||||
centroidDoc.put("projectid", project.getId());
|
||||
centroidDoc.put(DBConstants.Defaults.PROJECT_ID, project.getId());
|
||||
centroidDoc.put(DBConstants.Defaults.DISPLAYED,true);
|
||||
|
||||
|
||||
|
||||
// ********************** EVALAUTE POSITION
|
||||
log.debug("indexing UseCaseDescriptor {} : Evaluating Centroid... ", useCaseDescriptor.getId());
|
||||
|
@ -232,6 +235,13 @@ public class SDIIndexerPlugin extends SDIAbstractPlugin implements IndexerPlugin
|
|||
log.info("Inserting Centroid {} into {} ",centroidDoc.toJson(),indexer);
|
||||
indexer.insert(centroidDoc);
|
||||
|
||||
|
||||
|
||||
//
|
||||
|
||||
|
||||
|
||||
|
||||
report.setStatus(Report.Status.OK);
|
||||
}catch (SDIInteractionException e){
|
||||
log.error("Unable to index "+request,e);
|
||||
|
@ -302,8 +312,10 @@ public class SDIIndexerPlugin extends SDIAbstractPlugin implements IndexerPlugin
|
|||
|
||||
|
||||
private static class Fields{
|
||||
public static final PostgisTable.Field PROJECT_ID= new PostgisTable.Field("projectid", PostgisTable.FieldType.TEXT);
|
||||
public static final PostgisTable.Field GEOM= new PostgisTable.Field("geom", PostgisTable.FieldType.GEOMETRY);
|
||||
public static final PostgisTable.Field PROJECT_ID= new PostgisTable.Field(DBConstants.Defaults.PROJECT_ID, PostgisTable.FieldType.TEXT);
|
||||
public static final PostgisTable.Field GEOM= new PostgisTable.Field(DBConstants.Defaults.DEFAULT_GEOMETRY_COLUMN_NAME, PostgisTable.FieldType.GEOMETRY);
|
||||
|
||||
public static final PostgisTable.Field DISPLAY=new PostgisTable.Field(DBConstants.Defaults.DISPLAYED,PostgisTable.FieldType.BOOLEAN);
|
||||
|
||||
}
|
||||
|
||||
|
@ -312,6 +324,8 @@ public class SDIIndexerPlugin extends SDIAbstractPlugin implements IndexerPlugin
|
|||
List<PostgisTable.Field> fields = new ArrayList<>(); // TODO From UseCaseDescriptor
|
||||
fields.add(Fields.GEOM);
|
||||
fields.add(Fields.PROJECT_ID);
|
||||
fields.add(Fields.DISPLAY);
|
||||
|
||||
|
||||
mappings.forEach(m -> {
|
||||
fields.add(new PostgisTable.Field(m.getName(), PostgisTable.FieldType.valueOf(m.getType())));
|
||||
|
|
Loading…
Reference in New Issue