Browse Source

Merge branch 'master' of https://git.tk.informatik.tu-darmstadt.de/scm-ssi-student-hostagev2

Alexander Brakowski 10 years ago
parent
commit
3b12882b11

+ 5 - 2
AndroidManifest.xml

@@ -27,6 +27,7 @@
         android:required="false" />
 
     <application
+		android:name=".HostageApplication"
         android:allowBackup="true"
         android:allowClearUserData="true"
         android:hardwareAccelerated="true"
@@ -37,10 +38,10 @@
         android:vmSafeMode="true" >
         <meta-data
             android:name="com.google.android.gms.version"
-            android:value="14" />
+            android:value="@integer/google_play_services_lib_version" />
         <meta-data
             android:name="com.google.android.maps.v2.API_KEY"
-            android:value="AIzaSyCqh4bb4aMzvDcpDfiqHyXoAWFTQ6iNxe8" />
+            android:value="@string/google_maps_api_key_debug" />
 
         <activity
             android:name="de.tudarmstadt.informatik.hostage.ui2.activity.MainActivity"
@@ -53,6 +54,7 @@
             </intent-filter>  
   
         </activity>
+
         <activity
             android:name="de.tudarmstadt.informatik.hostage.ui.MainActivity"
             android:configChanges="keyboardHidden|orientation|screenSize"
@@ -84,6 +86,7 @@
             android:name="de.tudarmstadt.informatik.hostage.ui.PlayGroundActivity"
             android:label="@string/gui_playground" >
         </activity>
+
         <activity
             android:name="de.tudarmstadt.informatik.hostage.sync.tracing.TracingSyncActivity"
             android:label="@string/gui_tracing"

+ 20 - 1
build.gradle

@@ -16,7 +16,7 @@ repositories {
 }
 
 dependencies {
-    compile 'com.google.android.gms:play-services:3.2.+'
+    compile 'com.google.android.gms:play-services:4.+'
     compile 'org.roboguice:roboguice:2.0'
     compile files('libs/nineoldandroids-2.4.0.jar')
     compile 'com.android.support:support-v4:18.0.0'
@@ -53,4 +53,23 @@ android {
         debug.setRoot('build-types/debug')
         release.setRoot('build-types/release')
     }
+
+    signingConfigs {
+        release {
+            storeFile file("release.keystore")
+        }
+    }
+
+    buildTypes {
+        debug {
+            debuggable true
+            jniDebugBuild true
+        }
+
+        release {
+            debuggable false
+            jniDebugBuild false
+            signingConfig signingConfigs.release
+        }
+    }
 }

+ 2 - 2
res/layout/expandable_section_header.xml

@@ -15,7 +15,7 @@
         android:layout_height="wrap_content"
         android:paddingLeft="?android:attr/expandableListPreferredItemPaddingLeft"
         android:textSize="17dp"
-        android:layout_weight="0.4"
+        android:layout_weight="0.25"
         android:textColor="#505c6d" />
 
     <TextView
@@ -26,7 +26,7 @@
         android:textSize="15dp"
         android:gravity="right"
         android:textColor="#505c6d"
-        android:layout_weight="0.6"
+        android:layout_weight="0.75"
         />
 
 

+ 0 - 5
res/values-de/arrays.xml

@@ -12,10 +12,5 @@
         <item>Alle</item>
     </string-array>
 
-    <string-array name="Grouping">
-        <item>Protokoll</item>
-        <item>BSSID</item>
-        <item>ESSID</item>
-    </string-array>
 
 </resources>

+ 3 - 0
res/values-de/strings.xml

@@ -92,6 +92,8 @@
     <string name="no_data_notification">Es sind keine Attacken vorhanden. &#220;berpr&#252;fen Sie gegebenenfalls Ihre Filtereinstellungen.</string>
     <string name="no_data_notification_no_filter">Es sind keine Attacken vorhanden.</string>
 
+    <string name="TODAY">Heute</string>
+    <string name="YESTERDAY">Gestern</string>
 
     <string name="ui_dev_by">UI Entwicklung</string>
     <string name="core_dev_by">Core Entwicklung</string>
