// get issues by project
  public List<Bug> getAllIssueByProject(long projectid) {
    List<Bug> bugs = new ArrayList<>();
    String sql =
        "SELECT * FROM "
            + Bugtracking.IssueEntry.TABLE_ISSUE
            + " WHERE "
            + Bugtracking.IssueEntry.PROID
            + " = "
            + projectid;

    Cursor cursor = this.db.rawQuery(sql, null);
    if (cursor.moveToFirst()) {
      do {
        Bug bug = new Bug();
        bug.setDevId(cursor.getInt(cursor.getColumnIndex(Bugtracking.IssueEntry.DEVID)));
        bug.setTitle(cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.TITLE)));
        bug.setCategory(cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.CATEGORY)));
        bug.setDate(cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.DATE)));
        bug.setDescription(
            cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.DESCRIPTION)));
        bug.setEffects(cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.EFFECT)));
        bug.setPriority(cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.PRIORITY)));
        bug.setProjectId(cursor.getInt(cursor.getColumnIndex(Bugtracking.IssueEntry.PROID)));
        bug.setReference(cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.REFERENCE)));
        bug.setReproduce(cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.REPRODUCE)));
        bug.setState(cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.STATE)));
        bugs.add(bug);
      } while (cursor.moveToNext());
    }
    return bugs;
  }
  public Bug getBugById(long id) {

    String sql =
        "SELECT * FROM "
            + Bugtracking.IssueEntry.TABLE_ISSUE
            + " WHERE "
            + Bugtracking.IssueEntry.ID
            + " = "
            + id;
    Cursor cursor = this.db.rawQuery(sql, null);

    if (cursor != null) {
      cursor.moveToFirst();
    }
    Bug bug = new Bug();
    bug.setId(cursor.getInt(cursor.getColumnIndex(Bugtracking.IssueEntry.ID)));
    bug.setDevId(cursor.getInt(cursor.getColumnIndex(Bugtracking.IssueEntry.DEVID)));
    bug.setTitle(cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.TITLE)));
    bug.setCategory(cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.CATEGORY)));
    bug.setDate(cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.DATE)));
    bug.setDescription(cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.DESCRIPTION)));
    bug.setEffects(cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.EFFECT)));
    bug.setPriority(cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.PRIORITY)));
    bug.setProjectId(cursor.getInt(cursor.getColumnIndex(Bugtracking.IssueEntry.PROID)));
    bug.setReference(cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.REFERENCE)));
    bug.setReproduce(cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.REPRODUCE)));
    bug.setState(cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.STATE)));

    return bug;
  }