List of usage examples for org.apache.commons.collections4 MapUtils isEmpty
public static boolean isEmpty(final Map<?, ?> map)
From source file:org.pegdown.JshRenderer.java
public void initStylesClassesForTags(String prefix) { String[] tags = new String[] { "h1", "h2", "h3", "h4", "h5", "h6", "h7", "h8", "img", "a", "p", "table", "tr", "td", "th", "tbody", "thead", "br", "li", "ul", "ol", "container", "code", "box", "box-ue", "box-container", "infobox", "infobox-ue", "infobox-container", "warnbox", "warnbox-ue", "warnbox-container", "alertbox", "alertbox-ue", "alertbox-container", "togglerparent", "splitter1", "splitter2" }; for (java.lang.String tag : tags) { String style = (StringUtils.isNotEmpty(prefix) ? prefix : "") + "md-" + tag; HashMap<String, String> tagStyles = allTagStyles.get(tag); if (MapUtils.isEmpty(tagStyles)) { tagStyles = new HashMap<String, String>(); }//from ww w.ja va2 s .com tagStyles.put(style, style); allTagStyles.put(tag, tagStyles); } }
From source file:org.pegdown.JshRenderer.java
public String renderExtendedMarkdownBoxStart(String type, String param) { String res = ""; if ("box".equalsIgnoreCase(type)) { res = "<div class=\"" + genStyleClassesForTag("box") + " " + param + "\">"; } else if ("container".equalsIgnoreCase(type)) { res = "<div class=\"" + genStyleClassesForTag("container") + " md-container-" + param + "\" id=\"md-container-" + param + "\">"; } else if ("box.info".equalsIgnoreCase(type)) { res = renderExtendedMarkdownBoxhtmlStart("info", param); } else if ("box.warn".equalsIgnoreCase(type)) { res = renderExtendedMarkdownBoxhtmlStart("warn", param); } else if ("box.alert".equalsIgnoreCase(type)) { res = renderExtendedMarkdownBoxhtmlStart("alert", param); } else if ("style".equalsIgnoreCase(type) && StringUtils.isNotEmpty(param)) { // do set style for next elements // split params elements:styles String[] params = param.split(":"); String[] tags = new String[] {}; String[] styles = new String[] {}; if (params.length > 0) { tags = params[0].split(" "); if (params.length > 1) { styles = params[1].split(" "); }//w w w . ja v a2 s.c o m } // set styles for all tags for (String tag : tags) { HashMap<String, String> tagStyles = allTagStyles.get(tag); if (MapUtils.isEmpty(tagStyles)) { tagStyles = new HashMap<>(); } for (String style : styles) { tagStyles.put(style, style); } allTagStyles.put(tag, tagStyles); } } return res; }
From source file:org.sigmah.server.servlet.FileServlet.java
/** * Generates a {@link MonitoredPoint} instance from the given {@code properties}.<br> * Following attributes of the generated monitored point are set: * <ul>//w w w . j av a 2 s . c om * <li>{@code label}</li> * <li>{@code expectedDate}</li> * <li>{@code deleted} (set to {@code false})</li> * </ul> * * @param properties * The properties. * @return The monitored point instance. * @throws UnsupportedOperationException * If the {@code properties} cannot be used to generate a <em>valid</em> {@link MonitoredPoint} instance. */ private static MonitoredPoint parseMonitoredPoint(final Map<String, String> properties) { if (MapUtils.isEmpty(properties)) { return null; } final String label = properties.get(FileUploadUtils.MONITORED_POINT_LABEL); final String expectedDateTime = properties.get(FileUploadUtils.MONITORED_POINT_DATE); if (StringUtils.isBlank(label) || StringUtils.isBlank(expectedDateTime)) { return null; } try { final MonitoredPoint monitoredPoint = new MonitoredPoint(); monitoredPoint.setLabel(label); monitoredPoint.setExpectedDate(new Date(Long.valueOf(expectedDateTime))); monitoredPoint.setDeleted(false); return monitoredPoint; } catch (final Exception e) { throw new UnsupportedOperationException( "Error occures while generating monitored point from properties.", e); } }