forked from D-Net/dnet-hadoop
WIP: align Solr JSON records to the explore portal requirements
This commit is contained in:
parent
3c9b8de892
commit
fb731b6d46
|
@ -9,6 +9,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import org.dom4j.Document;
|
||||
import org.dom4j.DocumentException;
|
||||
import org.dom4j.io.SAXReader;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.google.common.base.Splitter;
|
||||
|
@ -113,7 +114,10 @@ public class ProvisionModelSupport {
|
|||
relation.getRelType(),
|
||||
relation.getRelClass(),
|
||||
StringUtils.substringAfter(relation.getTarget(), IdentifierFactory.ID_PREFIX_SEPARATOR),
|
||||
relatedRecordType));
|
||||
relatedRecordType,
|
||||
Optional.ofNullable(relation.getDataInfo())
|
||||
.map(d -> Optional.ofNullable(d.getProvenanceaction())
|
||||
.map(Qualifier::getClassid).orElse(null)).orElse(null)));
|
||||
|
||||
rr.setAcronym(re.getAcronym());
|
||||
rr.setCode(re.getCode());
|
||||
|
@ -131,11 +135,18 @@ public class ProvisionModelSupport {
|
|||
rr.setOfficialname(re.getOfficialname());
|
||||
rr.setOpenairecompatibility(mapCodeLabel(re.getOpenairecompatibility()));
|
||||
rr.setPid(asPid(re.getPid()));
|
||||
rr.setProjectTitle(rr.getProjectTitle());
|
||||
rr.setProjectTitle(re.getProjectTitle());
|
||||
rr.setPublisher(re.getPublisher());
|
||||
rr.setResulttype(mapQualifier(re.getResulttype()));
|
||||
rr.setTitle(Optional.ofNullable(re.getTitle()).map(StructuredProperty::getValue).orElse(null));
|
||||
|
||||
if (relation.getValidated() == null) {
|
||||
relation.setValidated(false);
|
||||
}
|
||||
if (ModelConstants.OUTCOME.equals(relation.getSubRelType()) && StringUtils.isNotBlank(relation.getValidationDate())) {
|
||||
rr.setValidationDate(relation.getValidationDate());
|
||||
}
|
||||
|
||||
return rr;
|
||||
}
|
||||
|
||||
|
@ -326,6 +337,7 @@ public class ProvisionModelSupport {
|
|||
rs.setOtherTitles(getOtherTitles(r.getTitle()));
|
||||
rs.setDescription(mapFieldList(r.getDescription()));
|
||||
rs.setSubject(asSubject(r.getSubject()));
|
||||
rs.setLanguage(asLanguage(r.getLanguage()));
|
||||
rs.setPublicationdate(mapField(r.getDateofacceptance()));
|
||||
rs.setPublisher(mapField(r.getPublisher()));
|
||||
rs.setEmbargoenddate(mapField(r.getEmbargoenddate()));
|
||||
|
@ -375,6 +387,12 @@ public class ProvisionModelSupport {
|
|||
return rs;
|
||||
}
|
||||
|
||||
private static Language asLanguage(Qualifier lang) {
|
||||
return Optional.ofNullable(lang)
|
||||
.map(q -> Language.newInstance(q.getClassid(), q.getClassname()))
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static List<String> getOtherTitles(List<StructuredProperty> titleList) {
|
||||
return Optional
|
||||
|
@ -508,7 +526,10 @@ public class ProvisionModelSupport {
|
|||
}
|
||||
|
||||
private static Provenance asProvenance(KeyValue keyValue) {
|
||||
return Optional.ofNullable(keyValue).map(cf -> Provenance.newInstance(cf.getKey(), cf.getValue())).orElse(null);
|
||||
return Optional.ofNullable(keyValue).map(kv ->
|
||||
Provenance.newInstance(
|
||||
StringUtils.substringAfter(kv.getKey(), IdentifierFactory.ID_PREFIX_SEPARATOR),
|
||||
kv.getValue())).orElse(null);
|
||||
}
|
||||
|
||||
private static List<Context> asContext(List<eu.dnetlib.dhp.schema.oaf.Context> ctxList,
|
||||
|
@ -581,7 +602,12 @@ public class ProvisionModelSupport {
|
|||
.map(
|
||||
pids -> pids
|
||||
.stream()
|
||||
.map(p -> Pid.newInstance(p.getQualifier().getClassname(), p.getValue()))
|
||||
.filter(p -> Objects.nonNull(p.getQualifier()))
|
||||
.filter(p -> Objects.nonNull(p.getQualifier().getClassid()))
|
||||
.map(p -> Pid.newInstance(
|
||||
p.getValue(),
|
||||
p.getQualifier().getClassid(),
|
||||
p.getQualifier().getClassname()))
|
||||
.collect(Collectors.toList()))
|
||||
.orElse(null);
|
||||
}
|
||||
|
@ -607,7 +633,7 @@ public class ProvisionModelSupport {
|
|||
.stream()
|
||||
.filter(s -> Objects.nonNull(s.getQualifier()))
|
||||
.filter(s -> Objects.nonNull(s.getQualifier().getClassname()))
|
||||
.map(s -> Subject.newInstance(s.getValue(), s.getQualifier().getClassname()))
|
||||
.map(s -> Subject.newInstance(s.getValue(), s.getQualifier().getClassid(), s.getQualifier().getClassname()))
|
||||
.collect(Collectors.toList()))
|
||||
.orElse(null);
|
||||
}
|
||||
|
@ -620,7 +646,7 @@ public class ProvisionModelSupport {
|
|||
.stream()
|
||||
.filter(s -> Objects.nonNull(s.getQualifier()))
|
||||
.filter(s -> Objects.nonNull(s.getQualifier().getClassname()))
|
||||
.map(s -> Subject.newInstance(s.getValue(), s.getQualifier().getClassname()))
|
||||
.map(s -> Subject.newInstance(s.getValue(), s.getQualifier().getClassid(), s.getQualifier().getClassname()))
|
||||
.collect(Collectors.toList()))
|
||||
.orElse(null);
|
||||
}
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -888,7 +888,7 @@
|
|||
<mockito-core.version>3.3.3</mockito-core.version>
|
||||
<mongodb.driver.version>3.4.2</mongodb.driver.version>
|
||||
<vtd.version>[2.12,3.0)</vtd.version>
|
||||
<dhp-schemas.version>[6.1.2]</dhp-schemas.version>
|
||||
<dhp-schemas.version>[6.1.3-SNAPSHOT]</dhp-schemas.version>
|
||||
<dnet-actionmanager-api.version>[4.0.3]</dnet-actionmanager-api.version>
|
||||
<dnet-actionmanager-common.version>[6.0.5]</dnet-actionmanager-common.version>
|
||||
<dnet-openaire-broker-common.version>[3.1.6]</dnet-openaire-broker-common.version>
|
||||
|
|
Loading…
Reference in New Issue