243 lines
6.5 KiB
Java
243 lines
6.5 KiB
Java
package eu.eudat.models.data;
|
|
|
|
import eu.eudat.data.old.DataRepository;
|
|
import eu.eudat.data.old.Registry;
|
|
import eu.eudat.data.old.Service;
|
|
import eu.eudat.data.old.UserInfo;
|
|
import eu.eudat.models.data.datarepository.DataRepositoryModel;
|
|
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.UUID;
|
|
|
|
public class ExternalReference {
|
|
|
|
private String id;
|
|
private String name;
|
|
private String abbreviation;
|
|
private String pid;
|
|
private String originalId;
|
|
private String key;
|
|
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 getOriginalId() {
|
|
return originalId;
|
|
}
|
|
|
|
public void setOriginalId(String originalId) {
|
|
this.originalId = originalId;
|
|
}
|
|
|
|
public String getKey() {
|
|
return key;
|
|
}
|
|
|
|
public void setKey(String key) {
|
|
this.key = key;
|
|
}
|
|
|
|
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 String getAbbreviation() {
|
|
return abbreviation;
|
|
}
|
|
|
|
public void setAbbreviation(String abbreviation) {
|
|
this.abbreviation = abbreviation;
|
|
}
|
|
|
|
public static ExternalReference fromRemoteModel(Map<String, String> data) {
|
|
ExternalReference externalReference = new ExternalReference();
|
|
if (data == null) return externalReference;
|
|
|
|
externalReference.setId(data.getOrDefault("id", null));
|
|
externalReference.setName(data.getOrDefault("name", null));
|
|
externalReference.setAbbreviation(data.getOrDefault("abbreviation", null));
|
|
externalReference.setPid(data.getOrDefault("pid", null));
|
|
externalReference.setOriginalId(data.getOrDefault("originalId", null));
|
|
externalReference.setKey(data.getOrDefault("key", null));
|
|
externalReference.setPidTypeField(data.getOrDefault("pidTypeField", null));
|
|
externalReference.setUri(data.getOrDefault("uri", null));
|
|
externalReference.setDescription(data.getOrDefault("description", null));
|
|
externalReference.setSource(data.getOrDefault("source", null));
|
|
externalReference.setCount(data.getOrDefault("count", null));
|
|
externalReference.setPath(data.getOrDefault("path", null));
|
|
externalReference.setHost(data.getOrDefault("host", null));
|
|
externalReference.setTypes(data.getOrDefault("types", null));
|
|
externalReference.setFirstName(data.getOrDefault("firstName", null));
|
|
externalReference.setLastName(data.getOrDefault("lastName", null));
|
|
externalReference.setTag(data.getOrDefault("tag", null));
|
|
return externalReference;
|
|
}
|
|
|
|
public ExternalReference 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 ExternalReference 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 ExternalReference 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;
|
|
}
|
|
}
|