Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,8 @@ public long getLength() {
public String getMimeType() {
return mimeType;
}

public void setFile(String file) {
this.file = file;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import com.databasepreservation.managers.ExportModuleContextManager;
import com.databasepreservation.managers.ModuleConfigurationManager;
import com.databasepreservation.model.data.BinaryCell;
import com.databasepreservation.model.data.Cell;
import com.databasepreservation.model.data.NullCell;
import com.databasepreservation.model.data.Row;
Expand Down Expand Up @@ -167,6 +168,9 @@ public void handleDataRow(Row row) throws ModuleException {
.get(currentTable.getId() + index);
Cell newCell = getExternalLOBSCellHandler(externalLobsConfiguration).handleCell(cell.getId(),
simpleCell.getSimpleData());
if (newCell instanceof BinaryCell binaryCell) {
binaryCell.setFile(simpleCell.getSimpleData());
}
rowCells.set(index, newCell);
} else {
reporter.ignored("Cell " + cell.getId(), "reference to external LOB is null");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.zip.ZipInputStream;

import org.apache.commons.codec.binary.Hex;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
import org.jdom2.Document;
import org.jdom2.Element;
Expand Down Expand Up @@ -367,6 +368,12 @@ private void processConvertedLobArchive(BinaryCell binaryCell, long rowIndex, in
throw new ModuleException().withMessage("Missing conversion_report.json in cell archive.");
}

String fileFromCell = binaryCell.getFile();
if (fileFromCell != null) {
String filename = FilenameUtils.getName(fileFromCell).stripTrailing();
report = report.withOriginalFilename(filename);
}

List<String> siardPhysicalPaths = new ArrayList<>();
int fileCount = 0;
String processedFilesExtension = "tif";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,9 @@ private ProcessedRowContext processRowAsync(Row row) throws ModuleException {

// TODO: Handle multiple files per cell if needed. Currently assumes single file
// output.
Cell newCell = new BinaryCell(cell.getId(), new PathInputStreamProvider(result.zipFile()),
BinaryCell newCell = new BinaryCell(cell.getId(), new PathInputStreamProvider(result.zipFile()),
"application/zip");
newCell.setFile(binCell.getFile());
cells.set(i, newCell);

// Track extracted parts to clean them individually later
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,9 @@ public ConversionReport withContext(DbptkContext context) {
return new ConversionReport(jobId, status, originalFilename, totalArtifactsProduced, artifacts, errorMessage,
context);
}

public ConversionReport withOriginalFilename(String newFilename) {
return new ConversionReport(jobId, status, newFilename, totalArtifactsProduced, artifacts, errorMessage,
dbptkContext);
}
}
Loading