dnet-applications/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityContentprovider.java

101 lines
2.3 KiB
Java
Raw Normal View History

2022-02-04 10:12:15 +01:00
package eu.dnetlib.openaire.community;
import javax.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.google.gson.Gson;
2022-02-07 10:09:18 +01:00
2022-02-04 10:12:15 +01:00
import eu.dnetlib.openaire.community.selectioncriteria.SelectionCriteria;
2022-08-19 15:21:40 +02:00
import io.swagger.v3.oas.annotations.media.Schema;
2022-02-04 10:12:15 +01:00
@JsonAutoDetect
public class CommunityContentprovider {
2022-08-19 15:21:40 +02:00
@Schema(description = "OpenAIRE identifier for this content provider, if available", required = false)
2022-02-04 10:12:15 +01:00
private String openaireId;
@NotNull
2022-08-19 15:21:40 +02:00
@Schema(description = "the community identifier this content provider belongs to", required = true)
2022-02-04 10:12:15 +01:00
private String communityId;
@NotNull
2022-08-19 15:21:40 +02:00
@Schema(description = "identifies this content provider within the context it belongs to", required = true)
2022-02-04 10:12:15 +01:00
private String id;
2022-08-19 15:21:40 +02:00
@Schema(description = "content provider name", required = false)
2022-02-04 10:12:15 +01:00
private String name;
@NotNull
2022-08-19 15:21:40 +02:00
@Schema(description = "content provider official name", required = true)
2022-02-04 10:12:15 +01:00
private String officialname;
2022-02-07 10:09:18 +01:00
// @NotNull
2022-08-19 15:21:40 +02:00
@Schema(description = "content provider selection criteria", required = false)
2022-02-04 10:12:15 +01:00
private SelectionCriteria selectioncriteria;
public String getOpenaireId() {
return openaireId;
}
public void setOpenaireId(final String openaireId) {
this.openaireId = openaireId;
}
public String getCommunityId() {
return communityId;
}
public void setCommunityId(final String communityId) {
this.communityId = communityId;
}
public String getId() {
return id;
}
public void setId(final String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(final String name) {
this.name = name;
}
public String getOfficialname() {
return officialname;
}
public void setOfficialname(final String officialname) {
this.officialname = officialname;
}
public SelectionCriteria getSelectioncriteria() {
2022-02-07 10:09:18 +01:00
return this.selectioncriteria;
2022-02-04 10:12:15 +01:00
}
2022-02-07 10:09:18 +01:00
public void setSelectioncriteria(final SelectionCriteria selectioncriteria) {
2022-02-04 10:12:15 +01:00
this.selectioncriteria = selectioncriteria;
}
2022-02-07 10:09:18 +01:00
@Override
public String toString() {
return String.format("id %s, name %s, selection criteria %s", this.id, this.name, toJson());
2022-02-04 10:12:15 +01:00
}
public String toJson() {
2022-02-07 10:09:18 +01:00
if (selectioncriteria == null) { return ""; }
2022-02-04 10:12:15 +01:00
return new Gson().toJson(selectioncriteria);
}
public String toXML() {
2022-02-07 10:09:18 +01:00
if (selectioncriteria == null) { return ""; }
return "<![CDATA[" + toJson() + "]]>";
2022-02-04 10:12:15 +01:00
}
}