AriadnePlus/dnet-ariadneplus-graphdb-pu.../src/main/java/eu/dnetlib/ariadneplus/elasticsearch/model/AriadneCatalogEntry.java

460 lines
15 KiB
Java

package eu.dnetlib.ariadneplus.elasticsearch.model;
import com.google.gson.Gson;
import eu.dnetlib.ariadneplus.reader.utils.ESUtils;
import java.util.List;
public class AriadneCatalogEntry {
private List<AatSubject> aatSubjects;
private String accessPolicy;
private String accessRights;
private ArcheologicalResourceType archeologicalResourceType;
private String contactPoint;
private List<AgentInfo> contributor;
private List<AgentInfo> creator;
private List<DerivedSubject> derivedSubject;
private String description;
private List <Distribution> distribution;
private List<AgentInfo> publisher;
private String title;
private String extent;
private List<ItemMetadataStructure> hasItemMetadataStructure;
private List<MetadataRecord> hasMetadataRecord;
private String identifier;
private String isPartOf;
private String issued;
private List<String> keyword;
private String landingPage;
private String language;
private List<AgentInfo> legalResponsible;
private String modified;
private List<NativeSubject> nativeSubject;
private String originalId;
private List<AgentInfo> owner;
private String packageId;
private String placeName;
private String postcode;
private String providerId;
private String rdfAbout;
private String resourceType;
private String rights;
private List<AgentInfo> scientificResponsible;
private List<Spatial> spatial;
// private List<SpatialRegion> spatialRegion;
// private List<SpatialRegionPoint> spatialRegionPoint;
private List<AgentInfo> technicalResponsible;
private List<AriadneTemporal> temporal;
public List<AgentInfo> getContributor() {
return contributor;
}
public void setContributor(List<AgentInfo> contributor) {
this.contributor = contributor;
}
public List<AatSubject> getAatSubjects() {
return aatSubjects;
}
public void setAatSubjects(List<AatSubject> aatSubjects) {
this.aatSubjects = aatSubjects;
}
public String getAccessPolicy() {
return accessPolicy;
}
public void setAccessPolicy(String accessPolicy) {
this.accessPolicy = accessPolicy;
}
public String getAccessRights() {
return accessRights;
}
public void setAccessRights(String accessRights) {
this.accessRights = accessRights;
}
public ArcheologicalResourceType getArcheologicalResourceType() {
return archeologicalResourceType;
}
public void setArcheologicalResourceType(ArcheologicalResourceType archeologicalResourceType) {
this.archeologicalResourceType = archeologicalResourceType;
}
public String getContactPoint() {
return contactPoint;
}
public void setContactPoint(String contactPoint) {
this.contactPoint = contactPoint;
}
public List<AgentInfo> getCreator() {
return creator;
}
public void setCreator(List<AgentInfo> creator) {
this.creator = creator;
}
public List<DerivedSubject> getDerivedSubject() {
return derivedSubject;
}
public void setDerivedSubject(List<DerivedSubject> derivedSubject) {
this.derivedSubject = derivedSubject;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public List<Distribution> getDistribution() {
return distribution;
}
public void setDistribution(List<Distribution> distribution) {
this.distribution = distribution;
}
public List<AgentInfo> getPublisher() {
return publisher;
}
public void setPublisher(List<AgentInfo> publisher) {
this.publisher = publisher;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getExtent() {
return extent;
}
public void setExtent(String extent) {
this.extent = extent;
}
public List<ItemMetadataStructure> getHasItemMetadataStructure() {
return hasItemMetadataStructure;
}
public void setHasItemMetadataStructure(List<ItemMetadataStructure> hasItemMetadataStructure) {
this.hasItemMetadataStructure = hasItemMetadataStructure;
}
public List<MetadataRecord> getHasMetadataRecord() {
return hasMetadataRecord;
}
public void setHasMetadataRecord(List<MetadataRecord> hasMetadataRecord) {
this.hasMetadataRecord = hasMetadataRecord;
}
public String getIdentifier() {
return identifier;
}
public void setIdentifier(String identifier) {
this.identifier = identifier;
}
public String getIsPartOf() {
return isPartOf;
}
public void setIsPartOf(String isPartOf) {
this.isPartOf = isPartOf;
}
public String getIssued() {
return issued;
}
public void setIssued(String issued) {
this.issued = ESUtils.getESFormatDate(issued);
}
public List<String> getKeyword() {
return keyword;
}
public void setKeyword(List<String> keyword) {
this.keyword = keyword;
}
public String getLandingPage() {
return landingPage;
}
public void setLandingPage(String landingPage) {
this.landingPage = landingPage;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
public List<AgentInfo> getLegalResponsible() {
return legalResponsible;
}
public void setLegalResponsible(List<AgentInfo> legalResponsible) {
this.legalResponsible = legalResponsible;
}
public String getModified() {
return modified;
}
public void setModified(String modified) {
this.modified = ESUtils.getESFormatDate(modified);
}
public List<NativeSubject> getNativeSubject() {
return nativeSubject;
}
public void setNativeSubject(List<NativeSubject> nativeSubject) {
this.nativeSubject = nativeSubject;
}
public String getOriginalId() {
return originalId;
}
public void setOriginalId(String originalId) {
this.originalId = originalId;
}
public List<AgentInfo> getOwner() {
return owner;
}
public void setOwner(List<AgentInfo> owner) {
this.owner = owner;
}
public String getPackageId() {
return packageId;
}
public void setPackageId(String packageId) {
this.packageId = packageId;
}
public String getPlaceName() {
return placeName;
}
public void setPlaceName(String placeName) {
this.placeName = placeName;
}
public String getPostcode() {
return postcode;
}
public void setPostcode(String postcode) {
this.postcode = postcode;
}
public String getProviderId() {
return providerId;
}
public void setProviderId(String providerId) {
this.providerId = providerId;
}
public String getRdfAbout() {
return rdfAbout;
}
public void setRdfAbout(String rdfAbout) {
this.rdfAbout = rdfAbout;
}
public String getResourceType() {
return resourceType;
}
public void setResourceType(String resourceType) {
this.resourceType = resourceType;
}
public String getRights() {
return rights;
}
public void setRights(String rights) {
this.rights = rights;
}
public List<AgentInfo> getScientificResponsible() {
return scientificResponsible;
}
public void setScientificResponsible(List<AgentInfo> scientificResponsible) {
this.scientificResponsible = scientificResponsible;
}
public List<Spatial> getSpatial() {
return spatial;
}
public void setSpatial(List<Spatial> spatial) {
if (this.spatial==null) {
this.spatial = spatial;
}
else {
this.spatial.addAll(spatial);
}
}
public List<AgentInfo> getTechnicalResponsible() {
return technicalResponsible;
}
public void setTechnicalResponsible(List<AgentInfo> technicalResponsible) {
this.technicalResponsible = technicalResponsible;
}
public List<AriadneTemporal> getTemporal() {
return temporal;
}
public void setTemporal(List<AriadneTemporal> temporal) {
this.temporal = temporal;
}
public static AriadneCatalogEntry fromJson(String json){
return new Gson().fromJson(json, AriadneCatalogEntry.class);
}
public String toJson(){
return new Gson().toJson(this);
}
// public static AriadneCatalogEntry fromRDFJson(JsonElement json, String identifier, Map<String, JsonElement> map){
// AriadneCatalogEntry acim = new AriadneCatalogEntry();
// acim.setIdentifier(identifier.substring(identifier.lastIndexOf("/") + 1));
// JsonObject content = json.getAsJsonObject();
// for (Map.Entry<String, JsonElement> stringJsonElementEntry : content.entrySet()) {
// switch (stringJsonElementEntry.getKey()){
// case "https://www.ariadne-infrastructure.eu/property/accessPolicy":
// acim.setAccessPolicy(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
// break;
// case "https://www.ariadne-infrastructure.eu/property/accessRights":
// acim.setAccessRights(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
// break;
// case "https://www.ariadne-infrastructure.eu/property/contributor":
// JsonArray contributor_array = stringJsonElementEntry.getValue().getAsJsonArray();
// List<AgentInfo> contributor_list = new ArrayList();
// for (int i = 0; i < contributor_array.size() ; i++ ){
// String map_key = contributor_array.get(i).getAsJsonObject().get("value").getAsString();
// contributor_list.add(AgentInfo.fromRDFJson(map.get(map_key)));
//
// }
// acim.setContributor(contributor_list);
// break;
// case "https://www.ariadne-infrastructure.eu/property/description":
// acim.setDescription(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
// break;
// case "https://www.ariadne-infrastructure.eu/property/isPartOf":
// acim.setPartOf(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
// break;
// case "https://www.ariadne-infrastructure.eu/property/issued":
// acim.setIssued(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
// break;
// case "https://www.ariadne-infrastructure.eu/property/landingPage":
// acim.setLandingPage(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
// break;
// case "https://www.ariadne-infrastructure.eu/property/language":
// acim.setLanguage(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
// break;
// case "https://www.ariadne-infrastructure.eu/property/modified":
// acim.setModified(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
// break;
// case "https://www.ariadne-infrastructure.eu/property/nativeSubject":
// JsonArray nativeSubject_array = stringJsonElementEntry.getValue().getAsJsonArray();
// List<NativeSubject> nativeSubject_list = new ArrayList();
// for (int i = 0; i < nativeSubject_array.size() ; i++ ){
// String map_key = nativeSubject_array.get(i).getAsJsonObject().get("value").getAsString();
// nativeSubject_list.add(NativeSubject.fromRDFJson(map.get(map_key)));
//
// }
// acim.setNativeSubject(nativeSubject_list);
// break;
// case "https://www.ariadne-infrastructure.eu/property/originalId":
// acim.setOriginalId(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
// break;
// case "https://www.ariadne-infrastructure.eu/property/resourceType":
// acim.setResourceType(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
// break;
// case "https://www.ariadne-infrastructure.eu/property/spatial":
// JsonArray spatial_array = stringJsonElementEntry.getValue().getAsJsonArray();
// List<Spatial> spatial_list = new ArrayList();
// for (int i = 0; i < spatial_array.size() ; i++ ){
// String map_key = spatial_array.get(i).getAsJsonObject().get("value").getAsString();
// spatial_list.add(Spatial.fromRDFJson(map.get(map_key), map));
//
// }
// acim.setSpatial(spatial_list);
// break;
// case "https://www.ariadne-infrastructure.eu/property/temporal":
// JsonArray temporal_array = stringJsonElementEntry.getValue().getAsJsonArray();
// List<AriadneTemporal> temporal_list = new ArrayList<>();
// for(int i=0; i < temporal_array.size(); i++){
// String map_key = temporal_array.get(i).getAsJsonObject().get("value").getAsString();
// temporal_list.add(AriadneTemporal.fromRDFJson(map.get(map_key)));
// }
// acim.setTemporal(temporal_list);
// break;
// case "https://www.ariadne-infrastructure.eu/property/title":
// acim.setTitle(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
// break;
// case "https://www.ariadne-infrastructure.eu/property/publisher":
// JsonArray publisher_array = stringJsonElementEntry.getValue().getAsJsonArray();
// List<AgentInfo> publisher_list = new ArrayList();
// for (int i = 0; i < publisher_array.size() ; i++ ){
// String map_key = publisher_array.get(i).getAsJsonObject().get("value").getAsString();
// publisher_list.add(AgentInfo.fromRDFJson(map.get(map_key)));
//
// }
// acim.setPublisher(publisher_list);
// break;
// case "https://www.ariadne-infrastructure.eu/property/archeologicalResourceType":
// acim.setArcheologicalResourceType(ArcheologicalResourceType.fromRDFJson(map.get(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString())));
// }
//
//
// }
//
// System.out.println(acim.toJson());
// return acim;
// }
}