Skip to content

Commit

Permalink
Updated metadata name procesing (now, the tags are replaced also when…
Browse files Browse the repository at this point in the history
… viewing metadata in roda-in app)
  • Loading branch information
sleroux-keep committed Dec 11, 2015
1 parent d3eac25 commit e4fc1ad
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 0 additions & 2 deletions src/main/java/org/roda/rodain/creation/BagitSipCreator.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, String> metadata = getMetadata(content);
for (String key : metadata.keySet()) {
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/org/roda/rodain/creation/EarkSipCreator.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/org/roda/rodain/rules/sip/SipMetadata.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/org/roda/rodain/rules/sip/SipPreview.java
Original file line number Diff line number Diff line change
@@ -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 [email protected]
Expand Down Expand Up @@ -58,7 +60,13 @@ public Set<TreeNode> 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;
}

/**
Expand Down

0 comments on commit e4fc1ad

Please sign in to comment.