diff --git a/src/main/java/info/textgrid/services/aggregator/tree/AggregationEntry.java b/src/main/java/info/textgrid/services/aggregator/tree/AggregationEntry.java index f307e6dd1fbedeacc744d3ee4798c358676748c2..df00fb48c58c3912cf3c18b0a49adcdb2f721c32 100644 --- a/src/main/java/info/textgrid/services/aggregator/tree/AggregationEntry.java +++ b/src/main/java/info/textgrid/services/aggregator/tree/AggregationEntry.java @@ -2,7 +2,6 @@ import info.textgrid.namespaces.metadata.core._2010.ObjectType; -import java.io.File; import java.net.URI; import java.text.MessageFormat; @@ -12,15 +11,11 @@ * Represents an entry in an aggregation. */ public class AggregationEntry implements IAggregationEntry { - - private static URI baseURI = new File(".").toURI().normalize(); private final ObjectType metadata; protected final Optional<Aggregation> parent; - private String baseName; - protected AggregationEntry(final ObjectType metadata) { this(metadata, null); } @@ -50,66 +45,9 @@ public ObjectType getMetadata() { return metadata; } - /** - * Returns a filename for this component only. - * - * @param withExtension - * whether to append a content type specific extension. - */ - protected String getSimpleFileName(final boolean withExtension) { - if (baseName == null) { - baseName = FilenamePolicy.getTransliterator().transliterate( - getMetadata().getGeneric().getProvided().getTitle().get(0)) - .concat(".") - .concat(URI.create( - getMetadata().getGeneric().getGenerated().getTextgridUri() - .getValue()).getSchemeSpecificPart()); - } - if (withExtension) - return FileExtensionMap.getInstance().addExtension(baseName, - getFormat()); - else - return baseName; - } - public String getFormat() { return getMetadata().getGeneric().getProvided().getFormat(); } - - public Optional<URI> getBase() { - if (getParent().isPresent()) - return Optional.of(URI.create(getParent().get().getFileName(false).concat("/"))); - else - return Optional.absent(); - } - - /** - * Returns a {@link File} representing the abstract file name for this - * aggregation entry from the root of the aggregation tree. - * - * @param withExtension - * if true, append a content type specific extension to the last - * component of the path. - */ - protected File getFile(final boolean withExtension) { - final Optional<Aggregation> parent = getParent(); - if (parent.isPresent()) - return new File(parent.get().getFile(false), - getSimpleFileName(withExtension)); - else - return new File(getSimpleFileName(withExtension)); - } - - /** - * Returns a {@link File} representing the abstract file name for this - * aggregation entry from the root of the aggregation tree. Equivalent to - * {@code {@linkplain #getFile(boolean) getFileName(true)}}. - * @param withExtension TODO - */ - @Deprecated - public String getFileName(final boolean withExtension) { - return baseURI.relativize(getFile(withExtension).toURI()).toString(); - } @Override public String toString() {