Autopsy  4.20.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
DeletedFilesSearchPanel.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2022 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.filesearch;
20 
21 import java.awt.event.ActionListener;
22 import org.sleuthkit.datamodel.TskData;
23 
24 class DeletedFilesSearchPanel extends javax.swing.JPanel {
25 
26  private static final long serialVersionUID = 1L;
27 
28  private final static String ALL_DELETED_CONTENT_QUERY = "( "
29  + "(dir_flags = " + TskData.TSK_FS_NAME_FLAG_ENUM.UNALLOC.getValue() //NON-NLS
30  + " OR " //NON-NLS
31  + "meta_flags = " + TskData.TSK_FS_META_FLAG_ENUM.ORPHAN.getValue() //NON-NLS
32  + ")"
33  + " AND type = " + TskData.TSK_DB_FILES_TYPE_ENUM.FS.getFileType() //NON-NLS
34  + " )"
35  + " OR type = " + TskData.TSK_DB_FILES_TYPE_ENUM.CARVED.getFileType() //NON-NLS
36  + " OR (dir_flags = " + TskData.TSK_FS_NAME_FLAG_ENUM.UNALLOC.getValue()
37  + " AND type = " + TskData.TSK_DB_FILES_TYPE_ENUM.LAYOUT_FILE.getFileType() + " )";
38 
42  DeletedFilesSearchPanel() {
43  initComponents();
44  }
45 
46  boolean isDeletedFileSelected() {
47  return deletedCheckbox.isSelected();
48  }
49 
50  void setDeletedFileSelected(boolean selected) {
51  deletedCheckbox.setSelected(selected);
52  }
53 
59  @SuppressWarnings("unchecked")
60  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
61  private void initComponents() {
62  java.awt.GridBagConstraints gridBagConstraints;
63 
64  deletedCheckbox = new javax.swing.JCheckBox();
65 
66  setMinimumSize(new java.awt.Dimension(337, 49));
67  setPreferredSize(new java.awt.Dimension(337, 49));
68  setLayout(new java.awt.GridBagLayout());
69 
70  org.openide.awt.Mnemonics.setLocalizedText(deletedCheckbox, org.openide.util.NbBundle.getMessage(DeletedFilesSearchPanel.class, "DeletedFilesSearchPanel.deletedCheckbox.text")); // NOI18N
71  deletedCheckbox.setMinimumSize(new java.awt.Dimension(0, 0));
72  gridBagConstraints = new java.awt.GridBagConstraints();
73  gridBagConstraints.gridx = 0;
74  gridBagConstraints.gridy = 0;
75  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
76  gridBagConstraints.weightx = 1.0;
77  gridBagConstraints.weighty = 1.0;
78  add(deletedCheckbox, gridBagConstraints);
79  }// </editor-fold>//GEN-END:initComponents
80 
81 
82  // Variables declaration - do not modify//GEN-BEGIN:variables
83  private javax.swing.JCheckBox deletedCheckbox;
84  // End of variables declaration//GEN-END:variables
85  static final class DeletedFileSearchFilter extends AbstractFileSearchFilter<DeletedFilesSearchPanel> {
86 
87  DeletedFileSearchFilter() {
88  super(new DeletedFilesSearchPanel());
89  }
90 
91  @Override
92  public boolean isEnabled() {
93  return true;
94  }
95 
96  @Override
97  public boolean isValid() {
98  return true;
99  }
100 
101  @Override
102  public String getPredicate() throws FilterValidationException {
103  if (getComponent().isDeletedFileSelected()) {
104  return ALL_DELETED_CONTENT_QUERY;
105  }
106 
107  return "";
108  }
109 
110  @Override
111  public void addActionListener(ActionListener l) {
112 
113  }
114 
115  }
116 
117 
118 }

Copyright © 2012-2022 Basis Technology. Generated on: Tue Aug 1 2023
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.