@@ -107,6 +109,7 @@
     <string name="discard">Verwerfen</string>
     <string name="save">Speichern</string>
     <string name="rec_protocol">Protokoll</string>
+    <string name="date">Datum</string>
     <string name="ESSID">ESSID</string>
     <string name="BSSID">BSSID</string>
     <string name="rec_sortby">Sortieren</string>

+ 4 - 0
res/values/api_keys.xml

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+	<string name="google_maps_api_key_debug">AIzaSyCqh4bb4aMzvDcpDfiqHyXoAWFTQ6iNxe8</string>
+</resources>

+ 0 - 6
res/values/arrays.xml

@@ -12,10 +12,4 @@
         <item>All</item>
     </string-array>
 
-    <string-array name="Grouping">
-        <item>Protocol</item>
-        <item>BSSID</item>
-        <item>ESSID</item>
-    </string-array>
-
 </resources>

+ 3 - 0
res/values/strings.xml

@@ -92,6 +92,8 @@
     <string name="no_data_notification">No Attacks are recorded. Please check your filter option.</string>
     <string name="no_data_notification_no_filter">No Attacks are recorded.</string>
 
+    <string name="TODAY">Today</string>
+    <string name="YESTERDAY">Yesterday</string>
 
     <string name="hostage_with_url"><a href="http://www.tk.informatik.tu-darmstadt.de/de/research/secure-smart-infrastructures/hostage">HosTaGe</a></string>
     <string name="ui_dev_by">UI developed by</string>
@@ -108,6 +110,7 @@
     <string name="save">Save</string>
 	<string name="really_want_delete_profiel">Do you really want to delete this profile?</string>
     <string name="rec_protocol">Protocol</string>
+    <string name="date">Date</string>
     <string name="ESSID">ESSID</string>
     <string name="BSSID">BSSID</string>
     <string name="rec_sortby">Sort by</string>

+ 4 - 0
res/values/version.xml

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+	<integer name="google_play_services_lib_version">4323000</integer>
+</resources>

+ 10 - 0
res/xml/app_tracker.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+	<integer name="ga_sessionTimeout">300</integer>
+	<bool name="ga_autoActivityTracking">true</bool>
+	<screenName name="de.tudarmstadt.informatik.hostage.ui2.fragment.HomeFragment">
+		HosTaGe Homeview
+	</screenName>
+	<!--  The following value should be replaced with correct property id. -->
+	<string name="ga_trackingId">UA-45491466-2</string>
+</resources>

+ 21 - 0
src/de/tudarmstadt/informatik/hostage/HostageApplication.java

@@ -0,0 +1,21 @@
+package de.tudarmstadt.informatik.hostage;
+
+import android.app.Application;
+
+import com.google.android.gms.analytics.Tracker;
+import com.google.android.gms.analytics.GoogleAnalytics;
+
+/**
+ * Created by Fabio Arnold on 28.03.14.
+ */
+public class HostageApplication extends Application {
+	private Tracker mAppTracker = null;
+
+	public synchronized Tracker getTracker() {
+		GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
+		if (mAppTracker == null) {
+			mAppTracker = analytics.newTracker(R.xml.app_tracker);
+		}
+		return mAppTracker;
+	}
+}

