partial implementation of xml serialization

This commit is contained in:
Michele Artini 2024-12-06 10:23:44 +01:00
parent 411ab9b27f
commit 34026cea35
2 changed files with 18 additions and 18 deletions

View File

@ -266,6 +266,7 @@ public class SolrRecordMapper {
final Instance instance = new Instance(); final Instance instance = new Instance();
// TODO verificare il valore (dovrebbe essere classid="0004" classname="Conference object")
instance.setInstancetype(re.getResourceType()); instance.setInstancetype(re.getResourceType());
instance.setCollectedfrom(collectedFrom); instance.setCollectedfrom(collectedFrom);
instance.setHostedby(hostedBy); instance.setHostedby(hostedBy);

View File

@ -132,27 +132,26 @@ public class XMLSolrSerializer {
} }
} }
private static void addResultInstance(final Element childrenNode, final Instance p) { private static void addResultInstance(final Element childrenNode, final Instance i) {
// TODO Auto-generated method stub final Element instanceNode = childrenNode.addElement("instance");
/*
//TODO manca il code o il name
addStructuredField(instanceNode, "instancetype", i.getInstancetype(), ModelConstants.DNET_PUBLICATION_RESOURCE, null);
addStructuredField(instanceNode, "accessright", i.getAccessright().getCode(), i.getAccessright().getLabel(), ModelConstants.DNET_ACCESS_MODES, null);
final Element collectedFrom = instanceNode.addElement("collectedfrom");
collectedFrom.addAttribute("id", i.getCollectedfrom().getDsId());
collectedFrom.addAttribute("name", i.getCollectedfrom().getDsName());
final Element hostedBy = instanceNode.addElement("hostedby");
hostedBy.addAttribute("id", i.getHostedby().getDsId());
hostedBy.addAttribute("name", i.getHostedby().getDsName());
if (i.getUrl() != null) {
i.getUrl().forEach(url -> instanceNode.addElement("webresource").addElement("url").addText(url));
}
<children>
<instance>
<accessright classid="CLOSED" classname="Closed Access" schemeid="dnet:access_modes" schemename="dnet:access_modes" />
<collectedfrom name="Croatian Scientific Bibliography - CROSBI" id="openaire____::345c9d171ef3c5d706d08041d506428c" />
<hostedby name="Croatian Scientific Bibliography - CROSBI" id="openaire____::345c9d171ef3c5d706d08041d506428c" />
<dateofacceptance>2013-01-01</dateofacceptance>
<instancetype classid="0004" classname="Conference object" schemeid="dnet:publication_resource" schemename="dnet:publication_resource" />
<refereed classid="0002" classname="nonPeerReviewed" schemeid="dnet:review_levels" schemename="dnet:review_levels" />
<webresource>
<url>https://www.bib.irb.hr/683750</url>
</webresource>
</instance>
</children>
</result>
*/
} }
private static void addRelProject(final Element relsNode, final RelatedRecord p) { private static void addRelProject(final Element relsNode, final RelatedRecord p) {