299 lines
7.5 KiB
Java
299 lines
7.5 KiB
Java
package org.gcube.data_catalogue.grsf_publish_ws.json.input;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
import javax.validation.Valid;
|
|
import javax.validation.constraints.NotNull;
|
|
import javax.validation.constraints.Size;
|
|
|
|
import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.CkanResource;
|
|
import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.CustomField;
|
|
import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.Group;
|
|
import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.Tag;
|
|
import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Source;
|
|
import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Status;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
|
|
/**
|
|
* Information that both Stock and Fishery must contain
|
|
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
|
*/
|
|
@JsonIgnoreProperties(value = {"author", "author_contact", "extras", "product_type"}, ignoreUnknown = true) // ignore in serialization/deserialization
|
|
public class Common {
|
|
|
|
public static final String PRODUCT_TYPE_KEY = "Product type";
|
|
|
|
@JsonProperty("description")
|
|
private String description;
|
|
|
|
@JsonProperty("license_id")
|
|
private String license;
|
|
|
|
// filled automatically by the service
|
|
@JsonProperty("author")
|
|
private String author;
|
|
|
|
@JsonProperty("version")
|
|
private Long version;
|
|
|
|
// filled automatically by the service
|
|
@JsonProperty("author_contact")
|
|
private String authorContact;
|
|
|
|
@JsonProperty("maintainer")
|
|
private String maintainer;
|
|
|
|
@JsonProperty("maintainer_contact")
|
|
private String maintainerContact;
|
|
|
|
@JsonProperty("data_owner")
|
|
@CustomField(key="Data owner")
|
|
private String dataOwner;
|
|
|
|
@JsonProperty("database_sources")
|
|
@CkanResource
|
|
@NotNull(message="database_source cannot be null")
|
|
@Size(min=1, message="database_source cannot be empty")
|
|
@Valid
|
|
private List<Resource<Source>> databaseSources;
|
|
|
|
@JsonProperty("source_of_information")
|
|
@CkanResource
|
|
@NotNull(message="source_of_information cannot be null")
|
|
@Size(min=1, message="source_of_information cannot be empty")
|
|
@Valid
|
|
private List<Resource<String>> sourceOfInformation;
|
|
|
|
@JsonProperty("short_title")
|
|
@CustomField(key="Short Title")
|
|
@NotNull(message="short_title cannot be null")
|
|
@Size(min=1, message="short_title cannot be empty")
|
|
private String shortTitle;
|
|
|
|
@JsonProperty("uuid_knowledge_base")
|
|
@CustomField(key="UUID Knowledge Base")
|
|
@NotNull(message="uuid_knowledge_base cannot be null")
|
|
@Size(min=1, message="uuid_knowledge_base cannot be empty")
|
|
// This will be the identifier of the product!!
|
|
private String uuid;
|
|
|
|
@JsonProperty("traceability_flag")
|
|
@CustomField(key="Traceability Flag")
|
|
@NotNull(message="traceability_flag cannot be null")
|
|
private boolean traceabilityFlag;
|
|
|
|
@JsonProperty("status")
|
|
@CustomField(key="Status")
|
|
@Group
|
|
@Tag
|
|
@NotNull(message="status cannot be null")
|
|
private Status status;
|
|
|
|
// automatically compiled
|
|
@JsonProperty("product_type")
|
|
@CustomField(key=PRODUCT_TYPE_KEY)
|
|
@Tag
|
|
private String productType;
|
|
|
|
@JsonProperty("extras")
|
|
private Map<String, List<String>> extras = new HashMap<>();
|
|
|
|
public Common() {
|
|
super();
|
|
}
|
|
|
|
/**
|
|
* Create a common element.
|
|
* @param description
|
|
* @param license
|
|
* @param author
|
|
* @param version
|
|
* @param authorContact
|
|
* @param maintainer
|
|
* @param maintainerContact
|
|
* @param catchesOrLandings
|
|
* @param databaseSources
|
|
* @param sourceOfInformation
|
|
* @param dataOwner
|
|
* @param type
|
|
* @param shortTitle
|
|
* @param uuid
|
|
* @param traceabilityFlag
|
|
* @param extras
|
|
* @param status
|
|
* @param productType
|
|
*/
|
|
public Common(String description, String license, String author,
|
|
Long version, String authorContact, String maintainer,
|
|
String maintainerContact,
|
|
List<Resource<Source>> databaseSources,
|
|
List<Resource<String>> sourceOfInformation, String dataOwner,
|
|
String shortTitle, String uuid,
|
|
boolean traceabilityFlag, Map<String, List<String>> extras,
|
|
Status status, String productType) {
|
|
super();
|
|
this.description = description;
|
|
this.license = license;
|
|
this.author = author;
|
|
this.version = version;
|
|
this.authorContact = authorContact;
|
|
this.maintainer = maintainer;
|
|
this.maintainerContact = maintainerContact;
|
|
this.databaseSources = databaseSources;
|
|
this.sourceOfInformation = sourceOfInformation;
|
|
this.dataOwner = dataOwner;
|
|
this.shortTitle = shortTitle;
|
|
this.uuid = uuid;
|
|
this.traceabilityFlag = traceabilityFlag;
|
|
this.extras = extras;
|
|
this.status = status;
|
|
this.productType = productType;
|
|
}
|
|
|
|
public String getProductType() {
|
|
return productType;
|
|
}
|
|
|
|
public void setProductType(String productType) {
|
|
this.productType = productType;
|
|
}
|
|
|
|
public String getDescription() {
|
|
return description;
|
|
}
|
|
|
|
public void setDescription(String description) {
|
|
this.description = description;
|
|
}
|
|
|
|
public String getLicense() {
|
|
return license;
|
|
}
|
|
|
|
public void setLicense(String license) {
|
|
this.license = license;
|
|
}
|
|
|
|
public String getAuthor() {
|
|
return author;
|
|
}
|
|
|
|
public void setAuthor(String author) {
|
|
this.author = author;
|
|
}
|
|
|
|
public Long getVersion() {
|
|
return version;
|
|
}
|
|
|
|
public void setVersion(Long version) {
|
|
this.version = version;
|
|
}
|
|
|
|
public String getAuthorContact() {
|
|
return authorContact;
|
|
}
|
|
|
|
public void setAuthorContact(String authorContact) {
|
|
this.authorContact = authorContact;
|
|
}
|
|
|
|
public String getMaintainer() {
|
|
return maintainer;
|
|
}
|
|
|
|
public void setMaintainer(String maintainer) {
|
|
this.maintainer = maintainer;
|
|
}
|
|
|
|
public String getMaintainerContact() {
|
|
return maintainerContact;
|
|
}
|
|
|
|
public void setMaintainerContact(String maintainerContact) {
|
|
this.maintainerContact = maintainerContact;
|
|
}
|
|
|
|
public List<Resource<Source>> getDatabaseSources() {
|
|
return databaseSources;
|
|
}
|
|
|
|
public void setDatabaseSources(List<Resource<Source>> databaseSources) {
|
|
this.databaseSources = databaseSources;
|
|
}
|
|
|
|
public List<Resource<String>> getSourceOfInformation() {
|
|
return sourceOfInformation;
|
|
}
|
|
|
|
public void setSourceOfInformation(List<Resource<String>> sourceOfInformation) {
|
|
this.sourceOfInformation = sourceOfInformation;
|
|
}
|
|
|
|
public String getDataOwner() {
|
|
return dataOwner;
|
|
}
|
|
|
|
public void setDataOwner(String dataOwner) {
|
|
this.dataOwner = dataOwner;
|
|
}
|
|
|
|
public void setExtras(Map<String, List<String>> extras) {
|
|
this.extras = extras;
|
|
}
|
|
|
|
public Map<String, List<String>> getExtras() {
|
|
return extras;
|
|
}
|
|
|
|
public String getShortTitle() {
|
|
return shortTitle;
|
|
}
|
|
|
|
public void setShortTitle(String shortTitle) {
|
|
this.shortTitle = shortTitle;
|
|
}
|
|
|
|
public String getUuid() {
|
|
return uuid;
|
|
}
|
|
|
|
public void setUuid(String uuid) {
|
|
this.uuid = uuid;
|
|
}
|
|
|
|
public boolean isTraceabilityFlag() {
|
|
return traceabilityFlag;
|
|
}
|
|
|
|
public void setTraceabilityFlag(boolean traceabilityFlag) {
|
|
this.traceabilityFlag = traceabilityFlag;
|
|
}
|
|
|
|
public Status getStatus() {
|
|
return status;
|
|
}
|
|
|
|
public void setStatus(Status status) {
|
|
this.status = status;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "Common [description=" + description + ", license=" + license
|
|
+ ", author=" + author + ", version=" + version
|
|
+ ", authorContact=" + authorContact + ", maintainer="
|
|
+ maintainer + ", maintainerContact=" + maintainerContact
|
|
+ ", dataOwner=" + dataOwner + ", databaseSources="
|
|
+ databaseSources + ", sourceOfInformation="
|
|
+ sourceOfInformation + ", shortTitle="
|
|
+ shortTitle + ", uuid=" + uuid + ", traceabilityFlag="
|
|
+ traceabilityFlag + ", extras=" + extras + ", status="
|
|
+ status + ", productType=" + productType + "]";
|
|
}
|
|
}
|