Skip to content
Snippets Groups Projects
Commit 85c8540c authored by Thorsten Vitt's avatar Thorsten Vitt
Browse files

Set zip entries' date to the object's last modified date

parent 60aa99d0
No related branches found
No related tags found
No related merge requests found
......@@ -107,12 +107,14 @@ private void addToMapping(ImportMapping mapping, AggregationEntry entry) {
}
}
private void writeAggregation(ZipOutputStream zip, Aggregation root) throws IOException {
writeFile(zip, root);
zip.putNextEntry(new ZipEntry(root.getFileName(false).concat("/")));
private void writeAggregation(ZipOutputStream zip, Aggregation aggregation) throws IOException {
writeFile(zip, aggregation);
ZipEntry zipEntry = new ZipEntry(aggregation.getFileName(false).concat("/"));
zip.putNextEntry(zipEntry);
zipEntry.setTime(aggregation.getMetadata().getGeneric().getGenerated().getLastModified().toGregorianCalendar().getTimeInMillis());
zip.closeEntry();
for (AggregationEntry child : root.getChildren()) {
for (AggregationEntry child : aggregation.getChildren()) {
if (child instanceof Aggregation)
writeAggregation(zip, (Aggregation) child);
else
......@@ -123,6 +125,7 @@ private void writeAggregation(ZipOutputStream zip, Aggregation root) throws IOEx
private void writeFile(ZipOutputStream zip, AggregationEntry aggregationEntry) throws IOException {
writeMetadata(zip, aggregationEntry);
ZipEntry zipEntry = new ZipEntry(aggregationEntry.getFileName(true));
zipEntry.setTime(aggregationEntry.getMetadata().getGeneric().getGenerated().getLastModified().toGregorianCalendar().getTimeInMillis());
ImportObject importObject = mapping.getImportObjectForTextGridURI(aggregationEntry.getTextGridURI().toString());
try {
......@@ -158,7 +161,9 @@ private void writeFile(ZipOutputStream zip, AggregationEntry aggregationEntry) t
}
private void writeMetadata(ZipOutputStream zip, AggregationEntry aggregationEntry) throws IOException {
zip.putNextEntry(new ZipEntry(aggregationEntry.getFileName(true).concat(".meta")));
ZipEntry zipEntry = new ZipEntry(aggregationEntry.getFileName(true).concat(".meta"));
zipEntry.setTime(aggregationEntry.getMetadata().getGeneric().getGenerated().getLastModified().toGregorianCalendar().getTimeInMillis());
zip.putNextEntry(zipEntry);
ConfigurableXMLRewriter rewriter = new ConfigurableXMLRewriter(mapping, true);
rewriter.configure(URI.create("internal:textgrid#metadata"));
if (aggregationEntry.getBase().isPresent())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment