Search in sources :

Example 21 with Schema

use of com.reprezen.kaizen.oasparser.model3.Schema in project ets-ogcapi-edr10 by opengeospatial.

the class OpenApiUtils method collectTemplateReplacements.

private static List<Map<String, String>> collectTemplateReplacements(PathItemAndServer pathItemAndServer, UriTemplate uriTemplate) {
    List<Map<String, String>> templateReplacements = new ArrayList<>();
    Collection<Parameter> parameters = pathItemAndServer.operationObject.getParameters();
    for (String templateVariable : uriTemplate.getTemplateVariables()) {
        for (Parameter parameter : parameters) {
            if (templateVariable.equals(parameter.getName())) {
                Schema schema = parameter.getSchema();
                if (schema.hasEnums()) {
                    addEnumTemplateValues(templateReplacements, templateVariable, schema);
                } else if (schema.getDefault() != null) {
                    addDefaultTemplateValue(templateReplacements, templateVariable, schema);
                } else {
                // TODO: What should be done if the parameter does not have a default value and
                // no
                // enumerated set of valid values?
                }
            }
        }
    }
    return templateReplacements;
}
Also used : Schema(com.reprezen.kaizen.oasparser.model3.Schema) ArrayList(java.util.ArrayList) Parameter(com.reprezen.kaizen.oasparser.model3.Parameter) HashMap(java.util.HashMap) Map(java.util.Map)

Example 22 with Schema

use of com.reprezen.kaizen.oasparser.model3.Schema in project molgenis-emx2 by molgenis.

the class DataCatalogueLoader method load.

@Override
public void load(Schema schema, boolean includeDemoData) {
    // create ontology schema
    Database db = schema.getDatabase();
    Schema ontologySchema = db.getSchema(CATALOGUE_ONTOLOGIES);
    if (ontologySchema == null) {
        ontologySchema = db.createSchema(CATALOGUE_ONTOLOGIES);
    }
    // create catalogue schema (which will create tables in ontology schema)
    createSchema(schema, "datacatalogue/molgenis.csv");
    // load data into ontology schema
    MolgenisIO.fromClasspathDirectory("datacatalogue/CatalogueOntologies", ontologySchema, false);
    // optionally, load demo data
    if (includeDemoData) {
        MolgenisIO.fromClasspathDirectory("datacatalogue/Cohorts", schema, false);
    }
}
Also used : Schema(org.molgenis.emx2.Schema) Database(org.molgenis.emx2.Database)

Example 23 with Schema

use of com.reprezen.kaizen.oasparser.model3.Schema in project molgenis-emx2 by molgenis.

the class DataCatalogueStagingLoader method load.

@Override
public void load(Schema schema, boolean includeDemoData) {
    // create ontology schema
    Database db = schema.getDatabase();
    Schema ontologySchema = db.getSchema(CATALOGUE_ONTOLOGIES);
    if (ontologySchema == null) {
        ontologySchema = db.createSchema(CATALOGUE_ONTOLOGIES);
    }
    // create the schema
    createSchema(schema, "datacatalogue/Catalogue_cdm/molgenis.csv");
    // load data into ontology schema
    MolgenisIO.fromClasspathDirectory("datacatalogue/CatalogueOntologies", ontologySchema, false);
}
Also used : Schema(org.molgenis.emx2.Schema) Database(org.molgenis.emx2.Database)

Example 24 with Schema

use of com.reprezen.kaizen.oasparser.model3.Schema in project geo-platform by geosdi.

the class WFSDescribeFeatureTest method c_describeSiteTrTest.

@Ignore(value = "Geoserver is Down")
@Test
public void c_describeSiteTrTest() throws Exception {
    WFSDescribeFeatureTypeRequest<Schema> request = newConnector().withServerUrl(new URL("http://150.145.141.241/geoserver/wfs")).build().createDescribeFeatureTypeRequest();
    String localPart = siteTRCom.getLocalPart();
    request.setTypeName(Arrays.asList(siteTRCom));
    logger.debug("#########################SCHEMA_AS_STRING : \n{}\n", request.formatResponseAsString(2));
    Schema s = request.getResponse();
    String name = localPart.substring(localPart.indexOf(":") + 1);
    StringWriter writer = new StringWriter();
    gpJAXBContextBuilder.marshal(schemaReader.getFeature(s, name), writer);
    logger.info("######################LAYER_SCHEMA_SITE_COM_XML : \n{}\n", writer);
}
Also used : StringWriter(java.io.StringWriter) Schema(org.geosdi.geoplatform.xml.xsd.v2001.Schema) URL(java.net.URL) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 25 with Schema

use of com.reprezen.kaizen.oasparser.model3.Schema in project geo-platform by geosdi.

the class WFSDescribeFeatureTest method d_describeLayerPercorsiNavetteTest.

@Ignore
@Test
public void d_describeLayerPercorsiNavetteTest() throws Exception {
    WFSDescribeFeatureTypeRequest<Schema> request = newConnector().withServerUrl(new URL("http://mappe-dpc.protezionecivile.it/gssitdpc/wfs")).build().createDescribeFeatureTypeRequest();
    QName percorsiNavette = new QName("PianoCampiFlegrei:CF_PercorsiNavette");
    String localPart = percorsiNavette.getLocalPart();
    request.setTypeName(Arrays.asList(percorsiNavette));
    logger.debug("#########################SCHEMA_AS_STRING : \n{}\n", request.formatResponseAsString(2));
    Schema s = request.getResponse();
    String name = localPart.substring(localPart.indexOf(":") + 1);
    JAXBElement<LayerSchemaDTO> root = new JAXBElement<>(percorsiNavette, LayerSchemaDTO.class, schemaReader.getFeature(s, name));
    StringWriter writer = new StringWriter();
    gpJAXBContextBuilder.marshal(root, writer);
    logger.info("######################LAYER_SCHEMA_PERCORSI_NAVETTE_XML : \n{}\n", writer);
}
Also used : StringWriter(java.io.StringWriter) QName(javax.xml.namespace.QName) Schema(org.geosdi.geoplatform.xml.xsd.v2001.Schema) LayerSchemaDTO(org.geosdi.geoplatform.connector.wfs.response.LayerSchemaDTO) JAXBElement(javax.xml.bind.JAXBElement) URL(java.net.URL) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)57 Schema (com.google.pubsub.v1.Schema)38 Schema (org.molgenis.emx2.Schema)38 AbstractMessage (com.google.protobuf.AbstractMessage)16 ByteString (com.google.protobuf.ByteString)16 QName (javax.xml.namespace.QName)16 File (java.io.File)15 URL (java.net.URL)15 Schema (org.geosdi.geoplatform.xml.xsd.v2001.Schema)15 SchemaServiceClient (com.google.cloud.pubsub.v1.SchemaServiceClient)14 ProjectName (com.google.pubsub.v1.ProjectName)14 LayerSchemaDTO (org.geosdi.geoplatform.connector.wfs.response.LayerSchemaDTO)14 IOException (java.io.IOException)13 StringWriter (java.io.StringWriter)13 Schema (org.oasisopen.odata.csdl.v4.Schema)13 Schema (com.reprezen.kaizen.oasparser.model3.Schema)11 JAXBElement (javax.xml.bind.JAXBElement)10 ArrayList (java.util.ArrayList)9 HashMap (java.util.HashMap)9 List (java.util.List)8