dnet-applications/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/CommunityContentprovider.java

140 lines
3.3 KiB
Java
Raw Normal View History

package eu.dnetlib.openaire.exporter.model.community;
2022-02-04 10:12:15 +01:00
import javax.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
2022-02-07 10:09:18 +01:00
import eu.dnetlib.openaire.exporter.model.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;
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;
// @NotNull
@Schema(description = "content provider enabled for content inclusion", required = false)
private boolean enabled;
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;
2024-02-27 10:36:55 +01:00
@Schema(description = "suggested for deposition", required = false)
private Boolean deposit;
@Schema(description = "message for the deposition page", required = false)
private String message;
2022-02-04 10:12:15 +01:00
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 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 boolean isEnabled() {
return enabled;
}
public void setEnabled(final boolean enabled) {
this.enabled = enabled;
}
2022-02-04 10:12:15 +01:00
public SelectionCriteria getSelectioncriteria() {
2024-02-27 10:36:55 +01:00
return 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;
}
public String toJson() {
2022-02-07 10:09:18 +01:00
if (selectioncriteria == null) { return ""; }
try {
return new ObjectMapper().writeValueAsString(selectioncriteria);
} catch (final JsonProcessingException e) {
throw new RuntimeException(e);
}
2022-02-04 10:12:15 +01:00
}
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
}
2023-06-29 10:39:53 +02:00
@Override
public String toString() {
final StringBuilder builder = new StringBuilder();
builder.append("CommunityContentprovider [\n\topenaireId = ")
2024-02-27 10:36:55 +01:00
.append(openaireId)
.append(",\n\tcommunityId = ")
.append(communityId)
.append(",\n\tname = ")
.append(name)
.append(",\n\tofficialname = ")
.append(officialname)
.append(",\n\tselectioncriteria = ")
.append(selectioncriteria)
.append("\n]");
2023-06-29 10:39:53 +02:00
return builder.toString();
}
2024-02-27 10:36:55 +01:00
public Boolean getDeposit() {
return deposit;
}
public void setDeposit(final Boolean deposit) {
this.deposit = deposit;
}
public String getMessage() {
return message;
}
public void setMessage(final String message) {
this.message = message;
}
2022-02-04 10:12:15 +01:00
}