public ArrayList getStructureData(String urlString, ArrayList list) { KeyValueBean keyValue = new KeyValueBean(); Element xmlElement = null; try { System.out.println("1"); ReadXML readXML = new ReadXML(); System.out.println("2"); String xmlString = readXML.convertFromURLToString(urlString); System.out.println("3"); xmlElement = readXML.getDocumentElementFromString(xmlString); System.out.println("9"); keyValue.setKey(readXML.getStringValueForXMLTag(xmlElement, "Code")); System.out.println("10"); keyValue.setValue(readXML.getStringValueForXMLTag(xmlElement, "Description")); System.out.println("11"); list.add(keyValue); } catch (Exception e) { e.printStackTrace(); } finally { xmlElement = null; } return list; }
public ArrayList get2DImageDataList(String urlString, ArrayList list) { try { ReadXML readXML = new ReadXML(); System.out.println("************************URLString is******************* - " + urlString); String xmlString = readXML.convertFromURLToString(urlString); System.out.println("XMLString is - " + xmlString); list = readXML.getImageData(xmlString); System.out.println("List Size is - " + list.size()); Iterator iterator = list.iterator(); /* CentralServiceVO vo = null; while (iterator.hasNext()) { vo = (CentralServiceVO)iterator.next(); //System.out.println("URL = "+vo.getWms()); //System.out.println("TFW Values = "+vo.getTfwValues()); } */ } catch (Exception e) { e.printStackTrace(); } return list; }
public EMAPServiceVO getPOIFromEMAPData(String urlString, EMAPServiceVO vo) { try { ReadXML readXML = new ReadXML(); String xmlString = readXML.convertFromURLToString(urlString); Element xmlElement = readXML.getDocumentElementFromString(xmlString); vo.setValue(readXML.getStringValueForXMLTag(xmlElement, "gml:pos")); } catch (Exception e) { e.printStackTrace(); } return vo; }
public static void main(String[] s) { ReadXML readXML = new ReadXML(); try { // Step 1 - read xml response string // String xmlString = // readXML.convertFromURLToString("http://incf-dev-local.crbs.ucsd.edu:8080/atlas-ucsd?service=WPS&version=1.0.0&request=Execute&Identifier=Get2DImagesByPOI&DataInputs=srsName=Mouse_ABAvoxel_1.0;x=263;y=159;z=227;filter=maptype:Sagittal;tolerance=3"); // System.out.println("XML String is - " + xmlString); /* //Step 2 - Create a xml document from the string Element xmlElement = readXML.getDocumentElementFromString(xmlString); //Step 3 - Get a value from the xml document String [] elementValues = readXML.getStringValuesForXMLTag(xmlElement, "ows:Identifier"); for (int i = 0; i < elementValues.length; i++) { System.out.println("Element Value is - " + elementValues[i]); } */ // String xmlString = // "http://incf-dev-local.crbs.ucsd.edu/atlas-ucsd?service=WPS&version=1.0.0&request=Execute&Identifier=Get2DImagesByPOI&DataInputs=srsName=Mouse_ABAvoxel_1.0;x=263;y=159;z=227;filter=maptype:Sagittal;tolerance=3"; // String xmlString = // "http://132.239.131.188:8080/ucsd/atlas?service=WPS&version=1.0.0&request=Execute&Identifier=Get2DImagesByPOI&DataInputs=srsName=Mouse_ABAvoxel_1.0;x=263;y=159;z=227;filter=maptype:sagittal;tolerance=3"; // xmlString = // "http://132.239.131.188:8080/atlas-central?service=WPS&version=1.0.0&request=Execute&Identifier=Get2DImagesByPOI&DataInputs=srsname=Mouse_ABAvoxel_1.0;x=263;y=159;z=227;filter=maptype:Sagittal;tolerance=3"; // String xmlString = // "http://incf-dev-local.crbs.ucsd.edu/aba/atlas?service=WPS&version=1.0.0&request=Execute&Identifier=Get2DImagesByPOI&DataInputs=srsName=Mouse_AGEA_1.0;x=6600;y=4000;z=5600;filter=maptype:coronal"; String xmlString = "http://lxbisel.macs.hw.ac.uk:8080/EMAPServiceController?request=Execute&identifier=TransformPOI&dataInputs=inputSRSCode=Mouse_WHS_1.0;targetSRSCode=Mouse_EMAP-T26_1.0;x=12;y=-29;z=-73"; EMAPServiceVO vo = new EMAPServiceVO(); vo = readXML.getPOIFromEMAPData(xmlString, vo); System.out.println("VO - " + vo.getValue()); /* ArrayList list = new ArrayList(); //list = readXML.getImageData(xmlString); list = readXML.get2DImageDataList(xmlString, list); System.out.println("*****************List = "+list.size()); Iterator iterator = list.iterator(); EMAPServiceVO vo = null; while (iterator.hasNext()) { vo = (EMAPServiceVO)iterator.next(); System.out.println("*****************URL = "+vo.getWms()); System.out.println("*****************TFW Values = "+vo.getTfwValues()); } */ /* ArrayList completeStructureList = new ArrayList(); CentralServiceVO vo = new CentralServiceVO(); // 2a - Call the method from ABA Hub String abaURL = "http://incf-dev.crbs.ucsd.edu:8080/atlas-aba?service=WPS&version=1.0.0&request=Execute&Identifier=GetStructureNamesByPOI&DataInputs=srsName=Mouse_ABAvoxel_1.0;x=280;y=112;z=162;vocabulary=Mouse_ABAvoxel_1.0;filter=structureset:Fine"; completeStructureList = readXML.getStructureData(abaURL, completeStructureList); // 2b - Call the method from UCSD Hub String ucsdURL = "http://incf-dev.crbs.ucsd.edu:8080/atlas-ucsd?service=WPS&version=1.0.0&request=Execute&Identifier=GetStructureNamesByPOI&DataInputs=srsName=Mouse_ABAvoxel_1.0;x=280;y=112;z=162;vocabulary=Mouse_ABAvoxel_1.0;filter=structureset:Fine"; completeStructureList = readXML.getStructureData(ucsdURL, completeStructureList); // 2c - Call the method from WHS Hub String whsURL = "http://incf-dev.crbs.ucsd.edu:8080/atlas-whs?service=WPS&version=1.0.0&request=Execute&Identifier=GetStructureNamesByPOI&DataInputs=srsName=Mouse_ABAvoxel_1.0;x=280;y=112;z=162;vocabulary=Mouse_ABAvoxel_1.0;filter=structureset:Fine"; completeStructureList = readXML.getStructureData(whsURL, completeStructureList); Iterator iterator = completeStructureList.iterator(); KeyValueBean keyValue = null; while (iterator.hasNext()) { keyValue = (KeyValueBean)iterator.next(); System.out.println("Name = "+keyValue.getKey()); System.out.println("Description = "+keyValue.getValue()); } */ } catch (Exception e) { e.printStackTrace(); } }