Example #1
0
  /* (non-Javadoc)
   * @see ca.cmput301f13t03.adventure_datetime.model.IWebStorage#putComment(ca.cmput301f13t03.adventure_datetime.model.Comment)
   */
  @Override
  public boolean putComment(Comment comment) throws Exception {
    Index index =
        new Index.Builder(comment)
            .index(_index)
            .type("comment")
            .id(comment.getId().toString())
            .build();
    JestResult result = execute(index);

    boolean success = result.isSucceeded();
    if (comment.getImage() != null) {
      success &= putImage(comment.getImage());
    }

    return success;
  }
Example #2
0
  private void mapImagesToComments(List<Comment> comments) throws Exception {
    if (comments == null || comments.size() == 0) return;

    // Get the thumbnails
    List<UUID> ids = new ArrayList<UUID>();
    for (Comment c : comments) {
      ids.add(c.getId());
    }

    List<Image> images = getImages(ids);

    for (Image i : images) {
      for (Comment c : comments) {
        if (c.getId().equals(i.getId())) {
          c.setImage(i.getEncodedBitmap());
          break;
        }
      }
    }
  }