communities: display name and shortname

This commit is contained in:
Michele Artini 2024-05-13 10:42:52 +02:00
parent 40db13d562
commit 1415976a0f
5 changed files with 107 additions and 39 deletions

View File

@ -243,6 +243,7 @@ public class CommunityImporterService {
details.setId(c.getId()); details.setId(c.getId());
details.setShortName(c.getLabel()); details.setShortName(c.getLabel());
details.setDisplayShortName(c.getLabel());
details.setLastUpdateDate(CommunityMappingUtils.asLocalDateTime(c.getLastUpdateDate())); details.setLastUpdateDate(CommunityMappingUtils.asLocalDateTime(c.getLastUpdateDate()));
details.setCreationDate(CommunityMappingUtils.asLocalDateTime(c.getCreationDate())); details.setCreationDate(CommunityMappingUtils.asLocalDateTime(c.getCreationDate()));
details.setQueryId(c.getId() + PIPE_SEPARATOR + c.getLabel()); details.setQueryId(c.getId() + PIPE_SEPARATOR + c.getLabel());
@ -260,6 +261,8 @@ public class CommunityImporterService {
} }
details.setName(StringUtils.firstNonBlank(asCsv(CSUMMARY_NAME, c.getParams()), c.getLabel())); details.setName(StringUtils.firstNonBlank(asCsv(CSUMMARY_NAME, c.getParams()), c.getLabel()));
details.setDisplayName(StringUtils.firstNonBlank(asCsv(CSUMMARY_NAME, c.getParams()), c.getLabel()));
details.setZenodoCommunity(asCsv(CSUMMARY_ZENODOC, c.getParams())); details.setZenodoCommunity(asCsv(CSUMMARY_ZENODOC, c.getParams()));
details.setSubjects(splitValues(asValues(CPROFILE_SUBJECT, c.getParams()), CSV_DELIMITER)); details.setSubjects(splitValues(asValues(CPROFILE_SUBJECT, c.getParams()), CSV_DELIMITER));
details.setFos(splitValues(asValues(CPROFILE_FOS, c.getParams()), CSV_DELIMITER)); details.setFos(splitValues(asValues(CPROFILE_FOS, c.getParams()), CSV_DELIMITER));

View File

