diff --git a/src/main/java/org/roda/rodain/creation/BagitSipCreator.java b/src/main/java/org/roda/rodain/creation/BagitSipCreator.java index d3557b35..a0c5e8f6 100644 --- a/src/main/java/org/roda/rodain/creation/BagitSipCreator.java +++ b/src/main/java/org/roda/rodain/creation/BagitSipCreator.java @@ -71,8 +71,6 @@ private void createBagit(String schemaId, SipPreview sip) { currentAction = actionCopyingMetadata; String content = sip.getMetadataContent(); - content = Utils.replaceTag(content,"#title#",sip.getName()); - content = Utils.replaceTag(content,"#date#",new SimpleDateFormat("yyyy-MM-dd").format(new Date())); Map metadata = getMetadata(content); for (String key : metadata.keySet()) { diff --git a/src/main/java/org/roda/rodain/creation/EarkSipCreator.java b/src/main/java/org/roda/rodain/creation/EarkSipCreator.java index 4939c9ee..a9b29a05 100644 --- a/src/main/java/org/roda/rodain/creation/EarkSipCreator.java +++ b/src/main/java/org/roda/rodain/creation/EarkSipCreator.java @@ -73,8 +73,6 @@ private void createEarkSip(String schemaId, SipPreview sip) { } String content = sip.getMetadataContent(); - content = Utils.replaceTag(content,"#title#",sip.getName()); - content = Utils.replaceTag(content,"#date#",new SimpleDateFormat("yyyy-MM-dd").format(new Date())); FileUtils.writeStringToFile(new File(home + metadataName), content); SIPDescriptiveMetadata metadata = new SIPDescriptiveMetadata(Paths.get(home + metadataName), null, metadataType); diff --git a/src/main/java/org/roda/rodain/rules/sip/SipMetadata.java b/src/main/java/org/roda/rodain/rules/sip/SipMetadata.java index 30ecc2cd..1cde9307 100644 --- a/src/main/java/org/roda/rodain/rules/sip/SipMetadata.java +++ b/src/main/java/org/roda/rodain/rules/sip/SipMetadata.java @@ -49,9 +49,7 @@ private void loadMetadata() { fileName = properties.getProperty("metadata.template.dcmes"); InputStream contentStream = ClassLoader.getSystemResource(fileName).openStream(); - content = Utils.convertStreamToString(contentStream); - //TODO configurable tags maybe... - + content = Utils.convertStreamToString(contentStream); contentStream.close(); loaded = true; } diff --git a/src/main/java/org/roda/rodain/rules/sip/SipPreview.java b/src/main/java/org/roda/rodain/rules/sip/SipPreview.java index 7a5d5f87..962a82cc 100644 --- a/src/main/java/org/roda/rodain/rules/sip/SipPreview.java +++ b/src/main/java/org/roda/rodain/rules/sip/SipPreview.java @@ -1,12 +1,14 @@ package org.roda.rodain.rules.sip; import java.nio.file.Path; +import java.text.SimpleDateFormat; import java.util.*; import org.roda.rodain.core.PathCollection; import org.roda.rodain.rules.MetadataTypes; import org.roda.rodain.rules.TreeNode; import org.roda.rodain.source.ui.items.SourceTreeItemState; +import org.roda.rodain.utils.Utils; /** * @author Andre Pereira apereira@keep.pt @@ -58,7 +60,13 @@ public Set getFiles() { * @see SipMetadata#getMetadataContent() */ public String getMetadataContent() { - return metadata.getMetadataContent(); + String content = metadata.getMetadataContent(); + if(content!=null){ + //TODO configurable tags... + content = Utils.replaceTag(content,"#title#",getName()); + content = Utils.replaceTag(content,"#date#",new SimpleDateFormat("yyyy-MM-dd").format(new Date())); + } + return content; } /**