AeroGear Android Library 1.1.0

org.jboss.aerogear.android.impl.datamanager
Class SQLStore<T>

java.lang.Object
  extended by android.database.sqlite.SQLiteOpenHelper
      extended by org.jboss.aerogear.android.impl.datamanager.SQLStore<T>
All Implemented Interfaces:
Store<T>

public class SQLStore<T>
extends android.database.sqlite.SQLiteOpenHelper
implements Store<T>


Constructor Summary
SQLStore(Class<T> klass, android.content.Context context)
           
SQLStore(Class<T> klass, android.content.Context context, com.google.gson.GsonBuilder builder, IdGenerator generator)
           
 
Method Summary
 void close()
           
 StoreType getType()
          Returns the type of the underlying 'store implementation'
 void onCreate(android.database.sqlite.SQLiteDatabase db)
          
 void onUpgrade(android.database.sqlite.SQLiteDatabase db, int oldVersion, int newVersion)
          
 void open(Callback onReady)
           
 T read(Serializable id)
          Reads a specific object/record from the underlying storage system.
 Collection<T> readAll()
          Reads all the data from the underlying storage system.
 List<T> readWithFilter(ReadFilter filter)
          Search for objects/records from the underlying storage system.
 void remove(Serializable id)
          Removes a specific object/record from the underlying storage system.
 void reset()
          Resets the entire storage system.
 void save(T item)
          Saves the given object in the underlying storage system.
 
Methods inherited from class android.database.sqlite.SQLiteOpenHelper
getDatabaseName, getReadableDatabase, getWritableDatabase, onDowngrade, onOpen
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SQLStore

public SQLStore(Class<T> klass,
                android.content.Context context)

SQLStore

public SQLStore(Class<T> klass,
                android.content.Context context,
                com.google.gson.GsonBuilder builder,
                IdGenerator generator)
Method Detail

getType

public StoreType getType()
Returns the type of the underlying 'store implementation'

Specified by:
getType in interface Store<T>
Returns:
StoreType

readAll

public Collection<T> readAll()
Reads all the data from the underlying storage system.

Specified by:
readAll in interface Store<T>
Returns:
List of T

read

public T read(Serializable id)
Reads a specific object/record from the underlying storage system.

Specified by:
read in interface Store<T>
Parameters:
id - id from the desired object
Returns:
T

readWithFilter

public List<T> readWithFilter(ReadFilter filter)
Search for objects/records from the underlying storage system.

Specified by:
readWithFilter in interface Store<T>
Parameters:
filter - a filter to use to fetch an object
Returns:
List SHOULD NOT BE NULL

save

public void save(T item)
Saves the given object in the underlying storage system.

Specified by:
save in interface Store<T>
Parameters:
item - Object to save

reset

public void reset()
Resets the entire storage system.

Specified by:
reset in interface Store<T>

remove

public void remove(Serializable id)
Removes a specific object/record from the underlying storage system.

Specified by:
remove in interface Store<T>
Parameters:
id - Id of item to remote

onCreate

public void onCreate(android.database.sqlite.SQLiteDatabase db)

Specified by:
onCreate in class android.database.sqlite.SQLiteOpenHelper

onUpgrade

public void onUpgrade(android.database.sqlite.SQLiteDatabase db,
                      int oldVersion,
                      int newVersion)

Specified by:
onUpgrade in class android.database.sqlite.SQLiteOpenHelper

open

public void open(Callback onReady)

close

public void close()
Overrides:
close in class android.database.sqlite.SQLiteOpenHelper

AeroGear Android Library 1.1.0

Copyright © 2013 JBoss by Red Hat. All Rights Reserved.