+ 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;
 
 /**
  * Database Helper class to create, read and write the database.

+ 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;
 
 /**

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

@@ -1,5 +1,8 @@
 package de.tudarmstadt.informatik.hostage.ui2.fragment;
 
+import com.google.android.gms.analytics.HitBuilders;
+import com.google.android.gms.analytics.Tracker;
+
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -25,12 +28,13 @@ import android.widget.ImageView;
 import android.widget.Switch;
 import android.widget.TextView;
 
+import de.tudarmstadt.informatik.hostage.HostageApplication;
 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.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;
 
@@ -313,6 +317,11 @@ public class HomeFragment extends Fragment {
 		final Activity activity = getActivity();
 		if (activity != null) {
 			activity.setTitle(getResources().getString(R.string.drawer_overview));
+
+			// tracking stuff
+			Tracker t = ((HostageApplication)activity.getApplication()).getTracker();
+			t.setScreenName(HomeFragment.class.getName());
+			t.send(new HitBuilders.AppViewBuilder().build());
 		}
 
 		mDbHelper = new HostageDBOpenHelper(getActivity());

+ 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;

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

@@ -9,7 +9,6 @@ import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.SharedPreferences;
 import android.os.Bundle;
-import android.os.Environment;
 import android.preference.PreferenceManager;
 import android.util.Log;
 import android.view.LayoutInflater;
@@ -25,8 +24,6 @@ import android.widget.Toast;
 
 import com.google.android.gms.maps.model.LatLng;
 
-import java.io.File;
-import java.io.FileOutputStream;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
@@ -35,27 +32,27 @@ import java.util.Collections;
 import java.util.Comparator;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
 import java.util.Random;
 
 import de.tudarmstadt.informatik.hostage.R;
-import de.tudarmstadt.informatik.hostage.commons.HelperUtils;
 import de.tudarmstadt.informatik.hostage.logging.AttackRecord;
 import de.tudarmstadt.informatik.hostage.logging.LogExport;
 import de.tudarmstadt.informatik.hostage.logging.MessageRecord;
 import de.tudarmstadt.informatik.hostage.logging.NetworkRecord;
 import de.tudarmstadt.informatik.hostage.logging.Record;
-import de.tudarmstadt.informatik.hostage.logging.formatter.TraCINgFormatter;
 import de.tudarmstadt.informatik.hostage.persistence.HostageDBOpenHelper;
 import de.tudarmstadt.informatik.hostage.sync.bluetooth.BluetoothSyncActivity;
 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.activity.MainActivity;
 import de.tudarmstadt.informatik.hostage.ui2.adapter.RecordListAdapter;
 import de.tudarmstadt.informatik.hostage.ui2.dialog.ChecklistDialog;
 import de.tudarmstadt.informatik.hostage.ui2.dialog.DateTimeDialogFragment;
 import de.tudarmstadt.informatik.hostage.ui2.model.ExpandableListItem;
+import de.tudarmstadt.informatik.hostage.ui2.model.LogFilter;
+import de.tudarmstadt.informatik.hostage.ui2.model.LogFilter.SortType;
 import de.tudarmstadt.informatik.hostage.ui2.popup.AbstractPopup;
 import de.tudarmstadt.informatik.hostage.ui2.popup.AbstractPopupItem;
 import de.tudarmstadt.informatik.hostage.ui2.popup.SimplePopupItem;
@@ -64,8 +61,8 @@ import de.tudarmstadt.informatik.hostage.ui2.popup.SplitPopupItem;
 
 public class RecordOverviewFragment extends UpNavigatibleFragment implements ChecklistDialog.ChecklistDialogListener, DateTimeDialogFragment.DateTimeDialogFragmentListener {
 
-	static final String FILTER_MENU_TITLE_BSSID = "BSSID";
-	static final String FILTER_MENU_TITLE_ESSID = "ESSID";
+	static final String FILTER_MENU_TITLE_BSSID = MainActivity.getContext().getString(R.string.BSSID);
+	static final String FILTER_MENU_TITLE_ESSID = MainActivity.getContext().getString(R.string.ESSID);
 	static final String FILTER_MENU_TITLE_PROTOCOLS = MainActivity.getContext().getString(R.string.rec_protocol);
 	static final String FILTER_MENU_TITLE_TIMESTAMP_BELOW = MainActivity.getContext().getString(
 			R.string.rec_latest);
@@ -78,6 +75,8 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
     static final String FILTER_MENU_POPUP_TITLE = MainActivity.getContext().getString(
 			R.string.rec_filter_by);
 
+    static final int DEFAULT_GROUPING_KEY_INDEX = 0;
+
     private boolean wasBelowTimePicker;
 
     private LogFilter filter;
@@ -130,7 +129,6 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
 
 		dbh = new HostageDBOpenHelper(this.getActivity().getBaseContext());
 	    pref = PreferenceManager.getDefaultSharedPreferences(getActivity());
-        //this.addRecordToDB(5, 2);
 
 	    // Get the message from the intent
 
@@ -146,7 +144,7 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
             }
         }
 
-        if (this.groupingKey == null) this.groupingKey = this.groupingTitles().get(0);
+        if (this.groupingKey == null) this.groupingKey = this.groupingTitles().get(DEFAULT_GROUPING_KEY_INDEX);
 
 	    this.setShowFilterButton(!this.filter.isNotEditable());
 
@@ -215,8 +213,8 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
                             if (adapter != null){
                                 adapter.notifyDataSetChanged();
 
-                                if (adapter.getGroupCount() == 1){
-                                    RecordOverviewFragment.this.expListView.expandGroup(0);
+                                if (adapter.getGroupCount() >= 1){
+                                    RecordOverviewFragment.this.expListView.expandGroup(DEFAULT_GROUPING_KEY_INDEX);
                                 } else {
                                     RecordOverviewFragment.this.setSectionToOpen(RecordOverviewFragment.this.sectionToOpen);
                                 }
@@ -253,7 +251,7 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
             @Override
             public void run()
             {
-                //RecordOverviewFragment.this.addRecordToDB(5, 10);
+                //RecordOverviewFragment.this.addRecordToDB(5, 10, 6);
                 updateUI(doInBackground());
             }
 
@@ -412,7 +410,7 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
         int ESSID_INDEX = 2;
         ArrayList<String> ssids = new ArrayList<String>();
         this.sectionToOpen = SSID;
-        this.groupingKey = this.groupingTitles(context).get(ESSID_INDEX);
+        this.groupingKey = this.groupingTitles().get(ESSID_INDEX);
   	}
 
 
@@ -427,10 +425,26 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
     *  @param  mylist {@link ExpandableListView ExpandableListView}
     * */
 	private RecordListAdapter populateListViewFromDB(ExpandableListView mylist) {
+        ArrayList<String> groupTitle = new ArrayList<String>();
+
+        HashMap<String, ArrayList<ExpandableListItem>> sectionData = this.fetchDataForFilter(this.filter, groupTitle);
+
+        RecordListAdapter adapter = null;
+        if (mylist.getAdapter() != null && mylist.getAdapter() instanceof RecordListAdapter){
+            adapter = (RecordListAdapter) mylist.getAdapter();
+            adapter.setData(sectionData);
+            adapter.setSectionHeader(groupTitle);
+        } else {
+            adapter = new RecordListAdapter( RecordOverviewFragment.this.getApplicationContext(), groupTitle, sectionData);
+        }
+
+        return adapter;
+	}
 
