From 76523ae78582a9c8cd271c65701368bbced9a6e5 Mon Sep 17 00:00:00 2001 From: zhourui Date: Thu, 6 Aug 2020 11:32:22 +0800 Subject: [PATCH] fix print --- .../jaxrs/identity/ActionListWithPerson.java | 2 - .../src/main/webapp/jest | 1393 ----------------- 2 files changed, 1395 deletions(-) delete mode 100644 o2server/x_teamwork_assemble_control/src/main/webapp/jest diff --git a/o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListWithPerson.java b/o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListWithPerson.java index fdd0b3db60..7e66e5a030 100644 --- a/o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListWithPerson.java +++ b/o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListWithPerson.java @@ -37,11 +37,9 @@ class ActionListWithPerson extends BaseAction { Optional optional = CacheManager.get(cacheCategory, cacheKey); if (optional.isPresent()) { result.setData((Wo) optional.get()); - System.out.println("!!!!!!!!!!!!!!GET with cache"); } else { Wo wo = this.list(business, wi); CacheManager.put(cacheCategory, cacheKey, wo); - System.out.println("!!!!!!!!!!!!!!nnnnnnnnnnnnoooooooooooooo cache"); result.setData(wo); } return result; diff --git a/o2server/x_teamwork_assemble_control/src/main/webapp/jest b/o2server/x_teamwork_assemble_control/src/main/webapp/jest deleted file mode 100644 index 5aa831b49f..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/webapp/jest +++ /dev/null @@ -1,1393 +0,0 @@ -var Describe = function() { - // 20180730 -} -Describe.splitValue = function(str) { - if (str) { - if (str.length > 0) { - return str.split(','); - } - } - return []; -} -Describe.joinValue = function(o, split) { - var s = ','; - if (split) { - s = '' + split; - } - if (o) { - if (toString.apply(o) === '[object Array]') { - return o.join(s); - } - } - return o; -} -Describe.doPost = function(address, m, data) { - $('#url').html(address); - if ((m.resultContentType) && m.resultContentType.indexOf('application/json') > -1) { - $.ajax({ - url : address, - type : 'POST', - headers : { - 'x-debugger' : true - }, - contentType : (m.contentType.indexOf('application/json') > -1) ? m.contentType : m.contentType, - processData : (m.contentType.indexOf('application/json') > -1) ? true : false, - xhrFields : { - 'withCredentials' : true - }, - data : ((m.contentType.indexOf('application/json') > -1) && (!m.useStringParameter) ? JSON.stringify(data) : data) - }).always(function(resultJson) { - $('#result').html(JSON.stringify(resultJson, null, 4)); - Describe.writeOut(m.outs, resultJson); - }); - } else { - $.ajax({ - url : address, - type : 'POST', - headers : { - 'x-debugger' : true - }, - contentType : (m.contentType.indexOf('application/json') > -1) ? m.contentType : false, - processData : (m.contentType.indexOf('application/json') > -1) ? true : false, - xhrFields : { - 'withCredentials' : true - }, - data : ((m.contentType.indexOf('application/json') > -1) && (!m.useStringParameter) ? JSON.stringify(data) : data) - }); - } -} -Describe.doPut = function(address, m, data) { - $('#url').html(address); - if ((m.resultContentType) && m.resultContentType.indexOf('application/json') > -1) { - $.ajax({ - url : address, - type : 'PUT', - headers : { - 'x-debugger' : true - }, - contentType : (m.contentType.indexOf('application/json') > -1) ? m.contentType : false, - processData : (m.contentType.indexOf('application/json') > -1) ? true : false, - xhrFields : { - 'withCredentials' : true - }, - data : ((m.contentType.indexOf('application/json') > -1) && (!m.useStringParameter) ? JSON.stringify(data) : data) - }).always(function(resultJson) { - $('#result').html(JSON.stringify(resultJson, null, 4)); - Describe.writeOut(m.outs, resultJson); - }); - } else { - $.ajax({ - url : address, - type : 'PUT', - headers : { - 'x-debugger' : true - }, - contentType : (m.contentType.indexOf('application/json') > -1) ? m.contentType : false, - processData : (m.contentType.indexOf('application/json') > -1) ? true : false, - xhrFields : { - 'withCredentials' : true - }, - data : ((m.contentType.indexOf('application/json') > -1) && (!m.useStringParameter) ? JSON.stringify(data) : data) - }); - } -} -Describe.doGet = function(address, m) { - $('#url').html(address); - if ((m.resultContentType) && m.resultContentType.indexOf('application/json') > -1) { - $.ajax({ - type : 'GET', - dataType : 'json', - url : address, - headers : { - 'x-debugger' : true - }, - contentType : m.contentType, - xhrFields : { - 'withCredentials' : true - }, - crossDomain : true - }).always(function(resultJson) { - $('#result').html(JSON.stringify(resultJson, null, 4)); - Describe.writeOut(m.outs, resultJson); - }); - } else { - window.open(address, '_blank'); - } -} -Describe.doDelete = function(address, m) { - $('#url').html(address); - if ((m.resultContentType) && m.resultContentType.indexOf('application/json') > -1) { - $.ajax({ - type : 'DELETE', - dataType : 'json', - url : address, - headers : { - 'x-debugger' : true - }, - contentType : m.contentType, - xhrFields : { - 'withCredentials' : true - }, - crossDomain : true - }).always(function(resultJson) { - $('#result').html(JSON.stringify(resultJson, null, 4)); - Describe.writeOut(m.outs, resultJson); - }); - } else { - $.ajax({ - type : 'DELETE', - dataType : 'json', - url : address, - headers : { - 'x-debugger' : true - }, - contentType : m.contentType, - xhrFields : { - 'withCredentials' : true - }, - crossDomain : true - }); - } -} -Describe.writeOut = function(outs, json) { - if (outs && (outs.length) && json && json.data) { - $.each(Object.keys(json.data), function(i, k) { - $('#out_' + k + '_out', '#outs').html(json.data[k]); - }); - } -} - -Describe.createSampleMootools = function(m) { - debugger; - var address = window.location.href; - address = address.substring(0,address.indexOf("/jest/")); - var address = address +"/"+ m.path; - if (m.pathParameters && m.pathParameters.length > 0) { - $.each(m.pathParameters, function(pi, p) { - address = address.replace('{' + p.name + '}', '替换参数'+pi); - }); - } - if (m.queryParameters && m.queryParameters.length > 0) { - $.each(m.queryParameters, function(pi, p) { - var query = p.name + '=' + '替换参数'+pi; - if (address.indexOf("?") > 0) { - address += '&' + query; - } else { - address += '?' + query; - } - }); - } - - var strSample=""; - if (m.contentType.indexOf('application/json') > -1) { - strSample = "var data = {};" + "\n"; - if (m.ins && m.ins.length > 0) { - $.each(m.ins, function(ii, i) { - switch (i.type) { - default: - if (i.isBaseType) { - if (i.isCollection) { - strSample += ' data["'+i.name+'"] = ["参数1"];' + "\n"; - } else { - strSample += ' data["'+i.name+'"] = "参数";' + "\n"; - } - } else { - if(i.isCollection){ - if(i.fieldValue){ - if(i.fieldType =='enum'){ - strSample += ' data["'+i.name+'"] = ["'+ i.fieldValue +'"];'+"\n"; - }else{ - strSample += ' data["'+i.name+'"] = ['+ i.fieldValue +'];'+"\n"; - } - - }else{ - strSample += ' data["'+i.name+'"] = [{"参数1":"value1","参数2":"value2"}];'+"\n"; - } - }else{ - if(i.fieldType =='enum'){ - strSample += ' data["'+i.name+'"] = "'+ i.fieldValue +'";'+"\n"; - }else{ - - strSample += ' data["'+i.name+'"] = {"参数1":"value1","参数2":"value2"};'+"\n"; - } - } - } - } - }); - } else if (m.useJsonElementParameter) { - strSample += 'data = {"参数1":"value1","参数2":"value2"};' +"\n"; - } else if (m.useStringParameter) { - strSample += 'data = "参数";'+"\n"; - } - - strSample += " \n var mootoolsRequest = new Request({" + "\n"; - strSample += " url:'"+address + "',\n"; - strSample += " method:'"+ m.type + "',\n"; - strSample += " dataType:'json',\n"; - strSample += " headers : {'Content-Type':'application/json;charset=utf8','x-token':'实际的x-token'}" + ",\n"; - if((m.contentType.indexOf('application/json') > -1) && (!m.useStringParameter)){ - strSample += " data:JSON.stringify(data),\n"; - }else{ - strSample += " data:data,\n"; - } - strSample += " onRequest: function(){ },"+ "\n"; - strSample += " onSuccess: function(responseText){},"+ "\n"; - strSample += " onFailure: function(){}"+ "\n"; - strSample +="}).send();"+ "\n"; - } else { - /* - strSample = "var formData = new FormData();" + "\n"; - if (m.formParameters && m.formParameters.length > 0) { - $.each(m.formParameters, function(pi, p) { - if (p.type == "File") { - //formData.append(p.name, $('input[type=file]', '#formParameters')[0].files[0]); - strSample += 'formData.append("'+p.name+'", $("input[type=file]")[0].files[0]);' + "\n"; - } else { - strSample += 'formData.append("'+p.name+'", "参数'+pi+'");' + "\n"; - } - }); - } - - strSample += "$.ajax({" + "\n"; - strSample += "type : '"+ m.type + "',\n"; - strSample += "url : '"+address + "',\n"; - strSample += "headers : {'x-debugger' : true}" + ",\n"; - strSample += "contentType : false,\n"; - strSample += "processData : false,\n"; - strSample += "xhrFields : {'withCredentials' : true}" + ",\n"; - strSample += "crossDomain : true"+ ",\n"; - strSample += "data : formData"+"\n"; - strSample += "});"; - */ - } - - return strSample; - } - -Describe.createSampleJSO2= function(m) { - var address = window.location.href; - address = address.substring(0,address.indexOf("/jest/")); - var uri = address.substring(address.lastIndexOf("/")+1,address.length); - address = m.path; - address = address.substring(address.indexOf("jaxrs/")+6,address.length); - var parameter = ""; - if (m.pathParameters && m.pathParameters.length > 0) { - $.each(m.pathParameters, function(pi, p) { - address = address.replace('{' + p.name + '}', '替换参数'+pi); - if(parameter == ""){ - parameter = "\"" + p.name + "\"" + ":" + '"替换参数'+pi +'"'; - }else{ - parameter = parameter + ",\"" + p.name + "\"" + ":" + '替换参数'+pi +'"'; - } - }); - } - if (m.queryParameters && m.queryParameters.length > 0) { - $.each(m.queryParameters, function(pi, p) { - var query = p.name + '=' + '替换参数'+pi; - if (address.indexOf("?") > 0) { - address += '&' + query; - } else { - address += '?' + query; - } - }); - } - - var strSample=""; - if (m.contentType.indexOf('application/json') > -1) { - strSample = "var data = {};" + "\n"; - if (m.ins && m.ins.length > 0) { - $.each(m.ins, function(ii, i) { - switch (i.type) { - default: - if (i.isBaseType) { - if (i.isCollection) { - strSample += ' data["'+i.name+'"] = ["参数1"];' + "\n"; - } else { - strSample += ' data["'+i.name+'"] = "参数";' + "\n"; - } - } else { - if(i.isCollection){ - if(i.fieldValue){ - if(i.fieldType =='enum'){ - strSample += ' data["'+i.name+'"] = ["'+ i.fieldValue +'"];'+"\n"; - }else{ - strSample += ' data["'+i.name+'"] = ['+ i.fieldValue +'];'+"\n"; - } - - }else{ - strSample += ' data["'+i.name+'"] = [{"参数1":"value1","参数2":"value2"}];'+"\n"; - } - }else{ - if(i.fieldType =='enum'){ - strSample += ' data["'+i.name+'"] = "'+ i.fieldValue + '";' + "\n"; - }else{ - strSample += ' data["'+i.name+'"] = {"参数1":"value1","参数2":"value2"};'+"\n"; - } - } - } - } - }); - } else if (m.useJsonElementParameter) { - strSample += 'data = {"参数1":"value1","参数2":"value2"};' +"\n"; - } else if (m.useStringParameter) { - strSample += 'data = "参数";'+"\n"; - } - var functionName = "do"; - strSample += "\n var root = \"" + uri + "\";" + "\n"; - strSample += " var options = { " + "\n"; - strSample += " " + functionName + ":{ //服务命名1,自定义"+ "\n"; - strSample += " \"uri\": \"/" + m.path + "\","+ "\n";; - strSample += " \"method\": \""+m.type+"\""+ "\n"; - strSample += " }"+ "\n"; - strSample += " }" + "\n"; - strSample += "var action = new this.Action( root, options);" + "\n\n"; - strSample += "action.invoke({" + "\n"; - strSample += " \"name\": \"" + functionName+ "\", //自定义的服务名" + "\n"; - strSample += " \"parameter\": {" + parameter+ "}, //uri参数 " + "\n"; - strSample += " \"data\": data, //请求的正文, JsonObject " + "\n"; - strSample += " \"success\": function(json){ //服务调用成功时的回调方法,json 是服务返回的数据" + "\n"; - strSample += " //这里进行具体的处理"+ "\n"; - strSample += " }.bind(this),"+ "\n"; - strSample += " \"failure\" : function(xhr){ //服务调用失败时的回调方法,xhr 为 XMLHttpRequest 对象" + "\n"; - strSample += " //这里进行具体的处理"+ "\n"; - strSample += " },"+ "\n"; - strSample += " \"async\" : true, //同步还是异步,默认为true" + "\n"; - strSample += " \"withCredentials\" : true, //是否允许跨域请求,默认为true" + "\n"; - strSample += " \"urlEncode\" : true //uri参数是否需要通过encodeURIComponent函数编码,默认为true" + "\n"; - strSample += "});" - } else { - - } - return strSample; - } - - - -Describe.createSampleO2= function(m) { - var address = window.location.href; - address = address.substring(0,address.indexOf("/jest/")); - var uri = address.substring(address.lastIndexOf("/")+1,address.length); - address = m.path; - address = address.substring(address.indexOf("jaxrs/")+6,address.length); - if (m.pathParameters && m.pathParameters.length > 0) { - $.each(m.pathParameters, function(pi, p) { - address = address.replace('{' + p.name + '}', '替换参数'+pi); - }); - } - if (m.queryParameters && m.queryParameters.length > 0) { - $.each(m.queryParameters, function(pi, p) { - var query = p.name + '=' + '替换参数'+pi; - if (address.indexOf("?") > 0) { - address += '&' + query; - } else { - address += '?' + query; - } - }); - } - - var strSample=""; - if (m.contentType.indexOf('application/json') > -1) { - strSample = "var data = {};" + "\n"; - if (m.ins && m.ins.length > 0) { - $.each(m.ins, function(ii, i) { - switch (i.type) { - default: - if (i.isBaseType) { - if (i.isCollection) { - strSample += ' data["'+i.name+'"] = ["参数1"];' + "\n"; - } else { - strSample += ' data["'+i.name+'"] = "参数";' + "\n"; - } - } else { - if(i.isCollection){ - if(i.fieldValue){ - if(i.fieldType =='enum'){ - strSample += ' data["'+i.name+'"] = ["'+ i.fieldValue +'"];'+"\n"; - }else{ - strSample += ' data["'+i.name+'"] = ['+ i.fieldValue +'];'+"\n"; - } - - }else{ - strSample += ' data["'+i.name+'"] = [{"参数1":"value1","参数2":"value2"}];'+"\n"; - } - }else{ - if(i.fieldType =='enum'){ - - strSample += ' data["'+i.name+'"] = "'+i.fieldValue+'"\n'; - }else{ - strSample += ' data["'+i.name+'"] = {"参数1":"value1","参数2":"value2"};'+"\n"; - } - - } - } - } - }); - } else if (m.useJsonElementParameter) { - strSample += 'data = {"参数1":"value1","参数2":"value2"};' +"\n"; - } else if (m.useStringParameter) { - strSample += 'data = "参数";'+"\n"; - } - - - if(m.type=="POST"){ - strSample += " \n var string = JSON.stringify(data);" + "\n"; - strSample += " var applications = this.Action.applications;"+ "\n"; - strSample += " var serviceRoot = \"" + uri + "\";"+ "\n"; - strSample += " var path = \"" + address + "\";"+ "\n"; ; - strSample += " var resp = applications.postQuery( serviceRoot, path , string);"+ "\n"; - } - if(m.type=="GET"){ - strSample += " \n var applications = this.Action.applications;"+ "\n"; - strSample += " var serviceRoot = \"" + uri + "\";"+ "\n"; - strSample += " var path = \"" + address + "\";"+ "\n"; ; - strSample += " var resp = applications.getQuery( serviceRoot, path );"+ "\n"; - } - if(m.type=="PUT"){ - strSample += " \n var string = JSON.stringify(data)"+ "\n"; - strSample += " var applications = this.Action.applications"+ "\n"; - strSample += " var serviceRoot = \"" + uri + "\";"+ "\n"; - strSample += " var path = \"" + address+ "\";"+ "\n"; ; - strSample += " var resp = applications.putQuery( serviceRoot, path , string);"+ "\n"; - } - if(m.type=="DELETE"){ - strSample += " \n var applications = this.Action.applications;"+ "\n"; - strSample += " var serviceRoot = \" "+ uri + "\";"+ "\n"; - strSample += " var path = \"" + address + "\";"+ "\n"; ; - strSample += " var resp = applications.deleteQuery( serviceRoot, path);"+ "\n"; - } - - strSample += " var json = JSON.parse( resp.toString() );"+ "\n"; - - } else { - - } - return strSample; - } -Describe.createSample= function(m) { - var address = window.location.href; - address = address.substring(0,address.indexOf("/jest/")); - var address = address +"/"+ m.path; - if (m.pathParameters && m.pathParameters.length > 0) { - $.each(m.pathParameters, function(pi, p) { - address = address.replace('{' + p.name + '}', '替换参数'+pi); - }); - } - if (m.queryParameters && m.queryParameters.length > 0) { - $.each(m.queryParameters, function(pi, p) { - var query = p.name + '=' + '替换参数'+pi; - if (address.indexOf("?") > 0) { - address += '&' + query; - } else { - address += '?' + query; - } - }); - } - - var strSample=""; - if (m.contentType.indexOf('application/json') > -1) { - if (m.ins && m.ins.length > 0) { - strSample = "var data = {};" + "\n"; - $.each(m.ins, function(ii, i) { - switch (i.type) { - default: - if (i.isBaseType) { - if (i.isCollection) { - strSample += ' data["'+i.name+'"] = ["参数1"];' + "\n"; - } else { - strSample += ' data["'+i.name+'"] = "参数";' + "\n"; - } - } else { - if(i.isCollection){ - if(i.fieldValue){ - if(i.fieldType =='enum'){ - strSample += ' data["'+i.name+'"] = ["'+ i.fieldValue +'"];'+"\n"; - }else{ - strSample += ' data["'+i.name+'"] = ['+ i.fieldValue +'];'+"\n"; - } - - }else{ - strSample += ' data["'+i.name+'"] = [{"参数1":"value1","参数2":"value2"}];'+"\n"; - } - }else{ - if(i.fieldType =='enum'){ - - strSample += ' data["'+i.name+'"] = "'+i.fieldValue+'"\n'; - }else{ - strSample += ' data["'+i.name+'"] = {"参数1":"value1","参数2":"value2"};'+"\n"; - } - - - } - } - } - }); - } else if (m.useJsonElementParameter) { - strSample += ' data = {"参数1":"value1","参数2":"value2"};' +"\n"; - } else if (m.useStringParameter) { - strSample += ' data = "参数";'+"\n"; - } - - strSample += "\n$.ajax({" + "\n"; - strSample += " type : '"+ m.type + "',\n"; - strSample += " dataType : 'json'" + ",\n"; - strSample += " url : '"+address + "',\n"; - strSample += " headers : {'x-debugger' : true}" + ",\n"; - strSample += " contentType : '"+m.contentType+ "',\n"; - strSample += " xhrFields : {'withCredentials' : true}" + ",\n"; - strSample += " crossDomain : true"+ ",\n"; - - if((m.contentType.indexOf('application/json') > -1) && (!m.useStringParameter)){ - strSample += " data : JSON.stringify(data),\n"; - }else{ - strSample += " data : data"+"\n"; - } - - strSample += "}).always(function(resultJson) {"+"\n"; - strSample += " alert(JSON.stringify(resultJson, null, 4))" +"\n"; - strSample += "});"; - - } else { - strSample = "var formData = new FormData();" + "\n"; - if (m.formParameters && m.formParameters.length > 0) { - $.each(m.formParameters, function(pi, p) { - if (p.type == "File") { - //formData.append(p.name, $('input[type=file]', '#formParameters')[0].files[0]); - strSample += 'formData.append("'+p.name+'", $("input[type=file]")[0].files[0]);' + "\n"; - } else { - strSample += 'formData.append("'+p.name+'", "参数'+pi+'");' + "\n"; - } - }); - } - strSample += "$.ajax({" + "\n"; - strSample += " type : '"+ m.type + "',\n"; - strSample += " url : '"+address + "',\n"; - strSample += " headers : {'x-debugger' : true}" + ",\n"; - //strSample += " contentType : false,\n"; - strSample += " contentType : '"+m.contentType+ "',\n"; - strSample += " processData : false,\n"; - strSample += " xhrFields : {'withCredentials' : true}" + ",\n"; - strSample += " crossDomain : true"+ ",\n"; - strSample += " data : formData"+"\n"; - strSample += "});"; - } - - return strSample; - } -Describe.createSampleCommon= function(m,className) { - debugger; - var address = window.location.href; - address = address.substring(0,address.indexOf("/jest/")); - var root = address.substring(address.lastIndexOf("/")+1,address.length); - - var parameter = ""; - if (m.pathParameters && m.pathParameters.length > 0) { - $.each(m.pathParameters, function(pi, p) { - if(parameter == ""){ - parameter = p.name ; - }else{ - parameter = parameter + "," + p.name; - } - }); - } - var query = ""; - if (m.queryParameters && m.queryParameters.length > 0) { - $.each(m.queryParameters, function(pi, p) { - if (query == "") { - query = "&" + p.name + '=' + '替换参数'+pi; - } else { - query = query + "&"+ p.name + '=' + '替换参数'+pi; - } - }); - } - var strSample=""; - var body = ""; - if (m.contentType.indexOf('application/json') > -1) { - if (m.ins && m.ins.length > 0) { - body = "var data = {};" + "\n"; - $.each(m.ins, function(ii, i) { - switch (i.type) { - default: - if (i.isBaseType) { - if (i.isCollection) { - body += ' data["'+i.name+'"] = ["参数1"];' + "\n"; - } else { - body += ' data["'+i.name+'"] = "参数";' + "\n"; - } - } else { - if(i.isCollection){ - if(i.fieldValue){ - if(i.fieldType =='enum'){ - body += ' data["'+i.name+'"] = ["'+ i.fieldValue +'"];'+"\n"; - body +=(i.fieldSample ? " "+'//注解:'+i.fieldSample +'\n':""); - }else{ - body += ' data["'+i.name+'"] = ['+ i.fieldValue +'];'+"\n"; - body +=(i.fieldSample ? " "+'//注解:'+i.fieldSample +'\n':""); - } - - }else{ - body += ' data["'+i.name+'"] = [{"参数1":"value1","参数2":"value2"}];'+"\n"; - } - }else{ - if(i.fieldType =='enum'){ - body += ' data["'+i.name+'"] = "'+ i.fieldValue +'";'+"\n"; - body +=(i.fieldSample ? " "+'//注解:'+i.fieldSample +'\n':""); - - }else{ - body += ' data["'+i.name+'"] = {"参数1":"value1","参数2":"value2"};'+"\n"; - } - } - } - } - }); - } else if (m.useJsonElementParameter) { - body += ' data = {"参数1":"value1","参数2":"value2"};' +"\n"; - } else if (m.useStringParameter) { - body += ' data = "参数";'+"\n"; - } - if(m.type != "GET" ){ - if( body != ""){ - strSample += body; - } - } - strSample += "var action = this.Actions.load(\"" + root + "\");\n"; - strSample += " action."+ className + "."+m.name+ "(//平台封装好的方法\n"; - if(parameter!=""){ - strSample += " " + parameter +",//uri的参数\n"; - } - if(m.type != "GET" ){ - if( body != ""){ - strSample += " data,//body请求参数\n"; - } - } - strSample += " function( json ){ //服务调用成功的回调函数, json为服务传回的数据\n"; - strSample += " data = json.data; //为变量data赋值\n"; - strSample += " }.bind(this),\n"; - strSample += " function( json ){ //服务调用失败的回调函数, json为服务传回的数据\n"; - strSample += " data = json.data; //为变量data赋值\n"; - strSample += " }.bind(this),\n"; - strSample += " false //同步执行 \n"; - strSample += " );\n"; - - }else{ - var formData = "var formData = new FormData();" + "\n"; - if (m.formParameters && m.formParameters.length > 0) { - $.each(m.formParameters, function(pi, p) { - if (p.type == "File") { - formData += ' formData.append("'+p.name+'", $("input[type=file]")[0].files[0]);' + "\n"; - } else { - formData += ' formData.append("'+p.name+'", "参数值'+pi+'");' + "\n"; - } - }); - } - strSample += formData; - strSample += "var action = this.Actions.load(\"" + root + "\");\n"; - //strSample += "action."+m.name+ "(//平台封装好的方法\n"; - strSample += " action."+ className + "."+m.name+ "(//平台封装好的方法\n"; - strSample += " "+parameter +",//uri的参数\n"; - strSample += " formData"+",//from参数\n"; - strSample += "function( json ){ //服务调用成功的回调函数, json为服务传回的数据\n"; - strSample += " data = json.data; //为变量data赋值\n"; - strSample += "}.bind(this),\n"; - strSample += "function( json ){ //服务调用失败的回调函数, json为服务传回的数据\n"; - strSample += " data = json.data; //为变量data赋值\n"; - strSample += "}.bind(this),\n"; - strSample += "false //同步执行 \n"; - strSample += ");\n" - } - return strSample ; - } - -Describe.prototype = { - "load" : function() { - var str = ''; - $("#menu").html(str); - $.each(json.jaxrs, function(ji, j) { - $.each(j.methods, function(mi, m) { - $('#' + j.name + '_' + m.name).click( - function() { - $('#result').html(''); - var sample = ""; - var txt = '
Method'; - txt += ''; - txt += ''; - txt += ''; - txt += ''; - txt += ''; - txt += '
name:' + m.name + '
path:' + m.path + '
type:' + m.type + '
description:' + m.description + '
'; - txt += ''; - txt += '
 
'; - txt += '
'; - if (m.pathParameters && m.pathParameters.length > 0) { - txt += '
Path Parameter'; - txt += ''; - $.each(m.pathParameters, function(pi, p) { - if (m.name == 'listNext' || m.name == 'listPrev') { - switch (p.name) { - case 'flag': - case 'id': - txt += ''; - break; - case 'count': - txt += ''; - break; - default: - txt += ''; - break - } - } else { - txt += ''; - } - }); - txt += '
' + p.name - + ':' + p.description + '
' + p.name + ':' - + p.description + '
' + p.name + ':' - + p.description + '
' + p.name + ':' - + p.description + '
'; - txt += '
'; - } - - if (m.formParameters && m.formParameters.length > 0) { - txt += '
Form Parameter'; - txt += ''; - $.each(m.formParameters, function(pi, p) { - if (p.type == "File") { - txt += ''; - } else { - txt += ''; - } - }); - txt += '
' - + p.name + ':' + p.description + '
' + p.name + ':' - + p.description + '
'; - txt += '
'; - } - - if (m.queryParameters && m.queryParameters.length > 0) { - txt += '
Query Parameter'; - txt += ''; - $.each(m.queryParameters, function(pi, p) { - txt += ''; - }); - txt += '
' + p.name + ':' + p.description - + '
'; - txt += '
'; - } - - if (m.ins && m.ins.length > 0) { - txt += '
In'; - txt += ''; - $.each(m.ins, function(ii, i) { - if (i.isCollection) { - - txt += '