SORMAS-Foundation / SORMAS-Project

SORMAS (Surveillance, Outbreak Response Management and Analysis System) is an early warning and management system to fight the spread of infectious diseases.
https://sormas.org
GNU General Public License v3.0
292 stars 140 forks source link

SORMAS OData service using Apache Olingo #4855

Open MartinWahnschaffe opened 3 years ago

MartinWahnschaffe commented 3 years ago

Situation Description

Internal and external systems often have the need to access the SORMAS data in a query-like manner, e.g. to search for entities with certain values or to limit the returned data to a subset of fields.

Feature Description

OData is an open protocol that does just that using a ReSTful-API. The Apache Olingo library is an OData implementation. For OData v2 it also provides an extension to automatically map entities based on JPA, that we want to use here. Note: There is also an extension for v4 provided by SAP, but it's not clear how well this is working, so we should stick to v2.

See https://olingo.apache.org/doc/odata2/tutorials/CreateWebApp.html and https://www.baeldung.com/olingo

Data security perspective

OData is an OASIS and ISO/IEC standard for accessing data via a ReSTful API. As such, it allows records to be queried and navigated through using standard HTTP calls. The data is returned as either XML or JSON.

It uses the Apache Olingo OData 2.0 Java library with the JPA processor extension. This allows access to all data mapped via JPA - so in the case of SORMAS, the full database.

Examples:

Access to SORMAS OData is only possible with the appropriate authorisation. This means that a user must be created in SORMAS who has the SORMAS OData authorisation.

Important: There is no restriction of the data based on the authenticated user.

Translated with www.DeepL.com/Translator (free version)

JonasCir commented 3 years ago

This is super cool and useful! :)

tkaefer commented 3 years ago

Thanks for picking up my idea. It will be pretty helpful.