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.ZENODOCOMMUNITY_ID_SUFFIX;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
|
@ -100,7 +99,7 @@ public class CommunityMappingUtils {
|
|||
public static CommunityDetails asCommunityProfile(final Context c) {
|
||||
|
||||
final CommunityDetails p = new CommunityDetails(asCommunitySummary(c));
|
||||
p.setLastUpdateDate(c.getLastUpdateDate());
|
||||
// p.setLastUpdateDate(c.getLastUpdateDate());
|
||||
final Map<String, List<Param>> params = c.getParams();
|
||||
if (params.containsKey(CPROFILE_SUBJECT)) {
|
||||
p.setSubjects(splitValues(asValues(params.get(CPROFILE_SUBJECT)), CSV_DELIMITER));
|
||||
|
@ -117,11 +116,11 @@ public class CommunityMappingUtils {
|
|||
|
||||
}
|
||||
if (params.containsKey(CPROFILE_CREATIONDATE)) {
|
||||
try {
|
||||
p.setCreationDate(org.apache.commons.lang3.time.DateUtils.parseDate(asCsv(params.get(CPROFILE_CREATIONDATE)), pattern));
|
||||
} catch (final ParseException e) {
|
||||
log.debug("Exception on date format: " + e.getMessage());
|
||||
}
|
||||
// try {
|
||||
// p.setCreationDate(org.apache.commons.lang3.time.DateUtils.parseDate(asCsv(params.get(CPROFILE_CREATIONDATE)), pattern));
|
||||
// } catch (final ParseException e) {
|
||||
// log.debug("Exception on date format: " + e.getMessage());
|
||||
// }
|
||||
}
|
||||
|
||||
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.DbProjectRepository;
|
||||
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.ResourceNotFoundException;
|
||||
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?
|
||||
// 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
|
||||
// 11) Move enums in dnet-exporter-model
|
||||
|
||||
@Autowired
|
||||
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.JsonStringType;
|
||||
|
||||
import eu.dnetlib.openaire.community.db.enums.CommunityClaimType;
|
||||
import eu.dnetlib.openaire.community.db.enums.CommunityClaimTypeConverter;
|
||||
import eu.dnetlib.openaire.community.db.enums.CommunityMembershipType;
|
||||
import eu.dnetlib.openaire.community.db.enums.CommunityMembershipTypeConverter;
|
||||
import eu.dnetlib.openaire.community.db.enums.CommunityType;
|
||||
import eu.dnetlib.openaire.community.db.utils.CommunityClaimTypeConverter;
|
||||
import eu.dnetlib.openaire.community.db.utils.CommunityMembershipTypeConverter;
|
||||
import eu.dnetlib.openaire.exporter.model.community.CommunityClaimType;
|
||||
import eu.dnetlib.openaire.exporter.model.community.CommunityMembershipType;
|
||||
import eu.dnetlib.openaire.exporter.model.community.CommunityStatus;
|
||||
import eu.dnetlib.openaire.exporter.model.community.CommunityType;
|
||||
|
||||
@Entity
|
||||
@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 org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import eu.dnetlib.openaire.exporter.model.community.CommunityClaimType;
|
||||
|
||||
public class CommunityClaimTypeConverter implements AttributeConverter<CommunityClaimType, String> {
|
||||
|
||||
@Override
|
|
@ -1,9 +1,11 @@
|
|||
package eu.dnetlib.openaire.community.db.enums;
|
||||
package eu.dnetlib.openaire.community.db.utils;
|
||||
|
||||
import javax.persistence.AttributeConverter;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import eu.dnetlib.openaire.exporter.model.community.CommunityMembershipType;
|
||||
|
||||
public class CommunityMembershipTypeConverter implements AttributeConverter<CommunityMembershipType, String> {
|
||||
|
||||
@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;
|
||||
|
|
@ -8,7 +8,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
|||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@ -46,7 +46,7 @@ public class CommunityApiControllerTest {
|
|||
final CommunitySummary cs = new CommunitySummary();
|
||||
cs.setDescription("the description");
|
||||
cs.setId("id1");
|
||||
cs.setLastUpdateDate(new Date());
|
||||
cs.setLastUpdateDate(LocalDateTime.now());
|
||||
cs.setName("X");
|
||||
cs.setShortName("x");
|
||||
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 {
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package eu.dnetlib.openaire.exporter.model.community;
|
||||
|
||||
import java.util.Date;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
|
@ -12,10 +12,10 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||
public class CommunityDetails extends CommunitySummary {
|
||||
|
||||
@Schema(description = "date of creation for this community")
|
||||
private Date creationDate;
|
||||
private LocalDateTime creationDate;
|
||||
|
||||
@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")
|
||||
private List<String> subjects;
|
||||
|
@ -36,12 +36,12 @@ public class CommunityDetails extends CommunitySummary {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Date getCreationDate() {
|
||||
public LocalDateTime getCreationDate() {
|
||||
return creationDate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCreationDate(final Date creationDate) {
|
||||
public void setCreationDate(final LocalDateTime creationDate) {
|
||||
this.creationDate = creationDate;
|
||||
}
|
||||
|
||||
|
@ -54,12 +54,12 @@ public class CommunityDetails extends CommunitySummary {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Date getLastUpdateDate() {
|
||||
public LocalDateTime getLastUpdateDate() {
|
||||
return lastUpdateDate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLastUpdateDate(final Date lastUpdateDate) {
|
||||
public void setLastUpdateDate(final LocalDateTime 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 {
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
package eu.dnetlib.openaire.exporter.model.community;
|
||||
|
||||
public enum CommunityType {
|
||||
community,
|
||||
ri
|
||||
}
|
Loading…
Reference in New Issue