Esempio n. 1
0
  public static synchronized void dispose() {
    checkInitialization();
    closeDatabase();

    sEntities = null;
    sModelInfo = null;
    sDatabaseHelper = null;

    sIsInitialized = false;

    Log.v("ActiveAndroid disposed. Call initialize to use library.");
  }
Esempio n. 2
0
  public static synchronized Model getEntity(Class<? extends Model> type, long id) {
    checkInitialization();
    for (Model entity : sEntities) {
      if (entity != null
          && entity.getClass() != null
          && entity.getClass() == type
          && entity.getId() != null
          && entity.getId() == id) {

        return entity;
      }
    }

    return null;
  }
Esempio n. 3
0
 public static synchronized SQLiteDatabase openDatabase() {
   if (sDatabaseHelper == null) {
     checkInitialization();
   }
   return sDatabaseHelper.getWritableDatabase();
 }
Esempio n. 4
0
 public static synchronized String getTableName(Class<? extends Model> type) {
   checkInitialization();
   return sModelInfo.getTableInfo(type).getTableName();
 }
Esempio n. 5
0
 public static synchronized TypeSerializer getParserForType(Class<?> type) {
   checkInitialization();
   return sModelInfo.getTypeSerializer(type);
 }
Esempio n. 6
0
 public static synchronized Collection<TableInfo> getTableInfos() {
   checkInitialization();
   return sModelInfo.getTableInfos();
 }
Esempio n. 7
0
 public static synchronized void removeEntity(Model entity) {
   checkInitialization();
   sEntities.remove(entity);
 }
Esempio n. 8
0
 public static synchronized void addEntity(Model entity) {
   checkInitialization();
   sEntities.add(entity);
 }
Esempio n. 9
0
 public static Context getContext() {
   checkInitialization();
   return sContext;
 }
Esempio n. 10
0
 public static synchronized void closeDatabase() {
   checkInitialization();
   sDatabaseHelper.close();
 }