private Map<String, String> getMessageMap() { ResourceBundle bundle = ResourceBundle.getBundle("com.gtl.fonecta.configuration"); String host = null; String port; host = bundle.getString("HOST"); port = bundle.getString("HTTP_PORT"); MessageService messageService = new MessageServiceImpl(); Map<String, String> map = new TreeMap<String, String>(); map.put("host", host); map.put("port", port); List<Message> listMessage = messageService.findAll(); for (Message message : listMessage) { if (!map.containsKey("handsetNo")) { map.put("handsetNo", message.getSourceAddr().toString()); } if (map.containsKey("serviceNo")) { map.put("serviceNo", message.getDestAddr().toString()); } String key = message.getMessageType() + message.getMsgId().toString(); String value = "<font face='sans-serif' color='gray'>" + message.getSendTime().toString().replace(".0", "").replace(" ", " ") + " [" + message.getSourceAddr().toString() + "->" + message.getDestAddr().toString() + "]" + "</font> <br> <font face='sans-serif'>" + message.getShortMessage() + ". </font>"; map.put(key, value); } return map; }
@SuppressWarnings("unused") private Map<String, String> getMessageMap(String handsetNo, String serviceNo) { ResourceBundle bundle = ResourceBundle.getBundle("com.gtl.fonecta.configuration"); String host = bundle.getString("HOST"); String port = bundle.getString("HTTP_PORT"); ; Map<String, String> map = new HashMap<String, String>(); map.put("host", host); map.put("port", port); MessageService messageService = new MessageServiceImpl(); List<Message> listMessage = messageService.findBySrcDestAddress(new Long(handsetNo), new Long(serviceNo)); map.put("handsetNo", handsetNo); map.put("serviceNo", serviceNo); for (Message message : listMessage) { String key = message.getMessageType() + message.getMsgId().toString(); String value = "<font face='sans-serif' color='gray'>" + message.getSendTime().toString().replace(".0", "") + " [" + message.getSourceAddr().toString() + "->" + message.getDestAddr().toString() + "]" + "</font> <br> <font face='sans-serif'>" + message.getShortMessage() + ". </font>"; map.put(key, value); } return map; }