122123124125126127128129130131132
} catch( RuntimeException e ) { if( transaction.isActive() ) { transaction.rollback(); } if( e instanceof EntityStoreException ) { throw (EntityStoreException) e; }
8485868788899091929394
entity.setProperty(DEVICE_REG_ID_PROPERTY, regId); datastore.put(entity); txn.commit(); } finally { if (txn.isActive()) { txn.rollback(); } } } /**
109110111112113114115116117118119
datastore.delete(key); } txn.commit(); } finally { if (txn.isActive()) { txn.rollback(); } } } /**
131132133134135136137138139140141
entity.setProperty(DEVICE_REG_ID_PROPERTY, newId); datastore.put(entity); txn.commit(); } finally { if (txn.isActive()) { txn.rollback(); } } } /**
154155156157158159160161162163164
devices.add(device); } txn.commit(); } finally { if (txn.isActive()) { txn.rollback(); } } return devices; }
175176177178179180181182183184185
logger.fine("Total number of devices: " + total); txn.commit(); return total; } finally { if (txn.isActive()) { txn.rollback(); } } } private static Entity findDeviceByRegId(String regId) {
217218219220221222223224225226227
encodedKey = KeyFactory.keyToString(key); logger.fine("multicast key: " + encodedKey); txn.commit(); } finally { if (txn.isActive()) { txn.rollback(); } } return encodedKey; }
245246247248249250251252253254255
} catch (EntityNotFoundException e) { logger.severe("No entity for key " + key); return Collections.emptyList(); } finally { if (txn.isActive()) { txn.rollback(); } } } /**
275276277278279280281282283284285
entity.setProperty(MULTICAST_REG_IDS_PROPERTY, devices); datastore.put(entity); txn.commit(); } finally { if (txn.isActive()) { txn.rollback(); } } } /**
295296297298299300301302303304305
Key key = KeyFactory.stringToKey(encodedKey); datastore.delete(key); txn.commit(); } finally { if (txn.isActive()) { txn.rollback(); } } } public static void deleteAllEntities(String type) {