added validation constraints to Oaf model classes
This commit is contained in:
parent
ded9f6c61b
commit
b4e3359327
|
@ -4,6 +4,8 @@ package eu.dnetlib.dhp.schema.oaf;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
public class Instance implements Serializable {
|
public class Instance implements Serializable {
|
||||||
|
@ -19,7 +21,7 @@ public class Instance implements Serializable {
|
||||||
@NotNull
|
@NotNull
|
||||||
private KeyValue hostedby;
|
private KeyValue hostedby;
|
||||||
|
|
||||||
@NotNull
|
@NotEmpty
|
||||||
private List<String> url;
|
private List<String> url;
|
||||||
|
|
||||||
// other research products specifc
|
// other research products specifc
|
||||||
|
|
|
@ -3,6 +3,7 @@ package eu.dnetlib.dhp.schema.oaf;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -11,10 +12,10 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
|
||||||
public class KeyValue implements Serializable {
|
public class KeyValue implements Serializable {
|
||||||
|
|
||||||
@NotNull
|
@NotBlank
|
||||||
private String key;
|
private String key;
|
||||||
|
|
||||||
@NotNull
|
@NotBlank
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
private DataInfo dataInfo;
|
private DataInfo dataInfo;
|
||||||
|
|
|
@ -9,6 +9,8 @@ import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
public abstract class Oaf implements Serializable {
|
public abstract class Oaf implements Serializable {
|
||||||
|
@ -16,9 +18,11 @@ public abstract class Oaf implements Serializable {
|
||||||
/**
|
/**
|
||||||
* The list of datasource id/name pairs providing this relationship.
|
* The list of datasource id/name pairs providing this relationship.
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@Valid
|
||||||
|
@NotEmpty
|
||||||
protected List<KeyValue> collectedfrom;
|
protected List<KeyValue> collectedfrom;
|
||||||
|
|
||||||
|
@Valid
|
||||||
@NotNull
|
@NotNull
|
||||||
private DataInfo dataInfo;
|
private DataInfo dataInfo;
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,10 @@ import java.io.Serializable;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
import eu.dnetlib.dhp.schema.common.AccessRightComparator;
|
import eu.dnetlib.dhp.schema.common.AccessRightComparator;
|
||||||
|
@ -20,6 +21,7 @@ public class Result extends OafEntity implements Serializable {
|
||||||
private List<Author> author;
|
private List<Author> author;
|
||||||
|
|
||||||
// resulttype allows subclassing results into publications | datasets | software
|
// resulttype allows subclassing results into publications | datasets | software
|
||||||
|
@Valid
|
||||||
@NotNull
|
@NotNull
|
||||||
private Qualifier resulttype;
|
private Qualifier resulttype;
|
||||||
|
|
||||||
|
@ -60,7 +62,8 @@ public class Result extends OafEntity implements Serializable {
|
||||||
|
|
||||||
private List<ExternalReference> externalReference;
|
private List<ExternalReference> externalReference;
|
||||||
|
|
||||||
@NotNull
|
@Valid
|
||||||
|
@NotEmpty
|
||||||
private List<Instance> instance;
|
private List<Instance> instance;
|
||||||
|
|
||||||
public List<Measure> getMeasures() {
|
public List<Measure> getMeasures() {
|
||||||
|
|
Loading…
Reference in New Issue