Ver Fonte

moved logfilter to model package in ui2, added logfilter comments

Julien Clauter há 10 anos atrás
pai
commit
e392ad02de

+ 1 - 1
src/de/tudarmstadt/informatik/hostage/deprecated/UglyDbHelper.java

@@ -15,7 +15,7 @@ import java.util.List;
 import de.tudarmstadt.informatik.hostage.logging.Record;
 import de.tudarmstadt.informatik.hostage.logging.MessageRecord.TYPE;
 import de.tudarmstadt.informatik.hostage.model.Profile;
-import de.tudarmstadt.informatik.hostage.ui.LogFilter;
+import de.tudarmstadt.informatik.hostage.ui2.model.LogFilter;
 
 /**
  * This class creates SQL tables and handles all access to the database.<br>

+ 1 - 1
src/de/tudarmstadt/informatik/hostage/persistence/HostageDBOpenHelper.java

@@ -25,7 +25,7 @@ import de.tudarmstadt.informatik.hostage.persistence.HostageDBContract.PacketEnt
 import de.tudarmstadt.informatik.hostage.persistence.HostageDBContract.ProfileEntry;
 import de.tudarmstadt.informatik.hostage.persistence.HostageDBContract.SyncDeviceEntry;
 import de.tudarmstadt.informatik.hostage.persistence.HostageDBContract.SyncInfoEntry;
-import de.tudarmstadt.informatik.hostage.ui.LogFilter;
+import de.tudarmstadt.informatik.hostage.ui2.model.LogFilter;
 
 public class HostageDBOpenHelper extends SQLiteOpenHelper {
 

+ 1 - 1
src/de/tudarmstadt/informatik/hostage/ui2/activity/MainActivity.java

@@ -37,7 +37,7 @@ import de.tudarmstadt.informatik.hostage.Hostage;
 import de.tudarmstadt.informatik.hostage.R;
 import de.tudarmstadt.informatik.hostage.model.Profile;
 import de.tudarmstadt.informatik.hostage.persistence.ProfileManager;
-import de.tudarmstadt.informatik.hostage.ui.LogFilter;
+import de.tudarmstadt.informatik.hostage.ui2.model.LogFilter;
 import de.tudarmstadt.informatik.hostage.ui2.adapter.DrawerListAdapter;
 import de.tudarmstadt.informatik.hostage.ui2.fragment.AboutFragment;
 import de.tudarmstadt.informatik.hostage.ui2.fragment.HomeFragment;

+ 1 - 1
src/de/tudarmstadt/informatik/hostage/ui2/fragment/ConnectionInfoDialogFragment.java

@@ -16,7 +16,7 @@ import android.widget.TextView;
 import java.util.ArrayList;
 
 import de.tudarmstadt.informatik.hostage.R;
-import de.tudarmstadt.informatik.hostage.ui.LogFilter;
+import de.tudarmstadt.informatik.hostage.ui2.model.LogFilter;
 import de.tudarmstadt.informatik.hostage.ui2.activity.MainActivity;
 
 /**

+ 1 - 7
src/de/tudarmstadt/informatik/hostage/ui2/fragment/HomeFragment.java

@@ -18,9 +18,6 @@ import android.content.SharedPreferences;
 import android.os.Bundle;
 import android.support.v4.content.LocalBroadcastManager;
 import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.CompoundButton;
@@ -28,15 +25,12 @@ import android.widget.ImageView;
 import android.widget.Switch;
 import android.widget.TextView;
 
-import de.tudarmstadt.informatik.hostage.Hostage;
 import de.tudarmstadt.informatik.hostage.R;
 import de.tudarmstadt.informatik.hostage.commons.HelperUtils;
 import de.tudarmstadt.informatik.hostage.persistence.ProfileManager;
 import de.tudarmstadt.informatik.hostage.model.Profile;
-import de.tudarmstadt.informatik.hostage.sync.bluetooth.BluetoothSync;
-import de.tudarmstadt.informatik.hostage.model.Profile;
 import de.tudarmstadt.informatik.hostage.persistence.HostageDBOpenHelper;
-import de.tudarmstadt.informatik.hostage.ui.LogFilter;
+import de.tudarmstadt.informatik.hostage.ui2.model.LogFilter;
 import de.tudarmstadt.informatik.hostage.ui2.activity.MainActivity;
 import de.tudarmstadt.informatik.hostage.ui2.fragment.opengl.ThreatIndicatorGLRenderer;
 

+ 0 - 1
src/de/tudarmstadt/informatik/hostage/ui2/fragment/RecordDetailFragment.java

@@ -20,7 +20,6 @@ import android.widget.ScrollView;
 import android.widget.TextView;
 import de.tudarmstadt.informatik.hostage.R;
 import de.tudarmstadt.informatik.hostage.logging.Record;
-import de.tudarmstadt.informatik.hostage.ui.LogFilter;
 import de.tudarmstadt.informatik.hostage.ui2.activity.MainActivity;
 import de.tudarmstadt.informatik.hostage.logging.MessageRecord;
 import de.tudarmstadt.informatik.hostage.persistence.HostageDBOpenHelper;

+ 3 - 3
src/de/tudarmstadt/informatik/hostage/ui2/fragment/RecordOverviewFragment.java

@@ -48,8 +48,8 @@ import de.tudarmstadt.informatik.hostage.persistence.HostageDBOpenHelper;
 import de.tudarmstadt.informatik.hostage.sync.bluetooth.BluetoothSync;
 import de.tudarmstadt.informatik.hostage.sync.nfc.NFCSync;
 import de.tudarmstadt.informatik.hostage.sync.tracing.TracingSyncActivity;
-import de.tudarmstadt.informatik.hostage.ui.LogFilter;
-import de.tudarmstadt.informatik.hostage.ui.LogFilter.SortType;
+import de.tudarmstadt.informatik.hostage.ui2.model.LogFilter;
+import de.tudarmstadt.informatik.hostage.ui2.model.LogFilter.SortType;
 import de.tudarmstadt.informatik.hostage.ui2.activity.MainActivity;
 import de.tudarmstadt.informatik.hostage.ui2.adapter.RecordListAdapter;
 import de.tudarmstadt.informatik.hostage.ui2.dialog.ChecklistDialog;
@@ -251,7 +251,7 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
             @Override
             public void run()
             {
-                RecordOverviewFragment.this.addRecordToDB(5, 10, 0);
+                //RecordOverviewFragment.this.addRecordToDB(5, 10, 1);
                 updateUI(doInBackground());
             }
 

+ 2 - 2
src/de/tudarmstadt/informatik/hostage/ui2/fragment/StatisticsFragment.java

@@ -41,7 +41,7 @@ import java.util.HashMap;
 import de.tudarmstadt.informatik.hostage.R;
 import de.tudarmstadt.informatik.hostage.logging.Record;
 import de.tudarmstadt.informatik.hostage.persistence.HostageDBOpenHelper;
-import de.tudarmstadt.informatik.hostage.ui.LogFilter;
+import de.tudarmstadt.informatik.hostage.ui2.model.LogFilter;
 import de.tudarmstadt.informatik.hostage.ui2.activity.MainActivity;
 import de.tudarmstadt.informatik.hostage.ui2.adapter.StatisticListAdapter;
 import de.tudarmstadt.informatik.hostage.ui2.dialog.ChecklistDialog;
@@ -1806,7 +1806,7 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
 
     /**
      * Displays a record over view fragment.
-     * @param filter  {@link de.tudarmstadt.informatik.hostage.ui.LogFilter LogFilter}
+     * @param filter  {@link de.tudarmstadt.informatik.hostage.ui2.model.LogFilter LogFilter}
      * @param sortKey String
      */
     private void pushRecordOverviewForFilter(LogFilter filter, String sortKey){

+ 1 - 1
src/de/tudarmstadt/informatik/hostage/ui2/fragment/ThreatMapFragment.java

@@ -40,7 +40,7 @@ import de.tudarmstadt.informatik.hostage.R;
 import de.tudarmstadt.informatik.hostage.commons.HelperUtils;
 import de.tudarmstadt.informatik.hostage.logging.Record;
 import de.tudarmstadt.informatik.hostage.persistence.HostageDBOpenHelper;
-import de.tudarmstadt.informatik.hostage.ui.LogFilter;
+import de.tudarmstadt.informatik.hostage.ui2.model.LogFilter;
 import de.tudarmstadt.informatik.hostage.ui2.activity.MainActivity;
 
 /**

+ 366 - 245
src/de/tudarmstadt/informatik/hostage/ui/LogFilter.java → src/de/tudarmstadt/informatik/hostage/ui2/model/LogFilter.java

@@ -1,245 +1,366 @@
-package de.tudarmstadt.informatik.hostage.ui;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-
-public class LogFilter implements Parcelable {
-
-	public final static String LOG_FILTER_INTENT_KEY = "de.tudarmstadt.informatik.hostage.logfilter";
-
-	private static final String TIMESTAMP_BELOW_KEY = "de.tudarmstadt.informatik.hostage.logfilter.timestampbelow";
-	private static final String TIMESTAMP_ABOVE_KEY = "de.tudarmstadt.informatik.hostage.logfilter.timestampabove";
-	private static final String PROTOCOLS_KEY = "de.tudarmstadt.informatik.hostage.logfilter.protocols";
-	private static final String ESSID_KEY = "de.tudarmstadt.informatik.hostage.logfilter.essid";
-	private static final String BSSID_KEY = "de.tudarmstadt.informatik.hostage.logfilter.bssid";
-	private static final String SORTTYPE_KEY = "de.tudarmstadt.informatik.hostage.logfilter.sorttype";
-
-	public enum SortType {
-		packet_timestamp(0), protocol(1), _bssid(1), ssid(3), _attack_id(7), _id(8);
-		private final int id;
-
-		SortType(int id) {
-			this.id = id;
-		}
-
-		public int getValue() {
-			return id;
-		}
-	}
-
-	public ArrayList<String> BSSIDs;
-	public ArrayList<String> ESSIDs;
-	public ArrayList<String> protocols;
-
-	public boolean isNotEditable;
-
-	public SortType sorttype;
-
-	public long belowTimestamp;
-	public long aboveTimestamp;
-
-	public LogFilter() {
-		this.clear();
-
-	}
-
-	public void clear() {
-		this.belowTimestamp = Long.MAX_VALUE;
-		this.aboveTimestamp = Long.MIN_VALUE;
-		this.sorttype = SortType.packet_timestamp;
-		this.BSSIDs = new ArrayList<String>();
-		this.ESSIDs = new ArrayList<String>();
-		this.protocols = new ArrayList<String>();
-	}
-
-	public int describeContents() {
-		return 0;
-	}
-
-	// write your object's data to the passed-in Parcel
-	public void writeToParcel(Parcel out, int flags) {
-		HashMap<String, ArrayList<String>> values = new HashMap<String, ArrayList<String>>();
-		if (this.BSSIDs != null && this.BSSIDs.size() > 0) {
-			values.put(BSSID_KEY, this.getBSSIDs());
-		}
-		if (this.ESSIDs != null && this.ESSIDs.size() > 0) {
-			values.put(ESSID_KEY, this.getESSIDs());
-		}
-		if (this.protocols != null && this.protocols.size() > 0) {
-			values.put(PROTOCOLS_KEY, this.getProtocols());
-		}
-		long timeArray[] = new long[] { this.aboveTimestamp, this.belowTimestamp };
-
-		out.writeMap(values);
-		out.writeInt(this.sorttype.getValue());
-		out.writeDouble(timeArray.length);
-		out.writeLongArray(timeArray);
-		out.writeString(this.isNotEditable ? "true" : "false");
-	}
-
-	public static final Parcelable.Creator<LogFilter> CREATOR = new Parcelable.Creator<LogFilter>() {
-		public LogFilter createFromParcel(Parcel in) {
-			return new LogFilter(in);
-		}
-
-		public LogFilter[] newArray(int size) {
-			return new LogFilter[size];
-		}
-	};
-
-	// example constructor that takes a Parcel and gives you an object populated
-	// with it's values
-	private LogFilter(Parcel in) {
-		// mData = in.readInt();
-		HashMap<String, ArrayList<String>> values = new HashMap<String, ArrayList<String>>();
-		in.readMap(values, ArrayList.class.getClassLoader());
-
-		this.BSSIDs = values.get(BSSID_KEY);
-		this.ESSIDs = values.get(ESSID_KEY);
-		this.protocols = values.get(protocols);
-
-		if (this.BSSIDs == null)
-			this.BSSIDs = new ArrayList<String>();
-		if (this.ESSIDs == null)
-			this.ESSIDs = new ArrayList<String>();
-		if (this.protocols == null)
-			this.protocols = new ArrayList<String>();
-
-		this.sorttype = SortType.values()[Math.min(in.readInt(), SortType.values().length)];
-
-		int size = (int) in.readDouble();
-		long timeArray[] = new long[size];
-		in.readLongArray(timeArray);
-
-		this.belowTimestamp = timeArray[1];
-		this.aboveTimestamp = timeArray[0];
-
-		String bool = in.readString();
-		if (bool.equals("true"))
-			this.isNotEditable = true;
-	}
-
-	public boolean isNotEditable() {
-		return this.isNotEditable;
-	}
-
-	public SortType getSorttype() {
-		return this.sorttype;
-	}
-
-	public ArrayList<String> getBSSIDs() {
-		return this.BSSIDs;
-	}
-
-	public ArrayList<String> getESSIDs() {
-		return this.ESSIDs;
-	}
-
-	public ArrayList<String> getProtocols() {
-		return this.protocols;
-	}
-
-	public void setIsNotEditable(boolean b) {
-		this.isNotEditable = b;
-	}
-
-	public long getBelowTimestamp() {
-		return this.belowTimestamp;
-	}
-
-	public long getAboveTimestamp() {
-		return this.aboveTimestamp;
-	}
-
-	public void setProtocols(ArrayList<String> protocols) {
-		this.protocols = protocols;
-	}
-
-	public void setBSSIDs(ArrayList<String> bssids) {
-		this.BSSIDs = bssids;
-	}
-
-	public void setESSIDs(ArrayList<String> essids) {
-		this.ESSIDs = essids;
-	}
-
-	public void setAboveTimestamp(long timestamp) {
-		this.aboveTimestamp = timestamp;
-	}
-
-	public void setBelowTimestamp(long timestamp) {
-		this.belowTimestamp = timestamp;
-	}
-
-	public void setSorttype(SortType type) {
-		this.sorttype = type;
-	}
-
-	public String getBSSIDQueryStatement(String tablename, String key) {
-		return this.convertArrayListToQueryString(this.BSSIDs, tablename, key);
-	}
-
-	public String getESSIDQueryStatement(String tablename, String key) {
-		return this.convertArrayListToQueryString(this.ESSIDs, tablename, key);
-	}
-
-	public String getProtocolsQueryStatement(String tablename, String key) {
-		return this.convertArrayListToQueryString(this.protocols, tablename, key);
-	}
-
-	public boolean isSet() {
-		boolean hasTime = this.hasATimestamp();
-		boolean hasBSSIDs = this.hasBSSIDs();
-		boolean hasESSIDs = this.hasESSIDs();
-		boolean hasProtocols = this.hasProtocols();
-
-		return hasBSSIDs || hasESSIDs || hasProtocols | hasTime;
-	}
-
-	public boolean hasBSSIDs() {
-		return this.getBSSIDs().size() > 0;
-	}
-
-	public boolean hasESSIDs() {
-		return this.getESSIDs().size() > 0;
-	}
-
-	public boolean hasProtocols() {
-		return this.getProtocols().size() > 0;
-	}
-
-	public boolean hasAboveTimestamp() {
-		return this.aboveTimestamp != Long.MIN_VALUE;
-	}
-
-	public boolean hasBelowTimestamp() {
-		return this.belowTimestamp != Long.MAX_VALUE;
-	}
-
-	public boolean hasATimestamp() {
-		return this.hasBelowTimestamp() || this.hasAboveTimestamp();
-	}
-
-	public String convertArrayListToQueryString(ArrayList<String> list, String table, String key) {
-		String statement = "";
-		if (list == null)
-			return statement;
-		statement = " ( ";
-
-		int i = 0, max = list.size();
-		for (String element : list) {
-			i++;
-			statement = statement + table + "." + key + " = " + "'" + element + "'";
-			if (i == max)
-				continue;
-			statement = statement + " OR ";
-		}
-		statement = statement + " ) ";
-
-		return statement;
-	}
-
-}
+package de.tudarmstadt.informatik.hostage.ui2.model;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+public class LogFilter implements Parcelable {
+
+	public final static String LOG_FILTER_INTENT_KEY = "de.tudarmstadt.informatik.hostage.logfilter";
+
+	//private static final String TIMESTAMP_BELOW_KEY = "de.tudarmstadt.informatik.hostage.logfilter.timestampbelow";
+	//private static final String TIMESTAMP_ABOVE_KEY = "de.tudarmstadt.informatik.hostage.logfilter.timestampabove";
+	private static final String PROTOCOLS_KEY = "de.tudarmstadt.informatik.hostage.logfilter.protocols";
+	private static final String ESSID_KEY = "de.tudarmstadt.informatik.hostage.logfilter.essid";
+	private static final String BSSID_KEY = "de.tudarmstadt.informatik.hostage.logfilter.bssid";
+	//private static final String SORTTYPE_KEY = "de.tudarmstadt.informatik.hostage.logfilter.sorttype";
+
+    /**
+     * The SortType
+     */
+	public enum SortType {
+		packet_timestamp(0), protocol(1), _bssid(1), ssid(3), _attack_id(7), _id(8);
+		private final int id;
+
+		SortType(int id) {
+			this.id = id;
+		}
+
+		public int getValue() {
+			return id;
+		}
+	}
+
+	public ArrayList<String> BSSIDs;
+	public ArrayList<String> ESSIDs;
+	public ArrayList<String> protocols;
+
+	public boolean isNotEditable;
+
+	public SortType sorttype;
+
+	public long belowTimestamp;
+	public long aboveTimestamp;
+
+    /**
+     * Constructur
+     */
+	public LogFilter() {
+		this.clear();
+	}
+
+    /**
+     * Clears / resets all attributes of the filter objects
+     * The below timestamp will be maximal and the above timestamp will be minimal (long).
+     * The sort type is set to the default: timestamp
+     */
+	public void clear() {
+		this.belowTimestamp = Long.MAX_VALUE;
+		this.aboveTimestamp = Long.MIN_VALUE;
+		this.sorttype = SortType.packet_timestamp;
+		this.BSSIDs = new ArrayList<String>();
+		this.ESSIDs = new ArrayList<String>();
+		this.protocols = new ArrayList<String>();
+	}
+
+    @Override
+	public int describeContents() {
+		return 0;
+	}
+
+	// write filter's data to the passed-in Parcel
+    @Override
+	public void writeToParcel(Parcel out, int flags) {
+		HashMap<String, ArrayList<String>> values = new HashMap<String, ArrayList<String>>();
+		if (this.BSSIDs != null && this.BSSIDs.size() > 0) {
+			values.put(BSSID_KEY, this.getBSSIDs());
+		}
+		if (this.ESSIDs != null && this.ESSIDs.size() > 0) {
+			values.put(ESSID_KEY, this.getESSIDs());
+		}
+		if (this.protocols != null && this.protocols.size() > 0) {
+			values.put(PROTOCOLS_KEY, this.getProtocols());
+		}
+		long timeArray[] = new long[] { this.aboveTimestamp, this.belowTimestamp };
+		out.writeMap(values);
+		out.writeInt(this.sorttype.getValue());
+		out.writeDouble(timeArray.length);
+		out.writeLongArray(timeArray);
+		out.writeString(this.isNotEditable ? "true" : "false");
+	}
+
+    // needed to create a parcel object
+	public static final Parcelable.Creator<LogFilter> CREATOR = new Parcelable.Creator<LogFilter>() {
+		public LogFilter createFromParcel(Parcel in) {
+			return new LogFilter(in);
+		}
+
+		public LogFilter[] newArray(int size) {
+			return new LogFilter[size];
+		}
+	};
+
+	/** constructor
+     * that takes a (filter) Parcel and gives you an LogFilter populated
+	 * with it's values.
+     * @param in {@link Parcel parcel}
+     * */
+	private LogFilter(Parcel in) {
+		HashMap<String, ArrayList<String>> values = new HashMap<String, ArrayList<String>>();
+		in.readMap(values, ArrayList.class.getClassLoader());
+
+		this.BSSIDs = values.get(BSSID_KEY);
+		this.ESSIDs = values.get(ESSID_KEY);
+		this.protocols = values.get(protocols);
+
+		if (this.BSSIDs == null)
+			this.BSSIDs = new ArrayList<String>();
+		if (this.ESSIDs == null)
+			this.ESSIDs = new ArrayList<String>();
+		if (this.protocols == null)
+			this.protocols = new ArrayList<String>();
+
+		this.sorttype = SortType.values()[Math.min(in.readInt(), SortType.values().length)];
+
+		int size = (int) in.readDouble();
+		long timeArray[] = new long[size];
+		in.readLongArray(timeArray);
+
+		this.belowTimestamp = timeArray[1];
+		this.aboveTimestamp = timeArray[0];
+
+		String bool = in.readString();
+		if (bool.equals("true"))
+			this.isNotEditable = true;
+	}
+
+    /**
+     * If the filter can be edited this method returns false.
+     * @return boolean
+     */
+	public boolean isNotEditable() {
+		return this.isNotEditable;
+	}
+
+    /**
+     * Returns the filter's sorttype
+     * @return {@link de.tudarmstadt.informatik.hostage.ui2.model.LogFilter.SortType, sorttype}
+     */
+	public SortType getSorttype() {
+		return this.sorttype;
+	}
+
+    /**
+     * Returns the filtered essid names.
+     * @return ArrayList<String>
+     */
+	public ArrayList<String> getBSSIDs() {
+		return this.BSSIDs;
+	}
+    /**
+     * Returns the filtered bssid names.
+     * @return ArrayList<String>
+     */
+	public ArrayList<String> getESSIDs() {
+		return this.ESSIDs;
+	}
+    /**
+     * Returns the filtered protocol names.
+     * @return ArrayList<String>
+     */
+	public ArrayList<String> getProtocols() {
+		return this.protocols;
+	}
+
+    /**
+     * If you don't want a filter to be editable, call this method and insert true
+     * @param b boolean
+     */
+	public void setIsNotEditable(boolean b) {
+		this.isNotEditable = b;
+	}
+
+    /**
+     * Returns the filtered maximal timestamp a entry could have.
+     * The default is max long.
+     * @return long timestamp
+     */
+	public long getBelowTimestamp() {
+		return this.belowTimestamp;
+	}
+    /**
+     * Returns the filtered minimal timestamp a entry could have.
+     * The default is min long.
+     * @return long timestamp
+     */
+	public long getAboveTimestamp() {
+		return this.aboveTimestamp;
+	}
+
+    /**
+     * Set the protocols which a {@link de.tudarmstadt.informatik.hostage.logging.Record Record} can have.
+     * @param protocols ArrayList<String>
+     */
+	public void setProtocols(ArrayList<String> protocols) {
+		this.protocols = protocols;
+	}
+
+    /**
+     * Set the bssids which a {@link de.tudarmstadt.informatik.hostage.logging.Record Record} can have.
+     * @param bssids ArrayList<String>
+     */
+	public void setBSSIDs(ArrayList<String> bssids) {
+		this.BSSIDs = bssids;
+	}
+
+    /**
+     * Set the Essids which a {@link de.tudarmstadt.informatik.hostage.logging.Record Record} can have.
+     * @param essids ArrayList<String>
+     */
+	public void setESSIDs(ArrayList<String> essids) {
+		this.ESSIDs = essids;
+	}
+
+    /**
+     * Set the minimal Timestamp a filter {@link de.tudarmstadt.informatik.hostage.logging.Record Record} can have.
+     * @param timestamp long
+     */
+	public void setAboveTimestamp(long timestamp) {
+		this.aboveTimestamp = timestamp;
+	}
+
+    /**
+     * Set the maximal Timestamp a filtered {@link de.tudarmstadt.informatik.hostage.logging.Record Record} can have.
+     * @param timestamp long
+     */
+	public void setBelowTimestamp(long timestamp) {
+		this.belowTimestamp = timestamp;
+	}
+
+    /**
+     * Set the {@link SortType SortType}.
+     * @param type SortType
+     */
+	public void setSorttype(SortType type) {
+		this.sorttype = type;
+	}
+
+    /**
+     * Returns the query statement string for all filtered BSSIDs.
+     * This method is used to perform a sql query.
+     * @param tablename String, the table name.
+     * @param key String, the table column name.
+     * @return queryString String
+     */
+	public String getBSSIDQueryStatement(String tablename, String key) {
+		return this.convertArrayListToQueryString(this.BSSIDs, tablename, key);
+	}
+
+    /**
+     * Returns the query statement string for all filtered ESSIDs.
+     * This method is used to perform a sql query.
+     * @param tablename String, the table name.
+     * @param key String, the table column name.
+     * @return queryString String
+     */
+	public String getESSIDQueryStatement(String tablename, String key) {
+		return this.convertArrayListToQueryString(this.ESSIDs, tablename, key);
+	}
+
+    /**
+     * Returns the query statement string for all filtered protocols.
+     * This method is used to perform a sql query.
+     * @param tablename String, the table name.
+     * @param key String, the table column name.
+     * @return queryString String
+     */
+	public String getProtocolsQueryStatement(String tablename, String key) {
+		return this.convertArrayListToQueryString(this.protocols, tablename, key);
+	}
+
+    /**
+     * Returns true if the filter has any attributes set.
+     * @return boolean
+     */
+	public boolean isSet() {
+		boolean hasTime = this.hasATimestamp();
+		boolean hasBSSIDs = this.hasBSSIDs();
+		boolean hasESSIDs = this.hasESSIDs();
+		boolean hasProtocols = this.hasProtocols();
+
+		return hasBSSIDs || hasESSIDs || hasProtocols | hasTime;
+	}
+
+    /**
+     * Returns true if the filter has more than one bssid.
+     * @return boolean
+     */
+	public boolean hasBSSIDs() {
+		return this.getBSSIDs().size() > 0;
+	}
+    /**
+     * Returns true if the filter has more than one essid.
+     * @return boolean
+     */
+	public boolean hasESSIDs() {
+		return this.getESSIDs().size() > 0;
+	}
+    /**
+     * Returns true if the filter has more than one protocl.
+     * @return boolean
+     */
+	public boolean hasProtocols() {
+		return this.getProtocols().size() > 0;
+	}
+
+    /**
+     * Returns true if the filter has a minimal timestamp.
+     * @return boolean
+     */
+	public boolean hasAboveTimestamp() {
+		return this.aboveTimestamp != Long.MIN_VALUE;
+	}
+    /**
+     * Returns true if the filter has a maximal timestamp.
+     * @return boolean
+     */
+	public boolean hasBelowTimestamp() {
+		return this.belowTimestamp != Long.MAX_VALUE;
+	}
+    /**
+     * Returns true if the filter has a any timestamp.
+     * @return boolean
+     */
+	public boolean hasATimestamp() {
+		return this.hasBelowTimestamp() || this.hasAboveTimestamp();
+	}
+
+    /**
+     * Returns a query statement to perform a sql query. The given list will be concatenate by an OR statement.
+     * @param list ArrayList<String> The entries which should be concatenate.
+     * @param table The table name.
+     * @param key The table column name.
+     * @return queryString string
+     */
+	public String convertArrayListToQueryString(ArrayList<String> list, String table, String key) {
+		String statement = "";
+		if (list == null)
+			return statement;
+		statement = " ( ";
+
+		int i = 0, max = list.size();
+		for (String element : list) {
+			i++;
+			statement = statement + table + "." + key + " = " + "'" + element + "'";
+			if (i == max)
+				continue;
+			statement = statement + " OR ";
+		}
+		statement = statement + " ) ";
+
+		return statement;
+	}
+
+}