Search in sources :

Example 6 with CommentEntity

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;
}
Also used : CommentEntity(com.ushahidi.android.app.entities.CommentEntity)

Example 7 with CommentEntity

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;
}
Also used : ArrayList(java.util.ArrayList) CommentEntity(com.ushahidi.android.app.entities.CommentEntity)

Aggregations

CommentEntity (com.ushahidi.android.app.entities.CommentEntity)7 ArrayList (java.util.ArrayList)2 JsonSyntaxException (com.google.gson.JsonSyntaxException)1 Util (com.ushahidi.android.app.util.Util)1 UshahidiException (com.ushahidi.java.sdk.UshahidiException)1