diff options
Diffstat (limited to 'aai-schema-gen/src/main/java/org/onap/aai/schemagen/AutoGenerateHtml.java')
-rw-r--r-- | aai-schema-gen/src/main/java/org/onap/aai/schemagen/AutoGenerateHtml.java | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/AutoGenerateHtml.java b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/AutoGenerateHtml.java index f279aef..13fd317 100644 --- a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/AutoGenerateHtml.java +++ b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/AutoGenerateHtml.java @@ -22,6 +22,8 @@ package org.onap.aai.schemagen; +import freemarker.template.TemplateException; + import java.io.File; import java.io.IOException; import java.util.Collections; @@ -36,8 +38,6 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.BeansException; import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import freemarker.template.TemplateException; - public class AutoGenerateHtml { private static Logger logger = LoggerFactory.getLogger(AutoGenerateHtml.class); @@ -54,31 +54,31 @@ public class AutoGenerateHtml { try (AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext( "org.onap.aai.setup", "org.onap.aai.schemagen")) { - SchemaConfigVersions schemaConfigVersions = ctx.getBean(SchemaConfigVersions.class); + SchemaConfigVersions schemaConfigVersions = ctx.getBean(SchemaConfigVersions.class); - List<SchemaVersion> versionsToGen = schemaConfigVersions.getVersions(); - Collections.sort(versionsToGen); - Collections.reverse(versionsToGen); - ListIterator<SchemaVersion> versionIterator = versionsToGen.listIterator(); - String schemaDir; - if (System.getProperty("user.dir") != null - && !System.getProperty("user.dir").contains(DEFAULT_RUN_DIR)) { - schemaDir = ALT_SCHEMA_DIR; - } else { - schemaDir = DEFAULT_SCHEMA_DIR; - } - String release = System.getProperty("aai.release", "onap"); - while (versionIterator.hasNext()) { - System.setProperty(AAI_GENERATE_VERSION, versionIterator.next().toString()); - String yamlFile = - schemaDir + "/src/main/resources/" + release + "/aai_swagger_yaml/aai_swagger_" - + System.getProperty(AAI_GENERATE_VERSION) + ".yaml"; - File swaggerYamlFile = new File(yamlFile); - if (swaggerYamlFile.exists()) { - GenerateSwagger.schemaConfigVersions = schemaConfigVersions; - GenerateSwagger.main(args); + List<SchemaVersion> versionsToGen = schemaConfigVersions.getVersions(); + Collections.sort(versionsToGen); + Collections.reverse(versionsToGen); + ListIterator<SchemaVersion> versionIterator = versionsToGen.listIterator(); + String schemaDir; + if (System.getProperty("user.dir") != null + && !System.getProperty("user.dir").contains(DEFAULT_RUN_DIR)) { + schemaDir = ALT_SCHEMA_DIR; + } else { + schemaDir = DEFAULT_SCHEMA_DIR; + } + String release = System.getProperty("aai.release", "onap"); + while (versionIterator.hasNext()) { + System.setProperty(AAI_GENERATE_VERSION, versionIterator.next().toString()); + String yamlFile = + schemaDir + "/src/main/resources/" + release + "/aai_swagger_yaml/aai_swagger_" + + System.getProperty(AAI_GENERATE_VERSION) + ".yaml"; + File swaggerYamlFile = new File(yamlFile); + if (swaggerYamlFile.exists()) { + GenerateSwagger.schemaConfigVersions = schemaConfigVersions; + GenerateSwagger.main(args); + } } - } } catch (BeansException e) { logger.warn("Unable to initialize AnnotationConfigApplicationContext ", e); } |