generated from 2martens/template-service
Extracted common fields into parent class
This commit is contained in:
parent
9b570d53c6
commit
21f04fa6e2
|
@ -3,49 +3,19 @@ package de.twomartens.oparlservice.entity;
|
|||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Builder
|
||||
@SuperBuilder
|
||||
@Getter
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AllArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
@NoArgsConstructor(force = true, access = AccessLevel.PRIVATE)
|
||||
public class Body {
|
||||
// common fields
|
||||
@NonNull
|
||||
@Schema(required = true, description = "The unique identifier of the object")
|
||||
private final String id;
|
||||
public class Body extends CommonFields {
|
||||
|
||||
@NonNull
|
||||
@Schema(required = true, description = "Namespace URL to the object type schema")
|
||||
private final String type;
|
||||
|
||||
@NonNull
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
@Schema(required = true, description = "Date and time of the creation of the object")
|
||||
private final ZonedDateTime created;
|
||||
|
||||
@NonNull
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
@Schema(required = true, description = "Date and time of the last update of the object")
|
||||
private final ZonedDateTime modified;
|
||||
|
||||
@Schema(description = "URL to the license", nullable = true)
|
||||
private String license;
|
||||
|
||||
@Schema(description = "Categorization of the object", nullable = true)
|
||||
private String keyword;
|
||||
|
||||
@Schema(description = "URL of a website that presents the object in the browser", nullable = true)
|
||||
private String web;
|
||||
|
||||
@Schema(description = "True, if the object was deleted")
|
||||
private final boolean deleted;
|
||||
|
||||
// bespoke fields
|
||||
@Schema(description = "URL to the system this body belongs to", nullable = true)
|
||||
private final String system;
|
||||
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package de.twomartens.oparlservice.entity;
|
||||
|
||||
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.time.ZonedDateTime;
|
||||
|
||||
@SuperBuilder
|
||||
@Getter
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
@AllArgsConstructor(access = AccessLevel.PROTECTED)
|
||||
@NoArgsConstructor(force = true, access = AccessLevel.PROTECTED)
|
||||
public class CommonFields {
|
||||
@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", nullable = true)
|
||||
private String license;
|
||||
|
||||
@Schema(description = "Categorization of the object", nullable = true)
|
||||
private String keyword;
|
||||
|
||||
@Schema(description = "URL of a website that presents the object in the browser", nullable = true)
|
||||
private String web;
|
||||
|
||||
@Schema(description = "True, if the object was deleted")
|
||||
private final boolean deleted;
|
||||
}
|
|
@ -3,50 +3,19 @@ package de.twomartens.oparlservice.entity;
|
|||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZonedDateTime;
|
||||
|
||||
@Builder
|
||||
@SuperBuilder
|
||||
@Getter
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AllArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
@NoArgsConstructor(force = true, access = AccessLevel.PRIVATE)
|
||||
public class LegislativeTerm {
|
||||
// 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
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
@Schema(required = true, description = "Date and time of the creation of the object")
|
||||
private final ZonedDateTime created;
|
||||
|
||||
@NonNull
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
@Schema(required = true, description = "Date and time of the last update of the object")
|
||||
private final ZonedDateTime modified;
|
||||
|
||||
@Schema(description = "URL to the license", nullable = true)
|
||||
private String license;
|
||||
|
||||
@Schema(description = "Categorization of the object", nullable = true)
|
||||
private String keyword;
|
||||
|
||||
@Schema(description = "URL of a website that presents the object in the browser", nullable = true)
|
||||
private String web;
|
||||
|
||||
@Schema(description = "True, if the object was deleted")
|
||||
private final boolean deleted;
|
||||
|
||||
// bespoke fields
|
||||
@Schema(allOf = CommonFields.class)
|
||||
public class LegislativeTerm extends CommonFields {
|
||||
|
||||
@Schema(description = "URL to body this legislative term belongs to", nullable = true)
|
||||
private final String body;
|
||||
|
|
|
@ -2,47 +2,18 @@ package de.twomartens.oparlservice.entity;
|
|||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Builder
|
||||
@SuperBuilder
|
||||
@Getter
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AllArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
@NoArgsConstructor(force = true, access = AccessLevel.PRIVATE)
|
||||
public class Location {
|
||||
// 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", nullable = true)
|
||||
private String license;
|
||||
|
||||
@Schema(description = "Categorization of the object", nullable = true)
|
||||
private String keyword;
|
||||
|
||||
@Schema(description = "URL of a website that presents the object in the browser", nullable = true)
|
||||
private String web;
|
||||
|
||||
@Schema(description = "True, if the object was deleted")
|
||||
private final boolean deleted;
|
||||
|
||||
// bespoke fields
|
||||
@Schema(allOf = CommonFields.class)
|
||||
public class Location extends CommonFields {
|
||||
|
||||
@Schema(description = "description of the location", nullable = true)
|
||||
private final String description;
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
package de.twomartens.oparlservice.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@SuperBuilder
|
||||
@Getter
|
||||
@ToString
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AllArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
@NoArgsConstructor(force = true, access = AccessLevel.PRIVATE)
|
||||
@Schema(allOf = CommonFields.class)
|
||||
public class Organization extends CommonFields {
|
||||
|
||||
@Schema(description = "URL to body this legislative term belongs to", nullable = true)
|
||||
private final String body;
|
||||
|
||||
@Schema(description = "official long name of the organization", nullable = true)
|
||||
private final String name;
|
||||
|
||||
@Schema(description = "short name of the organization", nullable = true)
|
||||
private final String shortName;
|
||||
|
||||
@Schema(description = "List of URLs to memberships", nullable = true)
|
||||
private final List<String> membership;
|
||||
|
||||
@Schema(description = "URL to list of meetings of this organization", nullable = true)
|
||||
private final String meeting;
|
||||
|
||||
@Schema(description = "URL to list of consultations of this organization", nullable = true)
|
||||
private final String consultation;
|
||||
|
||||
@Schema(description = "List of positions available in this organization", nullable = true)
|
||||
private final List<String> post;
|
||||
|
||||
@Schema(description = "URL to a parent organization", nullable = true)
|
||||
private final String subOrganizationOf;
|
||||
|
||||
@Schema(description = "rough categorization of the organization", nullable = true,
|
||||
allowableValues = "Gremium, Partei, Fraktion, Verwaltungsbereich, externes Gremium, Institution, Sonstiges")
|
||||
private final String organizationType;
|
||||
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
@Schema(description = "founding date of the organization", nullable = true)
|
||||
private final LocalDate startDate;
|
||||
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
@Schema(description = "date of the last day of existance of the organization", nullable = true)
|
||||
private final LocalDate endDate;
|
||||
|
||||
@Schema(description = "URL to the website of the organization", nullable = true)
|
||||
private final String website;
|
||||
|
||||
@Schema(description = "location of the organization", nullable = true)
|
||||
private final Location location;
|
||||
|
||||
@Schema(description = "URL to external OParl body describing this organization", nullable = true)
|
||||
private final String externalBody;
|
||||
}
|
|
@ -1,51 +1,20 @@
|
|||
package de.twomartens.oparlservice.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Builder
|
||||
@SuperBuilder
|
||||
@Getter
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@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;
|
||||
@Schema(allOf = CommonFields.class)
|
||||
public class System extends CommonFields {
|
||||
|
||||
@NonNull
|
||||
@Schema(required = true, description = "Namespace URL to the object type schema")
|
||||
private final String type;
|
||||
|
||||
@NonNull
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
@Schema(required = true, description = "Date and time of the creation of the object")
|
||||
private final ZonedDateTime created;
|
||||
|
||||
@NonNull
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
@Schema(required = true, description = "Date and time of the last update of the object")
|
||||
private final ZonedDateTime modified;
|
||||
|
||||
@Schema(description = "URL to the license", nullable = true)
|
||||
private String license;
|
||||
|
||||
@Schema(description = "Categorization of the object", nullable = true)
|
||||
private String keyword;
|
||||
|
||||
@Schema(description = "URL of a website that presents the object in the browser", nullable = true)
|
||||
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;
|
||||
|
|
Loading…
Reference in New Issue