argos/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/SecurityAndPrivacyRDAMapper...

22 lines
617 B
Java

package eu.eudat.models.rda.mapper;
import com.fasterxml.jackson.databind.JsonNode;
import eu.eudat.models.rda.SecurityAndPrivacy;
public class SecurityAndPrivacyRDAMapper {
public static SecurityAndPrivacy toRDA(JsonNode structure, JsonNode properties) {
SecurityAndPrivacy rda = new SecurityAndPrivacy();
String rdaProperty = structure.get("rdaProperty").asText();
String value = properties.get(structure.get("id").asText()).asText();
if (rdaProperty.contains("description")) {
rda.setDescription(value);
} else if (rdaProperty.contains("title")) {
rda.setTitle(value);
}
return rda;
}
}