String getErrorPanel(String message) { return RenderUtils.blockError(message, ""); }
public String execute(Map<String, String> macroParams, String body, ConversionContext conversionContext) { String urlPath = macroParams.get("urlPath"); if (StringUtils.isBlank(urlPath)) { return RenderUtils.error( getText("dotbookmarkslink.error.urlpathnotspecified") ); } else { StringBuilder stringBuilder = new StringBuilder(); String url = stringBuilder.append(settingsManager.getGlobalSettings().getBaseUrl()).append(urlPath).toString(); stringBuilder.setLength(0); return stringBuilder .append("<a href=\"") .append(GeneralUtil.htmlEncode(url)) .append("\">") .append(GeneralUtil.htmlEncode(StringUtils.defaultString(macroParams.get("alias"), url))) .append("</a>") .toString(); } }
public String execute(Map<String, String> parameters, String body, ConversionContext conversionContext) { String url = RenderUtils.getParameter(parameters, URL, 0); if (StringUtils.isEmpty(url)) url = StringUtils.strip(body); // Maintained for the old execute method if (StringUtils.isEmpty(url)) return RenderUtils.blockError(getText("macro.error.urlnotspecified"), ""); return renderManager.getEmbeddedHtml(url, parameters); }
public ImagePlaceholder getImagePlaceholder(Map<String, String> parameters, ConversionContext conversionContext) { String url = RenderUtils.getParameter(parameters, URL, 0); return renderManager.getImagePlaceholder(url, parameters); } }
private String getErrorMessageMarkup(String protocol, String twitterUserName, String statusId) { return RenderUtils.blockError( getText( "com.atlassian.confluence.extra.widgetconnector.twitter.single.error", protocol + String.format("://twitter.com/%s/status/%s", twitterUserName, statusId), SINGLE_TWEET_RETRIEVAL_FAILURE_DELAY / DateTimeConstants.MILLIS_PER_MINUTE ), "" ); }
private String createError(RenderContext context, EmbeddedResource resource) { return context.addRenderedContent(RenderUtils.error(context, "Unable to resolve filename '" + resource.getFilename() + "'", originalLink(resource), false)); }
private String getIncludedContent(ContentEntityObject page, I18NBean i18NBean, ConversionContext conversionContext) { try { if (page == null) { return RenderUtils.blockError(i18NBean.getText(RENDER_ERROR_PREFIX), i18NBean.getText(NOT_FOUND_ERROR)); } return fetchPageContent(page, conversionContext); } catch (NotAuthorizedException exception) { // Don't let the user know they weren't allowed to see the page. log.debug(exception.getMessage(), exception); return RenderUtils.blockError(i18NBean.getText(RENDER_ERROR_PREFIX), i18NBean.getText(NOT_FOUND_ERROR)); } catch (IllegalArgumentException exception) { log.debug(exception.getMessage(), exception); return RenderUtils.blockError(i18NBean.getText(RENDER_ERROR_PREFIX), exception.getMessage()); } }
public String renderLink(Link link, RenderContext context) { if (!(context instanceof PageContext)) { return RenderUtils.error(context, "[Unknown context for drawing a link]", null, false);
private String render(final Map<String, String> parameters, final List<Page> children, final ExcerptType excerptType, final int depth) throws MacroExecutionException { metrics.renderOptions(excerptType, depth); if (isNotEmpty(parameters.get("style"))) { String style = parameters.get("style"); if (style.matches("h[1-6]")) { return printChildrenUnderHeadings(children, depth, excerptType, style.charAt(1)); } else { return RenderUtils.blockError( getConfluenceActionSupport().getText("children.error.unable-to-render"), getConfluenceActionSupport().getText( "children.error.unknown-style", new String[]{StringEscapeUtils.escapeHtml4(style)}) ); } } return printChildren(children, depth, excerptType); }
public String createExcerpt(ContentEntityObject contentEntityObject, String outputType) { try { ExcerptConfig excerptConfig = ExcerptConfig.builder().ignoreUserDefinedExcerpt(false).maxBlocks(3).maxCharCount(300).build(); return excerpter.createExcerpt(contentEntityObject, outputType, excerptConfig); } catch (XMLStreamException e) { log.warn("Unable to render excerpt", e); return RenderUtils.error(getI18nBean().getText("advanced.macros.excerpt.error")); } }
public String execute(Map parameters, String body, RenderContext renderContext) throws MacroException { Map<String, Object> contextMap = getDefaultVelocityContext(); PageContext context = (PageContext) renderContext; ContentEntityObject ceo = context.getEntity(); if (ceo instanceof AbstractPage) { AbstractPage page = (AbstractPage) ceo; List previousVersions = pageManager.getVersionHistorySummaries(page); // Remove the current version, that's rendered separately previousVersions.remove(0); contextMap.put("page", page); contextMap.put("previousVersions", previousVersions); contextMap.put("space", page.getSpace()); return getRenderedTemplate(contextMap); } else { return RenderUtils.blockError( getConfluenceActionSupportTextStatic(), StringUtils.EMPTY); } }
return RenderUtils.error(getText("repomacros.plugins-supported.invalidProfileKey", Arrays.asList(GeneralUtil.htmlEncode(profileKey))));
return RenderUtils.blockError(getConfluenceActionSupport().getText("children.error.unable-to-render"), e.getMessage()); depth = Integer.parseInt(parameters.get("depth")); } catch (NumberFormatException e) { return RenderUtils.blockError( getConfluenceActionSupport().getText("children.error.unable-to-render"), getConfluenceActionSupport().getText(
return RenderUtils.error(getText("repomacros.compatibility-matrix.invalidPluginKey", Arrays.asList(GeneralUtil.htmlEncode(pluginKey)))); return RenderUtils.error(getText("repomacros.compatibility-matrix.invalidProfileKey", Arrays.asList(GeneralUtil.htmlEncode(pluginKey)))); return RenderUtils.error(getText("repomacros.compatibility-matrix.invalidStartVersion")); if (BUILD_NOT_FOUND == endBuild) return RenderUtils.error(getText("repomacros.compatibility-matrix.invalidEndVersion")); if (startBuild > endBuild) return RenderUtils.error(getText("repomacros.compatibility-matrix.startBuildLargerThanEndBuild"));
return RenderUtils.blockError("Error in reading index files to generate usage statistics. Please try rebuilding the index.", ""); return RenderUtils.blockError("Error querying popular content usage: " + e, ""); } catch (Exception e) { if (log.isErrorEnabled()) log.error("Unable to render macro.", e); return RenderUtils.blockError("Error in macro: " + e, "");
return RenderUtils.blockError("Error in reading index files to query active users. Please try rebuilding the index.", ""); return RenderUtils.blockError("Error querying popular content usage: " + e, ""); } catch (Exception e) { if (log.isErrorEnabled()) log.error("Unable to render macro.", e); return RenderUtils.blockError("Error in macro: " + e, "");
return RenderUtils.blockError("Error in reading index files to query popular content usage. Please try rebuilding the index.", ""); return RenderUtils.blockError("Error querying popular content usage: " + e, ""); } catch (Exception e) { if (log.isErrorEnabled()) log.error("Unable to render macro.", e); return RenderUtils.blockError("Error in macro: " + e, "");
public String execute(Map parameters, String body, RenderContext renderContext) throws MacroException { if (!(renderContext instanceof PageContext)) return RenderUtils.blockError( getConfluenceActionSuppport().getText("relatedlabels.error.unable-to-render"), getConfluenceActionSuppport().getText("relatedlabels.error.can-only-be-used-in-pages-or-blogposts")
public String execute(Map<String, String> parameters, String body, ConversionContext conversionContext) throws MacroExecutionException { if (isPeopleDirectoryDisabled()) { return RenderUtils.blockError( getText("userlister.notpermitted.viewuserprofile"), ""
@Override public Streamable executeToStream(final Map<String, String> parameters, final Streamable body, final ConversionContext context) throws MacroExecutionException { final String id = parameters.get(PARAM_ID); if (id != null && id.length() > PARAM_ID_MAX_LENGTH) return Streamables.from(blockError(i18nResolver.getText("details.error.id.length"), "")); if (!toBoolean(parameters.get("hidden"))) { pageBuilderService.assembler().resources().requireWebResource(MASTERDETAIL_RESOURCES); return new Streamable() { @Override public void writeTo(final Writer writer) throws IOException { writer.write("<div class='plugin-tabmeta-details'>"); body.writeTo(writer); writer.write("</div>"); } }; } return empty(); }