24 lines
604 B
Java
24 lines
604 B
Java
package eu.eudat.models.rda.mapper;
|
|
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
import eu.eudat.models.rda.License;
|
|
|
|
import java.net.URI;
|
|
|
|
public class LicenseRDAMapper {
|
|
|
|
public static License toRDA(JsonNode structure, JsonNode properties) {
|
|
License rda = new License();
|
|
String rdaProperty = structure.get("rdaProperty").asText();
|
|
String value = properties.get(structure.get("id").asText()).asText();
|
|
|
|
if (rdaProperty.contains("license_ref")) {
|
|
rda.setLicenseRef(URI.create(value));
|
|
} else if (rdaProperty.contains("start_date")) {
|
|
rda.setStartDate(value);
|
|
}
|
|
|
|
return rda;
|
|
}
|
|
}
|