19 package org.sleuthkit.autopsy.logicalimager.configuration;
21 import com.google.gson.annotations.Expose;
22 import com.google.gson.annotations.SerializedName;
23 import java.util.ArrayList;
24 import java.util.HashMap;
25 import java.util.List;
32 class LogicalImagerRule {
34 @Expose(serialize =
true)
35 private final Boolean shouldAlert;
36 @Expose(serialize = true)
37 private final Boolean shouldSave;
38 @Expose(serialize = true)
39 private final String name;
40 @Expose(serialize = true)
41 private final String description;
42 @Expose(serialize = true)
43 private List<String> extensions = new ArrayList<>();
44 @SerializedName("file-names")
45 @Expose(serialize = true)
46 private List<String> filenames = new ArrayList<>();
47 @SerializedName("folder-names")
48 @Expose(serialize = true)
49 private List<String> paths = new ArrayList<>();
50 @SerializedName("full-paths")
51 @Expose(serialize = true)
52 private List<String> fullPaths = new ArrayList<>();
53 @SerializedName("size-range")
54 @Expose(serialize = true)
55 final private Map<String, Integer> sizeRange = new HashMap<>();
56 @SerializedName("date-range")
57 @Expose(serialize = true)
58 final private Map<String, Integer> dateRange = new HashMap<>();
61 @Expose(serialize = false)
62 private Integer minFileSize;
63 @Expose(serialize = false)
64 private Integer maxFileSize;
65 @Expose(serialize = false)
66 private Integer minDays;
67 @Expose(serialize = false)
68 private Integer minDate;
69 @Expose(serialize = false)
70 private Integer maxDate;
72 private LogicalImagerRule(Boolean shouldAlert, Boolean shouldSave, String name, String description,
73 List<String> extensions,
74 List<String> filenames,
76 List<String> fullPaths,
83 this.shouldAlert = shouldAlert;
84 this.shouldSave = shouldSave;
86 this.description = description;
87 this.extensions = extensions;
88 this.filenames = filenames;
90 this.fullPaths = fullPaths;
92 this.sizeRange.put(
"min", minFileSize);
93 this.minFileSize = minFileSize;
94 this.sizeRange.put(
"max", maxFileSize);
95 this.maxFileSize = maxFileSize;
96 this.dateRange.put(
"min-days", minDays);
97 this.minDays = minDays;
98 this.dateRange.put(
"min-date", minDate);
99 this.minDate = minDate;
100 this.dateRange.put(
"max-date", maxDate);
101 this.maxDate = maxDate;
104 LogicalImagerRule() {
105 this.shouldAlert =
false;
106 this.shouldSave =
true;
107 this.description = null;
111 Boolean isShouldAlert() {
115 Boolean isShouldSave() {
123 String getDescription() {
127 List<String> getExtensions() {
131 List<String> getFilenames() {
135 List<String> getPaths() {
139 List<String> getFullPaths() {
143 Integer getMinFileSize() {
147 Integer getMaxFileSize() {
151 Integer getMinDays() {
155 Integer getMinDate() {
159 Integer getMaxDate() {
166 static class Builder {
167 private Boolean shouldAlert = null;
168 private Boolean shouldSave = null;
169 private String name = null;
170 private String description = null;
171 private List<String> extensions = null;
172 private List<String> filenames = null;
173 private List<String> paths = null;
174 private List<String> fullPaths = null;
175 private Integer minFileSize = null;
176 private Integer maxFileSize = null;
177 private Integer minDays = null;
178 private Integer minDate = null;
179 private Integer maxDate = null;
181 Builder getShouldAlert(
boolean shouldAlert) {
182 this.shouldAlert = shouldAlert;
186 Builder getShouldSave(
boolean shouldSave) {
187 this.shouldSave = shouldSave;
191 Builder getName(String name) {
196 Builder getDescription(String description) {
197 this.description = description;
201 Builder getExtensions(List<String> extensions) {
202 this.extensions = extensions;
206 Builder getFilenames(List<String> filenames) {
207 this.filenames = filenames;
211 Builder getPaths(List<String> paths) {
216 Builder getFullPaths(List<String> fullPaths) {
217 this.fullPaths = fullPaths;
221 Builder getMinFileSize(Integer minFileSize) {
222 this.minFileSize = minFileSize;
226 Builder getMaxFileSize(Integer maxFileSize) {
227 this.maxFileSize = maxFileSize;
231 Builder getMinDays(Integer minDays) {
232 this.minDays = minDays;
236 Builder getMinDate(Integer minDate) {
237 this.minDate = minDate;
241 Builder getMaxDate(Integer maxDate) {
242 this.maxDate = maxDate;
246 LogicalImagerRule build() {
247 return new LogicalImagerRule(shouldAlert, shouldSave, name, description,
248 extensions, filenames, paths, fullPaths,
249 minFileSize, maxFileSize,
250 minDays, minDate, maxDate