@ -50,6 +50,8 @@ public class CommunityMappingUtils {
c.setId(details.getId()); c.setId(details.getId());
c.setName(details.getName()); c.setName(details.getName());
c.setShortName(details.getShortName()); c.setShortName(details.getShortName());
c.setDisplayName(details.getDisplayName());
c.setDisplayShortName(details.getDisplayShortName());
c.setDescription(details.getDescription()); c.setDescription(details.getDescription());
c.setStatus(details.getStatus()); c.setStatus(details.getStatus());
c.setLogoUrl(details.getLogoUrl()); c.setLogoUrl(details.getLogoUrl());
@ -77,6 +79,12 @@ public class CommunityMappingUtils {
if (StringUtils.isNotBlank(details.getShortName())) { if (StringUtils.isNotBlank(details.getShortName())) {
c.setShortName(details.getShortName()); c.setShortName(details.getShortName());
} }
if (StringUtils.isNotBlank(details.getDisplayName())) {
c.setDisplayName(details.getDisplayName());
}
if (StringUtils.isNotBlank(details.getDisplayShortName())) {
c.setDisplayShortName(details.getDisplayShortName());
}
if (StringUtils.isNotBlank(details.getDescription())) { if (StringUtils.isNotBlank(details.getDescription())) {
c.setDescription(details.getDescription()); c.setDescription(details.getDescription());
} }
@ -138,8 +146,10 @@ public class CommunityMappingUtils {
private static void populateSummary(final CommunitySummary summary, final DbCommunity c) { private static void populateSummary(final CommunitySummary summary, final DbCommunity c) {
summary.setId(c.getId()); summary.setId(c.getId());
summary.setShortName(c.getShortName());
summary.setName(c.getName()); summary.setName(c.getName());
summary.setShortName(c.getShortName());
summary.setDisplayName(c.getDisplayName());
summary.setDisplayShortName(c.getDisplayShortName());
summary.setLastUpdateDate(c.getLastUpdateDate()); summary.setLastUpdateDate(c.getLastUpdateDate());
summary.setCreationDate(c.getCreationDate()); summary.setCreationDate(c.getCreationDate());
summary.setQueryId(c.getId() + PIPE_SEPARATOR + c.getShortName()); summary.setQueryId(c.getId() + PIPE_SEPARATOR + c.getShortName());

View File

@ -124,44 +124,48 @@ public class CommunityDetails extends CommunitySummary {
public String toString() { public String toString() {
final StringBuilder builder = new StringBuilder(); final StringBuilder builder = new StringBuilder();
builder.append("CommunityDetails [\n\tcreationDate = ") builder.append("CommunityDetails [\n\tcreationDate = ")
.append(creationDate) .append(creationDate)
.append(",\n\tlastUpdateDate = ") .append(",\n\tlastUpdateDate = ")
.append(lastUpdateDate) .append(lastUpdateDate)
.append(",\n\tsubjects = ") .append(",\n\tsubjects = ")
.append(subjects) .append(subjects)
.append(",\n\tfos = ") .append(",\n\tfos = ")
.append(fos) .append(fos)
.append(",\n\tsdg = ") .append(",\n\tsdg = ")
.append(sdg) .append(sdg)
.append(",\n\tadvancedConstraints = ") .append(",\n\tadvancedConstraints = ")
.append(advancedConstraints) .append(advancedConstraints)
.append(",\n\tremoveConstraints = ") .append(",\n\tremoveConstraints = ")
.append(removeConstraints) .append(removeConstraints)
.append(",\n\totherZenodoCommunities = ") .append(",\n\totherZenodoCommunities = ")
.append(otherZenodoCommunities) .append(otherZenodoCommunities)
.append(",\n\tid = ") .append(",\n\tid = ")
.append(id) .append(id)
.append(",\n\tqueryId = ") .append(",\n\tqueryId = ")
.append(queryId) .append(queryId)
.append(",\n\ttype = ") .append(",\n\ttype = ")
.append(type) .append(type)
.append(",\n\tname = ") .append(",\n\tname = ")
.append(name) .append(name)
.append(",\n\tshortName = ") .append(",\n\tshortName = ")
.append(shortName) .append(shortName)
.append(",\n\tdescription = ") .append(",\n\tdisplayName = ")
.append(description) .append(displayName)
.append(",\n\tlogoUrl = ") .append(",\n\tdisplayShortName = ")
.append(logoUrl) .append(displayShortName)
.append(",\n\tstatus = ") .append(",\n\tdescription = ")
.append(status) .append(description)
.append(",\n\tzenodoCommunity = ") .append(",\n\tlogoUrl = ")
.append(zenodoCommunity) .append(logoUrl)
.append(",\n\tsuggestedAcknowledgements = ") .append(",\n\tstatus = ")
.append(suggestedAcknowledgements) .append(status)
.append(",\n\tplan = ") .append(",\n\tzenodoCommunity = ")
.append(plan) .append(zenodoCommunity)
.append("\n]"); .append(",\n\tsuggestedAcknowledgements = ")
.append(suggestedAcknowledgements)
.append(",\n\tplan = ")
.append(plan)
.append("\n]");
return builder.toString(); return builder.toString();
} }

View File

@ -24,6 +24,12 @@ public class CommunitySummary {
@Schema(description = "community short name") @Schema(description = "community short name")
protected String shortName; protected String shortName;
@Schema(description = "community name for display")
protected String displayName;
@Schema(description = "community short name for display")
protected String displayShortName;
@Schema(description = "community creation date") @Schema(description = "community creation date")
protected LocalDateTime creationDate; protected LocalDateTime creationDate;
@ -59,6 +65,8 @@ public class CommunitySummary {
final CommunityType type, final CommunityType type,
final String name, final String name,
final String shortName, final String shortName,
final String displayName,
final String displayShortName,
final LocalDateTime creationDate, final LocalDateTime creationDate,
final LocalDateTime lastUpdateDate, final LocalDateTime lastUpdateDate,
final String description, final String description,
@ -71,6 +79,8 @@ public class CommunitySummary {
this.type = type; this.type = type;
this.name = name; this.name = name;
this.shortName = shortName; this.shortName = shortName;
this.displayName = displayName;
this.displayShortName = displayShortName;
this.creationDate = creationDate; this.creationDate = creationDate;
this.lastUpdateDate = lastUpdateDate; this.lastUpdateDate = lastUpdateDate;
this.description = description; this.description = description;
@ -86,6 +96,8 @@ public class CommunitySummary {
summary.getType(), summary.getType(),
summary.getName(), summary.getName(),
summary.getShortName(), summary.getShortName(),
summary.getDisplayName(),
summary.getDisplayShortName(),
summary.getCreationDate(), summary.getCreationDate(),
summary.getLastUpdateDate(), summary.getLastUpdateDate(),
summary.getDescription(), summary.getDescription(),
@ -135,6 +147,22 @@ public class CommunitySummary {
this.shortName = shortName; this.shortName = shortName;
} }
public String getDisplayName() {
return displayName;
}
public void setDisplayName(final String displayName) {
this.displayName = displayName;
}
public String getDisplayShortName() {
return displayShortName;
}
public void setDisplayShortName(final String displayShortName) {
this.displayShortName = displayShortName;
}
public LocalDateTime getCreationDate() { public LocalDateTime getCreationDate() {
return creationDate; return creationDate;
} }

View File

@ -16,6 +16,12 @@ public class CommunityWritableProperties {
@Schema(description = "community short name") @Schema(description = "community short name")
private String shortName; private String shortName;
@Schema(description = "community name for display")
private String displayName;
@Schema(description = "community short name for display")
private String displayShortName;
@Schema(description = "community description") @Schema(description = "community description")
private String description; private String description;
@ -98,6 +104,22 @@ public class CommunityWritableProperties {
this.shortName = shortName; this.shortName = shortName;
} }
public String getDisplayName() {
return displayName;
}
public void setDisplayName(final String displayName) {
this.displayName = displayName;
}
public String getDisplayShortName() {
return displayShortName;
}
public void setDisplayShortName(final String displayShortName) {
this.displayShortName = displayShortName;
}
public String getDescription() { public String getDescription() {
return description; return description;
} }
@ -185,4 +207,5 @@ public class CommunityWritableProperties {
public void setPlan(final CommunityPlanType plan) { public void setPlan(final CommunityPlanType plan) {
this.plan = plan; this.plan = plan;
} }
} }