/** * Get the local id * * @param uuid * @return */ public long localIdFromUuid(String uuid) { TodorooCursor<RTYPE> cursor = query(Query.select(AbstractModel.ID_PROPERTY).where(RemoteModel.UUID_PROPERTY.eq(uuid))); try { if (cursor.getCount() == 0) return AbstractModel.NO_ID; cursor.moveToFirst(); return cursor.get(AbstractModel.ID_PROPERTY); } finally { cursor.close(); } }
/** Fetch a model object by UUID */ public TagData fetch(String uuid, Property<?>... properties) { return getFirst(Query.select(properties).where(RemoteModel.UUID_PROPERTY.eq(uuid))); }
/** * Returns cursor to object corresponding to the given identifier * * @param database * @param table name of table * @param properties properties to read * @param id id of item * @return */ protected TodorooCursor<RTYPE> fetchItem(String uuid, Property<?>... properties) { TodorooCursor<RTYPE> cursor = query(Query.select(properties).where(RemoteModel.UUID_PROPERTY.eq(uuid))); cursor.moveToFirst(); return new TodorooCursor<RTYPE>(cursor, properties); }