1    package com.instantbank.collections.commonQueuing.web;
2    
3    import java.io.ByteArrayInputStream;
4    import java.io.InputStream;
5    import oracle.xml.parser.v2.DOMParser;
6    import oracle.xml.parser.v2.XMLDocument;
7    import oracle.xml.parser.v2.XMLNode;
8    import org.w3c.dom.Element;
9    import org.w3c.dom.NodeList;
10   import com.instantbank.collections.util.InstantbankException;
11   import com.instantbank.collections.util.StringFormat;
12   
13   public class QueueTypesTransformer {
14     String idexp;
15     ByteArrayInputStream InputStream = null;
16     XMLDocument inxml;
17     DOMParser xmlParser = new DOMParser();
18     private String xmlString;
19   
20   
21     public QueueTypesTransformer(String QueueTypesXml) {
22       try {
23         xmlString = QueueTypesXml;
24         InputStream = new ByteArrayInputStream(QueueTypesXml.getBytes());
25         xmlParser.setValidationMode(false);
26         xmlParser.parse(InputStream);
27         inxml = xmlParser.getDocument();
28       }
29       catch(Exception e) {
30       }
31     }
32   
33   
34     public String getQueueTypesArray() throws InstantbankException {
35       XMLNode node;
36       NodeList NodeList;
37       Element Parent;
38       String ResultVector = "var QueueTypesVector = new Array();\n";
39   
40       try {
41         Parent = inxml.getDocumentElement();
42         NodeList = Parent.getChildNodes();
43         for(int i = 0; i < NodeList.getLength(); i++) {
44           node = (XMLNode)NodeList.item(i);
45           ResultVector += "QueueTypesVector[" + i + "]= new Array();\n";
46           ResultVector += "QueueTypesVector[" + i + "][0]='" + node.valueOf("./id") + "';\n";
47           ResultVector += "QueueTypesVector[" + i + "][1]='" + node.valueOf("./category") + "';\n";
48           ResultVector += "QueueTypesVector[" + i + "][2]='" + StringFormat.toSafeJavaString(node.valueOf("./name")) + "';\n";
49           ResultVector += "QueueTypesVector[" + i + "][3]='" + StringFormat.toSafeJavaString(node.valueOf("./description")) + "';\n";
50           ResultVector += "QueueTypesVector[" + i + "][4]='" + node.valueOf("./lastChangedDate") + "';\n";
51           ResultVector += "QueueTypesVector[" + i + "][5]='" + node.valueOf("./latChangedById") + "';\n";
52           ResultVector += "QueueTypesVector[" + i + "][6]='" + StringFormat.toSafeJavaString(node.valueOf("./lastChangedByName")) + "';\n";
53           ResultVector += "QueueTypesVector[" + i + "][7]='N';\n";
54         }
55       }
56       catch(Exception e) {
57         ResultVector += "/* " + xmlString + "*/ ";
58       }
59       finally {
60         return ResultVector;
61       }
62     }
63   }
64   
65