private void internalAddStatus(Status status) throws IOException {
    XContentBuilder jsonifiedObject;

    jsonifiedObject =
        XContentFactory.jsonBuilder()
            .startObject()
            .field("username", status.getUsername())
            .field("domain", status.getDomain())
            .field("statusDate", status.getStatusDate())
            .field("content", status.getContent())
            .endObject();

    addObject(status.getClass(), status.getStatusId(), jsonifiedObject);
  }
 @Override
 @Async
 public void addStatus(final Status status) {
   try {
     internalAddStatus(status);
   } catch (IOException e) {
     log.error(
         "The status wasn't added to the index: "
             + status.getStatusId()
             + " ["
             + status.toString()
             + "]",
         e);
   }
 }
Esempio n. 3
0
  @Async
  public void sendUserMentionEmail(Status status, User mentionnedUser) {
    if (log.isDebugEnabled()) {
      log.debug(
          "Sending Mention e-mail to User '"
              + mentionnedUser.getLogin()
              + "' with locale : '"
              + locale
              + "'");
    }
    String url =
        tatamiUrl + "/tatami/profile/" + status.getUsername() + "/#/status/" + status.getStatusId();

    Map<String, Object> model = new HashMap<String, Object>();
    model.put("user", mentionnedUser);
    model.put("status", status);
    model.put("statusUrl", url);

    sendTextFromTemplate(mentionnedUser, model, "userMention", this.locale);
  }
 @Override
 public void removeStatus(final Status status) {
   Assert.notNull(status, "status can't be null");
   removeObject(status.getClass(), status.getStatusId());
 }