Skip to content

Commit

Permalink
Index / Add model.
Browse files Browse the repository at this point in the history
  • Loading branch information
fxprunayre committed Jul 3, 2024
1 parent 613ec3d commit 4df3738
Show file tree
Hide file tree
Showing 43 changed files with 8,722 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* (c) 2003 Open Source Geospatial Foundation - all rights reserved
* This code is licensed under the GPL 2.0 license,
* available at the root application directory.
*/


package org.geonetwork.index.model.record;

import lombok.*;

import java.util.List;

@Data
@Builder
@AllArgsConstructor
@RequiredArgsConstructor
public class AttributeTable {
String name;
String definition;
String code;
String link;
String type;
String cardinality;
@Singular
List<CodeListValue> values;
}
23 changes: 23 additions & 0 deletions src/main/java/org/geonetwork/index/model/record/CodeListValue.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* (c) 2003 Open Source Geospatial Foundation - all rights reserved
* This code is licensed under the GPL 2.0 license,
* available at the root application directory.
*/


package org.geonetwork.index.model.record;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.RequiredArgsConstructor;

@Data
@Builder
@AllArgsConstructor
@RequiredArgsConstructor
public class CodeListValue {
String label;
String definition;
String code;
}
29 changes: 29 additions & 0 deletions src/main/java/org/geonetwork/index/model/record/Codelist.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* (c) 2003 Open Source Geospatial Foundation - all rights reserved
* This code is licensed under the GPL 2.0 license,
* available at the root application directory.
*/


package org.geonetwork.index.model.record;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.*;

import java.util.Map;

@Data
@Builder
@AllArgsConstructor
@RequiredArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class Codelist {
@JsonAnySetter
@JsonAnyGetter
@JsonIgnore
@Singular
Map<String, String> properties;
}
37 changes: 37 additions & 0 deletions src/main/java/org/geonetwork/index/model/record/Contact.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* (c) 2003 Open Source Geospatial Foundation - all rights reserved
* This code is licensed under the GPL 2.0 license,
* available at the root application directory.
*/


package org.geonetwork.index.model.record;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.util.HashMap;
import java.util.Map;

import static org.geonetwork.index.model.record.IndexRecordFieldNames.ORGANISATION_NAME;


@Data
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class Contact {

private String role;
private String individual;

@JsonProperty(ORGANISATION_NAME)
private Map<String, String> organisation = new HashMap<>();
private String email;
private String logo;
private String phone;
private String address;
private String website;
private String position;
}
18 changes: 18 additions & 0 deletions src/main/java/org/geonetwork/index/model/record/CrsDetails.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* (c) 2003 Open Source Geospatial Foundation - all rights reserved
* This code is licensed under the GPL 2.0 license,
* available at the root application directory.
*/


package org.geonetwork.index.model.record;

import lombok.Data;

@Data
public class CrsDetails {
private String code;
private String codeSpace;
private String name;
private String url;
}
17 changes: 17 additions & 0 deletions src/main/java/org/geonetwork/index/model/record/DateRange.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* (c) 2003 Open Source Geospatial Foundation - all rights reserved
* This code is licensed under the GPL 2.0 license,
* available at the root application directory.
*/


package org.geonetwork.index.model.record;

import lombok.Data;

@Data
public class DateRange {

private String gte;
private String lte;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* (c) 2003 Open Source Geospatial Foundation - all rights reserved
* This code is licensed under the GPL 2.0 license,
* available at the root application directory.
*/


package org.geonetwork.index.model.record;

import lombok.Data;

@Data
public class DateRangeDetails {

private DateRangeDetailsInfo start;
private DateRangeDetailsInfo end;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* (c) 2003 Open Source Geospatial Foundation - all rights reserved
* This code is licensed under the GPL 2.0 license,
* available at the root application directory.
*/


package org.geonetwork.index.model.record;

import lombok.Data;

@Data
public class DateRangeDetailsInfo {
String date;
String frame;
String calendarEraName;
String indeterminatePosition;
}
26 changes: 26 additions & 0 deletions src/main/java/org/geonetwork/index/model/record/FeatureType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* (c) 2003 Open Source Geospatial Foundation - all rights reserved
* This code is licensed under the GPL 2.0 license,
* available at the root application directory.
*/


package org.geonetwork.index.model.record;

import lombok.*;

import java.util.List;

@Data
@Builder
@AllArgsConstructor
@RequiredArgsConstructor
public class FeatureType {
String typeName;
String definition;
String code;
String isAbstract;
String aliases;
@Singular("attributeTable")
List<AttributeTable> attributeTable;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* (c) 2003 Open Source Geospatial Foundation - all rights reserved
* This code is licensed under the GPL 2.0 license,
* available at the root application directory.
*/
package org.geonetwork.index.model.record;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Map;

public class HashMapSerializer extends JsonSerializer<Map<String, ArrayList<Object>>> {
@Override
public void serialize(Map<String, ArrayList<Object>> map, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
map.keySet().forEach(key -> {
try {
jsonGenerator.writeFieldName(key);
jsonGenerator.writeStartArray();
map.get(key).forEach(value -> {
try {
jsonGenerator.writeObject(value);
} catch (IOException e) {
e.printStackTrace();
}
});
jsonGenerator.writeEndArray();
} catch (IOException e) {
e.printStackTrace();
}
});
}
}
27 changes: 27 additions & 0 deletions src/main/java/org/geonetwork/index/model/record/Index.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* (c) 2003 Open Source Geospatial Foundation - all rights reserved
* This code is licensed under the GPL 2.0 license,
* available at the root application directory.
*/


package org.geonetwork.index.model.record;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.nio.file.Path;

@Getter
@Setter
@ToString
public class Index {

private String name;
private IndexType type;

Path getConfigFile() {
return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* (c) 2003 Open Source Geospatial Foundation - all rights reserved
* This code is licensed under the GPL 2.0 license,
* available at the root application directory.
*/


package org.geonetwork.index.model.record;

public enum IndexDocumentType {
metadata, features
}
Loading

0 comments on commit 4df3738

Please sign in to comment.