applicationDict.js 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. applicationDict_parameter = {};
  2. function applicationDict_listWithApplication_init() {
  3. str = '<table border="1" width="100%">';
  4. str += '<tr><td colspan="2"><a href="#" id="get">get</a></td></tr>';
  5. str += '<tr><td>flag:</td><td><input type="text" id="flag" style="width:95%"/></td></tr>';
  6. str += '</table>';
  7. $('#content').html(str);
  8. $('#result').html('');
  9. $('#get').click(function() {
  10. applicationDict_listWithApplication($('#flag').val());
  11. });
  12. }
  13. function applicationDict_listWithApplication(flag) {
  14. $.ajax({
  15. type : 'get',
  16. dataType : 'json',
  17. contentType : 'application/json; charset=utf-8',
  18. url : '../jaxrs/applicationdict/list/application/' + flag,
  19. xhrFields : {
  20. 'withCredentials' : true
  21. },
  22. crossDomain : true
  23. }).always(function(json) {
  24. $('#result').html(JSON.stringify(json, null, 4));
  25. });
  26. }
  27. function applicationDict_get_init() {
  28. str = '<table border="1" width="100%">';
  29. str += '<tr><td colspan="2"><a href="#" id="get">get</a>&nbsp;<a href="#" id="put">put</a></td></tr>';
  30. str += '<tr><td>flag:</td><td><input type="text" id="flag" style="width:95%"/></td></tr>';
  31. str += '<tr><td>createTime:</td><td id="createTime">&nbsp;</td></tr>';
  32. str += '<tr><td>updateTime:</td><td id="updateTime">&nbsp;</td></tr>';
  33. str += '<tr><td>id:</td><td id="id">&nbsp;</td></tr>';
  34. str += '<tr><td>sequence:</td><td id="sequence">&nbsp;</td></tr>';
  35. str += '<tr><td>application</td><td id="application">&nbsp;</td></tr>';
  36. str += '<tr><td>name:</td><td><input type="text" id="name" style="width:95%"/></td></tr>';
  37. str += '<tr><td>alias:</td><td><input type="text" id="alias" style="width:95%"/></td></tr>';
  38. str += '<tr><td>description:</td><td><input type="text" id="description" style="width:95%"/></td></tr>';
  39. str += '<tr><td colspan="2"><textarea id="data" style="width:95%;height:500px"/></td></tr>';
  40. str += '</table>';
  41. $('#content').html(str);
  42. $('#result').html('');
  43. $('#get').click(function() {
  44. applicationDict_get($('#flag').val());
  45. });
  46. $('#put').click(function() {
  47. applicationDict_put($('#flag').val());
  48. });
  49. }
  50. function applicationDict_get(flag) {
  51. $.ajax({
  52. type : 'get',
  53. dataType : 'json',
  54. contentType : 'application/json; charset=utf-8',
  55. url : '../jaxrs/applicationdict/' + flag,
  56. xhrFields : {
  57. 'withCredentials' : true
  58. },
  59. crossDomain : true
  60. }).done(function(json) {
  61. if (json.type == 'success') {
  62. $('#createTime').html(json.data.createTime);
  63. $('#updateTime').html(json.data.updateTime);
  64. $('#id').html(json.data.id);
  65. $('#sequence').html(json.data.sequence);
  66. $('#application').html(json.data.application);
  67. $('#name').val(json.data.name);
  68. $('#alias').val(json.data.alias);
  69. $('#description').val(json.data.description);
  70. $('#data').val(JSON.stringify(json.data.data, null, 4));
  71. }
  72. }).always(function(json) {
  73. $('#result').html(JSON.stringify(json, null, 4));
  74. });
  75. }
  76. function applicationDict_put(flag) {
  77. $.ajax({
  78. type : 'put',
  79. dataType : 'json',
  80. contentType : 'application/json; charset=utf-8',
  81. url : '../jaxrs/applicationdict/' + flag,
  82. xhrFields : {
  83. 'withCredentials' : true
  84. },
  85. data : JSON.stringify({
  86. name : $('#name').val(),
  87. alias : $('#alias').val(),
  88. description : $('#description').val(),
  89. data : $.parseJSON($('#data').val())
  90. }),
  91. crossDomain : true
  92. }).always(function(json) {
  93. $('#result').html(JSON.stringify(json, null, 4));
  94. });
  95. }
  96. function applicationDict_query() {
  97. str = '<table border="1" width="100%">';
  98. str += '<tr><td colspan="2"><a href="#" id="get">get</a>&nbsp;<a href="#" id="put">put</a>&nbsp;<a href="#" id="post">post</a>&nbsp;<a href="#" id="delete">delete</a></td></tr>';
  99. str += '<tr><td>flag:</td><td><input type="text" id="flag" style="width:95%"/></td></tr>';
  100. str += '<tr><td>applicationFlag:</td><td><input type="text" id="applicationFlag" style="width:95%"/></td></tr>';
  101. str += '<tr><td>paths:</td><td><input type="text" id="paths" style="width:95%"></input></td></tr>';
  102. str += '<tr><td colspan="2"><textarea id="data" style="width:95%;height:500px"/></td></tr>';
  103. str += '</table>';
  104. $('#content').html(str);
  105. $('#result').html('');
  106. $('#get').click(function() {
  107. applicationDict_getData($('#flag').val(), $('#applicationFlag').val(), $('#paths').val().replace(/\./g, '\/'));
  108. });
  109. $('#put').click(function() {
  110. applicationDict_updateData($('#flag').val(), $('#applicationFlag').val(), $('#paths').val().replace(/\./g, '\/'));
  111. });
  112. $('#post').click(function() {
  113. applicationDict_createData($('#flag').val(), $('#applicationFlag').val(), $('#paths').val().replace(/\./g, '\/'));
  114. });
  115. $('#delete').click(function() {
  116. applicationDict_deleteData($('#flag').val(), $('#applicationFlag').val(), $('#paths').val().replace(/\./g, '\/'));
  117. });
  118. }
  119. function applicationDict_getData(flag, applicationFlag, paths) {
  120. $.ajax({
  121. type : 'get',
  122. dataType : 'json',
  123. contentType : 'application/json; charset=utf-8',
  124. url : '../jaxrs/applicationdict/' + flag + '/application/' + applicationFlag + ((paths.length > 0) ? ('/' + paths) : '') + '/data',
  125. xhrFields : {
  126. 'withCredentials' : true
  127. },
  128. crossDomain : true
  129. }).done(function(json) {
  130. if (json.type == 'success') {
  131. $('#data').val(JSON.stringify(json.data, null, 4));
  132. }
  133. }).always(function(json) {
  134. $('#result').html(JSON.stringify(json, null, 4));
  135. });
  136. }
  137. function applicationDict_updateData(flag, applicationFlag, paths) {
  138. $.ajax({
  139. type : 'put',
  140. dataType : 'json',
  141. contentType : 'application/json; charset=utf-8',
  142. url : '../jaxrs/applicationdict/' + flag + '/application/' + applicationFlag + ((paths.length > 0) ? ('/' + paths) : '') + '/data',
  143. xhrFields : {
  144. 'withCredentials' : true
  145. },
  146. data : JSON.stringify($.parseJSON($('#data').val())),
  147. crossDomain : true
  148. }).always(function(json) {
  149. $('#result').html(JSON.stringify(json, null, 4));
  150. });
  151. }
  152. function applicationDict_deleteData(flag, applicationFlag, paths) {
  153. $.ajax({
  154. type : 'delete',
  155. dataType : 'json',
  156. contentType : 'application/json; charset=utf-8',
  157. url : '../jaxrs/applicationdict/' + flag + '/application/' + applicationFlag + ((paths.length > 0) ? ('/' + paths) : '') + '/data',
  158. xhrFields : {
  159. 'withCredentials' : true
  160. },
  161. crossDomain : true
  162. }).always(function(json) {
  163. $('#result').html(JSON.stringify(json, null, 4));
  164. });
  165. }
  166. function applicationDict_createData(flag, applicationFlag, paths) {
  167. $.ajax({
  168. type : 'post',
  169. dataType : 'json',
  170. contentType : 'application/json; charset=utf-8',
  171. url : '../jaxrs/applicationdict/' + flag + '/application/' + applicationFlag + ((paths.length > 0) ? ('/' + paths) : '') + '/data',
  172. xhrFields : {
  173. 'withCredentials' : true
  174. },
  175. data : JSON.stringify($.parseJSON($('#data').val())),
  176. crossDomain : true
  177. }).always(function(json) {
  178. $('#result').html(JSON.stringify(json, null, 4));
  179. });
  180. }