objects.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. /**
  2. * WAS에서 전달받는 XML용 Result Object result.xml 참조
  3. *
  4. * getType() : success|select|valueobject|rowset|xml
  5. */
  6. function Result(p_type, p_requestUri, p_requestEvent) {
  7. this.type = p_type;
  8. this.getType = function() {
  9. return this.type;
  10. };
  11. this.setType = function(p_type) {
  12. this.type = p_type;
  13. };
  14. this.requestUri = p_requestUri;
  15. this.getRequestUri = function() {
  16. return this.requestUri;
  17. };
  18. this.setRequestUri = function(p_requestUri) {
  19. this.requestUri = p_requestUri;
  20. };
  21. this.requestEvent = p_requestEvent;
  22. this.getRequestEvent = function() {
  23. return this.requestEvent;
  24. };
  25. this.setRequestEvent = function(p_requestEvent) {
  26. this.requestEvent = p_requestEvent;
  27. };
  28. this.requestParameter = "";
  29. this.getRequestParameter = function() {
  30. return this.requestParameter;
  31. };
  32. this.setRequestParameter = function(p_requestParameter) {
  33. this.requestParameter = p_requestParameter;
  34. };
  35. this.success = false;
  36. this.getSuccess = function() {
  37. return this.success;
  38. };
  39. this.setSuccess = function(p_success) {
  40. this.success = p_success;
  41. };
  42. this.message = "";
  43. this.getMessage = function() {
  44. return this.message;
  45. };
  46. this.setMessage = function(p_message) {
  47. this.message = p_message;
  48. };
  49. this.detailMessage = "";
  50. this.getDetailMessage = function() {
  51. return this.detailMessage;
  52. };
  53. this.setDetailMessage = function(p_detailMessage) {
  54. this.detailMessage = p_detailMessage;
  55. };
  56. this.select_vo = null;
  57. this.getSelect = function() {
  58. return this.select_vo;
  59. };
  60. this.setSelect = function(p_select_vo) {
  61. this.select_vo = p_select_vo;
  62. };
  63. this.vo = null;
  64. this.getValueObject = function() {
  65. return this.vo;
  66. };
  67. this.setValueObject = function(p_vo) {
  68. this.vo = p_vo;
  69. };
  70. this.rowset = null;
  71. this.getRowSet = function() {
  72. return this.rowset;
  73. };
  74. this.setRowSet = function(p_rowset) {
  75. this.rowset = p_rowset;
  76. };
  77. this.xml = "";
  78. this.getXml = function() {
  79. return this.xml;
  80. };
  81. this.setXml = function(p_xml) {
  82. this.xml = p_xml;
  83. };
  84. this.toString = function() {
  85. var msg = "Result Object : \n\n" + "type=" + this.type + "\n"
  86. + "requestUri=" + this.requestUri + "\n" + "requestEvent="
  87. + this.requestEvent + "\n" + "success=" + this.success + "\n"
  88. + "message=" + this.message + "\n" + "requestParameter="
  89. + this.requestParameter + "\n";
  90. if (this.type == "xml") {
  91. msg += +"xml=" + this.xml + "\n";
  92. }
  93. return msg;
  94. };
  95. }
  96. function ValueObject() {
  97. this.keyArray = new Array();
  98. this.valueArray = new Array();
  99. this.getSize = function() {
  100. return this.keyArray.length;
  101. };
  102. this.getKeyArray = function() {
  103. return this.keyArray;
  104. };
  105. this.getValueArray = function() {
  106. return this.valueArray;
  107. };
  108. this.set = function(p_key, p_value) {
  109. this.keyArray[this.keyArray.length] = p_key;
  110. this.valueArray[this.valueArray.length] = p_value;
  111. };
  112. this.getValue = function(p_index) {
  113. return this.valueArray[p_index];
  114. };
  115. this.getKey = function(p_index) {
  116. return this.keyArray[p_index];
  117. };
  118. this.get = function(p_key) {
  119. for (var i = 0; i < this.getSize(); i++) {
  120. if (this.getKey(i).toLowerCase() == p_key.toLowerCase()) {
  121. return this.getValue(i);
  122. }
  123. }
  124. return "";
  125. };
  126. }
  127. function RowSet() {
  128. this.rowArray = new Array();
  129. this.getRowSize = function() {
  130. return this.rowArray.length;
  131. }
  132. this.getColSize = function() {
  133. if (this.rowArray.length == 0)
  134. return 0;
  135. else
  136. return this.rowArray[0].getSize();
  137. }
  138. this.setRow = function(p_row) {
  139. this.rowArray[this.rowArray.length] = p_row;
  140. }
  141. this.getRow = function(p_rowIndex) {
  142. return this.rowArray[p_rowIndex];
  143. }
  144. this.getColName = function(p_col_index) {
  145. if (this.rowArray.length == 0)
  146. return null;
  147. else
  148. return this.rowArray[0].getName(p_col_index);
  149. }
  150. this.getColValue = function(p_row_index, p_col_index) {
  151. if (this.rowArray.length == 0)
  152. return "";
  153. else {
  154. if (p_row_index < this.getRowSize())
  155. return this.rowArray[p_row_index].getValue(p_col_index);
  156. else
  157. return null;
  158. }
  159. }
  160. }
  161. function Row() {
  162. this.nameArray = new Array();
  163. this.valueArray = new Array();
  164. this.getSize = function() {
  165. return this.nameArray.length;
  166. };
  167. this.getNameArray = function() {
  168. return this.nameArray;
  169. };
  170. this.getValueArray = function() {
  171. return this.valueArray;
  172. };
  173. this.set = function(p_name, p_value) {
  174. this.nameArray[this.nameArray.length] = p_name;
  175. this.valueArray[this.valueArray.length] = p_value;
  176. };
  177. this.getValue = function(p_index) {
  178. return this.valueArray[p_index];
  179. };
  180. this.getName = function(p_index) {
  181. return this.nameArray[p_index];
  182. };
  183. this.get = function(p_name) {
  184. for (var i = 0; i < this.getSize(); i++) {
  185. if (this.getName(i) == p_name) {
  186. return this.getValue(i);
  187. }
  188. }
  189. return null;
  190. };
  191. this.toString = function() {
  192. var msg = "Row Object : \n\n";
  193. for (var i = 0; i < this.getSize(); i++) {
  194. msg += i + " : " + this.getName(i) + "=" + this.getValue(i) + "\n";
  195. }
  196. return msg;
  197. };
  198. }