Fixed RDA Import indexing

This commit is contained in:
George Kalampokis 2020-03-27 16:50:20 +02:00
parent f7a4bee8e1
commit af93a2ce99
2 changed files with 10 additions and 3 deletions

View File

@ -65,7 +65,6 @@ import org.w3c.dom.NodeList;
import javax.activation.MimetypesFileTypeMap;
import javax.persistence.criteria.Join;
import javax.persistence.criteria.JoinType;
import javax.transaction.Transactional;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
@ -417,7 +416,7 @@ public class DatasetManager {
// return exportFile;
}
private XWPFDocument getightWordDocument(ConfigLoader configLoader, DatasetWizardModel dataset, VisibilityRuleService visibilityRuleService) throws IOException {
private XWPFDocument getLightWordDocument(ConfigLoader configLoader, DatasetWizardModel dataset, VisibilityRuleService visibilityRuleService) throws IOException {
WordBuilder wordBuilder = new WordBuilder();
XWPFDocument document = configLoader.getDocument();
@ -463,7 +462,7 @@ public class DatasetManager {
}
public String getWordDocumentText (DatasetWizardModel datasetEntity) throws Exception {
XWPFDocument document = getightWordDocument(this.configLoader, datasetEntity, this.apiContext.getUtilitiesService().getVisibilityRuleService());
XWPFDocument document = getLightWordDocument(this.configLoader, datasetEntity, this.apiContext.getUtilitiesService().getVisibilityRuleService());
XWPFWordExtractor extractor = new XWPFWordExtractor(document);
return extractor.getText();/*.replaceAll("\n\\s*", " ");*/
}

View File

@ -38,6 +38,7 @@ public class MetadataRDAMapper {
rdas.get(rdas.size() - 1).setMetadataStandardId(MetadataStandardIdRDAMapper.toRDA(data.get("uri").asText()));
rdas.get(rdas.size() - 1).setDescription(data.get("label").asText());
rdas.get(rdas.size() - 1).setAdditionalProperty("fieldId", node.get("id").asText());
rdas.get(rdas.size() - 1).setAdditionalProperty("valueId", data.get("id").asText());
rdaMap.put(data.get("uri").asText(), node.get("numbering").asText());
}
}
@ -169,6 +170,12 @@ public class MetadataRDAMapper {
Map<String, Object> metadata = mapper.convertValue(rda, Map.class);
Map<String, String> additionalProperties = mapper.convertValue(metadata.get("additional_properties"), Map.class);
String id = additionalProperties.remove("valueId");
additionalProperties.clear();
additionalProperties.put("id", id);
Map<String, String> metadataStandardId = mapper.convertValue(metadata.get("metadata_standard_id"), Map.class);
String url = metadataStandardId.remove("identifier");
@ -185,6 +192,7 @@ public class MetadataRDAMapper {
result.putAll(newMetadata);
result.putAll(metadataStandardId);
result.putAll(additionalProperties);
return result;
}