Search in sources :

Example 1 with OpenApiWebMvcResource

use of org.springdoc.webmvc.api.OpenApiWebMvcResource in project snow-owl by b2ihealthcare.

the class FhirMetadataController method initCache.

private Holder initCache() {
    final Holder holder = new Holder();
    // XXX: we know that the subclass is instantiated (in SnowOwlApiConfig)
    final OpenAPI openAPI = ((SnowOwlOpenApiWebMvcResource) openApiWebMvcResource).getOpenApi();
    final Collection<Resource> resources = collectResources(openAPI);
    final Collection<OperationDefinition> operationDefinitions = collectOperationDefinitions(openAPI);
    final Rest.Builder restBuilder = Rest.builder().mode(RestfulCapabilityMode.SERVER).resources(resources);
    holder.operationMap = newHashMap();
    for (final OperationDefinition operationDefinition : operationDefinitions) {
        for (final Code code : operationDefinition.getResources()) {
            final String key = code.getCodeValue() + operationDefinition.getName();
            holder.operationMap.put(key, operationDefinition);
            restBuilder.addOperation(com.b2international.snowowl.fhir.core.model.capabilitystatement.Operation.builder().name(operationDefinition.getName()).definition(buildOperationUrl(code, operationDefinition)).build());
        }
    }
    final String serverVersion = Platform.getBundle(CoreActivator.PLUGIN_ID).getVersion().toString();
    String description = ApplicationContext.getServiceForClass(SnowOwlConfiguration.class).getDescription();
    holder.capabilityStatement = CapabilityStatement.builder().name("FHIR Capability statement for Snow Owl© Terminology Server").status(PublicationStatus.ACTIVE).experimental(false).kind(CapabilityStatementKind.INSTANCE.getCode()).fhirVersion("4.0.1").addInstantiate(new Uri("http://hl7.org/fhir/CapabilityStatement/terminology-server")).software(Software.builder().name("Snow Owl©").version(serverVersion).build()).implementation(Implementation.builder().url("https://b2i.sg").description(description).build()).addFormat(new Code(AbstractFhirController.APPLICATION_FHIR_JSON)).addRest(restBuilder.build()).build();
    return holder;
}
Also used : SnowOwlOpenApiWebMvcResource(com.b2international.snowowl.core.rest.SnowOwlOpenApiWebMvcResource) OpenApiWebMvcResource(org.springdoc.webmvc.api.OpenApiWebMvcResource) SnowOwlOpenApiWebMvcResource(com.b2international.snowowl.core.rest.SnowOwlOpenApiWebMvcResource) Code(com.b2international.snowowl.fhir.core.model.dt.Code) Uri(com.b2international.snowowl.fhir.core.model.dt.Uri) OpenAPI(io.swagger.v3.oas.models.OpenAPI) OperationDefinition(com.b2international.snowowl.fhir.core.model.operationdefinition.OperationDefinition) SnowOwlConfiguration(com.b2international.snowowl.core.config.SnowOwlConfiguration)

Aggregations

SnowOwlConfiguration (com.b2international.snowowl.core.config.SnowOwlConfiguration)1 SnowOwlOpenApiWebMvcResource (com.b2international.snowowl.core.rest.SnowOwlOpenApiWebMvcResource)1 Code (com.b2international.snowowl.fhir.core.model.dt.Code)1 Uri (com.b2international.snowowl.fhir.core.model.dt.Uri)1 OperationDefinition (com.b2international.snowowl.fhir.core.model.operationdefinition.OperationDefinition)1 OpenAPI (io.swagger.v3.oas.models.OpenAPI)1 OpenApiWebMvcResource (org.springdoc.webmvc.api.OpenApiWebMvcResource)1