new_model_for_communities #15
|
@ -33,7 +33,6 @@ import static eu.dnetlib.openaire.community.CommunityConstants.PIPE_SEPARATOR;
|
||||||
import static eu.dnetlib.openaire.community.CommunityConstants.PROJECTS_ID_SUFFIX;
|
import static eu.dnetlib.openaire.community.CommunityConstants.PROJECTS_ID_SUFFIX;
|
||||||
import static eu.dnetlib.openaire.community.CommunityConstants.ZENODOCOMMUNITY_ID_SUFFIX;
|
import static eu.dnetlib.openaire.community.CommunityConstants.ZENODOCOMMUNITY_ID_SUFFIX;
|
||||||
|
|
||||||
import java.text.ParseException;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -100,7 +99,7 @@ public class CommunityMappingUtils {
|
||||||
public static CommunityDetails asCommunityProfile(final Context c) {
|
public static CommunityDetails asCommunityProfile(final Context c) {
|
||||||
|
|
||||||
final CommunityDetails p = new CommunityDetails(asCommunitySummary(c));
|
final CommunityDetails p = new CommunityDetails(asCommunitySummary(c));
|
||||||
p.setLastUpdateDate(c.getLastUpdateDate());
|
// p.setLastUpdateDate(c.getLastUpdateDate());
|
||||||
final Map<String, List<Param>> params = c.getParams();
|
final Map<String, List<Param>> params = c.getParams();
|
||||||
if (params.containsKey(CPROFILE_SUBJECT)) {
|
if (params.containsKey(CPROFILE_SUBJECT)) {
|
||||||
p.setSubjects(splitValues(asValues(params.get(CPROFILE_SUBJECT)), CSV_DELIMITER));
|
p.setSubjects(splitValues(asValues(params.get(CPROFILE_SUBJECT)), CSV_DELIMITER));
|
||||||
|
@ -117,11 +116,11 @@ public class CommunityMappingUtils {
|
||||||
|
|
||||||
}
|
}
|
||||||
if (params.containsKey(CPROFILE_CREATIONDATE)) {
|
if (params.containsKey(CPROFILE_CREATIONDATE)) {
|
||||||
try {
|
// try {
|
||||||
p.setCreationDate(org.apache.commons.lang3.time.DateUtils.parseDate(asCsv(params.get(CPROFILE_CREATIONDATE)), pattern));
|
// p.setCreationDate(org.apache.commons.lang3.time.DateUtils.parseDate(asCsv(params.get(CPROFILE_CREATIONDATE)), pattern));
|
||||||
} catch (final ParseException e) {
|
// } catch (final ParseException e) {
|
||||||
log.debug("Exception on date format: " + e.getMessage());
|
// log.debug("Exception on date format: " + e.getMessage());
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
|
|
|
@ -27,6 +27,7 @@ import eu.dnetlib.openaire.community.db.repository.DbDatasourceRepository;
|
||||||
import eu.dnetlib.openaire.community.db.repository.DbOrganizationRepository;
|
import eu.dnetlib.openaire.community.db.repository.DbOrganizationRepository;
|
||||||
import eu.dnetlib.openaire.community.db.repository.DbProjectRepository;
|
import eu.dnetlib.openaire.community.db.repository.DbProjectRepository;
|
||||||
import eu.dnetlib.openaire.community.db.repository.DbSupportOrgRepository;
|
import eu.dnetlib.openaire.community.db.repository.DbSupportOrgRepository;
|
||||||
|
import eu.dnetlib.openaire.community.db.utils.ConvertionUtils;
|
||||||
import eu.dnetlib.openaire.exporter.exceptions.CommunityException;
|
import eu.dnetlib.openaire.exporter.exceptions.CommunityException;
|
||||||
import eu.dnetlib.openaire.exporter.exceptions.ResourceNotFoundException;
|
import eu.dnetlib.openaire.exporter.exceptions.ResourceNotFoundException;
|
||||||
import eu.dnetlib.openaire.exporter.model.community.CommunityContentprovider;
|
import eu.dnetlib.openaire.exporter.model.community.CommunityContentprovider;
|
||||||
|
@ -55,7 +56,6 @@ public class CommunityService {
|
||||||
// 9) i campi officialName e selectioncriteria mancano nel nuovo modello delle datasource, si aggiungono?
|
// 9) i campi officialName e selectioncriteria mancano nel nuovo modello delle datasource, si aggiungono?
|
||||||
// 10) i campi name, logoUrl e websiteUrl mancano nel nuovo modello delle organization,
|
// 10) i campi name, logoUrl e websiteUrl mancano nel nuovo modello delle organization,
|
||||||
// esistono solo in quello delle support_org, occorre rivedere le api e i mapping
|
// esistono solo in quello delle support_org, occorre rivedere le api e i mapping
|
||||||
// 11) Move enums in dnet-exporter-model
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DbCommunityRepository dbCommunityRepository;
|
private DbCommunityRepository dbCommunityRepository;
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
package eu.dnetlib.openaire.community.db.enums;
|
|
||||||
|
|
||||||
public enum CommunityType {
|
|
||||||
community,
|
|
||||||
ri
|
|
||||||
}
|
|
|
@ -21,12 +21,12 @@ import com.vladmihalcea.hibernate.type.array.StringArrayType;
|
||||||
import com.vladmihalcea.hibernate.type.json.JsonBinaryType;
|
import com.vladmihalcea.hibernate.type.json.JsonBinaryType;
|
||||||
import com.vladmihalcea.hibernate.type.json.JsonStringType;
|
import com.vladmihalcea.hibernate.type.json.JsonStringType;
|
||||||
|
|
||||||
import eu.dnetlib.openaire.community.db.enums.CommunityClaimType;
|
import eu.dnetlib.openaire.community.db.utils.CommunityClaimTypeConverter;
|
||||||
import eu.dnetlib.openaire.community.db.enums.CommunityClaimTypeConverter;
|
import eu.dnetlib.openaire.community.db.utils.CommunityMembershipTypeConverter;
|
||||||
import eu.dnetlib.openaire.community.db.enums.CommunityMembershipType;
|
import eu.dnetlib.openaire.exporter.model.community.CommunityClaimType;
|
||||||
import eu.dnetlib.openaire.community.db.enums.CommunityMembershipTypeConverter;
|
import eu.dnetlib.openaire.exporter.model.community.CommunityMembershipType;
|
||||||
import eu.dnetlib.openaire.community.db.enums.CommunityType;
|
|
||||||
import eu.dnetlib.openaire.exporter.model.community.CommunityStatus;
|
import eu.dnetlib.openaire.exporter.model.community.CommunityStatus;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.CommunityType;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "communities")
|
@Table(name = "communities")
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package eu.dnetlib.openaire.community.db.enums;
|
package eu.dnetlib.openaire.community.db.utils;
|
||||||
|
|
||||||
import javax.persistence.AttributeConverter;
|
import javax.persistence.AttributeConverter;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.CommunityClaimType;
|
||||||
|
|
||||||
public class CommunityClaimTypeConverter implements AttributeConverter<CommunityClaimType, String> {
|
public class CommunityClaimTypeConverter implements AttributeConverter<CommunityClaimType, String> {
|
||||||
|
|
||||||
@Override
|
@Override
|
|
@ -1,9 +1,11 @@
|
||||||
package eu.dnetlib.openaire.community.db.enums;
|
package eu.dnetlib.openaire.community.db.utils;
|
||||||
|
|
||||||
import javax.persistence.AttributeConverter;
|
import javax.persistence.AttributeConverter;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.CommunityMembershipType;
|
||||||
|
|
||||||
public class CommunityMembershipTypeConverter implements AttributeConverter<CommunityMembershipType, String> {
|
public class CommunityMembershipTypeConverter implements AttributeConverter<CommunityMembershipType, String> {
|
||||||
|
|
||||||
@Override
|
@Override
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.dnetlib.openaire.community.db;
|
package eu.dnetlib.openaire.community.db.utils;
|
||||||
|
|
||||||
import static eu.dnetlib.openaire.community.CommunityConstants.PIPE_SEPARATOR;
|
import static eu.dnetlib.openaire.community.CommunityConstants.PIPE_SEPARATOR;
|
||||||
|
|
|
@ -8,7 +8,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||||
|
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.util.Date;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
@ -46,7 +46,7 @@ public class CommunityApiControllerTest {
|
||||||
final CommunitySummary cs = new CommunitySummary();
|
final CommunitySummary cs = new CommunitySummary();
|
||||||
cs.setDescription("the description");
|
cs.setDescription("the description");
|
||||||
cs.setId("id1");
|
cs.setId("id1");
|
||||||
cs.setLastUpdateDate(new Date());
|
cs.setLastUpdateDate(LocalDateTime.now());
|
||||||
cs.setName("X");
|
cs.setName("X");
|
||||||
cs.setShortName("x");
|
cs.setShortName("x");
|
||||||
final List<CommunitySummary> csList = singletonList(cs);
|
final List<CommunitySummary> csList = singletonList(cs);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.dnetlib.openaire.community.db.enums;
|
package eu.dnetlib.openaire.exporter.model.community;
|
||||||
|
|
||||||
public enum CommunityClaimType {
|
public enum CommunityClaimType {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package eu.dnetlib.openaire.exporter.model.community;
|
package eu.dnetlib.openaire.exporter.model.community;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||||
|
@ -12,10 +12,10 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
public class CommunityDetails extends CommunitySummary {
|
public class CommunityDetails extends CommunitySummary {
|
||||||
|
|
||||||
@Schema(description = "date of creation for this community")
|
@Schema(description = "date of creation for this community")
|
||||||
private Date creationDate;
|
private LocalDateTime creationDate;
|
||||||
|
|
||||||
@Schema(description = "date of the last update for this communityu")
|
@Schema(description = "date of the last update for this communityu")
|
||||||
private Date lastUpdateDate;
|
private LocalDateTime lastUpdateDate;
|
||||||
|
|
||||||
@Schema(description = "list of subjects (keywords) that characterise this community")
|
@Schema(description = "list of subjects (keywords) that characterise this community")
|
||||||
private List<String> subjects;
|
private List<String> subjects;
|
||||||
|
@ -36,12 +36,12 @@ public class CommunityDetails extends CommunitySummary {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Date getCreationDate() {
|
public LocalDateTime getCreationDate() {
|
||||||
return creationDate;
|
return creationDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setCreationDate(final Date creationDate) {
|
public void setCreationDate(final LocalDateTime creationDate) {
|
||||||
this.creationDate = creationDate;
|
this.creationDate = creationDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,12 +54,12 @@ public class CommunityDetails extends CommunitySummary {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Date getLastUpdateDate() {
|
public LocalDateTime getLastUpdateDate() {
|
||||||
return lastUpdateDate;
|
return lastUpdateDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setLastUpdateDate(final Date lastUpdateDate) {
|
public void setLastUpdateDate(final LocalDateTime lastUpdateDate) {
|
||||||
this.lastUpdateDate = lastUpdateDate;
|
this.lastUpdateDate = lastUpdateDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.dnetlib.openaire.community.db.enums;
|
package eu.dnetlib.openaire.exporter.model.community;
|
||||||
|
|
||||||
public enum CommunityMembershipType {
|
public enum CommunityMembershipType {
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
package eu.dnetlib.openaire.exporter.model.community;
|
||||||
|
|
||||||
|
public enum CommunityType {
|
||||||
|
community,
|
||||||
|
ri
|
||||||
|
}
|
Loading…
Reference in New Issue