/** * @param uri * @return * @throws org.bsc.maven.reporting.AbstractConfluenceMojo.ProcessUriException */ private String processUri(java.net.URI uri, Charset charset) throws ProcessUriException { try { return toString(Site.processUri(uri), charset); } catch (Exception ex) { throw new ProcessUriException("error reading content!", ex); } }
protected <T extends Site.Page> Page generateChild( Confluence confluence, T child, String spaceKey, String parentPageTitle, String titlePrefix) { java.net.URI source = child.getUri(getProject(), getFileExt()); getLog() .info( String.format( "generateChild spacekey=[%s] parentPageTtile=[%s]\n%s", spaceKey, parentPageTitle, child.toString())); try { if (!isSnapshot() && isRemoveSnapshots()) { final String snapshot = titlePrefix.concat("-SNAPSHOT"); boolean deleted = ConfluenceUtils.removePage(confluence, spaceKey, parentPageTitle, snapshot); if (deleted) { getLog().info(String.format("Page [%s] has been removed!", snapshot)); } } final String pageName = String.format("%s - %s", titlePrefix, child.getName()); Page p = ConfluenceUtils.getOrCreatePage(confluence, spaceKey, parentPageTitle, pageName); if (source != null /*&& source.isFile() && source.exists() */) { final MiniTemplator t = new MiniTemplator.Builder() .setSkipUndefinedVars(true) .build(Site.processUri(source), getCharset()); addProperties(t); p.setContent(t.generateOutput()); } p = confluence.storePage(p); for (String label : child.getComputedLabels()) { confluence.addLabelByName(label, Long.parseLong(p.getId())); } child.setName(pageName); return p; } catch (Exception e) { final String msg = "error loading template"; getLog().error(msg, e); // throw new MavenReportException(msg, e); return null; } }