Skip to content
Snippets Groups Projects
Commit 1444d9aa authored by Piotr Gawron's avatar Piotr Gawron
Browse files

entrez parser is much faster (validation of xml from API is disabled)

parent 60f9dfbf
No related branches found
No related tags found
2 merge requests!630WIP: Resolve "The privileges of a new user are not saved in some cases",!386Resolve "Continous integration tests"
package lcsb.mapviewer.annotation.services.annotators;
import java.io.IOException;
import java.io.StringReader;
import java.net.HttpURLConnection;
import java.util.ArrayList;
import java.util.Collections;
......@@ -8,9 +9,14 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.log4j.Logger;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import lcsb.mapviewer.annotation.cache.GeneralCacheInterface;
import lcsb.mapviewer.annotation.cache.SourceNotAvailable;
......@@ -211,11 +217,10 @@ public class EntrezAnnotator extends ElementAnnotator implements IExternalServic
EntrezData result = entrezSerializer.xmlToObject(super.getCacheNode(ENTREZ_DATA_PREFIX + entrezMiriamData.getResource()));
if (result == null) {
String query = REST_API_URL + entrezMiriamData.getResource();
logger.debug(query);
try {
String content = getWebPageContent(query);
result = new EntrezData();
Node xml = getXmlDocumentFromString(content);
Node xml = getXmlDocumentFromString(content, false);
Node response = getNode("Entrezgene-Set", xml.getChildNodes());
if (response != null) {
......
......@@ -49,7 +49,7 @@ public class EntrezAnnotatorTest extends AnnotationTestFunctions {
@Test
public void testGetAnnotationsForEntrezId() throws Exception {
try {
MiriamData nsmf = new MiriamData(MiriamType.ENTREZ, "84532");
MiriamData nsmf = new MiriamData(MiriamType.ENTREZ, "6647");
GenericProtein proteinAlias = new GenericProtein("id");
proteinAlias.addMiriamData(nsmf);
entrezAnnotator.annotateElement(proteinAlias);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment