@Test public void extractDOILowScore() throws IOException, MalformedDOIException { String response = IOUtils.toString(getClass().getResourceAsStream("crossRefReplyLowScore.json"), StandardCharsets.UTF_8); assertNull(new DOIResolverImpl().extractDOI(response)); }
DOI extractDOI(String response) throws IOException, MalformedDOIException { ObjectMapper mapper = new ObjectMapper(); JsonNode jsonNode = mapper.readTree(response); DOI doi = null; if (jsonNode.has("message")) { JsonNode msg = jsonNode.get("message"); if (msg.has("items")) { for (JsonNode items : msg.get("items")) { if (hasReasonableMatchScore(items)) { doi = DOI.create(items.get("DOI").asText()); } } } } return doi; }
DOIResolverImpl implements DOIResolver { DOI extractDOI(String response) throws IOException, MalformedDOIException { ObjectMapper mapper = new ObjectMapper(); JsonNode jsonNode = mapper.readTree(response); DOI doi = null; if (jsonNode.has("message")) { JsonNode msg = jsonNode.get("message"); if (msg.has("items")) { for (JsonNode items : msg.get("items")) { if (hasReasonableMatchScore(items)) { doi = DOI.create(items.get("DOI").asText()); } } } } return doi; } }
DOIResolverImpl implements DOIResolver { DOI extractDOI(String response) throws IOException, MalformedDOIException { ObjectMapper mapper = new ObjectMapper(); JsonNode jsonNode = mapper.readTree(response); DOI doi = null; if (jsonNode.has("message")) { JsonNode msg = jsonNode.get("message"); if (msg.has("items")) { for (JsonNode items : msg.get("items")) { if (hasReasonableMatchScore(items)) { doi = DOI.create(items.get("DOI").asText()); } } } } return doi; } DOIResolverImpl();  DOIResolverImpl(String baseURL); }
DOIResolverImpl implements DOIResolver { DOI extractDOI(String response) throws IOException, MalformedDOIException { ObjectMapper mapper = new ObjectMapper(); JsonNode jsonNode = mapper.readTree(response); DOI doi = null; if (jsonNode.has("message")) { JsonNode msg = jsonNode.get("message"); if (msg.has("items")) { for (JsonNode items : msg.get("items")) { if (hasReasonableMatchScore(items)) { doi = DOI.create(items.get("DOI").asText()); } } } } return doi; } DOIResolverImpl();  DOIResolverImpl(String baseURL); @Override Map<String, DOI> resolveDoiFor(Collection<String> references); @Override DOI resolveDoiFor(final String reference); String findCitationForDOI(DOI doi); void setMinMatchScore(double minMatchScore); }
DOIResolverImpl implements DOIResolver { DOI extractDOI(String response) throws IOException, MalformedDOIException { ObjectMapper mapper = new ObjectMapper(); JsonNode jsonNode = mapper.readTree(response); DOI doi = null; if (jsonNode.has("message")) { JsonNode msg = jsonNode.get("message"); if (msg.has("items")) { for (JsonNode items : msg.get("items")) { if (hasReasonableMatchScore(items)) { doi = DOI.create(items.get("DOI").asText()); } } } } return doi; } DOIResolverImpl();  DOIResolverImpl(String baseURL); @Override Map<String, DOI> resolveDoiFor(Collection<String> references); @Override DOI resolveDoiFor(final String reference); String findCitationForDOI(DOI doi); void setMinMatchScore(double minMatchScore);  }