I have a hashtable. Inside I've added keys, and values. But now I need to have an arrayList for each keyvalue. I was thinking I needed to create an ArrayList with the ArrayList name from the hashtable key and the contents of the hashtable values placed inside values. I'm using Ultra-Studio to make modifications to this script file.
So for instance in my hashtable
This will be the name of the ArrayList: SW_Version
Second all SW Version values will be added SW_Version
I think what I need to do is first cycle through the hashtable gather all the SW Versions values and put them in
I'm very confused on this, please be patient with me. I have to write my JAVA code in an javaScript file
I wanted to pull data directly from the hashTable, I would also need to group the keys and add the values into the arrayList.
Here are my Hashtable and ArrayList declaration.
var legendRows = newPackages.java.util.ArrayList();
var xmlItems = newPackages.java.util.ArrayList();
var modeItems = newPackages.java.util.ArrayList();
var ircDOORSHashTable = newjava.util.Hashtable();
This is my code:
This function gets the "Legacy Data" value from a procedure bean. It then adds the table cell values into the HashTable "ircDOORSHashTable".
Cell key = var mapKeyDOORS
Cell value = mapKeyDOORSValue
function getDOORSData(documentID, contentBean, text) {
var xmlText = cleanTable(text);
try
{
var docFactory = Packages.javax.xml.parsers.DocumentBuilderFactory.newInstance();
var docBuilder = docFactory.newDocumentBuilder();
var sbis = newPackages.org.xml.sax.InputSource(newjava.io.StringReader(xmlText));
var document = docBuilder.parse(sbis);
var root = document.getDocumentElement();
varnodeList = root.getElementsByTagName("tr");
for (row = 0; row < nodeList.getLength(); row++) {
var node = nodeList.item(row);
var mapKeyDOORS = newjava.lang.String(node.getElementsByTagName("td").item(0).getTextContent().trim());
var mapKeyDOORSValue = newjava.lang.String(node.getElementsByTagName("td").item(1).getTextContent().trim());
if((mapKeyDOORS !== null && mapKeyDOORS!=="") && (mapKeyDOORSValue!== null || mapKeyDOORSValue !== "")){
// Returnsanarrayoflineitems.
varibplValues = parseFields(mapKeyDOORSValue);
for (varf = 0; f < ibplValues.length; f++) {
log("InsidegetDOORSDatafunction. InfirstPass")
checkIBPL(ibplValues[f], documentID, contentBean, mapKeyDOORS);
}else{
log("ArrayList xmlItem: " + ibplValues[i]);
xmlItems.add(ibplValues[f]);
ircDOORSHashTable.put(mapKeyDOORS, ibplValues[i]);
}
}
}
}
}catch(e){ log ("ErrorfoundingetDOORSDatafunction " + e); } }
Thankyou, your help is greatly appreciated.