")
- .append("Dear " + name)
- .append(",
")
- .append(fromFullName).append(" has invited you to " + vreName + ", you can find a brief description below:")
- .append("
")
- .append("
").append(vreDescription)
- .append("
")
- .append("
To accept the invite just follow this link: " + linkToAcceptInvite)
- .append("
")
- .append("")
- .append("Please note: if you do not have an account yet, sign up first: " + linkToCreateAccount)
- .append("")
- .append("
");
- return body.toString();
-
- }
-
- /**
- * Convert html into simple text
- *
- */
- protected static String convertHTML2Text(String html) {
- if (html == null) {
- return null;
- }
- String removedMarkup = html.replaceAll("&", "&");
- removedMarkup = removedMarkup.replaceAll(">", ">");
- removedMarkup = removedMarkup.replaceAll("<", "<");
- String text = removedMarkup;
- try {
- Document document = Jsoup.parse(removedMarkup);
- Element body = document.body();
- text = buildStringFromNode(body).toString();
- }
- catch (Exception e) {
- _log.error("While converting HTML into text: " +e.getMessage());
- return removedMarkup;
- }
- return text;
- }
-
- private static StringBuffer buildStringFromNode(Node node) {
- StringBuffer buffer = new StringBuffer();
-
- if (node instanceof TextNode) {
- TextNode textNode = (TextNode) node;
- buffer.append(textNode.text().trim());
- }
-
- for (Node childNode : node.childNodes()) {
- buffer.append(buildStringFromNode(childNode));
- }
-
- if (node instanceof Element) {
- Element element = (Element) node;
- String tagName = element.tagName();
- if ("p".equals(tagName) || "br".equals(tagName) || "div".equals(tagName) || "h1".equals(tagName) || "h2".equals(tagName) || "h3".equals(tagName) || "h4".equals(tagName)) {
- buffer.append("\n");
- }
- }
-
- return buffer;
- }
-
+
private static ArrayList