Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.openapitools.codegen.languages;
import org.apache.commons.lang3.BooleanUtils;
import org.openapitools.codegen.CodegenModel;
import org.openapitools.codegen.CodegenOperation;
import org.openapitools.codegen.CodegenProperty;
import org.openapitools.codegen.CodegenType;
import org.openapitools.codegen.SupportingFile;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class JavaUndertowServerCodegen extends AbstractJavaCodegen {
private static final Logger LOGGER = LoggerFactory.getLogger(JavaUndertowServerCodegen.class);
protected String title = "OpenAPI Undertow Server";
protected String implFolder = "src/main/java";
public JavaUndertowServerCodegen() {
super();
sourceFolder = "src/main/java";
apiTestTemplateFiles.clear(); // TODO: add test template
embeddedTemplateDir = templateDir = "undertow";
invokerPackage = "org.openapitools.handler";
artifactId = "openapi-undertow-server";
dateLibrary = "legacy"; //TODO: add joda support
// clear model and api doc template as this codegen
// does not support auto-generated markdown doc at the moment
//TODO: add doc templates
modelDocTemplateFiles.remove("model_doc.mustache");
apiDocTemplateFiles.remove("api_doc.mustache");
if(System.getProperty("swagger.codegen.undertow.apipackage") != null && System.getProperty("openapi.codegen.undertow.apipackage") == null) {
LOGGER.warn("System property 'swagger.codegen.undertow.apipackage' was renamed to 'swagger.codegen.undertow.apipackage'");
apiPackage = System.getProperty("swagger.codegen.undertow.apipackage", "org.openapitools.handler");
} else {
apiPackage = System.getProperty("openapi.codegen.undertow.apipackage", "org.openapitools.handler");
}
if(System.getProperty("swagger.codegen.undertow.modelpackage") != null && System.getProperty("openapi.codegen.undertow.modelpackage") == null) {
LOGGER.warn("System property 'swagger.codegen.undertow.modelpackage' was renamed to 'openapi.codegen.undertow.modelpackage'");
modelPackage = System.getProperty("swagger.codegen.undertow.modelpackage", "org.openapitools.model");
} else {
modelPackage = System.getProperty("openapi.codegen.undertow.modelpackage", "org.openapitools.model");
}
additionalProperties.put("title", title);
}
@Override
public CodegenType getTag() {
return CodegenType.SERVER;
}
@Override
public String getName() {
return "java-undertow-server";
}
@Override
public String getHelp() {
return "Generates a Java Undertow Server application (beta).";
}
@Override
public void processOpts() {
super.processOpts();
apiTemplateFiles.remove("api.mustache");
writeOptional(outputFolder, new SupportingFile("pom.mustache", "", "pom.xml"));
writeOptional(outputFolder, new SupportingFile("README.mustache", "", "README.md"));
// keep the yaml in config folder for framework validation.
supportingFiles.add(new SupportingFile("openapi.mustache", ("src.main.resources.config").replace(".", java.io.File.separator), "openapi.json"));
supportingFiles.add(new SupportingFile("handler.mustache", ("src.main.java.org.openapitools.handler").replace(".", java.io.File.separator), "PathHandlerProvider.java"));
supportingFiles.add(new SupportingFile("service.mustache", ("src.main.resources.META-INF.services").replace(".", java.io.File.separator), "com.networknt.server.HandlerProvider"));
// configuration files
supportingFiles.add(new SupportingFile("server.json", ("src.main.resources.config").replace(".", java.io.File.separator), "server.json"));
supportingFiles.add(new SupportingFile("security.json", ("src.main.resources.config").replace(".", java.io.File.separator), "security.json"));
supportingFiles.add(new SupportingFile("primary.crt", ("src.main.resources.config.oauth").replace(".", java.io.File.separator), "primary.crt"));
}
@Override
public Map postProcessOperationsWithModels(Map objs, List