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.setShortName(c.getLabel());
details.setDisplayShortName(c.getLabel());
details.setLastUpdateDate(CommunityMappingUtils.asLocalDateTime(c.getLastUpdateDate()));
details.setCreationDate(CommunityMappingUtils.asLocalDateTime(c.getCreationDate()));
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.setDisplayName(StringUtils.firstNonBlank(asCsv(CSUMMARY_NAME, c.getParams()), c.getLabel()));
details.setZenodoCommunity(asCsv(CSUMMARY_ZENODOC, c.getParams()));
details.setSubjects(splitValues(asValues(CPROFILE_SUBJECT, 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.setName(details.getName());
c.setShortName(details.getShortName());
c.setDisplayName(details.getDisplayName());
c.setDisplayShortName(details.getDisplayShortName());
c.setDescription(details.getDescription());
c.setStatus(details.getStatus());
c.setLogoUrl(details.getLogoUrl());
@ -77,6 +79,12 @@ public class CommunityMappingUtils {
if (StringUtils.isNotBlank(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())) {
c.setDescription(details.getDescription());
}
@ -138,8 +146,10 @@ public class CommunityMappingUtils {
private static void populateSummary(final CommunitySummary summary, final DbCommunity c) {
summary.setId(c.getId());
summary.setShortName(c.getShortName());
summary.setName(c.getName());
summary.setShortName(c.getShortName());
summary.setDisplayName(c.getDisplayName());
summary.setDisplayShortName(c.getDisplayShortName());
summary.setLastUpdateDate(c.getLastUpdateDate());
summary.setCreationDate(c.getCreationDate());
summary.setQueryId(c.getId() + PIPE_SEPARATOR + c.getShortName());

View File

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

View File

@ -24,6 +24,12 @@ public class CommunitySummary {
@Schema(description = "community short name")
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")
protected LocalDateTime creationDate;
@ -59,6 +65,8 @@ public class CommunitySummary {
final CommunityType type,
final String name,
final String shortName,
final String displayName,
final String displayShortName,
final LocalDateTime creationDate,
final LocalDateTime lastUpdateDate,
final String description,
@ -71,6 +79,8 @@ public class CommunitySummary {
this.type = type;
this.name = name;
this.shortName = shortName;
this.displayName = displayName;
this.displayShortName = displayShortName;
this.creationDate = creationDate;
this.lastUpdateDate = lastUpdateDate;
this.description = description;
@ -86,6 +96,8 @@ public class CommunitySummary {
summary.getType(),
summary.getName(),
summary.getShortName(),
summary.getDisplayName(),
summary.getDisplayShortName(),
summary.getCreationDate(),
summary.getLastUpdateDate(),
summary.getDescription(),
@ -135,6 +147,22 @@ public class CommunitySummary {
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() {
return creationDate;
}

View File

@ -16,6 +16,12 @@ public class CommunityWritableProperties {
@Schema(description = "community short name")
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")
private String description;
@ -98,6 +104,22 @@ public class CommunityWritableProperties {
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() {
return description;
}
@ -185,4 +207,5 @@ public class CommunityWritableProperties {
public void setPlan(final CommunityPlanType plan) {
this.plan = plan;
}
}