+    private HashMap<String, ArrayList<ExpandableListItem>> fetchDataForFilter(LogFilter filter, ArrayList<String> groupTitle){
         HashMap<String, ArrayList<ExpandableListItem>> sectionData = new HashMap<String, ArrayList<ExpandableListItem>>();
 
-        ArrayList<Record> data = dbh.getRecordsForFilter(RecordOverviewFragment.this.filter);
+        ArrayList<Record> data = dbh.getRecordsForFilter(filter == null ? this.filter : filter);
 
         // Adding Items to ListView
         String keys[] = new String[] { RecordOverviewFragment.this.getString(R.string.RecordBSSID), RecordOverviewFragment.this.getString(R.string.RecordSSID), RecordOverviewFragment.this.getString(R.string.RecordProtocol), RecordOverviewFragment.this.getString(R.string.RecordTimestamp)};
@@ -443,7 +457,12 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
             i++;
         }
 
-        ArrayList<String>groupTitle = new ArrayList<String>();
+        if (groupTitle == null){
+            groupTitle = new ArrayList<String>();
+        } else {
+            groupTitle.clear();
+        }
+
 
         for (Record val : data) {
             // DO GROUPING IN HERE
@@ -474,25 +493,41 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
             items.add(item);
         }
 
-        Collections.sort(groupTitle, new Comparator<String>() {
-            @Override
-            public int compare(String s1, String s2) {
-                return s1.compareToIgnoreCase(s2);
-            }
-        });
-
-
-        RecordListAdapter adapter = null;
-        if (mylist.getAdapter() != null && mylist.getAdapter() instanceof RecordListAdapter){
-            adapter = (RecordListAdapter) mylist.getAdapter();
-            adapter.setData(sectionData);
-            adapter.setSectionHeader(groupTitle);
+        if (this.groupingKey.equals(this.groupingTitles().get(DEFAULT_GROUPING_KEY_INDEX))){
+            Collections.sort(groupTitle,new StringDateComparator());
         } else {
-            adapter = new RecordListAdapter( RecordOverviewFragment.this.getApplicationContext(), groupTitle, sectionData);
+            Collections.sort(groupTitle, new Comparator<String>() {
+                @Override
+                public int compare(String s1, String s2) {
+                    return s1.compareToIgnoreCase(s2);
+                }
+            });
         }
 
-        return adapter;
-	}
+        return sectionData;
+    }
+
+    class StringDateComparator implements Comparator<String>
+    {
+        DateFormat formatter = DateFormat.getDateInstance(DateFormat.SHORT, Locale.getDefault());
+        //String pattern       = ((SimpleDateFormat)formatter).toPattern();
+        String localPattern  = ((SimpleDateFormat)formatter).toLocalizedPattern();
+        SimpleDateFormat dateFormat = new SimpleDateFormat(localPattern);
+
+        public int compare(String lhs, String rhs)
+        {
+            Date date1;
+            Date date2;
+            try {
+                date1 = dateFormat.parse(lhs);
+                date2 = dateFormat.parse(rhs);
+            } catch (java.text.ParseException e ) {
+                return 0;
+            }
+
+            return date2.compareTo(date1);
+        }
+    }
 
     /**
      * Actualises the list in a background thread
@@ -645,6 +680,41 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
 		}
 	}
 
+    /**
+     * Returns the timestamp in a localised format.
+     * if the date is today, it returns today,
+     * if the date was yesterday it returns yesterday, otherwise the format is localised.
+     * @param timestamp long
+     * @return formatted date String
+     */
+    public String getFormattedDate(long timestamp) {
+        Calendar smsTime = Calendar.getInstance();
+        smsTime.setTimeInMillis(timestamp);
+
+        Calendar now = Calendar.getInstance();
+
+        if(now.get(Calendar.DATE) == smsTime.get(Calendar.DATE) ){
+            return this.getDateAsDayString(timestamp) + " - " + this.getResources().getString( R.string.TODAY);
+        }else if(now.get(Calendar.DATE) - smsTime.get(Calendar.DATE) == 1 ){
+            return this.getDateAsDayString(timestamp) + " - " + this.getResources().getString( R.string.YESTERDAY);
+        }
+        return this.getDateAsDayString(timestamp);
+    }
+
+    /**Returns a date as a formated string
+     * @param timeStamp date
+     * @return String date format is localised*/
+    @SuppressLint("SimpleDateFormat")
+    private String getDateAsDayString(long timeStamp) {
+        try {
+            Date netDate = (new Date(timeStamp));
+            DateFormat dateFormat = android.text.format.DateFormat.getMediumDateFormat(this.getActivity());
+            return dateFormat.format(netDate);
+            //return dateFormat.format(netDate);
+        } catch (Exception ex) {
+            return "xx";
+        }
+    }
 
 	/*****************************
 	 *
@@ -727,31 +797,38 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
     public String getGroupValue(Record rec){
         int index = this.groupingTitles().indexOf(this.groupingKey);
         switch (index){
-            case 0:
-                return rec.getProtocol();
             case 1:
-                return rec.getBssid();
+                return rec.getProtocol();
             case 2:
                 return rec.getSsid();
+            case 3:
+                return rec.getBssid();
+            case 0:
+                return this.getFormattedDate(rec.getTimestamp());
             default:
-                return rec.getProtocol();
+                return this.getFormattedDate(rec.getTimestamp());
         }
     }
 
     /**Returns the Group titles for the specified grouping key. e.g. groupingKey is "ESSID" it returns all available essids.
     * @return ArrayList<String> grouptitles*/
