partial implementation of the extension

This commit is contained in:
Michele Artini 2024-09-24 12:40:15 +02:00
parent 8c1111527d
commit fa84a3b90d
3 changed files with 82 additions and 16 deletions

View File

@ -135,6 +135,15 @@ public class DbCommunity implements Serializable {
@Column(name = "params")
private List<Param> params = new ArrayList<>();
@Column(name = "category")
private String category;
@Column(name = "claimable")
private boolean claimable = false;
@Column(name = "browsable")
private boolean browsable = false;
public String getId() {
return id;
}
@ -327,4 +336,28 @@ public class DbCommunity implements Serializable {
this.params = params;
}
public String getCategory() {
return category;
}
public void setCategory(final String category) {
this.category = category;
}
public boolean isClaimable() {
return claimable;
}
public void setClaimable(final boolean claimable) {
this.claimable = claimable;
}
public boolean isBrowsable() {
return browsable;
}
public void setBrowsable(final boolean browsable) {
this.browsable = browsable;
}
}

View File

@ -237,16 +237,27 @@ public class CommunityMappingUtils {
public static DbCommunity toDbCommunity(final String master, final SubCommunity sub) {
final DbCommunity dbsc = new DbCommunity();
// TODO
dbsc.setId(sub.getSubCommunityId());
dbsc.setMaster(master);
// dbsc.setMaster(master);
// dbsc.setId(sub.getSubCommunityId());
// dbsc.setCategory(sub.getCategory());
// dbsc.setLabel(sub.getLabel());
// dbsc.setParams(sub.getParams());
// TODO
// dbsc.setParent(sub.getParent());
// dbsc.setClaim(sub.isClaim());
// dbsc.setBrowsable(sub.isBrowsable());
dbsc.setCategory(sub.getCategory());
dbsc.setName(sub.getLabel());
dbsc.setShortName(sub.getLabel());
dbsc.setParams(sub.getParams());
dbsc.setClaimable(sub.isClaim());
dbsc.setBrowsable(sub.isBrowsable());
dbsc.setAdvancedConstraints(sub.getAdvancedConstraints());
dbsc.setRemoveConstraints(sub.getRemoveConstraints());
dbsc.setFos(toStringArray(sub.getFos()));
dbsc.setSdg(toStringArray(sub.getSdg()));
dbsc.setSubjects(toStringArray(sub.getSubjects()));
dbsc.setMainZenodoCommunity(sub.getZenodoCommunity());
dbsc.setOtherZenodoCommunities(toStringArray(sub.getOtherZenodoCommunities()));
dbsc.setSuggestedAcknowledgements(toStringArray(sub.getSuggestedAcknowledgements()));
dbsc.setLastUpdateDate(LocalDateTime.now());
return dbsc;
}
@ -254,16 +265,25 @@ public class CommunityMappingUtils {
public static SubCommunity toSubCommunity(final DbCommunity sub) {
final SubCommunity sc = new SubCommunity();
// TODO
sc.setSubCommunityId(sub.getId());
sc.setCommunityId(sub.getMaster());
// sc.setSubCommunityId(sub.getId());
// sc.setCategory(sub.getCategory());
// sc.setCommunityId(sub.getCommunity());
// sc.setLabel(sub.getLabel());
// sc.setParams(sub.getParams());
// TODO
// sc.setParent(sub.getParent());
// sc.setClaim(sub.isClaim());
// sc.setBrowsable(sub.isBrowsable());
sc.setCategory(sub.getCategory());
sc.setLabel(sub.getName());
sc.setParams(sub.getParams());
sc.setClaim(sub.isClaimable());
sc.setBrowsable(sub.isBrowsable());
sc.setAdvancedConstraints(sub.getAdvancedConstraints());
sc.setRemoveConstraints(sub.getRemoveConstraints());
sc.setFos(Arrays.asList(sub.getFos()));
sc.setSdg(Arrays.asList(sub.getSdg()));
sc.setSubjects(Arrays.asList(sub.getSubjects()));
sc.setZenodoCommunity(sub.getMainZenodoCommunity());
sc.setOtherZenodoCommunities(Arrays.asList(sub.getOtherZenodoCommunities()));
sc.setSuggestedAcknowledgements(Arrays.asList(sub.getSuggestedAcknowledgements()));
return sc;
}

View File

@ -51,6 +51,9 @@ public class SubCommunity {
@Schema(description = "list of the remove criteria for this sub-community")
private SelectionCriteria removeConstraints;
@Schema(description = "Zenodo community associated to this sub-community")
protected String zenodoCommunity;
@Schema(description = "other zenodo communities for this sub-community")
private List<String> otherZenodoCommunities;
@ -161,6 +164,14 @@ public class SubCommunity {
this.removeConstraints = removeConstraints;
}
public String getZenodoCommunity() {
return zenodoCommunity;
}
public void setZenodoCommunity(final String zenodoCommunity) {
this.zenodoCommunity = zenodoCommunity;
}
public List<String> getOtherZenodoCommunities() {
return otherZenodoCommunities;
}
@ -206,6 +217,8 @@ public class SubCommunity {
builder.append(advancedConstraints);
builder.append(", removeConstraints=");
builder.append(removeConstraints);
builder.append(", zenodoCommunity=");
builder.append(zenodoCommunity);
builder.append(", otherZenodoCommunities=");
builder.append(otherZenodoCommunities);
builder.append(", suggestedAcknowledgements=");