Merge pull request 'communities-displayname-field' (#20) from communities-displayname-field into master

Reviewed-on: #20
This commit is contained in:
Michele Artini 2024-05-17 10:16:34 +02:00
commit 8e82868559
7 changed files with 131 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

@ -53,6 +53,12 @@ public class DbCommunity implements Serializable {
@Column(name = "shortname")
private String shortName;
@Column(name = "displayname")
private String displayName;
@Column(name = "displayshortname")
private String displayShortName;
@Column(name = "description")
private String description;
@ -143,6 +149,22 @@ public class DbCommunity implements Serializable {
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;
}

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

@ -9,6 +9,8 @@ CREATE TABLE communities (
id text PRIMARY KEY,
name text NOT NULL,
shortname text NOT NULL, -- in the profile is label
displayname text,
displayshortname text,
description text NOT NULL DEFAULT '',
status text NOT NULL DEFAULT 'hidden', -- all, manager, hidden, members
membership text NOT NULL DEFAULT 'by-invitation', -- open, by-invitation

View File

@ -149,6 +149,10 @@ public class CommunityDetails extends CommunitySummary {
.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 = ")

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;
}
}