community plan as enum

This commit is contained in:
Michele Artini 2024-05-09 10:11:50 +02:00
parent 3cbce1024c
commit 550baf79e4
6 changed files with 45 additions and 37 deletions

View File

@ -38,6 +38,7 @@ import eu.dnetlib.openaire.exporter.model.community.CommunityContentprovider;
import eu.dnetlib.openaire.exporter.model.community.CommunityDetails;
import eu.dnetlib.openaire.exporter.model.community.CommunityMembershipType;
import eu.dnetlib.openaire.exporter.model.community.CommunityOrganization;
import eu.dnetlib.openaire.exporter.model.community.CommunityPlanType;
import eu.dnetlib.openaire.exporter.model.community.CommunityProject;
import eu.dnetlib.openaire.exporter.model.community.CommunityStatus;
import eu.dnetlib.openaire.exporter.model.community.CommunityType;
@ -268,7 +269,7 @@ public class CommunityImporterService {
// In the map the string is the serialization of the json representing the selection criteria so it is a valid json
details.setRemoveConstraints(SelectionCriteria.fromJson(asCsv(CPROFILE_REMOVE_CONSTRAINT, c.getParams())));
details.setSuggestedAcknowledgements(splitValues(asValues(CPROFILE_SUGGESTED_ACKNOWLEDGEMENT, c.getParams()), CSV_DELIMITER));
details.setPlan(null);
details.setPlan(CommunityPlanType.Default);
try {
details.setCreationDate(CommunityMappingUtils.asLocalDateTime(asCsv(CPROFILE_CREATIONDATE, c.getParams())));
} catch (final Exception e) {

View File

@ -27,6 +27,7 @@ import eu.dnetlib.openaire.community.utils.CommunityClaimTypeConverter;
import eu.dnetlib.openaire.community.utils.CommunityMembershipTypeConverter;
import eu.dnetlib.openaire.exporter.model.community.CommunityClaimType;
import eu.dnetlib.openaire.exporter.model.community.CommunityMembershipType;
import eu.dnetlib.openaire.exporter.model.community.CommunityPlanType;
import eu.dnetlib.openaire.exporter.model.community.CommunityStatus;
import eu.dnetlib.openaire.exporter.model.community.CommunityType;
import eu.dnetlib.openaire.exporter.model.community.selectioncriteria.SelectionCriteria;
@ -115,7 +116,8 @@ public class DbCommunity implements Serializable {
private String[] suggestedAcknowledgements;
@Column(name = "plan")
private String plan;
@Enumerated(EnumType.STRING)
private CommunityPlanType plan;
public String getId() {
return id;
@ -269,11 +271,11 @@ public class DbCommunity implements Serializable {
this.suggestedAcknowledgements = suggestedAcknowledgements;
}
public String getPlan() {
public CommunityPlanType getPlan() {
return plan;
}
public void setPlan(final String plan) {
public void setPlan(final CommunityPlanType plan) {
this.plan = plan;
}

View File

@ -25,7 +25,7 @@ CREATE TABLE communities (
last_update timestamp NOT NULL DEFAULT now(),
logo_url text,
suggested_acknowledgements text[],
plan text
plan text NOT NULL DEFAULT 'Default'
);
CREATE TABLE community_projects (

View File

@ -0,0 +1,5 @@
package eu.dnetlib.openaire.exporter.model.community;
public enum CommunityPlanType {
Standard, Advanced, Premium, National, Default
}

View File

@ -49,7 +49,7 @@ public class CommunitySummary {
protected String zenodoCommunity;
@Schema(description = "community plan")
protected String plan;
protected CommunityPlanType plan;
public CommunitySummary() {}
@ -65,7 +65,7 @@ public class CommunitySummary {
final String logoUrl,
final CommunityStatus status,
final String zenodoCommunity,
final String plan) {
final CommunityPlanType plan) {
this.id = id;
this.queryId = queryId;
this.type = type;
@ -199,11 +199,11 @@ public class CommunitySummary {
this.zenodoCommunity = zenodoCommunity;
}
public String getPlan() {
public CommunityPlanType getPlan() {
return plan;
}
public void setPlan(final String plan) {
public void setPlan(final CommunityPlanType plan) {
this.plan = plan;
}

View File

@ -56,7 +56,7 @@ public class CommunityWritableProperties {
private CommunityClaimType claim;
@Schema(description = "community plan")
private String plan;
private CommunityPlanType plan;
public List<String> getFos() {
return fos;
@ -178,11 +178,11 @@ public class CommunityWritableProperties {
this.otherZenodoCommunities = otherZenodoCommunities;
}
public String getPlan() {
public CommunityPlanType getPlan() {
return plan;
}
public void setPlan(final String plan) {
public void setPlan(final CommunityPlanType plan) {
this.plan = plan;
}
}