-    public ArrayList<String> getGroupTitles(){
+    public List<String> getGroupTitles(){
         int index = this.groupingTitles().indexOf(this.groupingKey);
         switch (index){
-            case 0:
-                return this.protocolTitles();
             case 1:
-                return this.bssids();
+                return this.protocolTitles();
             case 2:
                 return this.essids();
+            case 3:
+                return this.bssids();
+            case 0:
             default:
-                return this.protocolTitles();
-        }
+                RecordListAdapter adapter = (RecordListAdapter) this.expListView.getExpandableListAdapter();
+                if (adapter != null){
+                    return adapter.getSectionHeaders();
+                }
+                return new ArrayList<String>();
+            }
     }
 
 
@@ -834,25 +911,14 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
     	this.filter.clear();
 	}
 
-    /**Returns all grouping titles
-    * @param  context Context
-    * @return ArrayList<String> titles*/
-    public ArrayList<String> groupingTitles(Context context){
-        ArrayList<String> titles = new ArrayList<String>();
-        for (String groupTitle : context.getResources().getStringArray(
-                R.array.Grouping)) {
-            titles.add(groupTitle);
-        }
-        return titles;
-    }
     /**Returns all grouping titles.
     * @return ArrayList<String> tiles*/
     public ArrayList<String> groupingTitles(){
         ArrayList<String> titles = new ArrayList<String>();
-        for (String groupTitle : this.getResources().getStringArray(
-                R.array.Grouping)) {
-            titles.add(groupTitle);
-        }
+        titles.add(MainActivity.getContext().getString(R.string.date));
+        titles.add(MainActivity.getContext().getString(R.string.rec_protocol));
+        titles.add(MainActivity.getContext().getString(R.string.ESSID));
+        titles.add(MainActivity.getContext().getString(R.string.BSSID));
         return titles;
     }
     /**
@@ -905,8 +971,8 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
 		ArrayList<String> titles = new ArrayList<String>();
 		titles.add(MainActivity.getContext().getString(R.string.rec_time));
 		titles.add(MainActivity.getContext().getString(R.string.rec_protocol));
-		titles.add(MainActivity.getContext().getString(R.string.BSSID));
-		titles.add(MainActivity.getContext().getString(R.string.ESSID));
+        titles.add(MainActivity.getContext().getString(R.string.ESSID));
+        titles.add(MainActivity.getContext().getString(R.string.BSSID));
 		return titles;
 	}
     /**
@@ -1020,6 +1086,7 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
 		} else {
 			this.filter.setAboveTimestamp(Long.MIN_VALUE);
 		}
+        this.actualiseListViewInBackground();
         this.actualiseFilterButton();
     }
 
@@ -1056,13 +1123,15 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
 		if(title.equals(FILTER_MENU_TITLE_SORTING)){
 			ArrayList<String> titles = dialog.getSelectedItemTitles();
             if (titles.size() == 0) return;
-			String t = titles.get(0);
+            // ALWAYS GET THE FIRST ELEMENT (SHOULD BE ALWAYS ONE)
+            String t = titles.get(0);
 			int sortType = this.sortTypeTiles().indexOf(t);
 			this.filter.setSorttype(SortType.values()[sortType]);
 		}
         if (title.equals(FILTER_MENU_TITLE_GROUP)){
             ArrayList<String> titles = dialog.getSelectedItemTitles();
             if (titles.size() == 0) return;
+            // ALWAYS GET THE FIRST ELEMENT (SHOULD BE ALWAYS ONE)
             this.groupingKey =  titles.get(0);
         }
         this.actualiseListViewInBackground();
@@ -1104,8 +1173,9 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
     * This will clear the database at first and than add new attacks.
     * @param createNetworks number of networks to create
     * @param attacksPerNetwork maximal number of attack per network
+    * @param maxMessagePerAttack maximal number of messages per attack
     * */
