fixed invalid prefix
This commit is contained in:
parent
6f873b1e45
commit
3a340bd737
|
@ -121,7 +121,15 @@ public class CommunityImporterService {
|
||||||
.readValue(json, new TypeReference<Map<String, List<String>>>() {})
|
.readValue(json, new TypeReference<Map<String, List<String>>>() {})
|
||||||
.entrySet()
|
.entrySet()
|
||||||
.stream()
|
.stream()
|
||||||
.flatMap(e -> e.getValue().stream().map(community -> new DbOrganization(community, e.getKey())))
|
.flatMap(e -> e.getValue()
|
||||||
|
.stream()
|
||||||
|
.map(community -> {
|
||||||
|
if (e.getKey().contains("|")) {
|
||||||
|
return new DbOrganization(community, StringUtils.substringAfter(e.getKey(), "|"));
|
||||||
|
} else {
|
||||||
|
return new DbOrganization(community, e.getKey());
|
||||||
|
}
|
||||||
|
}))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
if (!simulation) {
|
if (!simulation) {
|
||||||
|
@ -144,7 +152,18 @@ public class CommunityImporterService {
|
||||||
final CommunityDetails community = asCommunityDetails(context);
|
final CommunityDetails community = asCommunityDetails(context);
|
||||||
|
|
||||||
final List<CommunityContentprovider> datasources =
|
final List<CommunityContentprovider> datasources =
|
||||||
getCommunityInfo(context, CONTENTPROVIDERS_ID_SUFFIX, c -> asCommunityDataprovider(context.getId(), c));
|
getCommunityInfo(context, CONTENTPROVIDERS_ID_SUFFIX, c -> asCommunityDataprovider(context.getId(), c))
|
||||||
|
.stream()
|
||||||
|
.map(o -> {
|
||||||
|
if (o.getOpenaireId() == null) {
|
||||||
|
log.warn("Openaire ID is missing, organization: " + o.getOfficialname());
|
||||||
|
} else if (o.getOpenaireId().contains("|")) {
|
||||||
|
o.setOpenaireId(StringUtils.substringAfter(o.getOpenaireId(), "|"));
|
||||||
|
}
|
||||||
|
return o;
|
||||||
|
})
|
||||||
|
.filter(o -> o.getOpenaireId() != null)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
final List<CommunityProject> projects =
|
final List<CommunityProject> projects =
|
||||||
getCommunityInfo(context, PROJECTS_ID_SUFFIX, c -> asCommunityProject(context.getId(), c))
|
getCommunityInfo(context, PROJECTS_ID_SUFFIX, c -> asCommunityProject(context.getId(), c))
|
||||||
|
@ -165,6 +184,8 @@ public class CommunityImporterService {
|
||||||
} else {
|
} else {
|
||||||
log.warn("Openaire ID is missing, funder: " + p.getFunder());
|
log.warn("Openaire ID is missing, funder: " + p.getFunder());
|
||||||
}
|
}
|
||||||
|
} else if (p.getOpenaireId().contains("|")) {
|
||||||
|
p.setOpenaireId(StringUtils.substringAfter(p.getOpenaireId(), "|"));
|
||||||
}
|
}
|
||||||
return p;
|
return p;
|
||||||
})
|
})
|
||||||
|
@ -174,10 +195,10 @@ public class CommunityImporterService {
|
||||||
final List<CommunityOrganization> orgs =
|
final List<CommunityOrganization> orgs =
|
||||||
getCommunityInfo(context, ORGANIZATION_ID_SUFFIX, c -> asCommunityOrganization(context.getId(), c));
|
getCommunityInfo(context, ORGANIZATION_ID_SUFFIX, c -> asCommunityOrganization(context.getId(), c));
|
||||||
|
|
||||||
final List<String> otherZenodoCimmunities =
|
final List<String> otherZenodoCommunities =
|
||||||
getCommunityInfo(context, ZENODOCOMMUNITY_ID_SUFFIX, c -> asZenodoCommunity(c));
|
getCommunityInfo(context, ZENODOCOMMUNITY_ID_SUFFIX, c -> asZenodoCommunity(c));
|
||||||
|
|
||||||
community.setOtherZenodoCommunities(otherZenodoCimmunities);
|
community.setOtherZenodoCommunities(otherZenodoCommunities);
|
||||||
|
|
||||||
final List<SubCommunity> subs = context.getCategories()
|
final List<SubCommunity> subs = context.getCategories()
|
||||||
.entrySet()
|
.entrySet()
|
||||||
|
|
Loading…
Reference in New Issue