Esempio n. 1
0
  public void reply(long anId, long statusId) throws Exception {

    Announcement an = announcementMgr.getAnnouncementById(anId);

    Announcer customer = announcerMgr.getAnnouncer(an.getCustomerId());

    if (customer == null) {

      throw new Exception("Customer not found for announcement: " + an.getId());
    }
    // Product product = productMgr.getProductById(an.getProductId());
    String cause = announcementMgr.getAnnouncementReasonStatusText(anId);

    // tweey check
    String customerName = customer.getName();
    String tweet = "";
    Message msg = msgMgr.generateMessageForAnnouncement(an.getId());
    tweet = msg.getTextWithParametersAdded();
    announcementMgr.updateSetMessage(an.getId(), tweet, msg.getId());
    //
    // logger.info(getScreenName() + " is following " + customerName +
    // " before replying...");
    // follow(an.getCustomerId());

    try {

      long tweetId = -1;
      logger.info(
          getScreenName()
              + " is replying "
              + customerName
              + " : "
              + tweet
              + "\nBecause of: @"
              + customerName
              + ":"
              + cause);
      tweetId = reply(tweet, statusId);
      announcementMgr.updateSetTweetId(anId, tweetId);

    } catch (TwitterException e) {
      ExceptionUtil.getInstance().handleError(e);
    }
  }