2020-03-20 17:20:22 +01:00
|
|
|
package eu.eudat.models.rda.mapper;
|
|
|
|
|
|
|
|
import eu.eudat.models.rda.Contributor;
|
|
|
|
import eu.eudat.models.rda.ContributorId;
|
|
|
|
|
|
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
public class ContributorIdRDAMapper {
|
|
|
|
|
2020-03-30 15:44:49 +02:00
|
|
|
public static ContributorId toRDA(Object id) {
|
2020-03-20 17:20:22 +01:00
|
|
|
ContributorId rda = new ContributorId();
|
2020-03-30 15:44:49 +02:00
|
|
|
String idParts[] = id.toString().split(":");
|
|
|
|
String prefix = idParts.length > 1 ? idParts[0] : id.toString();
|
|
|
|
if (prefix.equals("orcid")) {
|
|
|
|
String finalId = id.toString().replace(prefix + ":", "");
|
|
|
|
rda.setIdentifier("http://orcid.org/" + finalId);
|
|
|
|
rda.setType(ContributorId.Type.ORCID);
|
|
|
|
} else {
|
|
|
|
rda.setIdentifier(id.toString());
|
|
|
|
rda.setType(ContributorId.Type.OTHER);
|
|
|
|
}
|
2020-03-20 17:20:22 +01:00
|
|
|
return rda;
|
|
|
|
}
|
|
|
|
}
|