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, Long> 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 Long minFileSize;
 
   63     @Expose(serialize = false)
 
   64     private Long 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     Long getMinFileSize() {
 
  147     Long getMaxFileSize() {
 
  151     Integer getMinDays() {
 
  155     Integer getMinDate() {
 
  159     Integer getMaxDate() {
 
  166     static class Builder {
 
  168         private Boolean shouldAlert = null;
 
  169         private Boolean shouldSave = null;
 
  170         private String name = null;
 
  171         private String description = null;
 
  172         private List<String> extensions = null;
 
  173         private List<String> filenames = null;
 
  174         private List<String> paths = null;
 
  175         private List<String> fullPaths = null;
 
  176         private Long minFileSize = null;
 
  177         private Long maxFileSize = null;
 
  178         private Integer minDays = null;
 
  179         private Integer minDate = null;
 
  180         private Integer maxDate = null;
 
  182         Builder getShouldAlert(
boolean shouldAlert) {
 
  183             this.shouldAlert = shouldAlert;
 
  187         Builder getShouldSave(
boolean shouldSave) {
 
  188             this.shouldSave = shouldSave;
 
  192         Builder getName(String name) {
 
  197         Builder getDescription(String description) {
 
  198             this.description = description;
 
  202         Builder getExtensions(List<String> extensions) {
 
  203             this.extensions = extensions;
 
  207         Builder getFilenames(List<String> filenames) {
 
  208             this.filenames = filenames;
 
  212         Builder getPaths(List<String> paths) {
 
  217         Builder getFullPaths(List<String> fullPaths) {
 
  218             this.fullPaths = fullPaths;
 
  222         Builder getMinFileSize(Long minFileSize) {
 
  223             this.minFileSize = minFileSize;
 
  227         Builder getMaxFileSize(Long maxFileSize) {
 
  228             this.maxFileSize = maxFileSize;
 
  232         Builder getMinDays(Integer minDays) {
 
  233             this.minDays = minDays;
 
  237         Builder getMinDate(Integer minDate) {
 
  238             this.minDate = minDate;
 
  242         Builder getMaxDate(Integer maxDate) {
 
  243             this.maxDate = maxDate;
 
  247         LogicalImagerRule build() {
 
  248             return new LogicalImagerRule(shouldAlert, shouldSave, name, description,
 
  249                     extensions, filenames, paths, fullPaths,
 
  250                     minFileSize, maxFileSize,
 
  251                     minDays, minDate, maxDate