/** @inheritdoc */ @Override public Long getKey(FavoItem entity) { if (entity != null) { return entity.getId(); } else { return null; } }
/** @inheritdoc */ @Override protected void readEntity(Cursor cursor, FavoItem entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setType( cursor.isNull(offset + 1) ? null : typeConverter.convertToEntityProperty( ReaderItemType.class, cursor.getString(offset + 1))); entity.setActualId(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); entity.setAddDate( cursor.isNull(offset + 3) ? null : addDateConverter.convertToEntityProperty( Timestamp.class, cursor.getLong(offset + 3))); entity.setUrl(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); entity.setTitle(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); entity.setExcerpt(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); entity.setThumbC(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); entity.setOtherId(cursor.isNull(offset + 8) ? null : cursor.getLong(offset + 8)); entity.setAuthor(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); entity.setAuthorEmail(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); entity.setAuthorUrl(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); entity.setDate( cursor.isNull(offset + 12) ? null : dateConverter.convertToEntityProperty(Timestamp.class, cursor.getLong(offset + 12))); entity.setVotePositive(cursor.isNull(offset + 13) ? null : cursor.getLong(offset + 13)); entity.setVoteNegative(cursor.isNull(offset + 14) ? null : cursor.getLong(offset + 14)); entity.setCommentCount(cursor.isNull(offset + 15) ? null : cursor.getLong(offset + 15)); entity.setThreadId(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); entity.setContent(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); entity.setTextContent(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); entity.setPics(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); entity.setPicFirst(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); entity.setPicCount(cursor.isNull(offset + 21) ? null : cursor.getLong(offset + 21)); entity.setHasGif(cursor.isNull(offset + 22) ? null : cursor.getShort(offset + 22) != 0); entity.setVideoThumbnail(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); entity.setVideoTitle(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); entity.setVideoDescription(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); entity.setVideoDuration(cursor.isNull(offset + 26) ? null : cursor.getFloat(offset + 26)); entity.setVideoLink(cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27)); entity.setVideoPlayer(cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28)); entity.setVideoSource(cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29)); }
/** @inheritdoc */ @Override protected Long updateKeyAfterInsert(FavoItem entity, long rowId) { entity.setId(rowId); return rowId; }
/** @inheritdoc */ @Override protected void bindValues(SQLiteStatement stmt, FavoItem entity) { stmt.clearBindings(); Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } ReaderItemType type = entity.getType(); if (type != null) { stmt.bindString(2, typeConverter.convertToDatabaseValue(type)); } String actualId = entity.getActualId(); if (actualId != null) { stmt.bindString(3, actualId); } Timestamp addDate = entity.getAddDate(); if (addDate != null) { stmt.bindLong(4, addDateConverter.convertToDatabaseValue(addDate)); } String url = entity.getUrl(); if (url != null) { stmt.bindString(5, url); } String title = entity.getTitle(); if (title != null) { stmt.bindString(6, title); } String excerpt = entity.getExcerpt(); if (excerpt != null) { stmt.bindString(7, excerpt); } String thumbC = entity.getThumbC(); if (thumbC != null) { stmt.bindString(8, thumbC); } Long otherId = entity.getOtherId(); if (otherId != null) { stmt.bindLong(9, otherId); } String author = entity.getAuthor(); if (author != null) { stmt.bindString(10, author); } String authorEmail = entity.getAuthorEmail(); if (authorEmail != null) { stmt.bindString(11, authorEmail); } String authorUrl = entity.getAuthorUrl(); if (authorUrl != null) { stmt.bindString(12, authorUrl); } Timestamp date = entity.getDate(); if (date != null) { stmt.bindLong(13, dateConverter.convertToDatabaseValue(date)); } Long votePositive = entity.getVotePositive(); if (votePositive != null) { stmt.bindLong(14, votePositive); } Long voteNegative = entity.getVoteNegative(); if (voteNegative != null) { stmt.bindLong(15, voteNegative); } Long commentCount = entity.getCommentCount(); if (commentCount != null) { stmt.bindLong(16, commentCount); } String threadId = entity.getThreadId(); if (threadId != null) { stmt.bindString(17, threadId); } String content = entity.getContent(); if (content != null) { stmt.bindString(18, content); } String textContent = entity.getTextContent(); if (textContent != null) { stmt.bindString(19, textContent); } String pics = entity.getPics(); if (pics != null) { stmt.bindString(20, pics); } String picFirst = entity.getPicFirst(); if (picFirst != null) { stmt.bindString(21, picFirst); } Long picCount = entity.getPicCount(); if (picCount != null) { stmt.bindLong(22, picCount); } Boolean hasGif = entity.getHasGif(); if (hasGif != null) { stmt.bindLong(23, hasGif ? 1L : 0L); } String videoThumbnail = entity.getVideoThumbnail(); if (videoThumbnail != null) { stmt.bindString(24, videoThumbnail); } String videoTitle = entity.getVideoTitle(); if (videoTitle != null) { stmt.bindString(25, videoTitle); } String videoDescription = entity.getVideoDescription(); if (videoDescription != null) { stmt.bindString(26, videoDescription); } Float videoDuration = entity.getVideoDuration(); if (videoDuration != null) { stmt.bindDouble(27, videoDuration); } String videoLink = entity.getVideoLink(); if (videoLink != null) { stmt.bindString(28, videoLink); } String videoPlayer = entity.getVideoPlayer(); if (videoPlayer != null) { stmt.bindString(29, videoPlayer); } String videoSource = entity.getVideoSource(); if (videoSource != null) { stmt.bindString(30, videoSource); } }