fixes
This commit is contained in:
parent
da57359f5c
commit
772eb7664c
|
@ -33,6 +33,7 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
import java.net.URI;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
|
@ -186,14 +187,6 @@ public class RdaFileTransformerService implements FileTransformerClient {
|
|||
rda.setCost(new ArrayList<>());
|
||||
if (cost != null) rda.getCost().add(cost);
|
||||
|
||||
// if (dmp.getDescriptions() != null) rda.setAdditionalProperty("templates", jsonHandlingService.toJsonSafe(dmp.getDescriptions().stream().filter(x-> x.getDescriptionTemplate() != null && x.getDescriptionTemplate().getId() != null).map(descriptionModel -> descriptionModel.getDescriptionTemplate().getId()).toList()));
|
||||
// if (dmp.getDmpBlueprint() != null) rda.setAdditionalProperty("blueprintId", dmp.getDmpBlueprint().getId().toString());
|
||||
// if (!licences.isEmpty()) rda.setAdditionalProperty("license", jsonHandlingService.toJsonSafe(licences));
|
||||
// if (dmp.getAccessType() != null) rda.setAdditionalProperty("visible", dmp.getAccessType());
|
||||
// if (dmp.getPublicAfter() != null) rda.setAdditionalProperty("publicDate", jsonHandlingService.toJsonSafe(dmp.getPublicAfter()));
|
||||
// if (dmp.getProperties() != null && dmp.getProperties().getContacts() != null) rda.setAdditionalProperty("contact", jsonHandlingService.toJsonSafe(dmp.getProperties().getContacts()));
|
||||
// if (dmp.getProperties() != null && dmp.getProperties().getDmpBlueprintValues() != null) rda.setAdditionalProperty("dmpProperties", jsonHandlingService.toJsonSafe(dmp.getProperties().getDmpBlueprintValues()));
|
||||
|
||||
if (dmp.getDescriptions() != null){
|
||||
rda.setDataset(new ArrayList<>());
|
||||
for (DescriptionModel descriptionModel : dmp.getDescriptions()) rda.getDataset().add(this.buildRdaDataset(descriptionModel, rda));
|
||||
|
@ -476,7 +469,10 @@ public class RdaFileTransformerService implements FileTransformerClient {
|
|||
rda.setLanguage(this.buildRdaDatasetLanguage(model));
|
||||
rda.setType(this.buildRdaDatasetType(model));
|
||||
rda.setIssued(this.buildRdaDatasetIssued(model));
|
||||
rda.setKeyword(this.buildRdaDatasetKeywords(model));//TODO: Build By Tags ?
|
||||
rda.setKeyword(this.buildRdaDatasetKeywords(model));
|
||||
if (rda.getKeyword().isEmpty() && model.getTags() != null){
|
||||
rda.getKeyword().addAll(model.getTags());
|
||||
}
|
||||
rda.setPersonalData(this.buildRdaDatasetPersonalData(model));
|
||||
rda.setSensitiveData(this.buildRdaDatasetSensitiveData(model));
|
||||
rda.setPreservationStatement(this.buildRdaDatasetPreservationStatement(model));
|
||||
|
@ -490,13 +486,6 @@ public class RdaFileTransformerService implements FileTransformerClient {
|
|||
dmpRda.getContributor().addAll(this.buildContributor(model));
|
||||
this.mergeEthicalIssues(model, dmpRda);
|
||||
|
||||
// if (model.getDescriptionTemplate() != null) rda.setAdditionalProperty("template", model.getDescriptionTemplate().getId());
|
||||
// rda.setAdditionalProperty("dmpSectionIndex", model.getSectionId());
|
||||
// if (model.getProperties() != null) rda.setAdditionalProperty("properties", jsonHandlingService.toJsonSafe(model.getProperties()));
|
||||
// if (rda.getKeyword() != null){
|
||||
// int i = 1;
|
||||
// for (String keyword : rda.getKeyword()) rda.setAdditionalProperty("keyword" + (i++), keyword);
|
||||
// } //TODO Old logic not moved
|
||||
return rda;
|
||||
}
|
||||
|
||||
|
@ -710,11 +699,12 @@ public class RdaFileTransformerService implements FileTransformerClient {
|
|||
for (ReferenceModel referenceModel : fieldValue.getReferences()) {
|
||||
if (referenceModel.getDefinition() != null && referenceModel.getDefinition().getFields() != null) {
|
||||
try {
|
||||
License license = new License(); //TODO
|
||||
String refValue = referenceModel.getDefinition().getFields().stream().filter(f -> this.configuration.getRdaFileTransformerServiceProperties().getLicenseRefCode().equalsIgnoreCase(f.getCode()) && f.getValue() != null && !f.getValue().isBlank()).map(ReferenceFieldModel::getValue).findFirst().orElse(null);
|
||||
License license = new License();
|
||||
String refValue = referenceModel.getReference();
|
||||
if (refValue != null && !refValue.isBlank()) license.setLicenseRef(URI.create(refValue));
|
||||
String startDateValue = referenceModel.getDefinition().getFields().stream().filter(f -> this.configuration.getRdaFileTransformerServiceProperties().getLicenseStartDateCode().equalsIgnoreCase(f.getCode()) && f.getValue() != null && !f.getValue().isBlank()).map(ReferenceFieldModel::getValue).findFirst().orElse(null);
|
||||
if (refValue != null && !refValue.isBlank()) license.setStartDate(startDateValue);
|
||||
else license.setStartDate(Instant.now().toString());
|
||||
|
||||
item.getLicense().add(license);
|
||||
} catch (Exception ex) {
|
||||
|
|
|
@ -19,7 +19,6 @@ public class RdaFileTransformerServiceProperties {
|
|||
private String researcherMalCode;
|
||||
private String projectStartDateCode;
|
||||
private String projectEndDateCode;
|
||||
private String licenseRefCode;
|
||||
private String licenseStartDateCode;
|
||||
|
||||
private Map<String, String> languageMap;
|
||||
|
@ -137,14 +136,6 @@ public class RdaFileTransformerServiceProperties {
|
|||
this.languageMap = languageMap;
|
||||
}
|
||||
|
||||
public String getLicenseRefCode() {
|
||||
return licenseRefCode;
|
||||
}
|
||||
|
||||
public void setLicenseRefCode(String licenseRefCode) {
|
||||
this.licenseRefCode = licenseRefCode;
|
||||
}
|
||||
|
||||
public String getLicenseStartDateCode() {
|
||||
return licenseStartDateCode;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ rda-file-transformer:
|
|||
researcherMalCode: "primaryEmail"
|
||||
projectStartDateCode: "startDate"
|
||||
projectEndDateCode: "endDate"
|
||||
licenseRefCode: "license_ref"
|
||||
licenseStartDateCode: "start_date"
|
||||
language-map:
|
||||
aa: aar
|
||||
|
|
Loading…
Reference in New Issue