generated from 2martens/template-service
Added first rudimentary OParl request
This commit is contained in:
parent
ef60abc4f9
commit
5089380cec
|
@ -15,5 +15,6 @@ public class OParlServiceProperties {
|
|||
public static class Template {
|
||||
|
||||
private String greeting;
|
||||
private String url;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -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<String> 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;
|
||||
}
|
Binary file not shown.
Loading…
Reference in New Issue