Skip to content

Commit

Permalink
documentation now has its own descriptive metadata, some minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nuno-vieira-deel committed Apr 3, 2017
1 parent 47c20f1 commit 8ecd5f1
Show file tree
Hide file tree
Showing 7 changed files with 319 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/main/java/org/roda/rodain/core/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public final class Constants {
public static final String CONF_K_SUFIX_TOP_LEVEL = ".topLevel";
public static final String CONF_K_SUFIX_ITEM_LEVEL = ".itemLevel";
public static final String CONF_K_SUFIX_FILE_LEVEL = ".fileLevel";
public static final String CONF_K_SUFFIX_TAGS = ".tags";
public static final String CONF_K_SUFIX_LEVELS_ICON = "levels.icon.";
// configs keys
public static final String CONF_K_IGNORED_FILES = "app.ignoredFiles";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ private Pair createBagit(Sip descriptionObject) {
Path metadataPath = tempDir.resolve(Utils.generateRandomAndPrefixedUUID());
bagit.addDescriptiveMetadata(BagitUtils.createBagitMetadata(metadataMap, bagit.getAncestors(), metadataPath));

currentAction = actionFinalizingSip;
Path name = bagit.build(outputPath, createSipName(descriptionObject, prefix, sipNameStrategy));
createdSipsCount++;
return new Pair(name, bagit);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ private Pair createHungarianSip(Sip descriptionObject) {
}

IPFile metadataFile = new IPFile(metadataPath);
metadataFile.setRelatedTags(descObjMetadata.getRelatedTags());
IPDescriptiveMetadata metadata = new IPDescriptiveMetadata(descObjMetadata.getId(), metadataFile, metadataType,
descObjMetadata.getMetadataVersion());

Expand Down Expand Up @@ -186,7 +187,7 @@ private Pair createHungarianSip(Sip descriptionObject) {
unsuccessful.add(descriptionObject);
CreationModalProcessing.showError(descriptionObject, e);
} catch (Exception e) {
LOGGER.error("Error exporting E-ARK SIP", e);
LOGGER.error("Error exporting Hungarian SIP", e);
unsuccessful.add(descriptionObject);
CreationModalProcessing.showError(descriptionObject, e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
Expand Down Expand Up @@ -31,6 +33,7 @@
public class DescriptiveMetadata {
private static final Logger LOGGER = LoggerFactory.getLogger(DescriptiveMetadata.class.getName());
private String id, content, contentEncoding, metadataType;
private List<String> relatedTags = new ArrayList<>();
private Map<String, Object> additionalProperties = new HashMap<>();
private TreeSet<TemplateFieldValue> values;
private Path path;
Expand Down Expand Up @@ -283,6 +286,15 @@ public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}

public List<String> getRelatedTags() {
return relatedTags;
}

public void setRelatedTags(List<String> relatedTags) {
this.relatedTags = relatedTags;
}

@Override
public DescriptiveMetadata clone() {
DescriptiveMetadata result = new DescriptiveMetadata();
result.setCreatorOption(creatorOption);
Expand All @@ -294,6 +306,7 @@ public DescriptiveMetadata clone() {
result.setMetadataVersion(metadataVersion);
result.setMetadataType(metadataType);
result.setTemplateType(templateType);
result.setRelatedTags(relatedTags);
return result;
}

Expand All @@ -302,7 +315,7 @@ public String toString() {
return "DescObjMetadata [id=" + id + ", content=" + content + ", contentEncoding=" + contentEncoding
+ ", metadataType=" + metadataType + ", additionalProperties=" + additionalProperties + ", values=" + values
+ ", path=" + path + ", loaded=" + loaded + ", creatorOption=" + creatorOption + ", metadataVersion="
+ metadataVersion + ", templateType=" + templateType + "]";
+ metadataVersion + ", templateType=" + templateType + ", relatedTags=" + relatedTags + "]";
}

public void initializeValues() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.roda.rodain.core.ConfigurationManager;
Expand Down Expand Up @@ -389,9 +390,12 @@ private void addTypeAndVersionToMetadata(Pair metaType, DescriptiveMetadata meta
String templateVersion = (String) metaType.getKey();
String metadataVersion = ConfigurationManager.getMetadataConfig(templateVersion + Constants.CONF_K_SUFIX_VERSION);
String metadataType = ConfigurationManager.getMetadataConfig(templateVersion + Constants.CONF_K_SUFIX_TYPE);
String metadataTags = ConfigurationManager.getMetadataConfig(templateVersion + Constants.CONF_K_SUFFIX_TAGS);
List<String> tagList = Arrays.asList(metadataTags.split(","));
metadataToAdd.setMetadataType(metadataType);
metadataToAdd.setMetadataVersion(metadataVersion);
metadataToAdd.setTemplateType(templateVersion);
metadataToAdd.setRelatedTags(tagList);
}
}

Expand Down
15 changes: 13 additions & 2 deletions src/main/resources/properties/config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ idPrefix=uuid-
#########################################################
# Metadata templates #
#########################################################
metadata.templates=ead2002,dc,keyvalue
metadata.templates=ead2002,dc,keyvalue,documentation

#########################################################
# Metadata types #
#########################################################
metadata.types=ead2002,dc,keyvalue
metadata.types=ead2002,dc,keyvalue,documentation

#########################################################
# Metadata definition #
Expand Down Expand Up @@ -52,6 +52,17 @@ metadata.keyvalue.fileLevel = file
metadata.keyvalue.aggregationLevel = series
metadata.keyvalue.topLevel = fonds

metadata.documentation.template=documentation.xml.hbs
metadata.documentation.title=Documentation
metadata.documentation.tags=documentation
metadata.documentation.type=ead
metadata.documentation.version=2002
metadata.documentation.schema=ead2002.xsd
metadata.documentation.itemLevel = item
metadata.documentation.fileLevel = file
metadata.documentation.aggregationLevel = series
metadata.documentation.topLevel = fonds

#########################################################
# Icons #
#########################################################
Expand Down
Loading

0 comments on commit 8ecd5f1

Please sign in to comment.