private void loadDbCache(){
  settings=dbHelper.getSharedPreferences();
  Cursor cursor=dataTypeDbAdapter.fetchAll();
  while (cursor.moveToNext()) {
    dataTypeNames.put(getLongFromCursor(cursor,DataTypeDbAdapter.KEY_DATATYPEID),getStringFromCursor(cursor,DataTypeDbAdapter.KEY_DATATYPENAME));
    dataTypeClassNames.put(getLongFromCursor(cursor,DataTypeDbAdapter.KEY_DATATYPEID),getStringFromCursor(cursor,DataTypeDbAdapter.KEY_DATATYPECLASSNAME));
  }
  cursor.close();
  cursor=dataFilterDbAdapter.fetchAll();
  while (cursor.moveToNext()) {
    dataFilterNames.put(getLongFromCursor(cursor,DataFilterDbAdapter.KEY_DATAFILTERID),getStringFromCursor(cursor,DataFilterDbAdapter.KEY_DATAFILTERDISPLAYNAME));
  }
  cursor.close();
  cursor=registeredAppDbAdapter.fetchAll();
  while (cursor.moveToNext()) {
    ModelApplication application=new ModelApplication(getStringFromCursor(cursor,RegisteredAppDbAdapter.KEY_APPNAME),"",R.drawable.icon_application_unknown,getLongFromCursor(cursor,RegisteredAppDbAdapter.KEY_APPID),getBooleanFromCursor(cursor,RegisteredAppDbAdapter.KEY_LOGIN),getStringFromCursor(cursor,RegisteredAppDbAdapter.KEY_USERNAME),getStringFromCursor(cursor,RegisteredAppDbAdapter.KEY_PASSWORD));
    applications.put(application.getDatabaseId(),application);
  }
  cursor.close();
  cursor=registeredEventDbAdapter.fetchAllOrdered();
  while (cursor.moveToNext()) {
    ModelEvent event=new ModelEvent(getLongFromCursor(cursor,RegisteredEventDbAdapter.KEY_EVENTID),getStringFromCursor(cursor,RegisteredEventDbAdapter.KEY_EVENTNAME),"",R.drawable.icon_event_unknown);
    events.put(event.getDatabaseId(),event);
  }
  cursor.close();
  cursor=registeredEventAttributeDbAdapter.fetchAllGlobalAttributes();
  while (cursor.moveToNext()) {
    ModelAttribute attribute=new ModelAttribute(getLongFromCursor(cursor,RegisteredEventAttributeDbAdapter.KEY_EVENTATTRIBUTEID),getLongFromCursor(cursor,RegisteredEventAttributeDbAdapter.KEY_EVENTID),getLongFromCursor(cursor,RegisteredEventAttributeDbAdapter.KEY_DATATYPEID),getStringFromCursor(cursor,RegisteredEventAttributeDbAdapter.KEY_EVENTATTRIBUTENAME),"",R.drawable.icon_attribute_unknown);
    globalAttributes.put(attribute.getDatabaseId(),attribute);
  }
  cursor.close();
  cursor=registeredEventAttributeDbAdapter.fetchAllSpecificAttibutes();
  while (cursor.moveToNext()) {
    ModelAttribute attribute=new ModelAttribute(getLongFromCursor(cursor,RegisteredEventAttributeDbAdapter.KEY_EVENTATTRIBUTEID),getLongFromCursor(cursor,RegisteredEventAttributeDbAdapter.KEY_EVENTID),getLongFromCursor(cursor,RegisteredEventAttributeDbAdapter.KEY_DATATYPEID),getStringFromCursor(cursor,RegisteredEventAttributeDbAdapter.KEY_EVENTATTRIBUTENAME),"",R.drawable.icon_attribute_unknown);
    specificAttributes.put(attribute.getDatabaseId(),attribute);
  }
  cursor.close();
  cursor=registeredActionParameterDbAdapter.fetchAll();
  while (cursor.moveToNext()) {
    ModelParameter parameter=new ModelParameter(getLongFromCursor(cursor,RegisteredActionParameterDbAdapter.KEY_ACTIONPARAMETERID),getLongFromCursor(cursor,RegisteredActionParameterDbAdapter.KEY_ACTIONID),getLongFromCursor(cursor,RegisteredActionParameterDbAdapter.KEY_DATATYPEID),getStringFromCursor(cursor,RegisteredActionParameterDbAdapter.KEY_ACTIONPARAMETERNAME),"");
    parameters.put(parameter.getDatabaseId(),parameter);
  }
  cursor.close();
  cursor=registeredActionDbAdapter.fetchAll();
  while (cursor.moveToNext()) {
    ModelApplication application=applications.get(getLongFromCursor(cursor,RegisteredActionDbAdapter.KEY_APPID));
    long actionID=getLongFromCursor(cursor,RegisteredActionDbAdapter.KEY_ACTIONID);
    ArrayList<ModelParameter> parameterList=new ArrayList<ModelParameter>();
    for (    ModelParameter parameter : parameters.values()) {
      if (parameter.getForeignKeyActionId() == actionID) {
        parameterList.add(parameter);
      }
    }
    ModelAction action=new ModelAction(getStringFromCursor(cursor,RegisteredActionDbAdapter.KEY_ACTIONNAME),"",R.drawable.icon_action_unknown,actionID,application,parameterList);
    actions.put(actionID,action);
  }
  cursor.close();
}

