예제 #1
0
 public static Comment getFromJson(JSONObject commentJson) throws JSONException {
   Comment comment = new Comment();
   comment.setId(commentJson.getLong(ID));
   comment.setSpotId(commentJson.getLong(SPOT_ID));
   comment.setUserId(commentJson.getLong(USER_ID));
   comment.setComment(commentJson.getString(COMMENT));
   comment.setCreatedAt(commentJson.getLong(CREATED_AT));
   comment.setUserName(commentJson.getString(USER_NAME));
   comment.setUserDp(commentJson.getString(USER_DP));
   return comment;
 }
  public String commentPass() {
    /////// Session
    // Bean/////////////////////////////////////////////////////////////////////////////
    Users e = (Users) ActionContext.getContext().getSession().get("user");
    if (e == null) {
      return ERROR;
    }

    SessionBean session = new SessionBean();
    l1 = session.getLecture(lectureID);
    Comment comment = new Comment();
    comment.setUser(e);
    comment.setComment(this.userComment);
    comment.setLecture(l1);

    Comment = session.findCommentByLectureId(lectureID);
    Comment.add(comment);
    session.updateLecture(l1);
    session.saveComment(comment);

    return SUCCESS;
  }
예제 #3
0
 private Comment cursorToComment(Cursor cursor) {
   Comment comment = new Comment();
   comment.setId(cursor.getLong(0));
   comment.setComment(cursor.getString(1));
   return comment;
 }