All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.kicksolutions.confluence.Swagger2Confluence Maven / Gradle / Ivy

The newest version!
package com.kicksolutions.confluence;

import java.util.logging.Logger;

import org.apache.commons.lang3.StringUtils;

import com.kicksolutions.CliArgs;

/**
 * MSANTOSH
 *
 */
public class Swagger2Confluence {
	private static final Logger LOGGER = Logger.getLogger(Swagger2Confluence.class.getName());
	private static final String USAGE = new StringBuilder()
			.append(" Usage: ")
			.append(Swagger2Confluence.class.getName()).append("  \n")
			.append(" -i  ").append(" -a  ").append(" -u  ")
			.append(" -p  ").append(" -l  ").append(" -s ")
			.append(" -r ").append("-c ").append("-d ")
			.append(" -f ").toString();

	public Swagger2Confluence() {
		super();
	}
	
	/**
	 * 
	 * @param args
	 */
	public static void main(String[] args) {
		Swagger2Confluence swagger2Confluence = new Swagger2Confluence();
		swagger2Confluence.init(args);
	}

	/**
	 * 
	 * @param args
	 */
	private void init(String args[]) {
		CliArgs cliArgs = new CliArgs(args);
		String specFile = cliArgs.getArgumentValue("-i", "");
		String parentPageID = cliArgs.getArgumentValue("-a", "");
		String userName = cliArgs.getArgumentValue("-u", "");
		String password = cliArgs.getArgumentValue("-p", "");
		String confluenceURL = cliArgs.getArgumentValue("-l", "");
		String confluenceSpaceKey = cliArgs.getArgumentValue("-s", "");
		String alternateURL = cliArgs.getArgumentValue("-r", "");
		String clientkitURL = cliArgs.getArgumentValue("-c", "");
		String htmlDocumentationURL = cliArgs.getArgumentValue("-d", "");
		String prefixForConfluencePage = cliArgs.getArgumentValue("-f", "");
		
		if (StringUtils.isNotEmpty(specFile) && StringUtils.isNotEmpty(parentPageID) && StringUtils.isNotEmpty(userName)
				&& StringUtils.isNotEmpty(password) && StringUtils.isNotEmpty(confluenceURL)
				&& StringUtils.isNotEmpty(confluenceSpaceKey)) {
			processSwagger2Confluence(specFile, parentPageID, userName, password, confluenceURL, 
					confluenceSpaceKey,alternateURL,clientkitURL,htmlDocumentationURL,prefixForConfluencePage);
		} else {
			LOGGER.severe(USAGE);
		}
	}

	/**
	 * Title: 
	 * | 
	 * |----- V1.0 Title
	 * | 
	 * |----- V1.1 Title
	 * 
	 * 
	 * @param specFile
	 * @param parentPageID
	 * @param userName
	 * @param password
	 * @param confluenceURL
	 * @param spaceKey
	 * @param htmlDocumentationURL 
	 * @param clientkitURL 
	 * @param prefixForConfluencePage
	 */
	private void processSwagger2Confluence(String specFile, String parentPageID, String userName, String password,
			String confluenceURL, String spaceKey,String alternateURL, String clientkitURL, String htmlDocumentationURL, 
			String prefixForConfluencePage) {
		SwaggerConfluenceUploader confluenceUploader = new SwaggerConfluenceUploader();
		confluenceUploader.processSwagger2Confluence(specFile, parentPageID, userName, password, confluenceURL, spaceKey, alternateURL, 
				clientkitURL, htmlDocumentationURL,prefixForConfluencePage,true);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy