コード例 #1
0
 public MessageResponse getMessageById(String messageId) {
   messageResponse = new MessageResponse();
   MessageDTO messageDTO = messageDao.getMessage(messageId);
   if (messageDTO != null) {
     messageResponse.setMessageId(messageDTO.getMessageId());
     messageResponse.setUsername(messageDTO.getUsername());
     messageResponse.setText(messageDTO.getText());
     messageResponse.setExpirationDate(messageDTO.getExpirationDate());
     return messageResponse;
   } else {
     return null;
   }
 }
コード例 #2
0
 public List<MessageContentResponse> getUnExpiredMessagesByUsername(String username)
     throws Exception {
   List<MessageContentResponse> messageContentResponses = new ArrayList<MessageContentResponse>();
   List<MessageDTO> messages = messageDao.getMessagesByUsername(username);
   if (messages != null) {
     expireMessages(messages);
     for (MessageDTO message : messages) {
       MessageContentResponse messageContentResponse = new MessageContentResponse();
       messageContentResponse.setId(message.getMessageId());
       messageContentResponse.setText(message.getText());
       messageContentResponses.add(messageContentResponse);
     }
   }
   return messageContentResponses;
 }