package org.onap.aai.schemagen;
+import freemarker.template.TemplateException;
+
import java.io.File;
import java.io.IOException;
import java.util.Collections;
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);
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);
}
sbParameter.append(" type: integer\n");
sbParameter.append(" format: int32\n");
}
+ if (("java.lang.Float").equals(this.getAttribute("type"))) {
+ sbParameter.append(" type: number\n");
+ sbParameter.append(" format: float\n");
+ }
+ if (("java.lang.Double").equals(this.getAttribute("type"))) {
+ sbParameter.append(" type: number\n");
+ sbParameter.append(" format: double\n");
+ }
if (("java.lang.Boolean").equals(this.getAttribute("type"))) {
sbParameter.append(" type: boolean\n");
}
sbParameter.append(" type: integer\n");
sbParameter.append(" format: int32\n");
}
+ if (("java.lang.Float").equals(this.getAttribute("type"))) {
+ sbParameter.append(" type: number\n");
+ sbParameter.append(" format: float\n");
+ }
+ if (("java.lang.Double").equals(this.getAttribute("type"))) {
+ sbParameter.append(" type: number\n");
+ sbParameter.append(" format: double\n");
+ }
if (("java.lang.Boolean").equals(this.getAttribute("type"))) {
sbParameter.append(" type: boolean\n");
}
if (elementType.equals("java.lang.Integer")) {
sbElement.append(" type=\"xs:int\"");
}
+ if (elementType.equals("java.lang.Float")) {
+ sbElement.append(" type=\"xs:float\"");
+ }
+ if (elementType.equals("java.lang.Double")) {
+ sbElement.append(" type=\"xs:double\"");
+ }
if (elementType.equals("java.lang.Boolean")) {
sbElement.append(" type=\"xs:boolean\"");
}
} else if (("java.lang.Integer").equals(this.getAttribute("type"))) {
sbProperties.append("integer\n");
sbProperties.append(" format: int32\n");
+ } else if (("java.lang.Float").equals(this.getAttribute("type"))) {
+ sbProperties.append("number\n");
+ sbProperties.append(" format: float\n");
+ } else if (("java.lang.Double").equals(this.getAttribute("type"))) {
+ sbProperties.append("number\n");
+ sbProperties.append(" format: double\n");
} else if (("java.lang.Boolean").equals(this.getAttribute("type"))) {
sbProperties.append("boolean\n");
}
case "java.lang.String":
case "java.lang.Long":
case "java.lang.Integer":
+ case "java.lang.Float":
+ case "java.lang.Double":
case "java.lang.Boolean":
return true;
}
</xs:appinfo>
</xs:annotation>
</xs:element>
- <xs:element name="cs-availability" minOccurs="0">
+ <xs:element name="cs-availability" type="xs:float" minOccurs="0">
<xs:annotation>
<xs:appinfo>
<annox:annotate target="field">@org.onap.aai.annotations.Metadata(description="The availability requirement for an network slice instance, expressed as a percentage.")</annox:annotate>
</xs:appinfo>
</xs:annotation>
</xs:element>
- <xs:element name="reliability" minOccurs="0">
+ <xs:element name="reliability" type="xs:float" minOccurs="0">
<xs:annotation>
<xs:appinfo>
<annox:annotate target="field">@org.onap.aai.annotations.Metadata(description="The reliability requirement for an network slice instance, expressed as a percentage.")</annox:annotate>
</xs:appinfo>
</xs:annotation>
</xs:element>
- <xs:element name="cs-availability" minOccurs="0">
+ <xs:element name="cs-availability" type="xs:float" minOccurs="0">
<xs:annotation>
<xs:appinfo>
<annox:annotate target="field">@org.onap.aai.annotations.Metadata(description="The availability requirement for an network slice subnet instance, expressed as a percentage.")</annox:annotate>
</xs:appinfo>
</xs:annotation>
</xs:element>
- <xs:element name="reliability" minOccurs="0">
+ <xs:element name="reliability" type="xs:float" minOccurs="0">
<xs:annotation>
<xs:appinfo>
<annox:annotate target="field">@org.onap.aai.annotations.Metadata(description="The reliability requirement for an network slice subnet instance, expressed as a percentage.")</annox:annotate>
</xs:appinfo>
</xs:annotation>
</xs:element>
- <xs:element name="availability" minOccurs="0">
+ <xs:element name="availability" type="xs:float" minOccurs="0">
<xs:annotation>
<xs:appinfo>
<annox:annotate target="field">@org.onap.aai.annotations.Metadata(description="This parameter specifies the availability requirement, expressed as a percentage.")</annox:annotate>
</xs:appinfo>
</xs:annotation>
</xs:element>
- <xs:element name="cs-availability-target" minOccurs="0">
+ <xs:element name="cs-availability-target" type="xs:float" minOccurs="0">
<xs:annotation>
<xs:appinfo>
<annox:annotate target="field">@org.onap.aai.annotations.Metadata(description="Communication service availability target value.")</annox:annotate>
</xs:appinfo>
</xs:annotation>
</xs:element>
- <xs:element name="reliability" minOccurs="0">
+ <xs:element name="reliability" type="xs:float" minOccurs="0">
<xs:annotation>
<xs:appinfo>
<annox:annotate target="field">@org.onap.aai.annotations.Metadata(description="The reliability requirement for an network slice subnet instance, expressed as a percentage.")</annox:annotate>
</xs:appinfo>
</xs:annotation>
</xs:element>
- <xs:element name="availability" minOccurs="0">
+ <xs:element name="availability" type="xs:float" minOccurs="0">
<xs:annotation>
<xs:appinfo>
<annox:annotate target="field">@org.onap.aai.annotations.Metadata(description="This parameter specifies the availability requirement, expressed as a percentage.")</annox:annotate>
</xs:appinfo>
</xs:annotation>
</xs:element>
- <xs:element name="cs-availability-target" minOccurs="0">
+ <xs:element name="cs-availability-target" type="xs:float" minOccurs="0">
<xs:annotation>
<xs:appinfo>
<annox:annotate target="field">@org.onap.aai.annotations.Metadata(description="Communication service availability target value.")</annox:annotate>
</xs:appinfo>
</xs:annotation>
</xs:element>
- <xs:element name="reliability" minOccurs="0">
+ <xs:element name="reliability" type="xs:float" minOccurs="0">
<xs:annotation>
<xs:appinfo>
<annox:annotate target="field">@org.onap.aai.annotations.Metadata(description="The reliability requirement for an network slice subnet instance, expressed as a percentage.")</annox:annotate>
</xs:appinfo>
</xs:annotation>
</xs:element>
- <xs:element name="availability" minOccurs="0">
+ <xs:element name="availability" type="xs:float" minOccurs="0">
<xs:annotation>
<xs:appinfo>
<annox:annotate target="field">@org.onap.aai.annotations.Metadata(description="This parameter specifies the availability requirement, expressed as a percentage.")</annox:annotate>
</xs:appinfo>
</xs:annotation>
</xs:element>
- <xs:element name="cs-availability-target" minOccurs="0">
+ <xs:element name="cs-availability-target" type="xs:float" minOccurs="0">
<xs:annotation>
<xs:appinfo>
<annox:annotate target="field">@org.onap.aai.annotations.Metadata(description="Communication service availability target value.")</annox:annotate>
</xs:appinfo>
</xs:annotation>
</xs:element>
- <xs:element name="reliability" minOccurs="0">
+ <xs:element name="reliability" type="xs:float" minOccurs="0">
<xs:annotation>
<xs:appinfo>
<annox:annotate target="field">@org.onap.aai.annotations.Metadata(description="The reliability requirement for an network slice subnet instance, expressed as a percentage.")</annox:annotate>
</xs:appinfo>
</xs:annotation>
</xs:element>
- <xs:element name="availability" minOccurs="0">
+ <xs:element name="availability" type="xs:float" minOccurs="0">
<xs:annotation>
<xs:appinfo>
<annox:annotate target="field">@org.onap.aai.annotations.Metadata(description="This parameter specifies the availability requirement, expressed as a percentage.")</annox:annotate>
</xs:appinfo>
</xs:annotation>
</xs:element>
- <xs:element name="cs-availability-target" minOccurs="0">
+ <xs:element name="cs-availability-target" type="xs:float" minOccurs="0">
<xs:annotation>
<xs:appinfo>
<annox:annotate target="field">@org.onap.aai.annotations.Metadata(description="Communication service availability target value.")</annox:annotate>
</xs:appinfo>
</xs:annotation>
</xs:element>
- <xs:element name="reliability" minOccurs="0">
+ <xs:element name="reliability" type="xs:float" minOccurs="0">
<xs:annotation>
<xs:appinfo>
<annox:annotate target="field">@org.onap.aai.annotations.Metadata(description="The reliability requirement for an network slice subnet instance, expressed as a percentage.")</annox:annotate>
</xs:appinfo>
</xs:annotation>
</xs:element>
- <xs:element name="availability" minOccurs="0">
+ <xs:element name="availability" type="xs:float" minOccurs="0">
<xs:annotation>
<xs:appinfo>
<annox:annotate target="field">@org.onap.aai.annotations.Metadata(description="This parameter specifies the availability requirement, expressed as a percentage.")</annox:annotate>
</xs:appinfo>
</xs:annotation>
</xs:element>
- <xs:element name="cs-availability-target" minOccurs="0">
+ <xs:element name="cs-availability-target" type="xs:float" minOccurs="0">
<xs:annotation>
<xs:appinfo>
<annox:annotate target="field">@org.onap.aai.annotations.Metadata(description="Communication service availability target value.")</annox:annotate>
</xs:appinfo>
</xs:annotation>
</xs:element>
- <xs:element name="reliability" minOccurs="0">
+ <xs:element name="reliability" type="xs:float" minOccurs="0">
<xs:annotation>
<xs:appinfo>
<annox:annotate target="field">@org.onap.aai.annotations.Metadata(description="The reliability requirement for an network slice subnet instance, expressed as a percentage.")</annox:annotate>
</xs:appinfo>
</xs:annotation>
</xs:element>
- <xs:element name="availability" minOccurs="0">
+ <xs:element name="availability" type="xs:float" minOccurs="0">
<xs:annotation>
<xs:appinfo>
<annox:annotate target="field">@org.onap.aai.annotations.Metadata(description="This parameter specifies the availability requirement, expressed as a percentage.")</annox:annotate>
</xs:appinfo>
</xs:annotation>
</xs:element>
- <xs:element name="cs-availability-target" minOccurs="0">
+ <xs:element name="cs-availability-target" type="xs:float" minOccurs="0">
<xs:annotation>
<xs:appinfo>
<annox:annotate target="field">@org.onap.aai.annotations.Metadata(description="Communication service availability target value.")</annox:annotate>
</xs:appinfo>
</xs:annotation>
</xs:element>
- <xs:element name="reliability" minOccurs="0">
+ <xs:element name="reliability" type="xs:float" minOccurs="0">
<xs:annotation>
<xs:appinfo>
<annox:annotate target="field">@org.onap.aai.annotations.Metadata(description="The reliability requirement for an network slice subnet instance, expressed as a percentage.")</annox:annotate>
</xs:appinfo>
</xs:annotation>
</xs:element>
- <xs:element name="availability" minOccurs="0">
+ <xs:element name="availability" type="xs:float" minOccurs="0">
<xs:annotation>
<xs:appinfo>
<annox:annotate target="field">@org.onap.aai.annotations.Metadata(description="This parameter specifies the availability requirement, expressed as a percentage.")</annox:annotate>
</xs:appinfo>
</xs:annotation>
</xs:element>
- <xs:element name="cs-availability-target" minOccurs="0">
+ <xs:element name="cs-availability-target" type="xs:float" minOccurs="0">
<xs:annotation>
<xs:appinfo>
<annox:annotate target="field">@org.onap.aai.annotations.Metadata(description="Communication service availability target value.")</annox:annotate>
</xs:appinfo>
</xs:annotation>
</xs:element>
- <xs:element name="reliability" minOccurs="0">
+ <xs:element name="reliability" type="xs:float" minOccurs="0">
<xs:annotation>
<xs:appinfo>
<annox:annotate target="field">@org.onap.aai.annotations.Metadata(description="The reliability requirement for an network slice subnet instance, expressed as a percentage.")</annox:annotate>
</xs:appinfo>
</xs:annotation>
</xs:element>
- <xs:element name="availability" minOccurs="0">
+ <xs:element name="availability" type="xs:float" minOccurs="0">
<xs:annotation>
<xs:appinfo>
<annox:annotate target="field">@org.onap.aai.annotations.Metadata(description="This parameter specifies the availability requirement, expressed as a percentage.")</annox:annotate>
</xs:appinfo>
</xs:annotation>
</xs:element>
- <xs:element name="cs-availability-target" minOccurs="0">
+ <xs:element name="cs-availability-target" type="xs:float" minOccurs="0">
<xs:annotation>
<xs:appinfo>
<annox:annotate target="field">@org.onap.aai.annotations.Metadata(description="Communication service availability target value.")</annox:annotate>
</xs:appinfo>
</xs:annotation>
</xs:element>
- <xs:element name="reliability" minOccurs="0">
+ <xs:element name="reliability" type="xs:float" minOccurs="0">
<xs:annotation>
<xs:appinfo>
<annox:annotate target="field">@org.onap.aai.annotations.Metadata(description="The reliability requirement for an network slice subnet instance, expressed as a percentage.")</annox:annotate>