From 5089380cec9dc082d065001d531976f020ca3ac5 Mon Sep 17 00:00:00 2001 From: Jim Martens Date: Wed, 8 Jul 2020 00:06:57 +0200 Subject: [PATCH] Added first rudimentary OParl request --- .../configs/OParlServiceProperties.java | 1 + .../oparlservice/control/OParlController.java | 45 +++++++++++ .../oparlservice/entity/System.java | 74 ++++++++++++++++++ .../src/main/resources/application.yaml | Bin 699 -> 727 bytes 4 files changed, 120 insertions(+) create mode 100644 oparl-server/src/main/java/de/twomartens/oparlservice/control/OParlController.java create mode 100644 oparl-server/src/main/java/de/twomartens/oparlservice/entity/System.java diff --git a/oparl-server/src/main/java/de/twomartens/oparlservice/configs/OParlServiceProperties.java b/oparl-server/src/main/java/de/twomartens/oparlservice/configs/OParlServiceProperties.java index 4370b9e..af4d430 100644 --- a/oparl-server/src/main/java/de/twomartens/oparlservice/configs/OParlServiceProperties.java +++ b/oparl-server/src/main/java/de/twomartens/oparlservice/configs/OParlServiceProperties.java @@ -15,5 +15,6 @@ public class OParlServiceProperties { public static class Template { private String greeting; + private String url; } } diff --git a/oparl-server/src/main/java/de/twomartens/oparlservice/control/OParlController.java b/oparl-server/src/main/java/de/twomartens/oparlservice/control/OParlController.java new file mode 100644 index 0000000..4159244 --- /dev/null +++ b/oparl-server/src/main/java/de/twomartens/oparlservice/control/OParlController.java @@ -0,0 +1,45 @@ +package de.twomartens.oparlservice.control; + +import de.twomartens.oparlservice.configs.OParlServiceProperties; +import de.twomartens.oparlservice.entity.System; +import io.swagger.v3.oas.annotations.Operation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; + +import java.time.ZonedDateTime; + +@Slf4j +@RestController +@RequestMapping(path = "/oparl") +public class OParlController { + private final OParlServiceProperties properties; + + OParlController(OParlServiceProperties properties) { + this.properties = properties; + } + + @GetMapping("system/v1.1") + @Operation(summary = "System information", description = "returns information about the OParl system") + @ResponseBody + public System system() { + log.info("method invoked /oparl/system/v1.1"); + return System.builder() + .id(properties.getTemplate().getUrl() + "/oparl/system/v1.1") + .type("https://schema.oparl.org/1.1/System") + .license("https://www.govdata.de/dl-de/by-2-0") + .created(ZonedDateTime.now()) + .modified(ZonedDateTime.now()) + .oparlVersion("https://schema.oparl.org/1.1/") + .name("OParl interface for ALLRIS of Hamburg Eimsbüttel") + .contactEmail("github@2martens.de") + .contactName("Jim Martens") + .website("https://sitzungsdienst-eimsbuettel.hamburg.de/bi/") + .vendor("https://2martens.de") + .product("https://git.2martens.de/2martens/oparl-service") + .body(properties.getTemplate().getUrl() + "/oparl/listBodies/v1.1") + .build(); + } +} diff --git a/oparl-server/src/main/java/de/twomartens/oparlservice/entity/System.java b/oparl-server/src/main/java/de/twomartens/oparlservice/entity/System.java new file mode 100644 index 0000000..2d8a051 --- /dev/null +++ b/oparl-server/src/main/java/de/twomartens/oparlservice/entity/System.java @@ -0,0 +1,74 @@ +package de.twomartens.oparlservice.entity; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import java.time.ZonedDateTime; +import java.util.List; + +@Builder +@Getter +@ToString +@EqualsAndHashCode +@AllArgsConstructor(access = AccessLevel.PRIVATE) +@NoArgsConstructor(force = true, access = AccessLevel.PRIVATE) +public class System { + // common fields + @NonNull + @Schema(required = true, description = "The unique identifier of the object") + private final String id; + + @NonNull + @Schema(required = true, description = "Namespace URL to the object type schema") + private final String type; + + @NonNull + @Schema(required = true, description = "Date and time of the creation of the object") + private final ZonedDateTime created; + + @NonNull + @Schema(required = true, description = "Date and time of the last update of the object") + private final ZonedDateTime modified; + + @Schema(description = "URL to the license") + private String license; + + @Schema(description = "Categorization of the object") + private String keyword; + + @Schema(description = "URL of a website that presents the object in the browser") + private String web; + + @Schema(description = "True, if the object was deleted") + private final boolean deleted; + + // bespoke fields + @NonNull + @Schema(required = true, description = "URL to the OParl specification supported by this service") + private final String oparlVersion; + + @Schema(description = "Contains a list of URLs to System objects supporting another Oparl version") + private final List otherOparlVersions; + + @NonNull + @Schema(required = true, description = "URL to the list of all bodies existing in this system") + private final String body; + + @Schema(description = "User friendly name for this system") + private final String name; + + @Schema(description = "E-Mail-Address for requests related to the OParl-API") + private final String contactEmail; + + @Schema(description = "Name of the contact person who can be reached by contactEmail") + private final String contactName; + + @Schema(description = "URL of the website of the parliamentary information system") + private final String website; + + @Schema(description = "URL to the website of the software creator of the OParl server software") + private final String vendor; + + @Schema(description = "URL to information about the OParl server software utilized by this system") + private final String product; +} diff --git a/oparl-server/src/main/resources/application.yaml b/oparl-server/src/main/resources/application.yaml index 55c0c9c42b2a2a246c38aaea6a9f4b2a3b881238..63c084409ace74bd5ea7bbfab3d64cf756588515 100644 GIT binary patch literal 727 zcmV;|0x10eM@dveQdv+`0FdeYzq9ScHb1rb@oeLbGV~Y2r-MfceVLu=Qa7pX;Jdt+ zQ9Z^W#yS!9y;tyXX*Wy`rd%u3&QFc^;&_Rp3#F-t`f1n_io@UcVrSQ={IDq4B}wYd z22}m2N{y6j8`ps106@`$&p+}$Hc(+9n}s6-7Q|7!oy4vc%ULS5pgm)T!;;q^*qI=0 z4z-?W#AR2BuYhgfkWq1lDWRne8Pao2oRDLOiO$>eT zOs!mFVE3-~VXV;^nWQa8pAN0HCh#|Zf~lpl8gNn&yOtqCpFxl*hfn13_Q?d(Z8o^1 z3WYa?Iy}fR7OdO3XMz!anTyaY?-tLg8{fanhu3ZT? z0j81jyM{kVt}GIWh*H(z!@HBA^r>OP-7iBBAbPA`zEo~~p*Z-FIU`uI2L+U>V|;MR zrJf=jQH3_Q4Q9CGV%-oda!$E@jmVY_x(<+m&6Dn}bn^lh1?;NP!1vy!C7C|j^myF(pfH*=2M(q zb`C@m{V-9XH97P6b;(MXC+Manb7&LaW3Wn15sD)qAPV2h#gIU1e%i~e76|5{Xt6k7 z=LYEE)<^~QXkUD^R>SqC+H7actgkfQ=y-<{_{>1%@KC6!2)1Kp)iW%Mu1pCYL?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