diff --git a/pom.xml b/pom.xml
index 5374deb..bc101b8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
infolis
metaDataTransformer
- 1.0-SNAPSHOT
+ 1.1-SNAPSHOT
jar
@@ -47,4 +47,4 @@
metaDataTransformer
-
\ No newline at end of file
+
diff --git a/src/main/java/infolis/metaDataTransformer/output/OutputWriter.java b/src/main/java/infolis/metaDataTransformer/output/OutputWriter.java
index eabd86e..e8e83a8 100644
--- a/src/main/java/infolis/metaDataTransformer/output/OutputWriter.java
+++ b/src/main/java/infolis/metaDataTransformer/output/OutputWriter.java
@@ -22,7 +22,7 @@
public class OutputWriter {
String lang = null, abstractDesc = null, title = null, identifier = null, uri = null;
- List authors = new ArrayList<>(), subjects = new ArrayList<>();
+ List authors = new ArrayList<>(), subjects = new ArrayList<>(), identifiers = new ArrayList<>();
String outputPath = null, fileName = null;
public OutputWriter(String lang, String abstractDesc, String title, String identifier, String uri, List authors, List subjects, String outputPath, String fileName) {
@@ -36,6 +36,17 @@ public OutputWriter(String lang, String abstractDesc, String title, String ident
this.outputPath = outputPath;
this.fileName = fileName;
}
+
+ public OutputWriter(String lang, String abstractDesc, String title, List identifiers, List authors, List subjects, String outputPath, String fileName) {
+ this.lang = lang;
+ this.abstractDesc = abstractDesc;
+ this.title = title;
+ this.identifiers = identifiers;
+ this.authors = authors;
+ this.subjects = subjects;
+ this.outputPath = outputPath;
+ this.fileName = fileName;
+ }
public void writeOutput() {
DocumentBuilderFactory icFactory = DocumentBuilderFactory.newInstance();
@@ -50,9 +61,11 @@ public void writeOutput() {
node.appendChild(header);
// append child elements to root element
- Element identifierEle = docOut.createElement("identifier");
- identifierEle.setTextContent(identifier);
- header.appendChild(identifierEle);
+ if (null != identifier) {
+ Element identifierEle = docOut.createElement("identifier");
+ identifierEle.setTextContent(identifier);
+ header.appendChild(identifierEle);
+ }
Element metadata = docOut.createElement("metadata");
node.appendChild(metadata);
@@ -72,9 +85,17 @@ public void writeOutput() {
langEle.setTextContent(lang);
ns1.appendChild(langEle);
- Element uriEle = docOut.createElement("dc:identifier");
- uriEle.setTextContent(uri);
- ns1.appendChild(uriEle);
+ if (null != uri) {
+ Element uriEle = docOut.createElement("dc:identifier");
+ uriEle.setTextContent(uri);
+ ns1.appendChild(uriEle);
+ }
+
+ for (String id : identifiers) {
+ Element idEle = docOut.createElement("dc:identifier");
+ idEle.setTextContent(id);
+ ns1.appendChild(idEle);
+ }
Element absEle = docOut.createElement("dc:description");
absEle.setTextContent(abstractDesc);
diff --git a/src/main/java/infolis/metaDataTransformer/ssoar/SSOARTransformator.java b/src/main/java/infolis/metaDataTransformer/ssoar/SSOARTransformator.java
index 41c7b7e..97d510f 100644
--- a/src/main/java/infolis/metaDataTransformer/ssoar/SSOARTransformator.java
+++ b/src/main/java/infolis/metaDataTransformer/ssoar/SSOARTransformator.java
@@ -36,8 +36,9 @@ public static void main(String args[]) throws ParserConfigurationException, SAXE
File inDir = new File(inputPath);
for (File f : inDir.listFiles()) {
- String lang = null, abstractDesc = null, title = null, identifier = null, uri = null;
- List authors = new ArrayList<>(), subjects = new ArrayList<>();
+ String lang = null, abstractDesc = null, title = null;
+ List authors = new ArrayList<>(), subjects = new ArrayList<>(),
+ identifiers = new ArrayList<>();
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
@@ -46,7 +47,7 @@ public static void main(String args[]) throws ParserConfigurationException, SAXE
NodeList fieldNodesHeader = doc.getElementsByTagName("ns0:identifier");
for (int j = 0; j < fieldNodesHeader.getLength(); j++) {
Node fieldNode = fieldNodesHeader.item(j);
- identifier = fieldNode.getTextContent();
+ identifiers.add(fieldNode.getTextContent());
}
NodeList fieldNodesBegin = doc.getElementsByTagName("ns1:dcvalue");
@@ -85,13 +86,13 @@ public static void main(String args[]) throws ParserConfigurationException, SAXE
if (element.getTextContent().equals("title") && language != null && language.getTextContent().equals(lang) && qualifier ==null) {
title = fieldNode.getTextContent();
}
- if (element.getTextContent().equals("identifier") && qualifier != null && qualifier.getTextContent().equals("uri")) {
- uri = fieldNode.getTextContent();
+ if (element.getTextContent().equals("identifier")) {
+ identifiers.add(fieldNode.getTextContent());
}
}
}
- OutputWriter writer = new OutputWriter(lang, abstractDesc, title, identifier, uri, authors, subjects, outputPath, f.getName());
+ OutputWriter writer = new OutputWriter(lang, abstractDesc, title, identifiers, authors, subjects, outputPath, f.getName());
writer.writeOutput();
}