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)
*
* 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
*
* https://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 io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import org.openapitools.codegen.*;
import org.openapitools.codegen.meta.GeneratorMetadata;
import org.openapitools.codegen.meta.Stability;
import java.io.File;
import java.text.Normalizer;
import java.util.*;
public class WsdlSchemaCodegen extends DefaultCodegen implements CodegenConfig {
public static final String PROJECT_NAME = "projectName";
public CodegenType getTag() {
return CodegenType.SCHEMA;
}
public String getName() {
return "wsdl-schema";
}
public String getHelp() {
return "Generates WSDL files.";
}
public WsdlSchemaCodegen() {
super();
generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata)
.stability(Stability.BETA)
.build();
outputFolder = "generated-code" + File.separator + "wsdl-schema";
embeddedTemplateDir = templateDir = "wsdl-schema";
apiPackage = "Apis";
modelPackage = "Models";
cliOptions.add(new CliOption("hostname", "the hostname of the service"));
cliOptions.add(new CliOption("soapPath", "basepath of the soap services"));
cliOptions.add(new CliOption("serviceName", "service name for the wsdl"));
additionalProperties.put("hostname", "localhost");
additionalProperties.put("soapPath", "soap");
additionalProperties.put("serviceName", "ServiceV1");
supportingFiles.add(new SupportingFile("wsdl-converter.mustache", "", "service.wsdl"));
supportingFiles.add(new SupportingFile("jaxb-customization.mustache", "",
"jaxb-customization.xml"));
}
public void preprocessOpenAPI(OpenAPI openAPI) {
Info info = openAPI.getInfo();
String title = info.getTitle();
String description = info.getDescription();
info.setDescription(this.processOpenapiSpecDescription(description));
info.setTitle(this.escapeTitle(title));
}
private String escapeTitle(String title) {
// strip umlauts etc.
final String normalizedTitle = Normalizer.normalize(title, Normalizer.Form.NFD)
.replaceAll("[^\\p{ASCII}]", "");
return super.escapeUnsafeCharacters(normalizedTitle);
}
public String processOpenapiSpecDescription(String description) {
if (description != null) {
return description.replaceAll("\\s+", " ");
} else {
return "No description provided";
}
}
@Override
public Map postProcessOperationsWithModels(Map objs,
List