Autopsy  4.21.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
KeywordSearchJobSettings.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2014 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org *
6 
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.keywordsearch;
20 
21 import java.util.ArrayList;
22 import java.util.HashSet;
23 import java.util.List;
25 
30 
31  private static final long serialVersionUID = 1L;
32  private static final boolean DEFAULT_INDEX_TO_SOLR = true;
33 
34  private final HashSet<String> namesOfEnabledKeywordLists;
35  private HashSet<String> namesOfDisabledKeywordLists; // Added in version 1.1
36 
41  private Boolean ocrEnabled;
42  private Boolean limitedOCREnabled;
43 
44  private boolean ocrOnly;
45 
46  // use object boolean so older settings missing this setting will deserialize to null.
47  private Boolean indexToSolr;
48 
54  KeywordSearchJobSettings(List<String> namesOfEnabledKeywordLists) {
55  this.namesOfEnabledKeywordLists = new HashSet<>(namesOfEnabledKeywordLists);
56  this.namesOfDisabledKeywordLists = new HashSet<>();
57 
58  // explicitly set to default value
59  this.ocrEnabled = null;
60  this.limitedOCREnabled = null;
61  this.ocrOnly = false;
62  this.indexToSolr = true;
63  }
64 
77  KeywordSearchJobSettings(List<String> namesOfEnabledKeywordLists, List<String> namesOfDisabledKeywordLists, boolean ocrEnabled, boolean limitedOCREnabled, boolean ocrOnly, boolean indexToSolr) {
78  this.namesOfEnabledKeywordLists = new HashSet<>(namesOfEnabledKeywordLists);
79  this.namesOfDisabledKeywordLists = new HashSet<>(namesOfDisabledKeywordLists);
80  this.ocrEnabled = ocrEnabled;
81  this.limitedOCREnabled = limitedOCREnabled;
82  this.ocrOnly = ocrOnly;
83  this.indexToSolr = indexToSolr;
84  }
85 
91  @SuppressWarnings("deprecation")
92  public boolean isOCREnabled() {
93  if (ocrEnabled == null) {
94  ocrEnabled = KeywordSearchSettings.getOcrOption();
95  }
96 
97  return ocrEnabled;
98  }
99 
105  public void setOCREnabled(boolean ocrEnabled) {
106  this.ocrEnabled = ocrEnabled;
107  }
108 
115  @SuppressWarnings("deprecation")
116  boolean isLimitedOCREnabled() {
117  if (limitedOCREnabled == null) {
118  limitedOCREnabled = KeywordSearchSettings.getLimitedOcrOption();
119  }
120 
121  return limitedOCREnabled;
122  }
123 
131  void setLimitedOCREnabled(boolean limitedOCREnabled) {
132  this.limitedOCREnabled = limitedOCREnabled;
133  }
134 
140  boolean isOCROnly() {
141  return ocrOnly;
142  }
143 
151  void setOCROnly(boolean ocrOnly) {
152  this.ocrOnly = ocrOnly;
153  }
154 
157  @Override
158  public long getVersionNumber() {
160  return serialVersionUID;
161  }
162 
171  boolean keywordListIsEnabled(String keywordListName) {
173  return namesOfEnabledKeywordLists.contains(keywordListName);
174  }
175 
181  List<String> getNamesOfEnabledKeyWordLists() {
183  return new ArrayList<>(namesOfEnabledKeywordLists);
184  }
185 
191  List<String> getNamesOfDisabledKeyWordLists() {
193  return new ArrayList<>(namesOfDisabledKeywordLists);
194  }
195 
200  private void upgradeFromOlderVersions() {
201  if (null == this.namesOfDisabledKeywordLists) {
202  this.namesOfDisabledKeywordLists = new HashSet<>();
203  }
204  }
205 
206  boolean isIndexToSolrEnabled() {
207  return indexToSolr == null ? DEFAULT_INDEX_TO_SOLR : indexToSolr;
208  }
209 
210  void setIndexToSolrEnabled(boolean enabled){
211  indexToSolr = enabled;
212  }
213 
214 }

Copyright © 2012-2024 Sleuth Kit Labs. Generated on: Mon Mar 17 2025
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.