-	private void addRecordToDB( int createNetworks, int attacksPerNetwork) {
+	private void addRecordToDB( int createNetworks, int attacksPerNetwork, int maxMessagePerAttack) {
         if ((dbh.getRecordCount() > 0)) dbh.clearData();
 
 		Calendar cal = Calendar.getInstance();
@@ -1131,7 +1201,7 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
             String protocolName = this.getResources().getStringArray(
                     R.array.protocols)[protocolIndex];
 
-            int numOfAttackPerNetwork = (Math.abs(random.nextInt()) % attacksPerNetwork) + 1;
+            int numOfAttackPerNetwork = (Math.abs(random.nextInt()) % Math.max(1, attacksPerNetwork + 1));
 
             NetworkRecord network = new NetworkRecord();
             network.setBssid(bssidName);
@@ -1152,10 +1222,11 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
             // ATTACKS PER NETWORK
             for (int attackNumber = 0; attackNumber < numOfAttackPerNetwork; attackNumber++) {
 
-                int numRecordsPerAttack = (Math.abs(random.nextInt()) % 5) + 1;
-                /*
-                * ADD A ATTACK*/
+                int numRecordsPerAttack = (Math.abs(random.nextInt()) % (Math.max( maxMessagePerAttack, 1))) + 1;
+
+                if (maxMessagePerAttack <= 0) numRecordsPerAttack = 0;
 
+                /* ADD A ATTACK*/
                 AttackRecord attack = new AttackRecord();
                 attack.setAttack_id(attackId);
 
@@ -1167,7 +1238,7 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
 
                 dbh.addAttackRecord(attack);
 
-                // RECORDS PER ATTACK
+                // MESSAGE PER ATTACK
                 for (int messageID = attackId; messageID < attackId + numRecordsPerAttack; messageID++) {
                     MessageRecord message = new MessageRecord();
                     message.setId(messageID);

+ 5 - 5
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;
@@ -1707,11 +1707,11 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
         return "" + hour + ":00";
     }
 
-    static final DateFormat dateFormat = new SimpleDateFormat("d.M.yy");
+    //static final DateFormat dateFormat = new SimpleDateFormat("d.M.yy");
 
     /**Returns a date as a formated string
      * @param timeStamp date
-     * @return String date format (d.M.yy)*/
+     * @return String date format is localised*/
     @SuppressLint("SimpleDateFormat")
     private String getDateAsDayString(long timeStamp) {
         try {
@@ -1730,7 +1730,7 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
      * @return String date format (H:mm  dd/MM/yyyy)*/
     private String getDateAsString(long timeStamp) {
         try {
-            DateFormat sdf = new SimpleDateFormat("H:mm  dd/MM/yyyy");
+            DateFormat sdf = new SimpleDateFormat("H:mm  dd.MM.yyyy");
             Date netDate = (new Date(timeStamp));
             return sdf.format(netDate);
         } catch (Exception ex) {
@@ -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;
 
 /**

+ 2 - 2
src/de/tudarmstadt/informatik/hostage/ui2/helper/ColorSequenceGenerator.java

@@ -14,12 +14,12 @@ public class ColorSequenceGenerator {
 			reverseIndex = (reverseIndex << 1) | (index & 1);
 			index >>= 1;
 		}
-		float hue = ((float)reverseIndex / (float)(1 << BIT_COUNT) + 0.6f) % 1.0f;
+		float hue = ((float)reverseIndex / (float)(1 << BIT_COUNT) + 0.0f) % 1.0f;
 
 		float[] hsv = new float[3];
 		hsv[0] = 360.0f * hue;
 		hsv[1] = 0.7f; // not fully saturated
-		hsv[2] = 1.0f;
+		hsv[2] = 0.9f;
 
 		return Color.HSVToColor(hsv);
 	}

+ 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), ssid(2), _bssid(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;
+	}
+
+}