diff options
Diffstat (limited to 'src/net/cbaines/suma/DataManager.java')
-rw-r--r-- | src/net/cbaines/suma/DataManager.java | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/src/net/cbaines/suma/DataManager.java b/src/net/cbaines/suma/DataManager.java index 984832c..97ebb54 100644 --- a/src/net/cbaines/suma/DataManager.java +++ b/src/net/cbaines/suma/DataManager.java @@ -72,7 +72,6 @@ public class DataManager { private static DatabaseHelper helper; private static Dao<BusRoute, Integer> busRouteDao; - private static Dao<Bus, Integer> busDao; private static Dao<BusStop, String> busStopDao; static void createDatabase(final Context context) throws SQLException, IOException { @@ -618,32 +617,12 @@ public class DataManager { Bus bus; if (stopObj.has("vehicle")) { busID = stopObj.getString("vehicle"); + } - QueryBuilder<Bus, Integer> busQueryBuilder = busDao.queryBuilder(); - busQueryBuilder.where().eq(Bus.ID_FIELD_NAME, busID); - PreparedQuery<Bus> busPreparedQuery = busQueryBuilder.prepare(); - - bus = busDao.queryForFirst(busPreparedQuery); + bus = new Bus(busID, route, dir); - if (bus == null) { - bus = new Bus(busID, route, dir); - bus.destination = destStop; - bus.destinationString = destString; - busDao.create(bus); - } else { - bus.destination = destStop; - bus.destinationString = destString; - bus.route = route; - bus.direction = dir; - busDao.update(bus); - } - - } else { - bus = new Bus(null, route, dir); - bus.destinationString = destString; - bus.destination = destStop; - busDao.create(bus); - } + bus.destinationString = destString; + bus.destination = destStop; stop = new Stop(bus, busStop, calender.getTime(), now, live); |