moved claim and membership to parent class
This commit is contained in:
parent
1a4dcddbe3
commit
970eff3926
|
@ -111,7 +111,7 @@ public class CommunityService {
|
|||
public CommunityDetails getCommunity(final String id) throws CommunityException {
|
||||
try {
|
||||
final DbCommunity c = dbCommunityRepository.findById(id).orElseThrow(() -> new ResourceNotFoundException("Community not found: " + id));
|
||||
return CommunityMappingUtils.CommunityDetails(c);
|
||||
return CommunityMappingUtils.toCommunityDetails(c);
|
||||
} catch (final Throwable e) {
|
||||
log.error(e);
|
||||
throw new CommunityException(e);
|
||||
|
|
|
@ -115,7 +115,7 @@ public class CommunityMappingUtils {
|
|||
c.setLastUpdateDate(LocalDateTime.now());
|
||||
}
|
||||
|
||||
public static CommunityDetails CommunityDetails(final DbCommunity c) {
|
||||
public static CommunityDetails toCommunityDetails(final DbCommunity c) {
|
||||
final CommunityDetails details = new CommunityDetails();
|
||||
populateSummary(details, c);
|
||||
details.setAdvancedConstraints(c.getAdvancedConstraints());
|
||||
|
@ -123,8 +123,6 @@ public class CommunityMappingUtils {
|
|||
details.setFos(Arrays.asList(c.getFos()));
|
||||
details.setSdg(Arrays.asList(c.getSdg()));
|
||||
details.setSubjects(Arrays.asList(c.getSubjects()));
|
||||
details.setClaim(c.getClaim());
|
||||
details.setMembership(c.getMembership());
|
||||
details.setOtherZenodoCommunities(Arrays.asList(c.getOtherZenodoCommunities()));
|
||||
return details;
|
||||
}
|
||||
|
@ -140,6 +138,8 @@ public class CommunityMappingUtils {
|
|||
summary.setDescription(c.getDescription());
|
||||
summary.setLogoUrl(c.getLogoUrl());
|
||||
summary.setStatus(c.getStatus());
|
||||
summary.setClaim(c.getClaim());
|
||||
summary.setMembership(c.getMembership());
|
||||
summary.setZenodoCommunity(c.getMainZenodoCommunity());
|
||||
}
|
||||
|
||||
|
|
|
@ -32,12 +32,6 @@ public class CommunityDetails extends CommunitySummary {
|
|||
@Schema(description = "list of the remove criteria")
|
||||
private SelectionCriteria removeConstraints;
|
||||
|
||||
@Schema(description = "type of claim")
|
||||
private CommunityClaimType claim;
|
||||
|
||||
@Schema(description = "type of membership")
|
||||
private CommunityMembershipType membership;
|
||||
|
||||
@Schema(description = "other zenodo communities")
|
||||
private List<String> otherZenodoCommunities;
|
||||
|
||||
|
@ -107,22 +101,6 @@ public class CommunityDetails extends CommunitySummary {
|
|||
this.removeConstraints = removeConstraints;
|
||||
}
|
||||
|
||||
public CommunityClaimType getClaim() {
|
||||
return claim;
|
||||
}
|
||||
|
||||
public void setClaim(final CommunityClaimType claim) {
|
||||
this.claim = claim;
|
||||
}
|
||||
|
||||
public CommunityMembershipType getMembership() {
|
||||
return membership;
|
||||
}
|
||||
|
||||
public void setMembership(final CommunityMembershipType membership) {
|
||||
this.membership = membership;
|
||||
}
|
||||
|
||||
public List<String> getOtherZenodoCommunities() {
|
||||
return otherZenodoCommunities;
|
||||
}
|
||||
|
@ -148,10 +126,6 @@ public class CommunityDetails extends CommunitySummary {
|
|||
.append(advancedConstraints)
|
||||
.append(",\n\tremoveConstraints = ")
|
||||
.append(removeConstraints)
|
||||
.append(",\n\tclaim = ")
|
||||
.append(claim)
|
||||
.append(",\n\tmembership = ")
|
||||
.append(membership)
|
||||
.append(",\n\totherZenodoCommunities = ")
|
||||
.append(otherZenodoCommunities)
|
||||
.append(",\n\tid = ")
|
||||
|
|
|
@ -39,6 +39,12 @@ public class CommunitySummary {
|
|||
@Schema(description = "status of the community, drives its visibility")
|
||||
protected CommunityStatus status;
|
||||
|
||||
@Schema(description = "type of claim")
|
||||
private CommunityClaimType claim;
|
||||
|
||||
@Schema(description = "type of membership")
|
||||
private CommunityMembershipType membership;
|
||||
|
||||
@Schema(description = "Zenodo community associated to this community")
|
||||
protected String zenodoCommunity;
|
||||
|
||||
|
@ -163,6 +169,22 @@ public class CommunitySummary {
|
|||
this.status = status;
|
||||
}
|
||||
|
||||
public CommunityClaimType getClaim() {
|
||||
return claim;
|
||||
}
|
||||
|
||||
public void setClaim(final CommunityClaimType claim) {
|
||||
this.claim = claim;
|
||||
}
|
||||
|
||||
public CommunityMembershipType getMembership() {
|
||||
return membership;
|
||||
}
|
||||
|
||||
public void setMembership(final CommunityMembershipType membership) {
|
||||
this.membership = membership;
|
||||
}
|
||||
|
||||
public String getZenodoCommunity() {
|
||||
return zenodoCommunity;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue