oparl-service/oparl-server/src/main/java/de/twomartens/oparlservice/service/OParlService.java

132 lines
4.7 KiB
Java

package de.twomartens.oparlservice.service;
import de.twomartens.oparlservice.configs.OParlServiceProperties;
import de.twomartens.oparlservice.entity.*;
import de.twomartens.oparlservice.entity.System;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.ZonedDateTime;
import java.util.Collections;
import java.util.List;
@Service
public class OParlService {
private final OParlServiceProperties properties;
private final Body exampleBody;
private final LegislativeTerm exampleTerm;
private final System system;
public OParlService(OParlServiceProperties properties) {
this.properties = properties;
this.exampleTerm = LegislativeTerm.builder()
.id(properties.getUrl() + "/v1.1/term/21")
.type("https://schema.oparl.org/1.1/LegislativeTerm")
.body(properties.getUrl() + "/v1.1/body/0")
.name("21. Wahlperiode")
.startDate(LocalDate.parse("2019-05-27"))
.endDate(LocalDate.parse("2024-05-26"))
.created(ZonedDateTime.now())
.modified(ZonedDateTime.now())
.build();
this.exampleBody = Body.builder()
.id(properties.getUrl() + "/v1.1/body/0")
.type("https://schema.oparl.org/1.1/Body")
.created(ZonedDateTime.now())
.modified(ZonedDateTime.now())
.shortName("Hamburg")
.name("Bezirk Eimsbüttel")
.system(properties.getUrl() + "/v1.1")
.legislativeTerm(List.of(exampleTerm))
.website("https://www.hamburg.de/eimsbuettel")
.ags("02000000")
.rgs("020000000000")
.equivalent(List.of("http://dbpedia.org/page/Eimsb%C3%BCttel", "http://d-nb.info/1208293575"))
.organization(properties.getUrl() + "/v1.1/organizations/0")
.person(properties.getUrl() + "/v1.1/persons/0")
.meeting(properties.getUrl() + "/v1.1/meetings/0")
.paper(properties.getUrl() + "/v1.1/papers/0")
.agendaItem(properties.getUrl() + "/v1.1/agendaItems/0")
.consultation(properties.getUrl() + "/v1.1/consultations/0")
.file(properties.getUrl() + "/v1.1/files/0")
.locationList(properties.getUrl() + "/v1.1/locations/0")
.legislativeTermList(properties.getUrl() + "/v1.1/terms")
.membership(properties.getUrl() + "/v1.1/memberships/0")
.classification("Bezirk")
.build();
this.system = System.builder()
.id(properties.getUrl() + "/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.getUrl() + "/bodies")
.build();
}
public List<Body> getBodies() {
return List.of(exampleBody);
}
public Body getBody(String id) {
return exampleBody;
}
public LegislativeTerm getLegislativeTerm(String id) {
return exampleTerm;
}
public Meeting getMeeting(String id) {
return null;
}
public List<Meeting> getMeetingsInBody(String bodyID) {
return Collections.emptyList();
}
public List<Meeting> getMeetingsInOrganization(String organizationID) {
return Collections.emptyList();
}
public Membership getMembership(String id) {
return null;
}
public List<Membership> getMembershipsInBody(String bodyID) {
return Collections.emptyList();
}
public List<Membership> getMembershipsInOrganization(String organizationID) {
return Collections.emptyList();
}
public List<Organization> getOrganizationsInBody(String bodyID) {
return Collections.emptyList();
}
public Organization getOrganization(String id) {
return null;
}
public List<Person> getPersonsInBody(String bodyID) {
return Collections.emptyList();
}
public Person getPerson(String id) {
return null;
}
public System getSystem() {
return system;
}
}