Fix to not call Paths.get() all the time

This commit is contained in:
Eugene Livis 2021-08-25 16:28:11 -04:00
parent 578a3d24bb
commit 6c7f899c80

View File

@ -30,32 +30,35 @@ import javax.annotation.concurrent.Immutable;
public final class Manifest implements Serializable { public final class Manifest implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private final String filePath; private final Path filePath;
private final Date dateFileCreated; private final Date dateFileCreated;
private final String caseName; private final String caseName;
private final String deviceId; private final String deviceId;
private final String dataSourcePath; private final Path dataSourcePath;
private final String dataSourceFileName;
private final Map<String, String> manifestProperties; private final Map<String, String> manifestProperties;
public Manifest(Path manifestFilePath, Date dateFileCreated, String caseName, String deviceId, Path dataSourcePath, Map<String, String> manifestProperties) { public Manifest(Path manifestFilePath, Date dateFileCreated, String caseName, String deviceId, Path dataSourcePath, Map<String, String> manifestProperties) {
this.filePath = manifestFilePath.toString(); this.filePath = Paths.get(manifestFilePath.toString());
this.dateFileCreated = dateFileCreated; this.dateFileCreated = new Date(dateFileCreated.getTime());
this.caseName = caseName; this.caseName = caseName;
this.deviceId = deviceId; this.deviceId = deviceId;
if (null != dataSourcePath) { if (null != dataSourcePath) {
this.dataSourcePath = dataSourcePath.toString(); this.dataSourcePath = Paths.get(dataSourcePath.toString());
dataSourceFileName = dataSourcePath.getFileName().toString();
} else { } else {
this.dataSourcePath = ""; this.dataSourcePath = Paths.get("");
dataSourceFileName = "";
} }
this.manifestProperties = new HashMap<>(manifestProperties); this.manifestProperties = new HashMap<>(manifestProperties);
} }
public Path getFilePath() { public Path getFilePath() {
return Paths.get(this.filePath); return this.filePath;
} }
public Date getDateFileCreated() { public Date getDateFileCreated() {
return new Date(this.dateFileCreated.getTime()); return dateFileCreated;
} }
public String getCaseName() { public String getCaseName() {
@ -67,11 +70,11 @@ public final class Manifest implements Serializable {
} }
public Path getDataSourcePath() { public Path getDataSourcePath() {
return Paths.get(dataSourcePath); return dataSourcePath;
} }
public String getDataSourceFileName() { public String getDataSourceFileName() {
return Paths.get(dataSourcePath).getFileName().toString(); return dataSourceFileName;
} }
public Map<String, String> getManifestProperties() { public Map<String, String> getManifestProperties() {