public void announce(long anId) { // // Announcement an = announcementMgr.getAnnouncementById(anId); try { String tweet = ""; Message msg = msgMgr.generateMessageForAnnouncement(anId); tweet = msg.getTextWithParametersAdded(); announcementMgr.updateSetMessage(anId, tweet, msg.getId()); logger.info(getScreenName() + " is tweeting :" + tweet); tweet(tweet); } catch (TwitterException e) { ExceptionUtil.getInstance().handleError(e); } catch (Exception e) { logger.error("Error", e); } }
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); } }