Search in sources :

Example 11 with UrlMapper

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);
}
Also used : UrlMapping(com.twinsoft.convertigo.beans.core.UrlMapping) UrlMapper(com.twinsoft.convertigo.beans.core.UrlMapper) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) ObjectExplorerWizardPage(com.twinsoft.convertigo.eclipse.wizards.new_object.ObjectExplorerWizardPage)

Example 12 with UrlMapper

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;
}
Also used : Path(io.swagger.models.Path) UrlMapper(com.twinsoft.convertigo.beans.core.UrlMapper) HashMap(java.util.HashMap) Swagger(io.swagger.models.Swagger) ArrayList(java.util.ArrayList) Model(io.swagger.models.Model) RefModel(io.swagger.models.RefModel) IMappingRefModel(com.twinsoft.convertigo.beans.core.IMappingRefModel) Tag(io.swagger.models.Tag)

Example 13 with UrlMapper

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;
}
Also used : IntegerSchema(io.swagger.v3.oas.models.media.IntegerSchema) ArraySchema(io.swagger.v3.oas.models.media.ArraySchema) FileSchema(io.swagger.v3.oas.models.media.FileSchema) BooleanSchema(io.swagger.v3.oas.models.media.BooleanSchema) StringSchema(io.swagger.v3.oas.models.media.StringSchema) ObjectSchema(io.swagger.v3.oas.models.media.ObjectSchema) NumberSchema(io.swagger.v3.oas.models.media.NumberSchema) XmlSchema(org.apache.ws.commons.schema.XmlSchema) Schema(io.swagger.v3.oas.models.media.Schema) ArrayList(java.util.ArrayList) ApiResponse(io.swagger.v3.oas.models.responses.ApiResponse) Components(io.swagger.v3.oas.models.Components) Example(io.swagger.v3.oas.models.examples.Example) Paths(io.swagger.v3.oas.models.Paths) SecurityScheme(io.swagger.v3.oas.models.security.SecurityScheme) RequestBody(io.swagger.v3.oas.models.parameters.RequestBody) UrlMapper(com.twinsoft.convertigo.beans.core.UrlMapper) JSONException(org.codehaus.jettison.json.JSONException) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) Callback(io.swagger.v3.oas.models.callbacks.Callback) Header(io.swagger.v3.oas.models.headers.Header) HeaderParameter(io.swagger.v3.oas.models.parameters.HeaderParameter) PathParameter(io.swagger.v3.oas.models.parameters.PathParameter) LinkParameter(io.swagger.v3.oas.models.links.LinkParameter) Parameter(io.swagger.v3.oas.models.parameters.Parameter) QueryParameter(io.swagger.v3.oas.models.parameters.QueryParameter) UrlMappingParameter(com.twinsoft.convertigo.beans.core.UrlMappingParameter) JSONObject(org.codehaus.jettison.json.JSONObject) Tag(io.swagger.v3.oas.models.tags.Tag) OpenAPI(io.swagger.v3.oas.models.OpenAPI) Link(io.swagger.v3.oas.models.links.Link)

Aggregations

UrlMapper (com.twinsoft.convertigo.beans.core.UrlMapper)13 ArrayList (java.util.ArrayList)8 UrlMapping (com.twinsoft.convertigo.beans.core.UrlMapping)6 UrlMappingOperation (com.twinsoft.convertigo.beans.core.UrlMappingOperation)6 Project (com.twinsoft.convertigo.beans.core.Project)5 Sequence (com.twinsoft.convertigo.beans.core.Sequence)5 Step (com.twinsoft.convertigo.beans.core.Step)5 EngineException (com.twinsoft.convertigo.engine.EngineException)5 RequestableStep (com.twinsoft.convertigo.beans.core.RequestableStep)4 BlockStep (com.twinsoft.convertigo.beans.steps.BlockStep)4 BranchStep (com.twinsoft.convertigo.beans.steps.BranchStep)4 ElseStep (com.twinsoft.convertigo.beans.steps.ElseStep)4 SequenceStep (com.twinsoft.convertigo.beans.steps.SequenceStep)4 ThenStep (com.twinsoft.convertigo.beans.steps.ThenStep)4 TransactionStep (com.twinsoft.convertigo.beans.steps.TransactionStep)4 XMLComplexStep (com.twinsoft.convertigo.beans.steps.XMLComplexStep)4 ProjectExplorerView (com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView)4 InformationNode (com.twinsoft.convertigo.eclipse.views.references.model.InformationNode)4 IsUsedByNode (com.twinsoft.convertigo.eclipse.views.references.model.IsUsedByNode)4 MapperNode (com.twinsoft.convertigo.eclipse.views.references.model.MapperNode)4