private void loadDbCache ( ) { settings = dbHelper . getSharedPreferences ( ) ; Cursor cursor = dataTypeDbAdapter . fetchAll ( ) ; while ( cursor . moveToNext ( ) ) { dataTypeNames . put ( getLongFromCursor ( cursor , DataTypeDbAdapter . KEY_DATATYPEID ) , getStringFromCursor ( cursor , DataTypeDbAdapter . KEY_DATATYPENAME ) ) ; dataTypeClassNames . put ( getLongFromCursor ( cursor , DataTypeDbAdapter . KEY_DATATYPEID ) , getStringFromCursor ( cursor , DataTypeDbAdapter . KEY_DATATYPECLASSNAME ) ) ; } cursor . close ( ) ; cursor = dataFilterDbAdapter . fetchAll ( ) ; while ( cursor . moveToNext ( ) ) { dataFilterNames . put ( getLongFromCursor ( cursor , DataFilterDbAdapter . KEY_DATAFILTERID ) , getStringFromCursor ( cursor , DataFilterDbAdapter . KEY_DATAFILTERDISPLAYNAME ) ) ; } cursor . close ( ) ; cursor = registeredAppDbAdapter . fetchAll ( ) ; while ( cursor . moveToNext ( ) ) { ModelApplication application = new ModelApplication ( getStringFromCursor ( cursor , RegisteredAppDbAdapter . KEY_APPNAME ) , "" , R . drawable . icon_application_unknown , getLongFromCursor ( cursor , RegisteredAppDbAdapter . KEY_APPID ) , getBooleanFromCursor ( cursor , RegisteredAppDbAdapter . KEY_LOGIN ) , getStringFromCursor ( cursor , RegisteredAppDbAdapter . KEY_USERNAME ) , getStringFromCursor ( cursor , RegisteredAppDbAdapter . KEY_PASSWORD ) ) ; applications . put ( application . getDatabaseId ( ) , application ) ; } cursor . close ( ) ; cursor = registeredEventDbAdapter . fetchAllOrdered ( ) ; while ( cursor . moveToNext ( ) ) { ModelEvent event = new ModelEvent ( getLongFromCursor ( cursor , RegisteredEventDbAdapter . KEY_EVENTID ) , getStringFromCursor ( cursor , RegisteredEventDbAdapter . KEY_EVENTNAME ) , "" , R . drawable . icon_event_unknown ) ; events . put ( event . getDatabaseId ( ) , event ) ; } cursor . close ( ) ; cursor = registeredEventAttributeDbAdapter . fetchAllGlobalAttributes ( ) ; while ( cursor . moveToNext ( ) ) { ModelAttribute attribute = new ModelAttribute ( getLongFromCursor ( cursor , RegisteredEventAttributeDbAdapter . KEY_EVENTATTRIBUTEID ) , getLongFromCursor ( cursor , RegisteredEventAttributeDbAdapter . KEY_EVENTID ) , getLongFromCursor ( cursor , RegisteredEventAttributeDbAdapter . KEY_DATATYPEID ) , getStringFromCursor ( cursor , RegisteredEventAttributeDbAdapter . KEY_EVENTATTRIBUTENAME ) , "" , R . drawable . icon_attribute_unknown ) ; globalAttributes . put ( attribute . getDatabaseId ( ) , attribute ) ; } cursor . close ( ) ; cursor = registeredEventAttributeDbAdapter . fetchAllSpecificAttibutes ( ) ; while ( cursor . moveToNext ( ) ) { ModelAttribute attribute = new ModelAttribute ( getLongFromCursor ( cursor , RegisteredEventAttributeDbAdapter . KEY_EVENTATTRIBUTEID ) , getLongFromCursor ( cursor , RegisteredEventAttributeDbAdapter . KEY_EVENTID ) , getLongFromCursor ( cursor , RegisteredEventAttributeDbAdapter . KEY_DATATYPEID ) , getStringFromCursor ( cursor , RegisteredEventAttributeDbAdapter . KEY_EVENTATTRIBUTENAME ) , "" , R . drawable . icon_attribute_unknown ) ; specificAttributes . put ( attribute . getDatabaseId ( ) , attribute ) ; } cursor . close ( ) ; cursor = registeredActionParameterDbAdapter . fetchAll ( ) ; while ( cursor . moveToNext ( ) ) { ModelParameter parameter = new ModelParameter ( getLongFromCursor ( cursor , RegisteredActionParameterDbAdapter . KEY_ACTIONPARAMETERID ) , getLongFromCursor ( cursor , RegisteredActionParameterDbAdapter . KEY_ACTIONID ) , getLongFromCursor ( cursor , RegisteredActionParameterDbAdapter . KEY_DATATYPEID ) , getStringFromCursor ( cursor , RegisteredActionParameterDbAdapter . KEY_ACTIONPARAMETERNAME ) , "" ) ; parameters . put ( parameter . getDatabaseId ( ) , parameter ) ; } cursor . close ( ) ; cursor = registeredActionDbAdapter . fetchAll ( ) ; while ( cursor . moveToNext ( ) ) { ModelApplication application = applications . get ( getLongFromCursor ( cursor , RegisteredActionDbAdapter . KEY_APPID ) ) ; long actionID = getLongFromCursor ( cursor , RegisteredActionDbAdapter . KEY_ACTIONID ) ; ArrayList < ModelParameter > parameterList = new ArrayList < ModelParameter > ( ) ; for ( ModelParameter parameter : parameters . values ( ) ) { if ( parameter . getForeignKeyActionId ( ) == actionID ) { parameterList . add ( parameter ) ; } } ModelAction action = new ModelAction ( getStringFromCursor ( cursor , RegisteredActionDbAdapter . KEY_ACTIONNAME ) , "" , R . drawable . icon_action_unknown , actionID , application , parameterList ) ; actions . put ( actionID , action ) ; } cursor . close ( ) ; }
load cached data into hash maps
