コード例 #1
0
ファイル: CommentAPI.java プロジェクト: hybridbpm/hybridbpm
 public Comment saveComment(Comment comment) {
   try (ODatabaseDocumentTx database = getODatabaseDocumentTx()) {
     ODocument doc = new ODocument("Comment");
     doc.field("body", comment.getBody());
     doc.field("parent", comment.getParent() != null ? new ORecordId(comment.getParent()) : null);
     doc.field("case", comment.getCase() != null ? new ORecordId(comment.getCase()) : null);
     doc.field("task", comment.getTask() != null ? new ORecordId(comment.getTask()) : null);
     doc.field("createDate", new Date());
     doc.field("creator", user.getId());
     doc = doc.save();
     database.commit();
     return oDocumentToComment(doc);
   }
 }