Skip to content

Commit

Permalink
Simplified DepositFile/FileInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
janvanmansum committed Dec 7, 2024
1 parent 25aae44 commit dfc30c0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,16 @@
package nl.knaw.dans.dvingest.core.dansbag.domain;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Value;
import org.w3c.dom.Node;

import java.nio.file.Path;

@Data
@Value
@AllArgsConstructor
public class DepositFile {
private Path path;
private Path physicalPath;
private String checksum;
private Node xmlNode;

public Path getPhysicalPath() {
if (this.physicalPath != null) {
return physicalPath;
}

return path;
}
Path path;
Path physicalPath;
String checksum;
Node xmlNode;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,18 @@
package nl.knaw.dans.dvingest.core.dansbag.domain;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.ToString;
import lombok.Value;
import nl.knaw.dans.lib.dataverse.model.file.FileMeta;

import java.nio.file.Path;

@Data
@Value
@ToString
@AllArgsConstructor
public class FileInfo {
private Path path;
private Path physicalPath;
private String checksum;
private boolean sanitized;
private FileMeta metadata;

Path path;
String checksum;
boolean sanitized;
FileMeta metadata;
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class FileElement extends Base {
);

@Value
private static class FileMetaResult {
public static class FileMetaResult {
boolean sanitized;
FileMeta fileMeta;
}
Expand Down Expand Up @@ -226,7 +226,6 @@ public static Map<Path, FileInfo> pathToFileInfo(Deposit deposit, boolean isMigr
var fileMetaResult = toFileMeta(depositFile.getXmlNode(), defaultRestrict, isMigration);
result.put(depositFile.getPath(), new FileInfo(
bagDir.resolve(depositFile.getPath()),
bagDir.resolve(depositFile.getPhysicalPath()),
depositFile.getChecksum(),
fileMetaResult.isSanitized(),
fileMetaResult.getFileMeta()
Expand Down

0 comments on commit dfc30c0

Please sign in to comment.