Skip to content

Commit

Permalink
Fixing Java doc issues
Browse files Browse the repository at this point in the history
  • Loading branch information
astroDEX2020 committed Dec 20, 2017
1 parent e11f15b commit af0250f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ private String getAuthenticationString(String userName, String password) {
new StringBuilder().append(userName).append(":").append(password).toString().getBytes());
}

/**
*
* @param confluenceAuthentication
* @return
*/
private HttpHeaders buildHttpHeaders(final String confluenceAuthentication) {
final HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", String.format("Basic %s", confluenceAuthentication));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ private void init(String args[]) {
* @param password
* @param confluenceURL
* @param spaceKey
* @param htmlDocumentationURL
* @param clientkitURL
* @param title
*/
private void processSwagger2Confluence(String specFile, String parentPageID, String userName, String password,
String confluenceURL, String spaceKey, String title) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,89 +16,76 @@
*/
public class PumlConfluenceUploader {
private static final Logger LOGGER = Logger.getLogger(PumlConfluenceUploader.class.getName());

public PumlConfluenceUploader() {
super();
}

/**
* Title:
* |
* |----- V1.0 Title
* |
* |----- V1.1 Title
*
*
* @param specFile
* @param parentPageID
* @param userName
* @param password
* @param confluenceURL
* @param spaceKey
* @param htmlDocumentationURL
* @param clientkitURL
* @throws IOException
* @param title
* @throws IOException
*/
public void processPuml2Confluence(String specFile, String parentPageID, String userName, String password,
String confluenceURL, String spaceKey,String title) throws IOException {
String confluenceURL, String spaceKey, String title) throws IOException {

File pumlFile = new File(specFile);
if(pumlFile.isFile()){

if (pumlFile.isFile()) {

String pumlContents = FileUtils.readFileToString(pumlFile, "UTF-8");

if(StringUtils.isNotEmpty(pumlContents)
&& pumlContents.contains("@startuml")){
String swaggerPageContent = plantUMLMacroContent(pumlContents);


if (StringUtils.isNotEmpty(pumlContents) && pumlContents.contains("@startuml")) {
String swaggerPageContent = plantUMLMacroContent(pumlContents);

LOGGER.log(Level.INFO, "About to generate Page -->" + title);

ConfluenceVo parentPageVo = createSwaggerPage(new ConfluenceVo(userName, password, confluenceURL, "",
parentPageID, "", title, "0", swaggerPageContent, spaceKey, false));

LOGGER.log(Level.INFO, "Done.... by generating Pages "+ parentPageVo.getPageID());
}
else{

LOGGER.log(Level.INFO, "Done.... by generating Pages " + parentPageVo.getPageID());
} else {
throw new RuntimeException("Puml File provided in input is not valid");
}
}
else{
} else {
throw new RuntimeException("Puml File provided in input is not valid");
}
}

/**
*
* @param swaggerLoctaion
* @param htmlDocumentationURL
* @param clientkitURL
* @param pumlContents
* @return
*/
private String plantUMLMacroContent(String pumlContents) {

StringBuilder macroString = new StringBuilder();
macroString.append("<ac:structured-macro ac:name=\"plantuml\" ac:schema-version=\"1\" ac:macro-id=\"29f50cc-3338-43cc-9f67-15a851eb3417\">")
.append("<ac:parameter ac:name=\"atlassian-macro-output-type\">INLINE</ac:parameter>")
.append("<ac:plain-text-body><![CDATA[")
.append(addEscapeChars(pumlContents))
.append("]]></ac:plain-text-body></ac:structured-macro>");
macroString
.append("<ac:structured-macro ac:name=\"plantuml\" ac:schema-version=\"1\" ac:macro-id=\"29f50cc-3338-43cc-9f67-15a851eb3417\">")
.append("<ac:parameter ac:name=\"atlassian-macro-output-type\">INLINE</ac:parameter>")
.append("<ac:plain-text-body><![CDATA[").append(addEscapeChars(pumlContents))
.append("]]></ac:plain-text-body></ac:structured-macro>");

return macroString.toString();
}

/**
*
* @param inputString
* @return
*/
private String addEscapeChars(String inputString){
private String addEscapeChars(String inputString) {
return inputString;
}

/**
*
* @param title
* @param confluenceVo
* @return
*/
private ConfluenceVo createSwaggerPage(ConfluenceVo confluenceVo) {
Expand Down

0 comments on commit af0250f

Please sign in to comment.