@Override public Node removeAttr(String key) { ensureAttributes(); return super.removeAttr(key); }
private void updateMentionUidToEmail(SymphonyClient symClient, List<Node> nodesList) { for (Node node : nodesList) { String nodeName = node.nodeName(); if (nodeName.equalsIgnoreCase(NodeTypes.MENTION.toString())) { if (node.attributes().hasKey(AttribTypes.UID.toString())) { String uid = node.attr(AttribTypes.UID.toString()); SymUser user = null; try { user = symClient.getUsersClient().getUserFromId(Long.parseLong(uid)); logger.info("Translated mention uid {} to email {}", uid, user.getEmailAddress()); } catch (UsersClientException e) { logger.error("Could not identify user email from id", e); } if (user != null && user.getEmailAddress() != null) { uid = user.getEmailAddress(); } Attribute emailAttribute = new Attribute(AttribTypes.EMAIL.toString(), uid); node.attributes().put(emailAttribute); node.removeAttr(AttribTypes.UID.toString()); } } updateMentionUidToEmail(symClient, node.childNodes()); } }
private void updateMentionUidToEmail(SymphonyClient symClient, List<Node> nodesList) { for (Node node : nodesList) { String nodeName = node.nodeName(); if (nodeName.equalsIgnoreCase(NodeTypes.MENTION.toString())) { if (node.attributes().hasKey(AttribTypes.UID.toString())) { String uid = node.attr(AttribTypes.UID.toString()); SymUser user = null; try { user = symClient.getUsersClient().getUserFromId(Long.parseLong(uid)); logger.info("Translated mention uid {} to email {}", uid, user.getEmailAddress()); } catch (UsersClientException e) { logger.error("Could not identify user email from id", e); } if (user != null && user.getEmailAddress() != null) { uid = user.getEmailAddress(); } Attribute emailAttribute = new Attribute(AttribTypes.EMAIL.toString(), uid); node.attributes().put(emailAttribute); node.removeAttr(AttribTypes.UID.toString()); } } updateMentionUidToEmail(symClient, node.childNodes()); } }