3289 harvest via oai pmh of rein d space fails#3321
Conversation
…pes of exceptions caught
| if(this.protocol == null || this.authority == null || this.identifier == null) { | ||
| return ""; | ||
| } else if(HTTP_PROTOCOL.equals(this.protocol) || HTTPS_PROTOCOL.equals(this.protocol)) { | ||
| return this.protocol + ':' + this.protocol + "://" + this.authority + this.identifier; |
There was a problem hiding this comment.
Two time this.protocol this was intended?
| public GlobalId(final String identifierString) { | ||
| final int index1 = identifierString.indexOf(':'); | ||
| if (index1 > 0) { // ':' found with one or more characters before it | ||
| if(identifierString.startsWith(HTTPS_PROTOCOL)) { |
There was a problem hiding this comment.
Missing space between if (
| } catch (final MalformedURLException e) { | ||
| throw new IllegalArgumentException(e); | ||
| } | ||
| } else if(identifierString.startsWith(HTTP_PROTOCOL)) { |
There was a problem hiding this comment.
Missing space between if {
| final ArrayList<Node> identifiers = getNodes(document, "identifier"); | ||
| if(identifiers.isEmpty()) { | ||
| throw new EJBException("Missing dc:identifier xml element"); | ||
| } | ||
| for(final Node node : identifiers) { | ||
| version.addField(newField(otherId, null). | ||
| addChild(newField(otherIdValue, node.getTextContent()))); | ||
| } | ||
| dataset.setGlobalId(createGlobalId(identifiers)); |
There was a problem hiding this comment.
Maybe this code could be moved where title is parsed. Both are required fields so maybe could be in the same place
| if (harvestingClient == null || harvestingClient.getDataverse() == null) { | ||
| public Dataset doImportHarvestedDataset(final DataverseRequest request, | ||
| final HarvestingClient client, final String identifier, | ||
| final HarvestImporterType importType, final String xml) throws ImportException { |
There was a problem hiding this comment.
I would not change last parameter from metadata -> xml. In OAI-PMH specification content is called metadata
|
|
||
| private GlobalId createGlobalId(final ArrayList<Node> identifierNodes) { | ||
|
|
||
| final List<String> identifiers = identifierNodes |
There was a problem hiding this comment.
If in this code we are only interested in first id, maybe just get first id and the do the logic without without for each type? final Optional<GlobalId> doi = identifiers .stream() .filter(GlobalId::isDOI) .findFirst()
No description provided.