Autopsy  4.4.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
MimeTypeFilter.java
Go to the documentation of this file.
1 /*
2  * To change this license header, choose License Headers in Project Properties.
3  * To change this template file, choose Tools | Templates
4  * and open the template in the editor.
5  */
6 package org.sleuthkit.autopsy.filesearch;
7 
8 import java.awt.event.ActionListener;
9 
13 class MimeTypeFilter extends AbstractFileSearchFilter<MimeTypePanel> {
14 
15  public MimeTypeFilter(MimeTypePanel component) {
16  super(component);
17  }
18 
19  public MimeTypeFilter() {
20  this(new MimeTypePanel());
21  }
22 
23  @Override
24  public boolean isEnabled() {
25  return this.getComponent().isSelected();
26  }
27 
28  @Override
29  public String getPredicate() throws FilterValidationException {
30  String predicate = "";
31  for (String mimeType : this.getComponent().getMimeTypesSelected()) {
32  predicate += "mime_type = '" + mimeType + "' OR ";
33  }
34  if (predicate.length() > 3) {
35  predicate = predicate.substring(0, predicate.length() - 3);
36  }
37  return predicate;
38  }
39 
40  @Override
41  public void addActionListener(ActionListener l) {
42  }
43 
44  @Override
45  public boolean isValid() {
46  return !this.getComponent().getMimeTypesSelected().isEmpty();
47  }
48 }

Copyright © 2012-2016 Basis Technology. Generated on: Fri Sep 29 2017
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.