diff options
author | David Development <david-dev@live.de> | 2016-04-17 15:57:40 +0300 |
---|---|---|
committer | David Development <david-dev@live.de> | 2016-04-17 15:57:40 +0300 |
commit | ab70b71613906fbba6fc0acd048b729cd32ec161 (patch) | |
tree | 7ec9ef391c5b0319f600167ab19e4de397b56b66 /News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/RssItemDao.java | |
parent | b95d4c10cd47cce6ceff1ddc5b31bd0a7211f6d4 (diff) |
Add support for fingerprint field of RssItem (owncloud/news#465)
Diffstat (limited to 'News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/RssItemDao.java')
-rw-r--r-- | News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/RssItemDao.java | 107 |
1 files changed, 58 insertions, 49 deletions
diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/RssItemDao.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/RssItemDao.java index f1a57b18..9e8e6ab2 100644 --- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/RssItemDao.java +++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/RssItemDao.java @@ -16,7 +16,7 @@ import de.greenrobot.dao.query.QueryBuilder; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. /** - * DAO for table RSS_ITEM. + * DAO for table "RSS_ITEM". */ public class RssItemDao extends AbstractDao<RssItem, Long> { @@ -37,13 +37,14 @@ public class RssItemDao extends AbstractDao<RssItem, Long> { public final static Property Author = new Property(7, String.class, "author", false, "AUTHOR"); public final static Property Guid = new Property(8, String.class, "guid", false, "GUID"); public final static Property GuidHash = new Property(9, String.class, "guidHash", false, "GUID_HASH"); - public final static Property Read_temp = new Property(10, Boolean.class, "read_temp", false, "READ_TEMP"); - public final static Property Starred_temp = new Property(11, Boolean.class, "starred_temp", false, "STARRED_TEMP"); - public final static Property LastModified = new Property(12, java.util.Date.class, "lastModified", false, "LAST_MODIFIED"); - public final static Property PubDate = new Property(13, java.util.Date.class, "pubDate", false, "PUB_DATE"); - public final static Property EnclosureLink = new Property(14, String.class, "enclosureLink", false, "ENCLOSURE_LINK"); - public final static Property EnclosureMime = new Property(15, String.class, "enclosureMime", false, "ENCLOSURE_MIME"); - } + public final static Property Fingerprint = new Property(10, String.class, "fingerprint", false, "FINGERPRINT"); + public final static Property Read_temp = new Property(11, Boolean.class, "read_temp", false, "READ_TEMP"); + public final static Property Starred_temp = new Property(12, Boolean.class, "starred_temp", false, "STARRED_TEMP"); + public final static Property LastModified = new Property(13, java.util.Date.class, "lastModified", false, "LAST_MODIFIED"); + public final static Property PubDate = new Property(14, java.util.Date.class, "pubDate", false, "PUB_DATE"); + public final static Property EnclosureLink = new Property(15, String.class, "enclosureLink", false, "ENCLOSURE_LINK"); + public final static Property EnclosureMime = new Property(16, String.class, "enclosureMime", false, "ENCLOSURE_MIME"); + }; private DaoSession daoSession; @@ -61,31 +62,32 @@ public class RssItemDao extends AbstractDao<RssItem, Long> { /** Creates the underlying database table. */ public static void createTable(SQLiteDatabase db, boolean ifNotExists) { String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "'RSS_ITEM' (" + // - "'_id' INTEGER PRIMARY KEY NOT NULL ," + // 0: id - "'FEED_ID' INTEGER NOT NULL ," + // 1: feedId - "'LINK' TEXT," + // 2: link - "'TITLE' TEXT," + // 3: title - "'BODY' TEXT," + // 4: body - "'READ' INTEGER," + // 5: read - "'STARRED' INTEGER," + // 6: starred - "'AUTHOR' TEXT NOT NULL ," + // 7: author - "'GUID' TEXT NOT NULL ," + // 8: guid - "'GUID_HASH' TEXT NOT NULL ," + // 9: guidHash - "'READ_TEMP' INTEGER," + // 10: read_temp - "'STARRED_TEMP' INTEGER," + // 11: starred_temp - "'LAST_MODIFIED' INTEGER," + // 12: lastModified - "'PUB_DATE' INTEGER," + // 13: pubDate - "'ENCLOSURE_LINK' TEXT," + // 14: enclosureLink - "'ENCLOSURE_MIME' TEXT);"); // 15: enclosureMime + db.execSQL("CREATE TABLE " + constraint + "\"RSS_ITEM\" (" + // + "\"_id\" INTEGER PRIMARY KEY NOT NULL ," + // 0: id + "\"FEED_ID\" INTEGER NOT NULL ," + // 1: feedId + "\"LINK\" TEXT," + // 2: link + "\"TITLE\" TEXT," + // 3: title + "\"BODY\" TEXT," + // 4: body + "\"READ\" INTEGER," + // 5: read + "\"STARRED\" INTEGER," + // 6: starred + "\"AUTHOR\" TEXT NOT NULL ," + // 7: author + "\"GUID\" TEXT NOT NULL ," + // 8: guid + "\"GUID_HASH\" TEXT NOT NULL ," + // 9: guidHash + "\"FINGERPRINT\" TEXT," + // 10: fingerprint + "\"READ_TEMP\" INTEGER," + // 11: read_temp + "\"STARRED_TEMP\" INTEGER," + // 12: starred_temp + "\"LAST_MODIFIED\" INTEGER," + // 13: lastModified + "\"PUB_DATE\" INTEGER," + // 14: pubDate + "\"ENCLOSURE_LINK\" TEXT," + // 15: enclosureLink + "\"ENCLOSURE_MIME\" TEXT);"); // 16: enclosureMime // Add Indexes db.execSQL("CREATE INDEX " + constraint + "IDX_RSS_ITEM_FEED_ID ON RSS_ITEM" + - " (FEED_ID);"); + " (\"FEED_ID\");"); } /** Drops the underlying database table. */ public static void dropTable(SQLiteDatabase db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "'RSS_ITEM'"; + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"RSS_ITEM\""; db.execSQL(sql); } @@ -113,45 +115,50 @@ public class RssItemDao extends AbstractDao<RssItem, Long> { Boolean read = entity.getRead(); if (read != null) { - stmt.bindLong(6, read ? 1l: 0l); + stmt.bindLong(6, read ? 1L: 0L); } Boolean starred = entity.getStarred(); if (starred != null) { - stmt.bindLong(7, starred ? 1l: 0l); + stmt.bindLong(7, starred ? 1L: 0L); } stmt.bindString(8, entity.getAuthor()); stmt.bindString(9, entity.getGuid()); stmt.bindString(10, entity.getGuidHash()); + String fingerprint = entity.getFingerprint(); + if (fingerprint != null) { + stmt.bindString(11, fingerprint); + } + Boolean read_temp = entity.getRead_temp(); if (read_temp != null) { - stmt.bindLong(11, read_temp ? 1l: 0l); + stmt.bindLong(12, read_temp ? 1L: 0L); } Boolean starred_temp = entity.getStarred_temp(); if (starred_temp != null) { - stmt.bindLong(12, starred_temp ? 1l: 0l); + stmt.bindLong(13, starred_temp ? 1L: 0L); } java.util.Date lastModified = entity.getLastModified(); if (lastModified != null) { - stmt.bindLong(13, lastModified.getTime()); + stmt.bindLong(14, lastModified.getTime()); } java.util.Date pubDate = entity.getPubDate(); if (pubDate != null) { - stmt.bindLong(14, pubDate.getTime()); + stmt.bindLong(15, pubDate.getTime()); } String enclosureLink = entity.getEnclosureLink(); if (enclosureLink != null) { - stmt.bindString(15, enclosureLink); + stmt.bindString(16, enclosureLink); } String enclosureMime = entity.getEnclosureMime(); if (enclosureMime != null) { - stmt.bindString(16, enclosureMime); + stmt.bindString(17, enclosureMime); } } @@ -181,12 +188,13 @@ public class RssItemDao extends AbstractDao<RssItem, Long> { cursor.getString(offset + 7), // author cursor.getString(offset + 8), // guid cursor.getString(offset + 9), // guidHash - cursor.isNull(offset + 10) ? null : cursor.getShort(offset + 10) != 0, // read_temp - cursor.isNull(offset + 11) ? null : cursor.getShort(offset + 11) != 0, // starred_temp - cursor.isNull(offset + 12) ? null : new java.util.Date(cursor.getLong(offset + 12)), // lastModified - cursor.isNull(offset + 13) ? null : new java.util.Date(cursor.getLong(offset + 13)), // pubDate - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // enclosureLink - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15) // enclosureMime + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // fingerprint + cursor.isNull(offset + 11) ? null : cursor.getShort(offset + 11) != 0, // read_temp + cursor.isNull(offset + 12) ? null : cursor.getShort(offset + 12) != 0, // starred_temp + cursor.isNull(offset + 13) ? null : new java.util.Date(cursor.getLong(offset + 13)), // lastModified + cursor.isNull(offset + 14) ? null : new java.util.Date(cursor.getLong(offset + 14)), // pubDate + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // enclosureLink + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16) // enclosureMime ); return entity; } @@ -204,12 +212,13 @@ public class RssItemDao extends AbstractDao<RssItem, Long> { entity.setAuthor(cursor.getString(offset + 7)); entity.setGuid(cursor.getString(offset + 8)); entity.setGuidHash(cursor.getString(offset + 9)); - entity.setRead_temp(cursor.isNull(offset + 10) ? null : cursor.getShort(offset + 10) != 0); - entity.setStarred_temp(cursor.isNull(offset + 11) ? null : cursor.getShort(offset + 11) != 0); - entity.setLastModified(cursor.isNull(offset + 12) ? null : new java.util.Date(cursor.getLong(offset + 12))); - entity.setPubDate(cursor.isNull(offset + 13) ? null : new java.util.Date(cursor.getLong(offset + 13))); - entity.setEnclosureLink(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); - entity.setEnclosureMime(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setFingerprint(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setRead_temp(cursor.isNull(offset + 11) ? null : cursor.getShort(offset + 11) != 0); + entity.setStarred_temp(cursor.isNull(offset + 12) ? null : cursor.getShort(offset + 12) != 0); + entity.setLastModified(cursor.isNull(offset + 13) ? null : new java.util.Date(cursor.getLong(offset + 13))); + entity.setPubDate(cursor.isNull(offset + 14) ? null : new java.util.Date(cursor.getLong(offset + 14))); + entity.setEnclosureLink(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setEnclosureMime(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); } /** @inheritdoc */ @@ -258,7 +267,7 @@ public class RssItemDao extends AbstractDao<RssItem, Long> { builder.append(','); SqlUtils.appendColumns(builder, "T0", daoSession.getFeedDao().getAllColumns()); builder.append(" FROM RSS_ITEM T"); - builder.append(" LEFT JOIN FEED T0 ON T.'FEED_ID'=T0.'_id'"); + builder.append(" LEFT JOIN FEED T0 ON T.\"FEED_ID\"=T0.\"_id\""); builder.append(' '); selectDeep = builder.toString(); } @@ -307,7 +316,7 @@ public class RssItemDao extends AbstractDao<RssItem, Long> { /** Reads all available rows from the given cursor and returns a list of new ImageTO objects. */ public List<RssItem> loadAllDeepFromCursor(Cursor cursor) { int count = cursor.getCount(); - List<RssItem> list = new ArrayList<>(count); + List<RssItem> list = new ArrayList<RssItem>(count); if (cursor.moveToFirst()) { if (identityScope != null) { |