Internal Field Reserved Keywords

This commit is contained in:
Fabio Sinibaldi 2022-02-18 18:12:02 +01:00
parent be0c16aa7e
commit b675a0b208
13 changed files with 75 additions and 57 deletions

View File

@ -16,15 +16,15 @@ import org.gcube.application.geoportal.common.model.document.lifecycle.Lifecycle
public class ProfiledDocument { public class ProfiledDocument {
public static final String ID="_id"; public static final String ID="_id";
public static final String VERSION="version"; public static final String VERSION="_version";
public static final String INFO="info"; public static final String INFO="_info";
public static final String PROFILE_ID="profileID"; public static final String PROFILE_ID="_profileID";
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 SPATIAL_REFERENCE="_spatialReference";
public static final String TEMPORAL_REFERENCE="temporalReference"; public static final String TEMPORAL_REFERENCE="_temporalReference";
public static final String THE_DOCUMENT="theDocument"; public static final String THE_DOCUMENT="_theDocument";
// CORE METADATA // CORE METADATA

View File

@ -9,8 +9,8 @@ import lombok.*;
@ToString @ToString
public class Relationship { 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";
private String relationshipName; private String relationshipName;
private String targetID; private String targetID;

View File

@ -9,8 +9,8 @@ import lombok.*;
@ToString @ToString
public class Access { public class Access {
public static final String POLICY="policy"; public static final String POLICY="_policy";
public static final String LICENSE="license"; public static final String LICENSE="_license";
private AccessPolicy policy; private AccessPolicy policy;
private String license; private String license;

View File

@ -11,9 +11,9 @@ import java.time.LocalDateTime;
@ToString @ToString
public class AccountingInfo { public class AccountingInfo {
public static final String USER="user"; public static final String USER="_user";
public static final String CONTEXT="context"; public static final String CONTEXT="_context";
public static final String INSTANT="instant"; public static final String INSTANT="_instant";
private User user; private User user;
private Context context; private Context context;

View File

@ -8,8 +8,8 @@ import lombok.*;
@Setter @Setter
@ToString @ToString
public class Context { public class Context {
public static final String ID="id"; public static final String ID="_id";
public static final String NAME = "name"; public static final String NAME = "_name";
private String id; private String id;

View File

@ -10,9 +10,9 @@ import org.gcube.application.geoportal.common.model.document.access.Access;
@ToString @ToString
public class PublicationInfo { public class PublicationInfo {
public static final String CREATION_INFO="creationInfo"; public static final String CREATION_INFO="_creationInfo";
public static final String LAST_EDIT_INFO="lastEditInfo"; public static final String LAST_EDIT_INFO="_lastEditInfo";
public static final String ACCESS = "access"; public static final String ACCESS = "_access";
private AccountingInfo creationInfo; private AccountingInfo creationInfo;
private AccountingInfo lastEditInfo; private AccountingInfo lastEditInfo;

View File

@ -9,7 +9,7 @@ import lombok.*;
@ToString @ToString
public class User { public class User {
public static final String USERNAME="username"; public static final String USERNAME="_username";
private String username; private String username;

View File

@ -2,6 +2,7 @@ package org.gcube.application.geoportal.common.model.document.filesets;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.bson.Document;
import java.util.List; import java.util.List;
@ -9,7 +10,7 @@ public class GCubeSDILayer extends Materialization{
@Data @Data
@NoArgsConstructor @NoArgsConstructor
public static class BBOX { public static class BBOX extends Document {
public static final BBOX WORLD=new BBOX(180d,90d,-180d,-90d); public static final BBOX WORLD=new BBOX(180d,90d,-180d,-90d);
@ -19,23 +20,28 @@ public class GCubeSDILayer extends Materialization{
public static final String MIN_Y="minY"; public static final String MIN_Y="minY";
public BBOX(Double maxX,Double maxY,Double minX,Double minY){ public BBOX(Double maxX,Double maxY,Double minX,Double minY){
this.maxX=maxX; setMaxX(maxX);
this.minX=minX; setMinX(minX);
this.maxY=maxY; setMaxY(maxY);
this.minY=minY; setMinY(minY);
} }
private Double maxY; public void setMaxX(Double d){this.put(MAX_X,d);}
private Double maxX; public void setMaxY(Double d){this.put(MAX_Y,d);}
private Double minY; public void setMinX(Double d){this.put(MIN_X,d);}
private Double minX; public void setMinY(Double d){this.put(MIN_Y,d);}
public Double getMinY(){return (Double) this.getOrDefault(MIN_Y,-90d);}
public Double getMaxY(){return (Double) this.getOrDefault(MAX_Y,90d);}
public Double getMinX(){return (Double) this.getOrDefault(MIN_X,-180d);}
public Double getMaxX(){return (Double) this.getOrDefault(MAX_X,180d);}
} }
public static final String GCUBE_SDY_LAYER_TYPE="gcube-sdi-layer"; public static final String GCUBE_SDY_LAYER_TYPE="gcube-sdi-layer";
public static final String OGC_LINKS="ogcLinks"; public static final String OGC_LINKS="_ogcLinks";
public static final String B_BOX = "bbox"; public static final String B_BOX = "_bbox";
public static final String PLATFORM_INFO="platformInfo"; public static final String PLATFORM_INFO="_platformInfo";
public GCubeSDILayer(){ public GCubeSDILayer(){
super(GCUBE_SDY_LAYER_TYPE); super(GCUBE_SDY_LAYER_TYPE);

View File

@ -5,10 +5,10 @@ import lombok.*;
@Data @Data
public class RegisteredFile { public class RegisteredFile {
public static String MIMETYPE="mimetype"; public static String MIMETYPE="_mimetype";
public static String STORAGE_ID="storageID"; public static String STORAGE_ID="_storageID";
public static String LINK="link"; public static String LINK="_link";
public static String NAME="NAME"; public static String NAME="_name";
private String mimetype; private String mimetype;
private String storageID; private String storageID;

View File

@ -11,12 +11,12 @@ public class RegisteredFileSet extends Document {
public static final String UUID="uuid"; public static final String UUID="_uuid";
public static final String CREATION_INFO="creationInfo"; public static final String CREATION_INFO="_creationInfo";
public static final String ACCESS="access"; public static final String ACCESS="_access";
public static final String FOLDER_ID="folderID"; public static final String FOLDER_ID="_folderID";
public static final String PAYLOADS="payloads"; public static final String PAYLOADS="_payloads";
public static final String MATERIALIZATIONS="materializations"; public static final String MATERIALIZATIONS="_materializations";
public Object getCreationInfo(){ return this.get(CREATION_INFO); } public Object getCreationInfo(){ return this.get(CREATION_INFO); }

View File

@ -10,12 +10,14 @@ public class LifecycleInformation {
public static final String DRAFT_PHASE="DRAFT"; public static final String DRAFT_PHASE="DRAFT";
public static final String PHASE="phase"; public static final String PUBLISHED_PHASE="PUBLISHED";
public static final String LAST_INVOKED_STEP="lastInvokedStep";
public static final String LAST_OPERATION_STATUS="lastOperationStatus"; public static final String PHASE="_phase";
public static final String ERROR_MESSAGES="errorMessages"; public static final String LAST_INVOKED_STEP="_lastInvokedStep";
public static final String WARNING_MESSAGES="warningMessages"; public static final String LAST_OPERATION_STATUS="_lastOperationStatus";
public static final String TRIGGERED_EVENTS="triggeredEvents"; public static final String ERROR_MESSAGES="_errorMessages";
public static final String WARNING_MESSAGES="_warningMessages";
public static final String TRIGGERED_EVENTS="_triggeredEvents";
public static enum Status{ public static enum Status{
OK,ERROR,WARNING OK,ERROR,WARNING

View File

@ -8,12 +8,12 @@ import java.util.List;
@Data @Data
public class TriggeredEvents { public class TriggeredEvents {
public static final String PHASE="phase"; public static final String PHASE="_phase";
public static final String LAST_INVOKED_STEP="lastInvokedStep"; public static final String LAST_INVOKED_STEP="_lastInvokedStep";
public static final String LAST_OPERATION_STATUS="lastOperationStatus"; public static final String LAST_OPERATION_STATUS="_lastOperationStatus";
public static final String ERROR_MESSAGES="errorMessages"; public static final String ERROR_MESSAGES="_errorMessages";
public static final String WARNING_MESSAGES="warningMessages"; public static final String WARNING_MESSAGES="_warningMessages";
public static final String TRIGGERED_EVENTS="triggeredEvents"; public static final String TRIGGERED_EVENTS="_triggeredEvents";
private String event; private String event;
private LifecycleInformation.Status lastOperationStatus; private LifecycleInformation.Status lastOperationStatus;

View File

@ -11,6 +11,8 @@ import com.jayway.jsonpath.spi.mapper.MappingProvider;
import org.bson.Document; import org.bson.Document;
import org.gcube.application.geoportal.common.JSONSerializationProvider; import org.gcube.application.geoportal.common.JSONSerializationProvider;
import org.gcube.application.geoportal.common.model.document.ProfiledDocument; import org.gcube.application.geoportal.common.model.document.ProfiledDocument;
import org.gcube.application.geoportal.common.model.document.filesets.Materialization;
import org.gcube.application.geoportal.common.model.document.filesets.RegisteredFileSet;
import org.gcube.application.geoportal.common.model.document.lifecycle.TriggeredEvents; import org.gcube.application.geoportal.common.model.document.lifecycle.TriggeredEvents;
import org.gcube.application.geoportal.common.utils.Files; import org.gcube.application.geoportal.common.utils.Files;
import org.junit.Test; import org.junit.Test;
@ -42,8 +44,16 @@ public class JSONPathTests {
@Test @Test
public void readElements() throws IOException { public void readElements() throws IOException {
JSONPathWrapper documentNavigator=getNavigator("profiledConcessioneExample.json"); JSONPathWrapper documentNavigator=getNavigator("profiledConcessioniExample.json");
// TODO REVERVED KEYS
System.out.println("All Registered FileNames"+ documentNavigator.getByPath("$..fileset.payloads[*].name"));
System.out.println(documentNavigator.getByPath("$..fileset."+ RegisteredFileSet.MATERIALIZATIONS));
// WMS
System.out.println(documentNavigator.getByPath("$..wms"));
} }