Add support for fingerprint field of RssItem (owncloud/news#465)
This commit is contained in:
parent
b95d4c10cd
commit
ab70b71613
12 changed files with 115 additions and 126 deletions
|
@ -26,7 +26,7 @@ public class DatabaseOrmGenerator {
|
|||
public static void main(String[] args) throws Exception {
|
||||
List<SchemaVersion> versions = new ArrayList<>();
|
||||
|
||||
versions.add(new Version4(true));
|
||||
versions.add(new Version5(true));
|
||||
|
||||
validateSchemas(versions);
|
||||
|
||||
|
|
|
@ -4,19 +4,14 @@ import de.greenrobot.daogenerator.Entity;
|
|||
import de.greenrobot.daogenerator.Property;
|
||||
import de.greenrobot.daogenerator.Schema;
|
||||
|
||||
/**
|
||||
* Version 1 of the Schema definition
|
||||
*
|
||||
* @author Jeremy
|
||||
*/
|
||||
public class Version4 extends SchemaVersion {
|
||||
public class Version5 extends SchemaVersion {
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param current
|
||||
*/
|
||||
public Version4(boolean current) {
|
||||
public Version5(boolean current) {
|
||||
super(current);
|
||||
|
||||
Schema schema = getSchema();
|
||||
|
@ -28,7 +23,7 @@ public class Version4 extends SchemaVersion {
|
|||
*/
|
||||
@Override
|
||||
public int getVersionNumber() {
|
||||
return 4;
|
||||
return 5;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused") // id properties (folderId, etc.) need to be in database
|
||||
|
@ -64,6 +59,7 @@ public class Version4 extends SchemaVersion {
|
|||
rssItem.addStringProperty("author").notNull();
|
||||
rssItem.addStringProperty("guid").notNull();
|
||||
rssItem.addStringProperty("guidHash").notNull();
|
||||
rssItem.addStringProperty("fingerprint");
|
||||
rssItem.addBooleanProperty("read_temp");
|
||||
rssItem.addBooleanProperty("starred_temp");
|
||||
rssItem.addDateProperty("lastModified");
|
|
@ -5,7 +5,7 @@ package de.luhmer.owncloudnewsreader.database.model;
|
|||
// KEEP INCLUDES - put your custom includes here
|
||||
// KEEP INCLUDES END
|
||||
/**
|
||||
* Entity mapped to table CURRENT_RSS_ITEM_VIEW.
|
||||
* Entity mapped to table "CURRENT_RSS_ITEM_VIEW".
|
||||
*/
|
||||
public class CurrentRssItemView {
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import de.greenrobot.dao.internal.DaoConfig;
|
|||
|
||||
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
|
||||
/**
|
||||
* DAO for table CURRENT_RSS_ITEM_VIEW.
|
||||
* DAO for table "CURRENT_RSS_ITEM_VIEW".
|
||||
*/
|
||||
public class CurrentRssItemViewDao extends AbstractDao<CurrentRssItemView, Long> {
|
||||
|
||||
|
@ -23,7 +23,7 @@ public class CurrentRssItemViewDao extends AbstractDao<CurrentRssItemView, Long>
|
|||
public static class Properties {
|
||||
public final static Property Id = new Property(0, long.class, "id", true, "_id");
|
||||
public final static Property RssItemId = new Property(1, long.class, "rssItemId", false, "RSS_ITEM_ID");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public CurrentRssItemViewDao(DaoConfig config) {
|
||||
|
@ -37,14 +37,14 @@ public class CurrentRssItemViewDao extends AbstractDao<CurrentRssItemView, 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 + "'CURRENT_RSS_ITEM_VIEW' (" + //
|
||||
"'_id' INTEGER PRIMARY KEY NOT NULL ," + // 0: id
|
||||
"'RSS_ITEM_ID' INTEGER NOT NULL );"); // 1: rssItemId
|
||||
db.execSQL("CREATE TABLE " + constraint + "\"CURRENT_RSS_ITEM_VIEW\" (" + //
|
||||
"\"_id\" INTEGER PRIMARY KEY NOT NULL ," + // 0: id
|
||||
"\"RSS_ITEM_ID\" INTEGER NOT NULL );"); // 1: rssItemId
|
||||
}
|
||||
|
||||
/** Drops the underlying database table. */
|
||||
public static void dropTable(SQLiteDatabase db, boolean ifExists) {
|
||||
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "'CURRENT_RSS_ITEM_VIEW'";
|
||||
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"CURRENT_RSS_ITEM_VIEW\"";
|
||||
db.execSQL(sql);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@ import de.greenrobot.dao.identityscope.IdentityScopeType;
|
|||
|
||||
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
|
||||
/**
|
||||
* Master of DAO (schema version 4): knows all DAOs.
|
||||
* Master of DAO (schema version 5): knows all DAOs.
|
||||
*/
|
||||
public class DaoMaster extends AbstractDaoMaster {
|
||||
public static final int SCHEMA_VERSION = 4;
|
||||
public static final int SCHEMA_VERSION = 5;
|
||||
|
||||
/** Creates underlying database table using DAOs. */
|
||||
public static void createAllTables(SQLiteDatabase db, boolean ifNotExists) {
|
||||
|
|
|
@ -9,7 +9,7 @@ import de.greenrobot.dao.DaoException;
|
|||
// KEEP INCLUDES - put your custom includes here
|
||||
// KEEP INCLUDES END
|
||||
/**
|
||||
* Entity mapped to table FEED.
|
||||
* Entity mapped to table "FEED".
|
||||
*/
|
||||
public class Feed {
|
||||
|
||||
|
@ -154,10 +154,7 @@ public class Feed {
|
|||
rssItemList = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient call for {@link de.greenrobot.dao.AbstractDao#delete(Object)}.
|
||||
* Entity must attached to an entity context.
|
||||
*/
|
||||
/** Convenient call for {@link AbstractDao#delete(Object)}. Entity must attached to an entity context. */
|
||||
public void delete() {
|
||||
if (myDao == null) {
|
||||
throw new DaoException("Entity is detached from DAO context");
|
||||
|
@ -165,10 +162,7 @@ public class Feed {
|
|||
myDao.delete(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient call for {@link de.greenrobot.dao.AbstractDao#update(Object)}.
|
||||
* Entity must attached to an entity context.
|
||||
*/
|
||||
/** Convenient call for {@link AbstractDao#update(Object)}. Entity must attached to an entity context. */
|
||||
public void update() {
|
||||
if (myDao == null) {
|
||||
throw new DaoException("Entity is detached from DAO context");
|
||||
|
@ -176,10 +170,7 @@ public class Feed {
|
|||
myDao.update(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient call for {@link de.greenrobot.dao.AbstractDao#refresh(Object)}.
|
||||
* Entity must attached to an entity context.
|
||||
*/
|
||||
/** Convenient call for {@link AbstractDao#refresh(Object)}. Entity must attached to an entity context. */
|
||||
public void refresh() {
|
||||
if (myDao == null) {
|
||||
throw new DaoException("Entity is detached from DAO context");
|
||||
|
|
|
@ -16,7 +16,7 @@ import de.greenrobot.dao.query.QueryBuilder;
|
|||
|
||||
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
|
||||
/**
|
||||
* DAO for table FEED.
|
||||
* DAO for table "FEED".
|
||||
*/
|
||||
public class FeedDao extends AbstractDao<Feed, Long> {
|
||||
|
||||
|
@ -33,7 +33,7 @@ public class FeedDao extends AbstractDao<Feed, Long> {
|
|||
public final static Property FaviconUrl = new Property(3, String.class, "faviconUrl", false, "FAVICON_URL");
|
||||
public final static Property Link = new Property(4, String.class, "link", false, "LINK");
|
||||
public final static Property AvgColour = new Property(5, String.class, "avgColour", false, "AVG_COLOUR");
|
||||
}
|
||||
};
|
||||
|
||||
private DaoSession daoSession;
|
||||
|
||||
|
@ -51,21 +51,21 @@ public class FeedDao extends AbstractDao<Feed, 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 + "'FEED' (" + //
|
||||
"'_id' INTEGER PRIMARY KEY NOT NULL ," + // 0: id
|
||||
"'FOLDER_ID' INTEGER," + // 1: folderId
|
||||
"'FEED_TITLE' TEXT NOT NULL ," + // 2: feedTitle
|
||||
"'FAVICON_URL' TEXT," + // 3: faviconUrl
|
||||
"'LINK' TEXT," + // 4: link
|
||||
"'AVG_COLOUR' TEXT);"); // 5: avgColour
|
||||
db.execSQL("CREATE TABLE " + constraint + "\"FEED\" (" + //
|
||||
"\"_id\" INTEGER PRIMARY KEY NOT NULL ," + // 0: id
|
||||
"\"FOLDER_ID\" INTEGER," + // 1: folderId
|
||||
"\"FEED_TITLE\" TEXT NOT NULL ," + // 2: feedTitle
|
||||
"\"FAVICON_URL\" TEXT," + // 3: faviconUrl
|
||||
"\"LINK\" TEXT," + // 4: link
|
||||
"\"AVG_COLOUR\" TEXT);"); // 5: avgColour
|
||||
// Add Indexes
|
||||
db.execSQL("CREATE INDEX " + constraint + "IDX_FEED_FOLDER_ID ON FEED" +
|
||||
" (FOLDER_ID);");
|
||||
" (\"FOLDER_ID\");");
|
||||
}
|
||||
|
||||
/** Drops the underlying database table. */
|
||||
public static void dropTable(SQLiteDatabase db, boolean ifExists) {
|
||||
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "'FEED'";
|
||||
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"FEED\"";
|
||||
db.execSQL(sql);
|
||||
}
|
||||
|
||||
|
@ -180,7 +180,7 @@ public class FeedDao extends AbstractDao<Feed, Long> {
|
|||
builder.append(',');
|
||||
SqlUtils.appendColumns(builder, "T0", daoSession.getFolderDao().getAllColumns());
|
||||
builder.append(" FROM FEED T");
|
||||
builder.append(" LEFT JOIN FOLDER T0 ON T.'FOLDER_ID'=T0.'_id'");
|
||||
builder.append(" LEFT JOIN FOLDER T0 ON T.\"FOLDER_ID\"=T0.\"_id\"");
|
||||
builder.append(' ');
|
||||
selectDeep = builder.toString();
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ public class FeedDao extends AbstractDao<Feed, Long> {
|
|||
/** Reads all available rows from the given cursor and returns a list of new ImageTO objects. */
|
||||
public List<Feed> loadAllDeepFromCursor(Cursor cursor) {
|
||||
int count = cursor.getCount();
|
||||
List<Feed> list = new ArrayList<>(count);
|
||||
List<Feed> list = new ArrayList<Feed>(count);
|
||||
|
||||
if (cursor.moveToFirst()) {
|
||||
if (identityScope != null) {
|
||||
|
|
|
@ -9,7 +9,7 @@ import de.greenrobot.dao.DaoException;
|
|||
// KEEP INCLUDES - put your custom includes here
|
||||
// KEEP INCLUDES END
|
||||
/**
|
||||
* Entity mapped to table FOLDER.
|
||||
* Entity mapped to table "FOLDER".
|
||||
*/
|
||||
public class Folder {
|
||||
|
||||
|
@ -86,10 +86,7 @@ public class Folder {
|
|||
feedList = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient call for {@link de.greenrobot.dao.AbstractDao#delete(Object)}.
|
||||
* Entity must attached to an entity context.
|
||||
*/
|
||||
/** Convenient call for {@link AbstractDao#delete(Object)}. Entity must attached to an entity context. */
|
||||
public void delete() {
|
||||
if (myDao == null) {
|
||||
throw new DaoException("Entity is detached from DAO context");
|
||||
|
@ -97,10 +94,7 @@ public class Folder {
|
|||
myDao.delete(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient call for {@link de.greenrobot.dao.AbstractDao#update(Object)}.
|
||||
* Entity must attached to an entity context.
|
||||
*/
|
||||
/** Convenient call for {@link AbstractDao#update(Object)}. Entity must attached to an entity context. */
|
||||
public void update() {
|
||||
if (myDao == null) {
|
||||
throw new DaoException("Entity is detached from DAO context");
|
||||
|
@ -108,10 +102,7 @@ public class Folder {
|
|||
myDao.update(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient call for {@link de.greenrobot.dao.AbstractDao#refresh(Object)}.
|
||||
* Entity must attached to an entity context.
|
||||
*/
|
||||
/** Convenient call for {@link AbstractDao#refresh(Object)}. Entity must attached to an entity context. */
|
||||
public void refresh() {
|
||||
if (myDao == null) {
|
||||
throw new DaoException("Entity is detached from DAO context");
|
||||
|
|
|
@ -10,7 +10,7 @@ import de.greenrobot.dao.internal.DaoConfig;
|
|||
|
||||
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
|
||||
/**
|
||||
* DAO for table FOLDER.
|
||||
* DAO for table "FOLDER".
|
||||
*/
|
||||
public class FolderDao extends AbstractDao<Folder, Long> {
|
||||
|
||||
|
@ -23,7 +23,7 @@ public class FolderDao extends AbstractDao<Folder, Long> {
|
|||
public static class Properties {
|
||||
public final static Property Id = new Property(0, long.class, "id", true, "_id");
|
||||
public final static Property Label = new Property(1, String.class, "label", false, "LABEL");
|
||||
}
|
||||
};
|
||||
|
||||
private DaoSession daoSession;
|
||||
|
||||
|
@ -40,14 +40,14 @@ public class FolderDao extends AbstractDao<Folder, 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 + "'FOLDER' (" + //
|
||||
"'_id' INTEGER PRIMARY KEY NOT NULL ," + // 0: id
|
||||
"'LABEL' TEXT NOT NULL );"); // 1: label
|
||||
db.execSQL("CREATE TABLE " + constraint + "\"FOLDER\" (" + //
|
||||
"\"_id\" INTEGER PRIMARY KEY NOT NULL ," + // 0: id
|
||||
"\"LABEL\" TEXT NOT NULL );"); // 1: label
|
||||
}
|
||||
|
||||
/** Drops the underlying database table. */
|
||||
public static void dropTable(SQLiteDatabase db, boolean ifExists) {
|
||||
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "'FOLDER'";
|
||||
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"FOLDER\"";
|
||||
db.execSQL(sql);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import de.luhmer.owncloudnewsreader.adapter.HasId;
|
|||
// KEEP INCLUDES - put your custom includes here
|
||||
// KEEP INCLUDES END
|
||||
/**
|
||||
* Entity mapped to table RSS_ITEM.
|
||||
* Entity mapped to table "RSS_ITEM".
|
||||
*/
|
||||
public class RssItem implements HasId<Long> {
|
||||
|
||||
|
@ -25,6 +25,7 @@ public class RssItem implements HasId<Long> {
|
|||
private String guid;
|
||||
/** Not-null value. */
|
||||
private String guidHash;
|
||||
private String fingerprint;
|
||||
private Boolean read_temp;
|
||||
private Boolean starred_temp;
|
||||
private java.util.Date lastModified;
|
||||
|
@ -52,7 +53,7 @@ public class RssItem implements HasId<Long> {
|
|||
this.id = id;
|
||||
}
|
||||
|
||||
public RssItem(long id, long feedId, String link, String title, String body, Boolean read, Boolean starred, String author, String guid, String guidHash, Boolean read_temp, Boolean starred_temp, java.util.Date lastModified, java.util.Date pubDate, String enclosureLink, String enclosureMime) {
|
||||
public RssItem(long id, long feedId, String link, String title, String body, Boolean read, Boolean starred, String author, String guid, String guidHash, String fingerprint, Boolean read_temp, Boolean starred_temp, java.util.Date lastModified, java.util.Date pubDate, String enclosureLink, String enclosureMime) {
|
||||
this.id = id;
|
||||
this.feedId = feedId;
|
||||
this.link = link;
|
||||
|
@ -63,6 +64,7 @@ public class RssItem implements HasId<Long> {
|
|||
this.author = author;
|
||||
this.guid = guid;
|
||||
this.guidHash = guidHash;
|
||||
this.fingerprint = fingerprint;
|
||||
this.read_temp = read_temp;
|
||||
this.starred_temp = starred_temp;
|
||||
this.lastModified = lastModified;
|
||||
|
@ -163,6 +165,14 @@ public class RssItem implements HasId<Long> {
|
|||
this.guidHash = guidHash;
|
||||
}
|
||||
|
||||
public String getFingerprint() {
|
||||
return fingerprint;
|
||||
}
|
||||
|
||||
public void setFingerprint(String fingerprint) {
|
||||
this.fingerprint = fingerprint;
|
||||
}
|
||||
|
||||
public Boolean getRead_temp() {
|
||||
return read_temp;
|
||||
}
|
||||
|
@ -239,10 +249,7 @@ public class RssItem implements HasId<Long> {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient call for {@link de.greenrobot.dao.AbstractDao#delete(Object)}.
|
||||
* Entity must attached to an entity context.
|
||||
*/
|
||||
/** Convenient call for {@link AbstractDao#delete(Object)}. Entity must attached to an entity context. */
|
||||
public void delete() {
|
||||
if (myDao == null) {
|
||||
throw new DaoException("Entity is detached from DAO context");
|
||||
|
@ -250,10 +257,7 @@ public class RssItem implements HasId<Long> {
|
|||
myDao.delete(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient call for {@link de.greenrobot.dao.AbstractDao#update(Object)}.
|
||||
* Entity must attached to an entity context.
|
||||
*/
|
||||
/** Convenient call for {@link AbstractDao#update(Object)}. Entity must attached to an entity context. */
|
||||
public void update() {
|
||||
if (myDao == null) {
|
||||
throw new DaoException("Entity is detached from DAO context");
|
||||
|
@ -261,10 +265,7 @@ public class RssItem implements HasId<Long> {
|
|||
myDao.update(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient call for {@link de.greenrobot.dao.AbstractDao#refresh(Object)}.
|
||||
* Entity must attached to an entity context.
|
||||
*/
|
||||
/** Convenient call for {@link AbstractDao#refresh(Object)}. Entity must attached to an entity context. */
|
||||
public void refresh() {
|
||||
if (myDao == null) {
|
||||
throw new DaoException("Entity is detached from DAO context");
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -71,6 +71,7 @@ public class InsertItemIntoDatabase implements IHandleJsonObject {
|
|||
rssItem.setFeedId(e.optLong("feedId"));
|
||||
rssItem.setGuid(guid);
|
||||
rssItem.setGuidHash(e.optString("guidHash"));
|
||||
rssItem.setFingerprint(e.optString("fingerprint"));
|
||||
rssItem.setBody(content);
|
||||
rssItem.setLastModified(new Date(e.optLong("lastModified")));
|
||||
rssItem.setRead(!e.optBoolean("unread"));
|
||||
|
|
Loading…
Reference in a new issue