Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/news-android.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid-Development <david-dev@live.de>2021-09-26 14:46:04 +0300
committerDavid Luhmer <david-dev@live.de>2021-09-26 14:46:04 +0300
commitd8016f5aff5fe117cf59968c0a0d07441d487d09 (patch)
tree8e3e4c205cf2b14522ceed86f4f87d8e7469f537 /News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model
parentc53b8cd55e0216bd8d1434b831ced227a2962b03 (diff)
update comments
Signed-off-by: David Luhmer <david-dev@live.de>
Diffstat (limited to 'News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model')
-rw-r--r--News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/CurrentRssItemViewDao.java78
-rw-r--r--News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/DaoMaster.java8
-rw-r--r--News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/Feed.java16
-rw-r--r--News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/FeedDao.java193
-rw-r--r--News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/FolderDao.java63
-rw-r--r--News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/RssItemDao.java172
6 files changed, 303 insertions, 227 deletions
diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/CurrentRssItemViewDao.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/CurrentRssItemViewDao.java
index 399bfbc0..1bd9c10f 100644
--- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/CurrentRssItemViewDao.java
+++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/CurrentRssItemViewDao.java
@@ -9,27 +9,26 @@ import de.greenrobot.dao.Property;
import de.greenrobot.dao.internal.DaoConfig;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
-/**
+/**
* DAO for table "CURRENT_RSS_ITEM_VIEW".
-*/
+ */
public class CurrentRssItemViewDao extends AbstractDao<CurrentRssItemView, Long> {
public static final String TABLENAME = "CURRENT_RSS_ITEM_VIEW";
- /**
- * Properties of entity CurrentRssItemView.<br/>
- * Can be used for QueryBuilder and for referencing column names.
- */
- 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");
- };
+ /** @inheritdoc */
+ @Override
+ protected void bindValues(SQLiteStatement stmt, CurrentRssItemView entity) {
+ stmt.clearBindings();
+ stmt.bindLong(1, entity.getId());
+ stmt.bindLong(2, entity.getRssItemId());
+ }
public CurrentRssItemViewDao(DaoConfig config) {
super(config);
}
-
+
public CurrentRssItemViewDao(DaoConfig config, DaoSession daoSession) {
super(config, daoSession);
}
@@ -48,50 +47,71 @@ public class CurrentRssItemViewDao extends AbstractDao<CurrentRssItemView, Long>
db.execSQL(sql);
}
- @Override
- protected void bindValues(SQLiteStatement stmt, CurrentRssItemView entity) {
- stmt.clearBindings();
- stmt.bindLong(1, entity.getId());
- stmt.bindLong(2, entity.getRssItemId());
- }
-
+ /**
+ * @inheritdoc
+ */
@Override
public Long readKey(Cursor cursor, int offset) {
- return cursor.getLong(offset);
- }
+ return cursor.getLong(offset + 0);
+ }
+ /**
+ * @inheritdoc
+ */
@Override
public CurrentRssItemView readEntity(Cursor cursor, int offset) {
- return new CurrentRssItemView( //
- cursor.getLong(offset), // id
- cursor.getLong(offset + 1) // rssItemId
+ CurrentRssItemView entity = new CurrentRssItemView( //
+ cursor.getLong(offset + 0), // id
+ cursor.getLong(offset + 1) // rssItemId
);
+ return entity;
}
-
+
+ /**
+ * @inheritdoc
+ */
@Override
public void readEntity(Cursor cursor, CurrentRssItemView entity, int offset) {
- entity.setId(cursor.getLong(offset));
+ entity.setId(cursor.getLong(offset + 0));
entity.setRssItemId(cursor.getLong(offset + 1));
- }
-
+ }
+
+ /**
+ * @inheritdoc
+ */
@Override
protected Long updateKeyAfterInsert(CurrentRssItemView entity, long rowId) {
entity.setId(rowId);
return rowId;
}
-
+
+ /**
+ * @inheritdoc
+ */
@Override
public Long getKey(CurrentRssItemView entity) {
- if(entity != null) {
+ if (entity != null) {
return entity.getId();
} else {
return null;
}
}
+ /**
+ * @inheritdoc
+ */
@Override
protected boolean isEntityUpdateable() {
return true;
}
+
+ /**
+ * Properties of entity CurrentRssItemView.<br/>
+ * Can be used for QueryBuilder and for referencing column names.
+ */
+ 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");
+ }
}
diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/DaoMaster.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/DaoMaster.java
index 90b1e600..53b01a3f 100644
--- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/DaoMaster.java
+++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/DaoMaster.java
@@ -10,11 +10,11 @@ import de.greenrobot.dao.AbstractDaoMaster;
import de.greenrobot.dao.identityscope.IdentityScopeType;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
-/**
- * Master of DAO (schema version 7): knows all DAOs.
-*/
+/**
+ * Master of DAO (schema version 8): knows all DAOs.
+ */
public class DaoMaster extends AbstractDaoMaster {
- public static final int SCHEMA_VERSION = 7;
+ public static final int SCHEMA_VERSION = 8;
/** Creates underlying database table using DAOs. */
public static void createAllTables(SQLiteDatabase db, boolean ifNotExists) {
diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/Feed.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/Feed.java
index eb883555..7e0c7d46 100644
--- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/Feed.java
+++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/Feed.java
@@ -20,6 +20,7 @@ public class Feed {
private String faviconUrl;
private String link;
private String avgColour;
+ private String notificationChannel;
/** Used to resolve relations */
private transient DaoSession daoSession;
@@ -42,13 +43,14 @@ public class Feed {
this.id = id;
}
- public Feed(long id, Long folderId, String feedTitle, String faviconUrl, String link, String avgColour) {
+ public Feed(long id, Long folderId, String feedTitle, String faviconUrl, String link, String avgColour, String notificationChannel) {
this.id = id;
this.folderId = folderId;
this.feedTitle = feedTitle;
this.faviconUrl = faviconUrl;
this.link = link;
this.avgColour = avgColour;
+ this.notificationChannel = notificationChannel;
}
/** called by internal mechanisms, do not call yourself. */
@@ -107,7 +109,17 @@ public class Feed {
this.avgColour = avgColour;
}
- /** To-one relationship, resolved on first access. */
+ public String getNotificationChannel() {
+ return notificationChannel;
+ }
+
+ public void setNotificationChannel(String notificationChannel) {
+ this.notificationChannel = notificationChannel;
+ }
+
+ /**
+ * To-one relationship, resolved on first access.
+ */
public Folder getFolder() {
Long __key = this.folderId;
if (folder__resolvedKey == null || !folder__resolvedKey.equals(__key)) {
diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/FeedDao.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/FeedDao.java
index 18d62970..45cf8e4c 100644
--- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/FeedDao.java
+++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/FeedDao.java
@@ -22,32 +22,6 @@ public class FeedDao extends AbstractDao<Feed, Long> {
public static final String TABLENAME = "FEED";
- /**
- * Properties of entity Feed.<br/>
- * Can be used for QueryBuilder and for referencing column names.
- */
- public static class Properties {
- public final static Property Id = new Property(0, long.class, "id", true, "_id");
- public final static Property FolderId = new Property(1, Long.class, "folderId", false, "FOLDER_ID");
- public final static Property FeedTitle = new Property(2, String.class, "feedTitle", false, "FEED_TITLE");
- 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;
-
- private Query<Feed> folder_FeedListQuery;
-
- public FeedDao(DaoConfig config) {
- super(config);
- }
-
- public FeedDao(DaoConfig config, DaoSession daoSession) {
- super(config, daoSession);
- this.daoSession = daoSession;
- }
-
/** Creates the underlying database table. */
public static void createTable(SQLiteDatabase db, boolean ifNotExists) {
String constraint = ifNotExists? "IF NOT EXISTS ": "";
@@ -57,44 +31,75 @@ public class FeedDao extends AbstractDao<Feed, Long> {
"\"FEED_TITLE\" TEXT NOT NULL ," + // 2: feedTitle
"\"FAVICON_URL\" TEXT," + // 3: faviconUrl
"\"LINK\" TEXT," + // 4: link
- "\"AVG_COLOUR\" TEXT);"); // 5: avgColour
+ "\"AVG_COLOUR\" TEXT," + // 5: avgColour
+ "\"NOTIFICATION_CHANNEL\" TEXT);"); // 6: notificationChannel
// Add Indexes
db.execSQL("CREATE INDEX " + constraint + "IDX_FEED_FOLDER_ID ON FEED" +
" (\"FOLDER_ID\");");
}
- /** Drops the underlying database table. */
- public static void dropTable(SQLiteDatabase db, boolean ifExists) {
- String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"FEED\"";
- db.execSQL(sql);
+ private DaoSession daoSession;
+
+ private Query<Feed> folder_FeedListQuery;
+
+ public FeedDao(DaoConfig config) {
+ super(config);
}
- /** @inheritdoc */
+ public FeedDao(DaoConfig config, DaoSession daoSession) {
+ super(config, daoSession);
+ this.daoSession = daoSession;
+ }
+
+ /**
+ * @inheritdoc
+ */
@Override
protected void bindValues(SQLiteStatement stmt, Feed entity) {
stmt.clearBindings();
stmt.bindLong(1, entity.getId());
-
+
Long folderId = entity.getFolderId();
if (folderId != null) {
stmt.bindLong(2, folderId);
}
stmt.bindString(3, entity.getFeedTitle());
-
+
String faviconUrl = entity.getFaviconUrl();
if (faviconUrl != null) {
stmt.bindString(4, faviconUrl);
}
-
+
String link = entity.getLink();
if (link != null) {
stmt.bindString(5, link);
}
-
+
String avgColour = entity.getAvgColour();
if (avgColour != null) {
stmt.bindString(6, avgColour);
}
+
+ String notificationChannel = entity.getNotificationChannel();
+ if (notificationChannel != null) {
+ stmt.bindString(7, notificationChannel);
+ }
+ }
+
+ /**
+ * Drops the underlying database table.
+ */
+ public static void dropTable(SQLiteDatabase db, boolean ifExists) {
+ String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"FEED\"";
+ db.execSQL(sql);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ @Override
+ public Long readKey(Cursor cursor, int offset) {
+ return cursor.getLong(offset + 0);
}
@Override
@@ -103,37 +108,67 @@ public class FeedDao extends AbstractDao<Feed, Long> {
entity.__setDaoSession(daoSession);
}
- /** @inheritdoc */
- @Override
- public Long readKey(Cursor cursor, int offset) {
- return cursor.getLong(offset);
- }
-
- /** @inheritdoc */
+ /**
+ * @inheritdoc
+ */
@Override
public Feed readEntity(Cursor cursor, int offset) {
- return new Feed( //
- cursor.getLong(offset), // id
- cursor.isNull(offset + 1) ? null : cursor.getLong(offset + 1), // folderId
- cursor.getString(offset + 2), // feedTitle
- cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // faviconUrl
- cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // link
- cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5) // avgColour
+ Feed entity = new Feed( //
+ cursor.getLong(offset + 0), // id
+ cursor.isNull(offset + 1) ? null : cursor.getLong(offset + 1), // folderId
+ cursor.getString(offset + 2), // feedTitle
+ cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // faviconUrl
+ cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // link
+ cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // avgColour
+ cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6) // notificationChannel
);
+ return entity;
}
-
- /** @inheritdoc */
+
+ /**
+ * @inheritdoc
+ */
@Override
public void readEntity(Cursor cursor, Feed entity, int offset) {
- entity.setId(cursor.getLong(offset));
+ entity.setId(cursor.getLong(offset + 0));
entity.setFolderId(cursor.isNull(offset + 1) ? null : cursor.getLong(offset + 1));
entity.setFeedTitle(cursor.getString(offset + 2));
entity.setFaviconUrl(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
entity.setLink(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
entity.setAvgColour(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
- }
-
- /** @inheritdoc */
+ entity.setNotificationChannel(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
+ }
+
+ public Feed loadDeep(Long key) {
+ assertSinglePk();
+ if (key == null) {
+ return null;
+ }
+
+ StringBuilder builder = new StringBuilder(getSelectDeep());
+ builder.append("WHERE ");
+ SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
+ String sql = builder.toString();
+
+ String[] keyArray = new String[]{key.toString()};
+ Cursor cursor = db.rawQuery(sql, keyArray);
+
+ try {
+ boolean available = cursor.moveToFirst();
+ if (!available) {
+ return null;
+ } else if (!cursor.isLast()) {
+ throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
+ }
+ return loadCurrentDeep(cursor, true);
+ } finally {
+ cursor.close();
+ }
+ }
+
+ /**
+ * @inheritdoc
+ */
@Override
protected Long updateKeyAfterInsert(Feed entity, long rowId) {
entity.setId(rowId);
@@ -185,7 +220,7 @@ public class FeedDao extends AbstractDao<Feed, Long> {
}
return selectDeep;
}
-
+
protected Feed loadCurrentDeep(Cursor cursor, boolean lock) {
Feed entity = loadCurrent(cursor, 0, lock);
int offset = getAllColumns().length;
@@ -193,38 +228,30 @@ public class FeedDao extends AbstractDao<Feed, Long> {
Folder folder = loadCurrentOther(daoSession.getFolderDao(), cursor, offset);
entity.setFolder(folder);
- return entity;
+ return entity;
}
- public Feed loadDeep(Long key) {
- assertSinglePk();
- if (key == null) {
- return null;
- }
-
- StringBuilder builder = new StringBuilder(getSelectDeep());
- builder.append("WHERE ");
- SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
- String sql = builder.toString();
-
- String[] keyArray = new String[] { key.toString() };
-
- try (Cursor cursor = db.rawQuery(sql, keyArray)) {
- boolean available = cursor.moveToFirst();
- if (!available) {
- return null;
- } else if (!cursor.isLast()) {
- throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
- }
- return loadCurrentDeep(cursor, true);
- }
+ /**
+ * Properties of entity Feed.<br/>
+ * Can be used for QueryBuilder and for referencing column names.
+ */
+ public static class Properties {
+ public final static Property Id = new Property(0, long.class, "id", true, "_id");
+ public final static Property FolderId = new Property(1, Long.class, "folderId", false, "FOLDER_ID");
+ public final static Property FeedTitle = new Property(2, String.class, "feedTitle", false, "FEED_TITLE");
+ 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");
+ public final static Property NotificationChannel = new Property(6, String.class, "notificationChannel", false, "NOTIFICATION_CHANNEL");
}
-
- /** Reads all available rows from the given cursor and returns a list of new ImageTO objects. */
+
+ /**
+ * 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<Feed>(count);
-
+
if (cursor.moveToFirst()) {
if (identityScope != null) {
identityScope.lock();
diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/FolderDao.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/FolderDao.java
index f43b942d..b17151d0 100644
--- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/FolderDao.java
+++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/database/model/FolderDao.java
@@ -9,21 +9,18 @@ import de.greenrobot.dao.Property;
import de.greenrobot.dao.internal.DaoConfig;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
-/**
+/**
* DAO for table "FOLDER".
-*/
+ */
public class FolderDao extends AbstractDao<Folder, Long> {
public static final String TABLENAME = "FOLDER";
- /**
- * Properties of entity Folder.<br/>
- * Can be used for QueryBuilder and for referencing column names.
- */
- 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");
- };
+ /** @inheritdoc */
+ @Override
+ public Long readKey(Cursor cursor, int offset) {
+ return cursor.getLong(offset + 0);
+ }
private DaoSession daoSession;
@@ -31,7 +28,7 @@ public class FolderDao extends AbstractDao<Folder, Long> {
public FolderDao(DaoConfig config) {
super(config);
}
-
+
public FolderDao(DaoConfig config, DaoSession daoSession) {
super(config, daoSession);
this.daoSession = daoSession;
@@ -67,34 +64,44 @@ public class FolderDao extends AbstractDao<Folder, Long> {
/** @inheritdoc */
@Override
- public Long readKey(Cursor cursor, int offset) {
- return cursor.getLong(offset);
- }
-
- /** @inheritdoc */
- @Override
public Folder readEntity(Cursor cursor, int offset) {
- return new Folder( //
- cursor.getLong(offset), // id
- cursor.getString(offset + 1) // label
+ Folder entity = new Folder( //
+ cursor.getLong(offset + 0), // id
+ cursor.getString(offset + 1) // label
);
+ return entity;
}
-
- /** @inheritdoc */
+
+ /**
+ * @inheritdoc
+ */
@Override
public void readEntity(Cursor cursor, Folder entity, int offset) {
- entity.setId(cursor.getLong(offset));
+ entity.setId(cursor.getLong(offset + 0));
entity.setLabel(cursor.getString(offset + 1));
- }
-
- /** @inheritdoc */
+ }
+
+ /**
+ * Properties of entity Folder.<br/>
+ * Can be used for QueryBuilder and for referencing column names.
+ */
+ 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");
+ }
+
+ /**
+ * @inheritdoc
+ */
@Override
protected Long updateKeyAfterInsert(Folder entity, long rowId) {
entity.setId(rowId);
return rowId;
}
-
- /** @inheritdoc */
+
+ /**
+ * @inheritdoc
+ */
@Override
public Long getKey(Folder entity) {
if(entity != null) {
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 38f19bc8..d6ba7141 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
@@ -15,39 +15,18 @@ import de.greenrobot.dao.query.Query;
import de.greenrobot.dao.query.QueryBuilder;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
-/**
+/**
* DAO for table "RSS_ITEM".
-*/
+ */
public class RssItemDao extends AbstractDao<RssItem, Long> {
public static final String TABLENAME = "RSS_ITEM";
- /**
- * Properties of entity RssItem.<br/>
- * Can be used for QueryBuilder and for referencing column names.
- */
- public static class Properties {
- public final static Property Id = new Property(0, long.class, "id", true, "_id");
- public final static Property FeedId = new Property(1, long.class, "feedId", false, "FEED_ID");
- public final static Property Link = new Property(2, String.class, "link", false, "LINK");
- public final static Property Title = new Property(3, String.class, "title", false, "TITLE");
- public final static Property Body = new Property(4, String.class, "body", false, "BODY");
- public final static Property Read = new Property(5, Boolean.class, "read", false, "READ");
- public final static Property Starred = new Property(6, Boolean.class, "starred", false, "STARRED");
- 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 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");
- public final static Property MediaThumbnail = new Property(17, String.class, "mediaThumbnail", false, "MEDIA_THUMBNAIL");
- public final static Property MediaDescription = new Property(18, String.class, "mediaDescription", false, "MEDIA_DESCRIPTION");
- public final static Property Rtl = new Property(19, Boolean.class, "rtl", false, "RTL");
- };
+ /** @inheritdoc */
+ @Override
+ public Long readKey(Cursor cursor, int offset) {
+ return cursor.getLong(offset + 0);
+ }
private DaoSession daoSession;
@@ -56,7 +35,7 @@ public class RssItemDao extends AbstractDao<RssItem, Long> {
public RssItemDao(DaoConfig config) {
super(config);
}
-
+
public RssItemDao(DaoConfig config, DaoSession daoSession) {
super(config, daoSession);
this.daoSession = daoSession;
@@ -187,25 +166,19 @@ public class RssItemDao extends AbstractDao<RssItem, Long> {
/** @inheritdoc */
@Override
- public Long readKey(Cursor cursor, int offset) {
- return cursor.getLong(offset);
- }
-
- /** @inheritdoc */
- @Override
public RssItem readEntity(Cursor cursor, int offset) {
- return new RssItem( //
- cursor.getLong(offset), // id
- cursor.getLong(offset + 1), // feedId
- cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // link
- cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // title
- cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // body
- cursor.isNull(offset + 5) ? null : cursor.getShort(offset + 5) != 0, // read
- cursor.isNull(offset + 6) ? null : cursor.getShort(offset + 6) != 0, // starred
- cursor.getString(offset + 7), // author
- cursor.getString(offset + 8), // guid
- cursor.getString(offset + 9), // guidHash
- cursor.getString(offset + 10), // fingerprint
+ RssItem entity = new RssItem( //
+ cursor.getLong(offset + 0), // id
+ cursor.getLong(offset + 1), // feedId
+ cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // link
+ cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // title
+ cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // body
+ cursor.isNull(offset + 5) ? null : cursor.getShort(offset + 5) != 0, // read
+ cursor.isNull(offset + 6) ? null : cursor.getShort(offset + 6) != 0, // starred
+ cursor.getString(offset + 7), // author
+ cursor.getString(offset + 8), // guid
+ cursor.getString(offset + 9), // guidHash
+ 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
@@ -216,12 +189,13 @@ public class RssItemDao extends AbstractDao<RssItem, Long> {
cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // mediaDescription
cursor.isNull(offset + 19) ? null : cursor.getShort(offset + 19) != 0 // rtl
);
+ return entity;
}
-
+
/** @inheritdoc */
@Override
public void readEntity(Cursor cursor, RssItem entity, int offset) {
- entity.setId(cursor.getLong(offset));
+ entity.setId(cursor.getLong(offset + 0));
entity.setFeedId(cursor.getLong(offset + 1));
entity.setLink(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
entity.setTitle(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
@@ -241,16 +215,47 @@ public class RssItemDao extends AbstractDao<RssItem, Long> {
entity.setMediaThumbnail(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17));
entity.setMediaDescription(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18));
entity.setRtl(cursor.isNull(offset + 19) ? null : cursor.getShort(offset + 19) != 0);
- }
-
- /** @inheritdoc */
+ }
+
+ public RssItem loadDeep(Long key) {
+ assertSinglePk();
+ if (key == null) {
+ return null;
+ }
+
+ StringBuilder builder = new StringBuilder(getSelectDeep());
+ builder.append("WHERE ");
+ SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
+ String sql = builder.toString();
+
+ String[] keyArray = new String[]{key.toString()};
+ Cursor cursor = db.rawQuery(sql, keyArray);
+
+ try {
+ boolean available = cursor.moveToFirst();
+ if (!available) {
+ return null;
+ } else if (!cursor.isLast()) {
+ throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
+ }
+ return loadCurrentDeep(cursor, true);
+ } finally {
+ cursor.close();
+ }
+ }
+
+ /**
+ * @inheritdoc
+ */
@Override
protected Long updateKeyAfterInsert(RssItem entity, long rowId) {
entity.setId(rowId);
return rowId;
}
-
- /** @inheritdoc */
+
+ /**
+ * @inheritdoc
+ */
@Override
public Long getKey(RssItem entity) {
if(entity != null) {
@@ -301,42 +306,47 @@ public class RssItemDao extends AbstractDao<RssItem, Long> {
int offset = getAllColumns().length;
Feed feed = loadCurrentOther(daoSession.getFeedDao(), cursor, offset);
- if(feed != null) {
+ if (feed != null) {
entity.setFeed(feed);
}
- return entity;
+ return entity;
}
- public RssItem loadDeep(Long key) {
- assertSinglePk();
- if (key == null) {
- return null;
- }
-
- StringBuilder builder = new StringBuilder(getSelectDeep());
- builder.append("WHERE ");
- SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
- String sql = builder.toString();
-
- String[] keyArray = new String[] { key.toString() };
-
- try (Cursor cursor = db.rawQuery(sql, keyArray)) {
- boolean available = cursor.moveToFirst();
- if (!available) {
- return null;
- } else if (!cursor.isLast()) {
- throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
- }
- return loadCurrentDeep(cursor, true);
- }
+ /**
+ * Properties of entity RssItem.<br/>
+ * Can be used for QueryBuilder and for referencing column names.
+ */
+ public static class Properties {
+ public final static Property Id = new Property(0, long.class, "id", true, "_id");
+ public final static Property FeedId = new Property(1, long.class, "feedId", false, "FEED_ID");
+ public final static Property Link = new Property(2, String.class, "link", false, "LINK");
+ public final static Property Title = new Property(3, String.class, "title", false, "TITLE");
+ public final static Property Body = new Property(4, String.class, "body", false, "BODY");
+ public final static Property Read = new Property(5, Boolean.class, "read", false, "READ");
+ public final static Property Starred = new Property(6, Boolean.class, "starred", false, "STARRED");
+ 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 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");
+ public final static Property MediaThumbnail = new Property(17, String.class, "mediaThumbnail", false, "MEDIA_THUMBNAIL");
+ public final static Property MediaDescription = new Property(18, String.class, "mediaDescription", false, "MEDIA_DESCRIPTION");
+ public final static Property Rtl = new Property(19, Boolean.class, "rtl", false, "RTL");
}
-
- /** Reads all available rows from the given cursor and returns a list of new ImageTO objects. */
+
+ /**
+ * 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<RssItem>(count);
-
+
if (cursor.moveToFirst()) {
if (identityScope != null) {
identityScope.lock();