archeologicalResourceType.id mapped
This commit is contained in:
parent
e689623994
commit
364d25f2b7
|
@ -3,32 +3,26 @@ package eu.dnetlib.ariadneplus.elasticsearch.model;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class ArchaeologicalResourceType {
|
public class ArchaeologicalResourceType {
|
||||||
private long id = 100000;
|
private long id = -1;
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
public ArchaeologicalResourceType() {
|
private transient HashMap<String, Long> type =new HashMap<>();
|
||||||
}
|
|
||||||
|
|
||||||
// public static ArchaeologicalResourceType fromRDFJson(JsonElement json) {
|
public ArchaeologicalResourceType() {
|
||||||
// ArchaeologicalResourceType art = new ArchaeologicalResourceType();
|
type.put("Scientific analysis", new Long(10));
|
||||||
// for (Map.Entry<String, JsonElement> entry : json.getAsJsonObject().entrySet()){
|
type.put("Fieldwork", new Long(11));
|
||||||
// switch (entry.getKey()){
|
type.put("Fieldwork report", new Long(12));
|
||||||
// case "https://www.ariadne-infrastructure.eu/property/id" :
|
type.put("Scientific analysis", new Long(13));
|
||||||
// art.setId(entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
type.put("Date", new Long(14));
|
||||||
// break;
|
type.put("Artefact", new Long(15));
|
||||||
// case "https://www.ariadne-infrastructure.eu/property/name":
|
type.put("Fieldwork archive", new Long(16));
|
||||||
// String tmp = entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString();
|
type.put("Inscription", new Long(17));
|
||||||
// art.setName(tmp);
|
type.put("Burial", new Long(18));
|
||||||
// break;
|
}
|
||||||
//
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return art;
|
|
||||||
// }
|
|
||||||
|
|
||||||
public long getId() {
|
public long getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -44,6 +38,15 @@ public class ArchaeologicalResourceType {
|
||||||
|
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
if (this.name==null) {
|
||||||
|
setId(-1);
|
||||||
|
}
|
||||||
|
if (type.containsKey(this.name)) {
|
||||||
|
setId(type.get(name).longValue());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
setId(-2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArchaeologicalResourceType fromJson(String json){
|
public static ArchaeologicalResourceType fromJson(String json){
|
||||||
|
|
Loading…
Reference in New Issue