didSendUserMessage(con, daos, it, envelope, userMessage, MessageDelivery.FAIL);
return;
}
try {
Message message = daos.getMessageAccess().find(con, UUID.fromString(userMessage.getMessageId()));
long twitterId = twitterLinkage.getTwitterId();
Event event = null;
if (userMessage.getEventId() != null)
event = daos.getEventAccess().find(con, userMessage.getEventId());
String url = "http://partake.in/messages/" + userMessage.getId();
String messageBody;
if (event != null) {
int rest = 140;
String format = "[PRTK] %s 「%s」に関する新着メッセージがあります。 : %s";
rest -= Util.codePointCount(format);
rest -= EventDAOFacade.URL_LENGTH;
String title = Util.shorten(event.getTitle(), 30);
rest -= Util.codePointCount(title);
String body = Util.shorten(message.getSubject(), rest);
messageBody = String.format(format, url, title, body);
} else {
int rest = 140;
String format = "[PRTK] %s 新着メッセージがあります。: %s";
rest -= Util.codePointCount(format);
rest -= EventDAOFacade.URL_LENGTH;
String subject = Util.shorten(message.getSubject(), rest);
messageBody = String.format(format, url, subject);
}
PartakeApp.getTwitterService().sendDirectMesage(