int nLen = recordNodes.getLength();
for (int i = 0; i < nLen; i++) {
LOG.finer("Going through a record node");
Node currNode = recordNodes.item(i);
CswRecord record = new CswRecord();
double maxX = 180;
double maxY = 90;
double minX = -180;
double minY = -90;
String lowerCorner = "";
String upperCorner = "";
record.setDefaultEnvelope(true);
NodeList nlChildren = currNode.getChildNodes();
int nChildren = nlChildren.getLength();
for (int nChild = 0; nChild < nChildren; nChild++) {
Node ndChild = nlChildren.item(nChild);
String nodeName = ndChild.getNodeName();
String nodeValue = ndChild.getTextContent();
if (nodeName.equals("ID")) {
record.setId(nodeValue);
} else if (nodeName.equals("Title")) {
record.setTitle(nodeValue);
} else if (nodeName.equals("Abstract")) {
record.setAbstractData(nodeValue);
} else if (nodeName.equals("ModifiedDate")) {
record.setModifiedDate(nodeValue);
} else if (nodeName.equals("MaxX")) {
maxX = Utils.chkDbl(nodeValue,maxX);
record.setDefaultEnvelope(
Utils.chkDbl(nodeValue,Integer.MIN_VALUE) == Integer.MIN_VALUE);
} else if (nodeName.equals("MaxY")) {
maxY = Utils.chkDbl(nodeValue,maxY);
} else if (nodeName.equals("MinX")) {
minX = Utils.chkDbl(nodeValue,minX);
} else if (nodeName.equals("MinY")) {
minY = Utils.chkDbl(nodeValue,minY);
} else if (nodeName.equals("LowerCorner")) {
lowerCorner = Utils.chkStr(nodeValue);
} else if (nodeName.equals("UpperCorner")) {
upperCorner = Utils.chkStr(nodeValue);
} else if (nodeName.equals("References")) {
record.setReference(nodeValue);
} else if (nodeName.equals("Types")) {
record.setTypes(nodeValue);
} else if (nodeName.equals("ModifiedDate")) {
record.setTypes(nodeValue);
}
}
if (!"".equals(lowerCorner)) {
String lowerCornerPts[] = lowerCorner.split(" ");
String upperCornerPts[] = upperCorner.split(" ");
if (lowerCornerPts != null && lowerCornerPts.length >= 2) {
minY = Utils.chkDbl(lowerCornerPts[1], minY);
minX = Utils.chkDbl(lowerCornerPts[0], minX);
record.setDefaultEnvelope(
Utils.chkDbl(lowerCornerPts[1], Integer.MIN_VALUE)
== Integer.MIN_VALUE);
}
if (upperCornerPts != null && upperCornerPts.length >= 2) {
maxY = Utils.chkDbl(upperCornerPts[1], maxY);
maxX = Utils.chkDbl(upperCornerPts[0], maxX);
}
}
record.setEnvelope(new Envelope(minX, minY, maxX, maxY));
// Attempting to see if this is a livedata record
record.setLiveDataOrMap(false);
Iterator<DcList.Value> iter = record.getTypes().iterator();
while (iter.hasNext()) {
DcList.Value value = iter.next();
if (value.getValue().equalsIgnoreCase("livedata")) {
record.setLiveDataOrMap(true);
}
}
// Links
NodeList nodeList = ((Element)currNode).getElementsByTagName("Link");
for(int j = 0; j < nodeList.getLength(); j++) {
Node linkNode = nodeList.item(j);
NamedNodeMap attrLinkNode = linkNode.getAttributes();
String gptLinkTag = null;
if(attrLinkNode.getNamedItem("gptLinkTag")!= null) {
gptLinkTag = attrLinkNode.getNamedItem("gptLinkTag").getNodeValue();
}
String show = null;
if(attrLinkNode.getNamedItem("show")!= null) {
show = attrLinkNode.getNamedItem("show").getNodeValue();
}
String url = null;
if(linkNode!= null) {
url = linkNode.getTextContent();
}
String label = null;
if(attrLinkNode.getNamedItem("label")!= null) {
label = attrLinkNode.getNamedItem("label").getNodeValue();
}
if(label != null && !"".equals(label)) {
record.getLinks().addCustomLink(label, url);
} else if(gptLinkTag != null && !"".equals(gptLinkTag)){
record.getLinks().addDefaultLinkOptions(gptLinkTag,
Val.chkBool(show, true));
} else {
continue;
}