Browse Source

Added object lists as per requirement

master
Jim Martens 10 months ago
parent
commit
e2f896338f
  1. 32
      oparl-server/src/main/java/de/twomartens/oparlservice/entity/Links.java
  2. 28
      oparl-server/src/main/java/de/twomartens/oparlservice/entity/ObjectList.java
  3. 26
      oparl-server/src/main/java/de/twomartens/oparlservice/entity/Pagination.java

32
oparl-server/src/main/java/de/twomartens/oparlservice/entity/Links.java

@ -0,0 +1,32 @@
package de.twomartens.oparlservice.entity;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
@Builder
@Getter
@ToString
@EqualsAndHashCode
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@NoArgsConstructor(force = true, access = AccessLevel.PRIVATE)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Links {
@Schema(description = "URL to the first list page", nullable = true)
private final String first;
@Schema(description = "URL to the previous list page", nullable = true)
private final String prev;
@Schema(description = "canonical URL for the current list page", nullable = true)
private final String self;
@Schema(description = "URL to the next list page", required = true)
private final String next;
@Schema(description = "URL to the last list page", nullable = true)
private final String last;
@Schema(description = "URL of a website that presents the object in the browser", nullable = true)
private String web;
}

28
oparl-server/src/main/java/de/twomartens/oparlservice/entity/ObjectList.java

@ -0,0 +1,28 @@
package de.twomartens.oparlservice.entity;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.List;
@Builder
@Getter
@ToString
@EqualsAndHashCode
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@NoArgsConstructor(force = true, access = AccessLevel.PRIVATE)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ObjectList<T> {
@NonNull
@Schema(description = "contains list of objects", required = true)
private final List<T> data;
@NonNull
@Schema(description = "contains information about pagination", required = true)
private final Pagination pagination;
@NonNull
@Schema(description = "contains links related to this list", required = true)
private final Links links;
}

26
oparl-server/src/main/java/de/twomartens/oparlservice/entity/Pagination.java

@ -0,0 +1,26 @@
package de.twomartens.oparlservice.entity;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
@Builder
@Getter
@ToString
@EqualsAndHashCode
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@NoArgsConstructor(force = true, access = AccessLevel.PRIVATE)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Pagination {
@Schema(description = "specifies total number of objects in the list", nullable = true)
private final int totalElements;
@Schema(description = "specifies the number of objects per list page", nullable = true)
private final int elementsPerPage;
@Schema(description = "specifies the current page number in the list", nullable = true)
private final int currentPage;
@Schema(description = "specifies the total number of pages in the list", nullable = true)
private final int totalPages;
}
Loading…
Cancel
Save