home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Java / Java.zip / mqaoad21.zip / TestElement.java < prev    next >
Text File  |  2002-12-19  |  4KB  |  222 lines

  1. package com.ibm.extricity.adapters.mqseries.mqak;
  2.  
  3. /**
  4.  * Insert the type's description here.
  5.  * Creation date: (10/24/00 10:13:16 AM)
  6.  * @author: Administrator
  7.  */
  8. import java.util.*;
  9.  
  10. public class TestElement implements com.extricity.document.api.Element
  11. {
  12.    protected Hashtable tbl = new Hashtable();
  13.  
  14. /**
  15.  * TestElement constructor comment.
  16.  */
  17. public TestElement()
  18. {
  19.    super();
  20. }
  21.  
  22. /**
  23.  * clearAll method comment.
  24.  */
  25. public void clearAll()
  26. {
  27.    tbl.clear();
  28. }
  29.  
  30. /**
  31.  * clearData method comment.
  32.  */
  33. public void clearData()
  34. {
  35.    tbl.clear();
  36. }
  37.  
  38. /**
  39.  * copyIn method comment.
  40.  */
  41. public void copyIn(com.extricity.document.api.Element arg1)
  42.    throws com.extricity.document.api.ElementTypeException
  43. {
  44.    copyIn("",arg1);
  45. }
  46.  
  47. /**
  48.  * copyIn method comment.
  49.  */
  50. public void copyIn(String arg1, com.extricity.document.api.Element arg2)
  51.    throws IndexOutOfBoundsException, com.extricity.document.api.InvalidQueryException, com.extricity.document.api.ElementTypeException
  52. {
  53.    TestElement src = (TestElement)arg2;
  54.  
  55.    Enumeration en = src.tbl.keys();
  56.    String key;
  57.  
  58.    if(arg1.length() > 0)
  59.    {
  60.       if(!arg1.endsWith("\\") && !arg1.endsWith("/"))
  61.       {
  62.          arg1 = arg1 + "/";
  63.       }
  64.    }
  65.    while(en.hasMoreElements())
  66.    {
  67.       key = (String)en.nextElement();
  68.       tbl.put(arg1 + key,src.tbl.get(key));
  69.    }
  70. }
  71.  
  72. /**
  73.  * getBusinessObject method comment.
  74.  */
  75. public com.extricity.document.api.BusinessObject getBusinessObject()
  76. {
  77.    return null;
  78. }
  79.  
  80. /**
  81.  * getData method comment.
  82.  */
  83. public String getData()
  84.    throws com.extricity.document.api.ElementTypeException
  85. {
  86.    return null;
  87. }
  88.  
  89. /**
  90.  * getData method comment.
  91.  */
  92. public String getData(String arg1)
  93.    throws IndexOutOfBoundsException, com.extricity.document.api.InvalidQueryException, com.extricity.document.api.ElementTypeException
  94. {
  95.    return (String)tbl.get(arg1);
  96. }
  97.  
  98. /**
  99.  * getDataType method comment.
  100.  */
  101. public String getDataType()
  102.    throws com.extricity.document.api.ElementTypeException
  103. {
  104.    return null;
  105. }
  106.  
  107. /**
  108.  * getElement method comment.
  109.  */
  110. public com.extricity.document.api.Element getElement(String arg1)
  111.    throws IndexOutOfBoundsException, com.extricity.document.api.InvalidQueryException
  112. {
  113.    return null;
  114. }
  115.  
  116. /**
  117.  * getElementSequence method comment.
  118.  */
  119. public com.extricity.document.api.ElementSequence getElementSequence(String arg1)
  120.    throws IndexOutOfBoundsException, com.extricity.document.api.InvalidQueryException
  121. {
  122.    return null;
  123. }
  124.  
  125. /**
  126.  * getTagName method comment.
  127.  */
  128. public String getTagName()
  129. {
  130.    return null;
  131. }
  132.  
  133. /**
  134.  * hasData method comment.
  135.  */
  136. public boolean hasData()
  137. {
  138.    return !tbl.isEmpty();
  139. }
  140.  
  141. /**
  142.  * isField method comment.
  143.  */
  144. public boolean isField()
  145. {
  146.    return true;
  147. }
  148.  
  149. /**
  150.  * isValid method comment.
  151.  */
  152. public boolean isValid()
  153. {
  154.    return true;
  155. }
  156.  
  157. /**
  158.  * setData method comment.
  159.  */
  160. public void setData(String arg1)
  161.    throws com.extricity.document.api.ElementTypeException
  162. {
  163.    setData(null,arg1);
  164. }
  165.  
  166. /**
  167.  * setData method comment.
  168.  */
  169. public void setData(String arg1, String arg2)
  170.    throws IndexOutOfBoundsException, com.extricity.document.api.InvalidQueryException, com.extricity.document.api.ElementTypeException
  171. {
  172.    if(arg1 != null)
  173.    {
  174.       if(arg1.length() == 0)
  175.       {
  176.          arg1 = null;
  177.       }
  178.    }
  179.    if(arg2 != null)
  180.    {
  181.       if(arg2.length() == 0)
  182.       {
  183.          arg2 = null;
  184.       }
  185.    }
  186.    if(arg2 == null)
  187.    {
  188.       tbl.remove(arg1);
  189.    }
  190.    else
  191.    {
  192.       tbl.put(arg1,arg2);
  193.    }
  194. }
  195.  
  196. /**
  197.  * Insert the method's description here.
  198.  * Creation date: (10/24/00 4:06:37 PM)
  199.  * @return java.lang.String
  200.  */
  201. public String toString()
  202. {
  203.    return toString(false);
  204. }
  205.  
  206. /**
  207.  * toString method comment.
  208.  */
  209. public String toString(boolean arg1)
  210. {
  211.    Enumeration en = tbl.keys();
  212.    String key;
  213.    String res = new String("\n");
  214.  
  215.    while(en.hasMoreElements())
  216.    {
  217.       key = (String)en.nextElement();
  218.       res = res + key + "=" + tbl.get(key) + "\n";
  219.    }
  220.    return res;
  221. }
  222. }