use of com.ushahidi.android.app.entities.CommentEntity in project Ushahidi_Android by ushahidi.
the class CommentDao method fetchReportComment.
/*
* (non-Javadoc)
*
* @see
* com.ushahidi.android.app.database.ICommentDao#fetchReportComment(int)
*/
@Override
public List<CommentEntity> fetchReportComment(int reportId) {
listComment = new ArrayList<CommentEntity>();
final String sortOrder = COMMENT_DATE + " DESC";
final String selection = REPORT_ID + " = " + reportId;
cursor = super.query(TABLE, COMMENT_COLUMN, selection, null, sortOrder);
if (cursor != null) {
cursor.moveToFirst();
while (!cursor.isAfterLast()) {
CommentEntity comment = cursorToEntity(cursor);
listComment.add(comment);
cursor.moveToNext();
}
cursor.close();
}
return listComment;
}
use of com.ushahidi.android.app.entities.CommentEntity in project Ushahidi_Android by ushahidi.
the class ListCommentModel method getCommentsByCheckinId.
public List<ListCommentModel> getCommentsByCheckinId(int checkinId) {
final List<ListCommentModel> comments = new ArrayList<ListCommentModel>();
mCommentModel = new ArrayList<CommentEntity>();
mCommentModel = Database.mCommentDao.fetchCheckinComment(checkinId);
if (mCommentModel != null && mCommentModel.size() > 0) {
for (CommentEntity item : mCommentModel) {
ListCommentModel comment = new ListCommentModel();
comment.setDbId(item.getDbId());
comment.setCommentAuthor(item.getCommentAuthor());
comment.setCommentDescription(item.getCommentDescription());
comment.setCheckinId(item.getCheckinId());
comment.setCommentId(item.getCommentId());
comment.setCommentDate(item.getCommentDate());
comments.add(comment);
}
}
return comments;
}
Aggregations