コード例 #1
0
  public Issue createIssue(Issue p) {

    System.out.println("inside createIssue");
    DBObject doc = IssueConverter.toDBObject(p);
    this.col.insert(doc);
    ObjectId id = (ObjectId) doc.get("_id");
    p.setId(id.toString());
    return p;
  }
コード例 #2
0
  public List<Issue> readAllIssue() {

    System.out.println("inside read all Issue");

    List<Issue> data = new ArrayList<Issue>();
    DBCursor cursor = col.find();
    while (cursor.hasNext()) {
      DBObject doc = cursor.next();
      Issue p = IssueConverter.toIssue(doc);

      System.out.println(p.getId());
      System.out.println(p.getDescription());
      System.out.println(p.getStatus());
      System.out.println(p.getSeverity());
      data.add(p);
    }
    System.out.println("read all success");
    return data;
  }
コード例 #3
0
 public Issue readIssue(Issue p) {
   DBObject query = BasicDBObjectBuilder.start().append("_id", new ObjectId(p.getId())).get();
   DBObject data = this.col.findOne(query);
   return IssueConverter.toIssue(data);
 }
コード例 #4
0
 public void deleteIssue(Issue p) {
   DBObject query = BasicDBObjectBuilder.start().append("_id", new ObjectId(p.getId())).get();
   this.col.remove(query);
 }
コード例 #5
0
 public void updateIssue(Issue p) {
   DBObject query = BasicDBObjectBuilder.start().append("_id", new ObjectId(p.getId())).get();
   this.col.update(query, IssueConverter.toDBObject(p));
 }