private String ensureSuffix(String text) { String positiveSuffix = getFormatInternal().getPositiveSuffix(); String negativeSuffix = getFormatInternal().getNegativeSuffix(); if (positiveSuffix.equals(negativeSuffix)) { String trimmedSuffix = StringUtility.trim(positiveSuffix); if (text.endsWith(trimmedSuffix)) { text = StringUtility.trim(text.substring(0, text.length() - trimmedSuffix.length())); } text = StringUtility.concatenateTokens(text, positiveSuffix); } return text; }
/** * Creates a select statement by merging the given entity contributions with the given base statement. This builder's * {@link #getWhereConstraints()} are added as well. * * @param stm * base statement with <selectParts/>, <fromParts/>, <whereParts/>, <groupByParts/> or * <havingParts/> place holders. * @param contributions * entity contributions that are used to replace markers in the given base statement. * @return Returns given base statement having all place holders replaced by the given entity contributions. * @since 3.8.1 */ public String createSelectStatement(String stm, EntityContribution... contributions) { EntityContribution mergedContribution = new EntityContribution(); if (contributions != null) { for (EntityContribution c : contributions) { mergedContribution.add(c); } } String where = StringUtility.trim(getWhereConstraints()); if (StringUtility.hasText(where)) { if (where.toUpperCase().startsWith("AND")) { where = where.substring(3); } mergedContribution.getWhereParts().add(where); } return createEntityPart(stm, false, mergedContribution); }
private String cleanupText(String text) { if (text == null) { return null; } HtmlHelper htmlHelper = BEANS.get(HtmlHelper.class); boolean containsHtml = text.contains("<html>"); if (containsHtml) { //Ignore every html code by removing all the tags to make sure it does not destroy the layout String textWithoutHtml = htmlHelper.toPlainText(text); if (textWithoutHtml != null) { text = textWithoutHtml; } } text = StringUtility.removeNewLines(text); text = StringUtility.trim(text); if (!containsHtml) { //If the text is not surrounded by <html> the html must not be interpreted but displayed as it is including all the html tags. text = htmlHelper.escape(text); } text = replaceSpaces(text); return text; }