use of com.twinsoft.convertigo.beans.core.UrlMapper in project convertigo by convertigo.
the class UrlMappingWizardPage method dialogChanged.
private void dialogChanged() {
DatabaseObject dbo = ((ObjectExplorerWizardPage) getWizard().getPage("ObjectExplorerWizardPage")).getCreatedBean();
if (dbo != null && dbo instanceof UrlMapping) {
String path = getPath();
if (path.length() == 0) {
updateStatus("Path must be specified");
return;
}
if (!path.startsWith("/")) {
updateStatus("Path must start with \"/\"");
return;
}
if (parentObject != null && parentObject instanceof UrlMapper) {
UrlMapper urlMapper = (UrlMapper) parentObject;
if (urlMapper.getMappingByPath(path) != null) {
updateStatus("This mapping path already exists");
return;
}
UrlMapping urlMapping = (UrlMapping) dbo;
urlMapping.setPath(path);
}
}
updateStatus(null);
}
use of com.twinsoft.convertigo.beans.core.UrlMapper in project convertigo by convertigo.
the class SwaggerUtils method parse.
public static Swagger parse(String requestUrl, Collection<UrlMapper> collection) {
Swagger swagger = parseCommon(requestUrl, null);
List<Tag> tags = new ArrayList<Tag>();
Map<String, Path> paths = new HashMap<String, Path>();
Map<String, Model> models = new HashMap<String, Model>();
for (UrlMapper urlMapper : collection) {
if (urlMapper != null) {
Swagger p_swagger = parse(requestUrl, urlMapper);
if (p_swagger != null) {
if (p_swagger != null) {
tags.addAll(p_swagger.getTags());
paths.putAll(p_swagger.getPaths());
models.putAll(p_swagger.getDefinitions());
}
}
}
}
swagger.setTags(tags);
swagger.setPaths(paths);
swagger.setDefinitions(models);
return swagger;
}
use of com.twinsoft.convertigo.beans.core.UrlMapper in project convertigo by convertigo.
the class OpenApiUtils method parse.
@SuppressWarnings("rawtypes")
public static OpenAPI parse(String requestUrl, Collection<UrlMapper> collection) {
OpenAPI openAPI = parseCommon(requestUrl, null);
List<Tag> tags = new ArrayList<>();
Components components = new Components();
components.callbacks(new HashMap<String, Callback>());
components.examples(new HashMap<String, Example>());
components.extensions(new HashMap<String, Object>());
components.headers(new HashMap<String, Header>());
components.links(new HashMap<String, Link>());
components.parameters(new HashMap<String, Parameter>());
components.requestBodies(new HashMap<String, RequestBody>());
components.responses(new HashMap<String, ApiResponse>());
components.schemas(new HashMap<String, Schema>());
components.securitySchemes(new HashMap<String, SecurityScheme>());
Paths paths = new Paths();
for (UrlMapper urlMapper : collection) {
if (urlMapper != null) {
OpenAPI _openAPI = parse(requestUrl, urlMapper);
if (_openAPI != null) {
try {
tags.addAll(_openAPI.getTags());
} catch (Exception e) {
}
try {
paths.putAll(_openAPI.getPaths());
} catch (Exception e) {
}
Components _components = _openAPI.getComponents();
if (_components != null) {
try {
components.getCallbacks().putAll(_components.getCallbacks());
} catch (Exception e) {
}
try {
components.getExamples().putAll(_components.getExamples());
} catch (Exception e) {
}
try {
components.getExtensions().putAll(_components.getExtensions());
} catch (Exception e) {
}
try {
components.getHeaders().putAll(_components.getHeaders());
} catch (Exception e) {
}
try {
components.getLinks().putAll(_components.getLinks());
} catch (Exception e) {
}
try {
components.getParameters().putAll(_components.getParameters());
} catch (Exception e) {
}
try {
components.getRequestBodies().putAll(_components.getRequestBodies());
} catch (Exception e) {
}
try {
components.getResponses().putAll(_components.getResponses());
} catch (Exception e) {
}
try {
components.getSchemas().putAll(_components.getSchemas());
} catch (Exception e) {
}
try {
components.getSecuritySchemes().putAll(_components.getSecuritySchemes());
} catch (Exception e) {
}
}
}
}
}
openAPI.setTags(tags);
openAPI.setPaths(paths);
openAPI.setComponents(components);
return openAPI;
}
Aggregations