Autopsy  4.0
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  public MimeTypeFilter() {
19  this(new MimeTypePanel());
20  }
21 
22  @Override
23  public boolean isEnabled() {
24  return this.getComponent().isSelected() &&
25  !this.getComponent().getMimeTypesSelected().isEmpty();
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 }

Copyright © 2012-2015 Basis Technology. Generated on: Wed Apr 6 2016
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.