19 package org.sleuthkit.autopsy.externalresults;
21 import java.util.ArrayList;
22 import java.util.Collections;
23 import java.util.List;
25 import org.openide.util.NbBundle;
34 private final List<Artifact>
artifacts =
new ArrayList<>();
35 private final List<Report>
reports =
new ArrayList<>();
42 Content getDataSource() {
46 Artifact addArtifact(String type, String sourceFilePath) {
48 throw new IllegalArgumentException(
49 NbBundle.getMessage(
this.getClass(),
"ExternalResults.addArtifact.exception.msg1.text"));
51 if (sourceFilePath.isEmpty()) {
52 throw new IllegalArgumentException(
53 NbBundle.getMessage(
this.getClass(),
"ExternalResults.addArtifact.exception.msg2.text"));
55 Artifact artifact =
new Artifact(type, sourceFilePath);
56 artifacts.add(artifact);
60 List<Artifact> getArtifacts() {
61 return Collections.unmodifiableList(artifacts);
64 void addReport(String localPath, String sourceModuleName, String reportName) {
65 if (localPath.isEmpty()) {
66 throw new IllegalArgumentException(
67 NbBundle.getMessage(
this.getClass(),
"ExternalResults.addReport.exception.msg1.text"));
69 if (sourceModuleName.isEmpty()) {
70 throw new IllegalArgumentException(
71 NbBundle.getMessage(
this.getClass(),
"ExternalResults.addReport.exception.msg2.text"));
73 Report report =
new Report(localPath, sourceModuleName, reportName);
77 List<Report> getReports() {
78 return Collections.unmodifiableList(reports);
81 void addDerivedFile(String localPath, String parentPath) {
82 if (localPath.isEmpty()) {
83 throw new IllegalArgumentException(
84 NbBundle.getMessage(
this.getClass(),
"ExternalResults.addDerivedFile.exception.msg1.text"));
86 if (parentPath.isEmpty()) {
87 throw new IllegalArgumentException(
88 NbBundle.getMessage(
this.getClass(),
"ExternalResults.addDerivedFile.exception.msg2.text"));
90 DerivedFile file =
new DerivedFile(localPath, parentPath);
91 derivedFiles.add(file);
94 List<DerivedFile> getDerivedFiles() {
95 return Collections.unmodifiableList(derivedFiles);
98 static final class Artifact {
100 private final String type;
101 private final String sourceFilePath;
102 private final ArrayList<ArtifactAttribute> attributes =
new ArrayList<>();
104 Artifact(String type, String sourceFilePath) {
106 this.sourceFilePath = sourceFilePath;
113 String getSourceFilePath() {
114 return sourceFilePath;
117 void addAttribute(String type, String value, String valueType, String sourceModule) {
118 if (type.isEmpty()) {
119 throw new IllegalArgumentException(NbBundle.getMessage(
this.getClass(),
120 "ExternalResults.Artifact.addAttribute.exception.msg1.text"));
122 if (value.isEmpty()) {
123 throw new IllegalArgumentException(NbBundle.getMessage(
this.getClass(),
124 "ExternalResults.Artifact.addAttribute.exception.msg2.text"));
126 if (valueType.isEmpty()) {
127 throw new IllegalArgumentException(NbBundle.getMessage(
this.getClass(),
128 "ExternalResults.Artifact.addAttribute.exception.msg3.text"));
130 attributes.add(
new ArtifactAttribute(type, value, valueType, sourceModule));
133 List<ArtifactAttribute> getAttributes() {
134 return Collections.unmodifiableList(attributes);
138 static final class ArtifactAttribute {
140 private final String type;
141 private final String valueType;
142 private final String value;
143 private final String sourceModule;
145 private ArtifactAttribute(String type, String value, String valueType, String sourceModule) {
148 this.valueType = valueType;
149 this.sourceModule = sourceModule;
160 String getValueType() {
164 String getSourceModule() {
169 static final class Report {
171 private final String localPath;
172 private final String sourceModuleName;
173 private final String reportName;
175 Report(String localPath, String sourceModuleName, String displayName) {
176 this.localPath = localPath;
177 this.sourceModuleName = sourceModuleName;
178 this.reportName = displayName;
181 String getLocalPath() {
185 String getSourceModuleName() {
186 return sourceModuleName;
189 String getReportName() {
194 static final class DerivedFile {
196 private final String localPath;
197 private final String parentPath;
199 DerivedFile(String localPath, String parentPath) {
200 this.localPath = localPath;
201 this.parentPath = parentPath;
204 String getLocalPath() {
208 String getParentPath() {
final List< Artifact > artifacts
final List< DerivedFile > derivedFiles
final List< Report > reports