patch to manage the instance type code
This commit is contained in:
parent
34026cea35
commit
37d0cec118
|
@ -40,7 +40,7 @@ public class ResultEntry implements Serializable {
|
||||||
@Schema(allowableValues = { "publication", "dataset", "software", "other" })
|
@Schema(allowableValues = { "publication", "dataset", "software", "other" })
|
||||||
private String type = "publication";
|
private String type = "publication";
|
||||||
|
|
||||||
@Schema(requiredMode = RequiredMode.REQUIRED, description = "Use 001 for articles, 021 for datasets, 0029 for software. See: http://api.openaire.eu/vocabularies/dnet:publication_resource for all the available resource types.")
|
@Schema(requiredMode = RequiredMode.REQUIRED, description = "Use 0001 for articles, 0021 for datasets, 0029 for software. See: http://api.openaire.eu/vocabularies/dnet:publication_resource for all the available resource types.")
|
||||||
private String resourceType;
|
private String resourceType;
|
||||||
|
|
||||||
@Schema(requiredMode = RequiredMode.REQUIRED)
|
@Schema(requiredMode = RequiredMode.REQUIRED)
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package eu.dnetlib.app.directindex.mapping;
|
||||||
|
|
||||||
|
import eu.dnetlib.dhp.schema.solr.Instance;
|
||||||
|
|
||||||
|
// TODO: To delete after the dismission of the XML
|
||||||
|
public class InstanceWithTypeCode extends Instance {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -5415824868827493090L;
|
||||||
|
|
||||||
|
private String instancetypeCode;
|
||||||
|
|
||||||
|
public String getInstancetypeCode() {
|
||||||
|
return instancetypeCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInstancetypeCode(final String instancetypeCode) {
|
||||||
|
this.instancetypeCode = instancetypeCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -264,10 +264,10 @@ public class SolrRecordMapper {
|
||||||
r.setBestaccessright(BestAccessRight.newInstance("UNKNOWN", "not available"));
|
r.setBestaccessright(BestAccessRight.newInstance("UNKNOWN", "not available"));
|
||||||
}
|
}
|
||||||
|
|
||||||
final Instance instance = new Instance();
|
// TODO: To replace with Instance after the dismission of the XML
|
||||||
|
final InstanceWithTypeCode instance = new InstanceWithTypeCode();
|
||||||
// TODO verificare il valore (dovrebbe essere classid="0004" classname="Conference object")
|
instance.setInstancetype(vocClient.findTermLabel("dnet:publication_resource", re.getResourceType()));
|
||||||
instance.setInstancetype(re.getResourceType());
|
instance.setInstancetypeCode(re.getResourceType());
|
||||||
instance.setCollectedfrom(collectedFrom);
|
instance.setCollectedfrom(collectedFrom);
|
||||||
instance.setHostedby(hostedBy);
|
instance.setHostedby(hostedBy);
|
||||||
instance.setPid(pids);
|
instance.setPid(pids);
|
||||||
|
|
|
@ -6,6 +6,7 @@ import org.dom4j.Element;
|
||||||
import org.dom4j.Namespace;
|
import org.dom4j.Namespace;
|
||||||
import org.dom4j.QName;
|
import org.dom4j.QName;
|
||||||
|
|
||||||
|
import eu.dnetlib.app.directindex.mapping.InstanceWithTypeCode;
|
||||||
import eu.dnetlib.dhp.schema.common.ModelConstants;
|
import eu.dnetlib.dhp.schema.common.ModelConstants;
|
||||||
import eu.dnetlib.dhp.schema.solr.BestAccessRight;
|
import eu.dnetlib.dhp.schema.solr.BestAccessRight;
|
||||||
import eu.dnetlib.dhp.schema.solr.Instance;
|
import eu.dnetlib.dhp.schema.solr.Instance;
|
||||||
|
@ -135,8 +136,9 @@ public class XMLSolrSerializer {
|
||||||
private static void addResultInstance(final Element childrenNode, final Instance i) {
|
private static void addResultInstance(final Element childrenNode, final Instance i) {
|
||||||
final Element instanceNode = childrenNode.addElement("instance");
|
final Element instanceNode = childrenNode.addElement("instance");
|
||||||
|
|
||||||
//TODO manca il code o il name
|
if (i instanceof InstanceWithTypeCode) {
|
||||||
addStructuredField(instanceNode, "instancetype", i.getInstancetype(), ModelConstants.DNET_PUBLICATION_RESOURCE, null);
|
addStructuredField(instanceNode, "instancetype", ((InstanceWithTypeCode) i).getInstancetypeCode(), i.getInstancetype(), ModelConstants.DNET_PUBLICATION_RESOURCE, null);
|
||||||
|
}
|
||||||
|
|
||||||
addStructuredField(instanceNode, "accessright", i.getAccessright().getCode(), i.getAccessright().getLabel(), ModelConstants.DNET_ACCESS_MODES, null);
|
addStructuredField(instanceNode, "accessright", i.getAccessright().getCode(), i.getAccessright().getLabel(), ModelConstants.DNET_ACCESS_MODES, null);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue