⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 isc_databinding.js

📁 javascript 很酷的类库
💻 JS
📖 第 1 页 / 共 5 页
字号:
return _2});isc.B._maxIndex=isc.C+22;isc.A=isc.DataSource.getPrototype();isc.A.addGlobalId=true;isc.A.dataFormat="iscServer";isc.A.callbackParam="callback";isc.A.transformResponseToJS=true;isc.A.supportsRequestQueuing=true;isc.A.copyLocalResults=true;isc.A.criteriaPolicy="dropOnShortening";isc.A.showPrompt=true;isc.A=isc.DataSource.getPrototype();isc.B=isc._allFuncs;isc.C=isc.B._maxIndex;isc.D=isc._funcClasses;isc.D[isc.C]=isc.A.Class;isc.A.$41v="Action";isc.A.$2j=[];isc.A.textContentProperty="xmlTextContent";isc.A.$dq="Defaults";isc.A.$dr="Properties";isc.A.$375="name";isc.A.$45y="startsWith";isc.A.$19q="substring";isc.A.$50i="exact";isc.A.$50j="iscServer";isc.B.push(isc.A.init=function(){if(this.serverType=="sql")this.dataFormat="iscServer";if(this.dataFormat=="iscServer"&&(this.serviceNamespace!=null||this.recordXPath!=null))this.dataFormat="xml";this.canQueueRequests=(this.dataFormat=="iscServer"||this.clientOnly);if(this.ID==null&&this.id!=null)this.ID=this.id;if(this.name==null)this.name=this.ID;var _1=isc.DS.get(this.ID);if(_1&&_1.builtinSchema)return _1;var _2=window[this.ID];if(this.addGlobalId&&this.addGlobalId!=isc.$ae&&(!_2||(!isc.isA.ClassObject(_2)&&isc.isA.DataSource(_2)))){isc.ClassFactory.addGlobalID(this)}var _3=this.fields;if(isc.isAn.Array(_3)){var _4={};for(var i=0;i<_3.length;i++){var _6=_3[i];if(_4[_6.name]!=null){this.logWarn("field.name collision: first field: "+this.echo(_4[_6.name])+", discarded field: "+this.echo(_6));continue}_4[_6.name]=_6}this.fields=_4}if(this.dataSourceType==isc.DataSource.VIEW)this.initViewSources();isc.DataSource.registerDataSource(this)},isc.A.destroy=function(){var _1=this.ID,_2=isc.DS;if(_1&&this==window[_1])window[_1]=null;if(_2._dataSources[_1]==this)_2._dataSources[_1]=null;if(_2.$54v[_1]==this)_2.$54v[_1]=null;if(_2.$54w[_1]==this)_2.$54w[_1]=null},isc.A.getResultSet=function(_1){var _2=isc.ClassFactory.getClass(this.resultSetClass||isc.ResultSet);if(!isc.isA.Class(_2)){this.logWarn("getResultSet(): Unrecognized 'resultSetClass' property:"+_2+", returning a standard isc.ResultSet.");_2=isc.ResultSet}return _2.create(_1,{$31k:true})},isc.A.dataChanged=function(dsResponse,dsRequest){},isc.A.updateCaches=function(_1,_2){var _3=_1.data,_4=_1.invalidateCache;if(!_3&&!_4){this.logWarn("Empty results returned on '"+_2.operationType+"' on dataSource '"+_2.dataSource+"', unable to update resultSet(s) on DataSource "+this.ID+".  Return affected records to ensure cache consistency.");return}this.dataChanged(_1,_2)},isc.A.getLegalChildTags=function(){var _1=this.getFieldNames(),_2=[];for(var i=0;i<_1.length;i++){if(this.fieldIsComplexType(_1[i]))_2.add(_1[i])}return _2},isc.A.getOperationBinding=function(_1,_2){if(_1==null||this.operationBindings==null)return this;if(isc.isAn.Object(_1)){var _3=_1;_1=_3.operationType;_2=_3.operationId}var _4;if(_2){var _5=this.operationBindings.find("operationId",_2);if(_5)return _5}if(_1){var _5=this.operationBindings.find("operationType",_1);if(_5)return _5}return this},isc.A.getDataFormat=function(_1,_2){return this.getOperationBinding(_1,_2).dataFormat||this.dataFormat},isc.A.transformRequest=function(_1){return _1.data},isc.A.serializeFields=function(_1,_2){if(!_1)_1=_2.data;if(!_1)return _1;if(isc.DS.isSimpleTypeValue(_1))return _1;if(isc.isAn.Array(_1)){var _3=[];for(var i=0;i<_1.length;i++){_3[i]=this.serializeFields(_1[i],_2)}return _3}_1=isc.addProperties({},_1);var _5=this.getFields();for(var _6 in _5){var _7=_5[_6];if(isc.isA.Date(_1[_6])&&isc.SimpleType.getBaseType(_7.type)=="date"&&!isc.SimpleType.inheritsFrom(_7.type,"datetime")){_1[_6].logicalDate=true}}return _1},isc.A.getDataProtocol=function(_1){var _2=this.getOperationBinding(_1),_3=this.getWebService(_1);return(_2.dataProtocol!=null?_2.dataProtocol:isc.isA.WebService(_3)?"soap":this.dataProtocol||"getParams")},isc.A.getServiceInputs=function(_1){var _2=this.getOperationBinding(_1),_3=this.getWebService(_1),_4=this.getWSOperation(_1);var _5=_2.defaultCriteria||this.defaultCriteria;if(_5&&_1.operationType=="fetch"){_1.data=isc.addProperties({},_5,_1.data)}_1.originalData=_1.data;_1.data=this.transformRequest(_1);if(isc.isA.WebService(_3)){if(_1.wsOperation==null&&isc.isAn.Object(_4)){_1.wsOperation=_4.name}this.logInfo("web service: "+_3+", wsOperation: "+this.echoLeaf(_4),"xmlBinding")}var _6=this.getDataURL(_1);_6=_1.actionURL||_1.dataURL||_6;var _7=this.getDataProtocol(_1);if(_7=="getParams"||_7=="postParams"){var _8=_1.data,_9=_2.defaultParams||this.defaultParams;if(_9)_8=isc.addProperties({},_9,_8);_8=this.serializeFields(_8,_1);return{actionURL:_6,httpMethod:_1.httpMethod||(_7=="getParams"?"GET":"POST"),params:_8}}var _10={actionURL:_6,httpMethod:"POST"};if(_7=="postMessage"){_10.data=(_1.data||"").toString()}if(_7=="postXML"||_7=="soap"){var _11=_10.data=this.getXMLRequestBody(_1);_10.contentType=_1.contentType||"text/xml";this.logDebug("XML post requestBody is: "+_11,"xmlBinding")}if(_7=="soap"){var _12=this.$du(_2.soapAction,_4.soapAction);if(_12!=null){if(isc.isAn.emptyString(_12))_12='""';_10.httpHeaders=isc.addProperties({SOAPAction:_12},_1.httpHeaders)}}this.logDebug("serviceInputs are: "+this.echo(_10),"xmlBinding");return _10},isc.A.$50e=function(_1,_2,_3){var _4=this.getClientOnlyResult(_3),_5=_3.$374;this.$38b(_2,_4,_5,_1,_3)},isc.A.$38a=function(_1,_2,_3){var _4={data:_2,startRow:0,endRow:0,totalRows:0,status:0};var _5=_3.$374;this.$38b(_2,_4,_5,_1,_3)},isc.A.$377=function(_1,_2,_3){var _4=_3.$374,_5=this.getOperationBinding(_4).recordXPath;if(_1.$38c&&this.logIsDebugEnabled("xmlBinding")){this.logDebug("Raw response data: "+isc.Comm.serialize(_2,true),"xmlBinding")}var _6=_2;if(this.recordXPath){_2=isc.xml.selectObjects(_2,this.recordXPath);this.logInfo("JSON recordXPath: '"+this.recordXPath+"', selected: "+this.echoLeaf(_2),"xmlBinding")}_2=this.recordsFromObjects(_2);if(this.logIsDebugEnabled("xmlBinding")){this.logDebug("Validated dsResponse.data: "+isc.Comm.serialize(_2,true),"xmlBinding")}var _7={data:_2,startRow:_4.startRow||0,status:0};_7.endRow=_7.startRow+Math.max(0,_2.length);_7.totalRows=Math.max(_7.endRow,_2.length);this.$38b(_6,_7,_4,_1,_3)},isc.A.$379=function(rpcResponse,jsonText,rpcRequest){var evalText=jsonText;if(rpcRequest.transport!="scriptInclude"){var re;if(this.jsonPrefix){re=new RegExp(/^\s*/);evalText=evalText.replace(re,"");if(evalText.startsWith(this.jsonPrefix)){evalText=evalText.substring(this.jsonPrefix.length)}else{this.logInfo("DataSource specifies jsonPrefix, but not present in "+"response returned from server. Processing response anyway.")}}if(this.jsonSuffix){re=new RegExp(/\s*$/)evalText=evalText.replace(re,"");if(evalText.endsWith(this.jsonSuffix)){evalText=evalText.substring(0,(evalText.length-this.jsonSuffix.length))}else{this.logInfo("DataSource specifies jsonSuffix, but not present in "+"response returned from server. Processing response anyway.")}}}if(evalText.match(/^\s*\{/)){evalText="var evalText = "+evalText+";evalText;"}try{var jsonObjects=eval(evalText)}catch(e){this.logWarn("Error evaluating JSON: "+e.toString()+", JSON text:\r"+jsonText);return}if(jsonObjects==null){this.logWarn("Evaluating JSON reply resulted in empty value. JSON text:\r"+this.echo(jsonText));return}rpcResponse.$38c=true;this.$377(rpcResponse,jsonObjects,rpcRequest)},isc.A.recordsFromObjects=function(_1){if(!isc.isAn.Array(_1))_1=[_1];for(var i=0;i<_1.length;i++){_1[i]=this.validateJSONRecord(_1[i])}return _1},isc.A.validateJSONRecord=function(_1){var _2=this.getFieldNames(),_3={};for(var i=0;i<_2.length;i++){var _5=_2[i],_6=this.getField(_5),_7;if(_6.valueXPath){_7=isc.xml.selectObjects(_1,_6.valueXPath,true)}else{_7=_1[_5]}if(_6.getFieldValue){if(!isc.isA.Function(_6.getFieldValue)){isc.Func.replaceWithMethod(_6,"getFieldValue","record,value,field,fieldName")}_7=_6.getFieldValue(_1,_7,_6,_5)}var _8;if(_7!=_8){_3[_5]=this.validateFieldValue(_6,_7)}}if(this.dropExtraFields)return _3;for(var i=0;i<_2.length;i++){var _5=_2[i];_1[_5]=_3[_5]}return _1},isc.A.getMessageSerializer=function(_1,_2){var _3=this.getOperationBinding(_1,_2);if(_3.wsOperation){var _4=this.getWebService(_1,_2);return _4.getMessageSerializer(_3.wsOperation)}return this},isc.A.getXMLRequestBody=function(_1,_2){if(isc.$cv)arguments.$cw=this;var _3=isc.SB.create(),_4=this.getDataProtocol(_1);if(_4=="soap"){_3.append(this.getSoapStart(_1),"\r");_3.append(this.getSoapBody(_1,_2));_3.append("\r",this.getSoapEnd(_1))}else{if(this.messageStyle=="template"){_3.append(this.$38d(_1))}else{var _5=this.getMessageSerializer(_1);_3.append(this.getXMLRequestBodyPart(_1,_1.data,_5,_2))}}if(this.logIsDebugEnabled("xmlComm")){this.logDebug("outbound XML message: "+_3,"xmlComm")}return _3.toString()},isc.A.$38d=function(_1){var _2=isc.SB.create(),_3=this.soapBodyTemplate,_4;_4=_3.evalDynamicString(this,_1);return _4},isc.A.getSchemaSet=function(){return isc.SchemaSet.get(this.schemaNamespace)},isc.A.hasWSDLService=function(_1){return isc.isA.WebService(this.getWebService(_1))},isc.A.getWebService=function(_1){var _2=this.getOperationBinding(_1),_3=(_1?_1.serviceNamespace:null)||_2.serviceNamespace||this.serviceNamespace;var _4=isc.WebService.get(_3);if(_3!=null&&_4==null){this.logWarn("No WebService definition has been loaded for serviceNamespace: "+_3+this.getStackTrace())}return _4||this},isc.A.getWSOperation=function(_1){var _2=this.getOperationBinding(_1),_3=(isc.isAn.Object(_1)?_1.wsOperation:null)||_2.wsOperation||this.wsOperation,_4=this.getWebService(_1);if(_3!=null&&isc.isA.WebService(_4)){return _4.getOperation(_3)}return this},isc.A.getDataURL=function(_1){var _2=this.getOperationBinding(_1);if(_2!=this&&_2.dataURL)return _2.dataURL;if(this.dataURL!=null)return this.dataURL;if(this.hasWSDLService(_1)){var _3=this.getWebService(_1);return _3.getDataURL(this.getWSOperation(_1).name)}return this.dataURL},isc.A.getGlobalNamespaces=function(_1){var _2=this.getWebService(_1),_3=this.globalNamespaces;if(_2&&_2.globalNamespaces){_3=isc.addProperties({},_3,_2.globalNamespaces)}return _3},isc.A.getSoapStart=function(_1){var _2=this.getWebService(_1);if(_2.getSoapStart)return _2.getSoapStart(_1);return isc.SB.concat(isc.DataSource.$37t,isc.xml.$37l(this.getGlobalNamespaces(_1),null,"         "),">",isc.DataSource.$37u,this.getSoapHeader(_1),isc.DataSource.$51y)},isc.A.getSoapHeader=function(_1){var _2=this.getWebService(_1);if(_2.getSoapHeader)return _2.getSoapHeader(_1);var _3=_1.headerData||_2.getHeaderData(_1);if(!_3)return;this.logDebug("headerData is: "+this.echo(_3),"xmlBinding");var _4=_2.getInputHeaderSchema(this.getWSOperation(_1))||isc.emptyObject;var _5="",_6=_1.useFlatHeaderFields;for(var _7 in _3){var _8=_4[_7];if(_8!=null){if(isc.isA.DataSource(_8)){_5+=_8.xmlSerialize(_3[_7],{useFlatFields:_6})}else{_5+="\r     "+this.$38g(_7,_8,_3[_7],_8.partNamespace)}}else{this.logWarn("headerData passed for SOAP header partName: "+_7+", no schema available, not outputting")}}return _5},isc.A.getSoapBody=function(_1,_2){var _3=isc.SB.create(),_4=this.getWebService(_1),_5=_4.getSoapStyle(_1),_6=this.getWSOperation(_1),_2=isc.addProperties({nsPrefixes:isc.addProperties({},this.xmlNamespaces)},_2),_7=_2.generateResponse?_4.getResponseMessage(_6.name):_4.getRequestMessage(_6.name),_8=_4.getBodyPartNames(_6.name,_2.generateResponse);isc.Comm.omitXSI=_6.inputEncoding!="encoded";var _9=isc.Comm.xmlSchemaMode;isc.Comm.xmlSchemaMode=true;var _10="        ";if(_5=="rpc"){_3.append("\n",_10,isc.Comm.$36u(_6.name,null,_6.inputNamespace,"opNS",true),">");_10+="    "}this.logInfo("soap:body parts in use: "+_8,"xmlSerialize");for(var i=0;i<_8.length;i++){var _12=_8[i],_13=_7.getField(_12);var _14=_8.length<2&&_5=="document"?_1.data:_1.data[_12];var _15=this.getSchema(_13.type,_13.xsElementRef?"element":null);var _16;if(isc.isA.DataSource(_15)){this.logInfo("soap:body part '"+_12+"' is complex type with schema: "+_15,"xmlSerialize");_16=this.getXMLRequestBodyPart(_1,_14,_15,_2,_10)}else{this.logInfo("soap:body part '"+_12+" is of simple type '"+_13.type+"'","xmlSerialize");_3.append("\r",_10);_16=this.$38g(_12,_13,_14,_13.partNamespace,_2)}_3.append(_16)}if(_5=="rpc"){_3.append("\n","        ",isc.Comm.$36v(_6.name,_6.inputNamespace,"opNS"))}isc.Comm.omitXSI=null;isc.Comm.xmlSchemaMode=_9;return isc.SB.concat("    ",isc.DS.$37v,this.outputNSPrefixes(_2.nsPrefixes,"        "),">",_3.toString(),"\r    ",isc.DS.$51z)},isc.A.getSoapEnd=function(_1){var _2=this.getWebService(_1);if(_2.getSoapEnd)return _2.getSoapEnd(_1);return isc.DataSource.$37w},isc.A.getSoapStyle=function(_1){if(!this.hasWSDLService(_1))return"document";return this.getWebService(_1).getSoapStyle(this.getWSOperation(_1).name)},isc.A.getXMLRequestBodyPart=function(_1,_2,_3,_4,_5){_4=isc.addProperties({soapStyle:this.getSoapStyle(_1)},_4);var _6=this.getOperationBinding(_1);_4.flatData=this.$du(_1.useFlatFields,_6.useFlatFields,this.useFlatFields);_4.recursiveFlatFields=this.$du(_1.recursiveFlatFields,_6.recursiveFlatFields,this.recursiveFlatFields);_4.textContentProperty=this.$du(_1.textContentProperty,_6.textContentProperty);_4.dsRequest=_1;_4.startRowTag=_6.startRowTag||this.startRowTag;_4.endRowTag=_6.endRowTag||this.endRowTag;return _3.xmlSerialize(_1.data,_4,_5)},isc.A.xmlSerialize=function(_1,_2,_3,_4){if(!_2)_2={};if(_2.useFlatFields)_2.flatData=true;var _5=this.getSchemaSet(),_6=(_2.qualifyAll==null);if(_5&&_5.qualifyAll){_2.qualifyAll=true}var _7;if(_2.nsPrefixes==null){_2.nsPrefixes=isc.addProperties({},this.xmlNamespaces);_7=true}isc.Comm.xmlSchemaMode=true;var _8;if(isc.Comm.omitXSI==null){_8=isc.Comm.omitXSI=true}var _9=this.$ew(_1,_2,_3,_4,_7);if(_6)_2.qualifyAll=null;var _10=isc.Comm.xmlSchemaMode;isc.Comm.xmlSchemaMode=_10;if(_8)isc.Comm.omitXSI=null;return _9},isc.A.$ew=function(_1,_2,_3,_4,_5){if(isc.$cv)arguments.$cw=this;if(this.logIsDebugEnabled("xmlSerialize")){this.logWarn("schema: "+this+" serializing: "+this.echo(_1)+" with flags: "+this.echo(_2))}var _6=this.mustQualify||_2.qualifyAll;var _7;if(_1!=null&&(_1._constructor||isc.isAn.Instance(_1))){var _7=isc.isAn.Instance(_1)?_1.Class:_1._constructor}if(isc.isAn.Instance(_1))_1=_1.getSerializeableFields();if(isc.DS.isSimpleTypeValue(_1)){this.logDebug("simple type value: "+this.echoLeaf(_1)+" passed to xmlSerialize on "+this,"xmlSerialize");return isc.Comm.$ew(_4||this.tagName||this.ID,_1)}if(isc.isAn.Array(_1)&&!this.canBeArrayValued)return this.map("xmlSerialize",_1,_2,_3).join("\n");var _8=isc.SB.create(),_4=_4||this.tagName||this.ID,_3=_3||"";_8.append("\r",_3);var _9;if(_6){_9=(this.isA("XSComplexType")?_2.parentSchemaNamespace:null)||this.schemaNamespace}_8.append(isc.Comm.$36u(_4,this.ID,_9,_2.nsPrefixes,true));_1=this.serializeAttributes(_1,_8,_2);if(_7&&_4!=_7){_8.append(" constructor=\"",_7,"\"")}var _10;if(_1!=null){_10=this.xmlSerializeFields(_1,_2,_3+"    ")}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -