ResourceType parentType, Confluence confluence)
throws PluginDocGeneratorException {
System.out.println("*** Publishing plugin doc page for " + resourceType + " Resource type to Confluence...");
String pageTitle = getPageTitle(resourceType, parentType);
try {
Page page = getPage(confluence, pageTitle);
if (page == null) {
page = createPage(pageTitle);
} else {
log.warn("Page with title '" + pageTitle + "' already exists - overwriting it...");
}
String parentPageTitle;
if (resourceType.getParentResourceTypes().isEmpty()) {
// root platform or server
parentPageTitle = getPageTitle(plugin);
} else {
if (parentType == null) {
parentType = resourceType.getParentResourceTypes().iterator().next();
}
parentPageTitle = getPageTitle(parentType, null);
}
Page parentPage = getPage(confluence, parentPageTitle);
if (parentPage != null) {
page.setParentId(parentPage.getId());
} else {
log.warn("Parent page [" + parentPageTitle + "] for page [" + pageTitle + "] not found - page will have no parent for now.");
}
File contentFile = getConfluenceResourceTypeOutputFile(outputDir, plugin, resourceType);
page.setContent(getContentAsString(contentFile));