245 lines
6.8 KiB
Java
245 lines
6.8 KiB
Java
package eu.eudat.models.data;
|
|
|
|
import eu.eudat.data.old.*;
|
|
|
|
import java.util.Map;
|
|
|
|
public class FetcherExternalReference {
|
|
|
|
private String id;
|
|
private String name;
|
|
private String pid;
|
|
private String pidTypeField;
|
|
private String uri;
|
|
private String description;
|
|
private String source;
|
|
private String count;
|
|
private String path;
|
|
private String host;
|
|
private String types;
|
|
private String firstName;
|
|
private String lastName;
|
|
private String tag;
|
|
|
|
public String getId() {
|
|
return id;
|
|
}
|
|
|
|
public void setId(String id) {
|
|
this.id = id;
|
|
}
|
|
|
|
public String getName() {
|
|
return name;
|
|
}
|
|
|
|
public void setName(String name) {
|
|
this.name = name;
|
|
}
|
|
|
|
public String getPid() {
|
|
return pid;
|
|
}
|
|
|
|
public void setPid(String pid) {
|
|
this.pid = pid;
|
|
}
|
|
|
|
public String getPidTypeField() {
|
|
return pidTypeField;
|
|
}
|
|
|
|
public void setPidTypeField(String pidTypeField) {
|
|
this.pidTypeField = pidTypeField;
|
|
}
|
|
|
|
public String getUri() {
|
|
return uri;
|
|
}
|
|
|
|
public void setUri(String uri) {
|
|
this.uri = uri;
|
|
}
|
|
|
|
public String getDescription() {
|
|
return description;
|
|
}
|
|
|
|
public void setDescription(String description) {
|
|
this.description = description;
|
|
}
|
|
|
|
public String getSource() {
|
|
return source;
|
|
}
|
|
|
|
public void setSource(String source) {
|
|
this.source = source;
|
|
}
|
|
|
|
public String getCount() {
|
|
return count;
|
|
}
|
|
|
|
public void setCount(String count) {
|
|
this.count = count;
|
|
}
|
|
|
|
public String getPath() {
|
|
return path;
|
|
}
|
|
|
|
public void setPath(String path) {
|
|
this.path = path;
|
|
}
|
|
|
|
public String getHost() {
|
|
return host;
|
|
}
|
|
|
|
public void setHost(String host) {
|
|
this.host = host;
|
|
}
|
|
|
|
public String getTypes() {
|
|
return types;
|
|
}
|
|
|
|
public void setTypes(String types) {
|
|
this.types = types;
|
|
}
|
|
|
|
public String getFirstName() {
|
|
return firstName;
|
|
}
|
|
|
|
public void setFirstName(String firstName) {
|
|
this.firstName = firstName;
|
|
}
|
|
|
|
public String getLastName() {
|
|
return lastName;
|
|
}
|
|
|
|
public void setLastName(String lastName) {
|
|
this.lastName = lastName;
|
|
}
|
|
|
|
public String getTag() {
|
|
return tag;
|
|
}
|
|
|
|
public void setTag(String tag) {
|
|
this.tag = tag;
|
|
}
|
|
|
|
public static FetcherExternalReference fromRemoteModel(Map<String, String> data) {
|
|
FetcherExternalReference fetcherExternalReference = new FetcherExternalReference();
|
|
if (data == null) return fetcherExternalReference;
|
|
|
|
fetcherExternalReference.setId(data.getOrDefault("id", null));
|
|
fetcherExternalReference.setName(data.getOrDefault("name", null));
|
|
fetcherExternalReference.setPid(data.getOrDefault("pid", null));
|
|
fetcherExternalReference.setPidTypeField(data.getOrDefault("pidTypeField", null));
|
|
fetcherExternalReference.setUri(data.getOrDefault("uri", null));
|
|
fetcherExternalReference.setDescription(data.getOrDefault("description", null));
|
|
fetcherExternalReference.setSource(data.getOrDefault("source", null));
|
|
fetcherExternalReference.setCount(data.getOrDefault("count", null));
|
|
fetcherExternalReference.setPath(data.getOrDefault("path", null));
|
|
fetcherExternalReference.setHost(data.getOrDefault("host", null));
|
|
fetcherExternalReference.setTypes(data.getOrDefault("types", null));
|
|
fetcherExternalReference.setFirstName(data.getOrDefault("firstName", null));
|
|
fetcherExternalReference.setLastName(data.getOrDefault("lastName", null));
|
|
fetcherExternalReference.setTag(data.getOrDefault("tag", null));
|
|
return fetcherExternalReference;
|
|
}
|
|
|
|
public FetcherExternalReference fromDataRepository(DataRepository entity) {
|
|
// this.setAbbreviation(entity.getAbbreviation());
|
|
this.setName(entity.getLabel());
|
|
this.setUri(entity.getUri());
|
|
this.setId(entity.getId().toString());
|
|
this.setPid(entity.getReference());
|
|
String source1 = entity.getReference().substring(0, entity.getReference().indexOf(":"));
|
|
if (source1.equals("dmp")) {
|
|
this.source = "Internal";
|
|
} else {
|
|
this.source = source1;
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public FetcherExternalReference fromRegistry(Registry entity){
|
|
this.id = entity.getId().toString();
|
|
// this.abbreviation = entity.getAbbreviation();
|
|
// this.created = entity.getCreated();
|
|
// this.label = entity.getLabel();
|
|
this.name = entity.getLabel();
|
|
// this.modified = entity.getModified();
|
|
this.uri = entity.getUri();
|
|
String source1 = entity.getReference().substring(0, entity.getReference().indexOf(":"));
|
|
if (source1.equals("dmp")) {
|
|
this.source = "Internal";
|
|
} else {
|
|
this.source = source1;
|
|
}
|
|
// this.reference = entity.getReference();
|
|
return this;
|
|
}
|
|
public FetcherExternalReference fromService(Service entity) {
|
|
// this.abbreviation = entity.getAbbreviation();
|
|
// this.created = entity.getCreated();
|
|
this.id = entity.getId().toString();
|
|
// this.label = entity.getLabel();
|
|
this.name = entity.getLabel();
|
|
// this.modified = entity.getModified();
|
|
this.uri = entity.getUri();
|
|
String source = entity.getReference().substring(0, entity.getReference().indexOf(":"));
|
|
if (source.equals("dmp")) {
|
|
this.source = "Internal";
|
|
} else {
|
|
this.source = source;
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public FetcherExternalReference fromResearcher(Researcher entity){
|
|
this.id = entity.getId().toString();
|
|
this.name = entity.getLabel();
|
|
String refParts[] = entity.getReference().split(":");
|
|
String source = refParts[0];
|
|
// if (source.equals("dmp")) {
|
|
// this.key = "Internal";
|
|
// }else {
|
|
// this.key = source;
|
|
// }
|
|
return this;
|
|
}
|
|
|
|
public FetcherExternalReference fromOrganisation(Organisation entity){
|
|
this.id = entity.getId().toString();
|
|
this.name = entity.getLabel();
|
|
String refParts[] = entity.getReference().split(":");
|
|
String source = refParts[0];
|
|
// if (source.equals("dmp")) {
|
|
// this.key = "Internal";
|
|
// }else {
|
|
// this.key = source;
|
|
// }
|
|
return this;
|
|
}
|
|
|
|
public FetcherExternalReference fromDataset(ExternalDataset entity){
|
|
this.id = entity.getId().toString();
|
|
this.name = entity.getLabel();
|
|
String source1 = entity.getReference().substring(0, entity.getReference().indexOf(":"));
|
|
if (source1.equals("dmp")) {
|
|
this.source = "Internal";
|
|
} else {
|
|
this.source = source1;
|
|
}
|
|
return this;
|
|
}
|
|
|
|
}
|