/**************************************************************************************************************************** Licensed Materials - Property of IBM BI and PM: QFW © Copyright IBM Corp. 2005, 2010 US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. *****************************************************************************************************************************/ var G_QanReportValidator = {}; G_QanReportValidator.m_sSeverity = "information"; G_QanReportValidator.F_Validate = function( v_nReport ) { var v_sReport2Validate = v_nReport.replace( /\/, "" ); this.m_oRequest = new C_ValidationRequest(this, v_sReport2Validate, this.m_sSeverity); D_Progress.F_SendRequest( this.m_oRequest, null, "VALIDATING" ); }; G_QanReportValidator.F_ValidateForLogging = function( v_nReport ) { var v_sReport2Log = v_nReport.replace( /\/, "" ); this.m_oRequest = new C_QanValidationRequest(this, v_sReport2Log, this.m_sSeverity); D_Progress.F_SendRequest( this.m_oRequest, null, "VALIDATING" ); }; G_QanReportValidator.F_Abort = function() { if ( this.m_oRequest ) { this.m_oRequest.F_Abort(); } }; G_QanReportValidator.F_Request_OnComplete = function(v_oRequest) { delete this.m_oRequest; var v_oError = v_oRequest.F_GetError(); if (v_oError) { alert( "Validation request return an error" ); return; } this.m_nDefects = v_oRequest.F_GetDefects(); var v_nValidateResponse = v_oRequest.F_GetQueryInfo(); var v_nProperty; var v_nlQFSLogging = v_nValidateResponse.selectNodes(".//property[@name='QFSLog']"); if( v_nlQFSLogging.length != 0 ) { v_nProperty = v_nlQFSLogging; v_sItemName = "QFSLog"; } else { if (this.m_nDefects.xml != null) { var v_xmlDoc = U_XML.F_LoadString( D_XmlError, this.m_nDefects.xml, false, true ); var v_message = v_xmlDoc.selectSingleNode("./defects/queryProblems/message"); if (v_message != null) var v_msgTitle = v_message.getAttribute("title"); if (v_msgTitle != "XQE Message") { v_message = v_xmlDoc.selectSingleNode("./defects/layoutProblems/messages/message"); if (v_message != null) var v_msgTitle = v_message.getAttribute("title"); alert(v_msgTitle); return; } } var v_nlQFSExecPlan = v_nValidateResponse.selectNodes(".//property[@name='QFExecutionPlan']"); v_nProperty = v_nlQFSLogging; v_sItemName = "XQE"; } G_QanReportValidator.F_GetQFSFeedbackProperty( v_nProperty, v_sItemName ); }; G_QanReportValidator.F_GetQFSLogging = function( v_nQFSLogProperty ) { this.f_showQFSFeedbackItem(v_oRequest, "ExecutionPlan"); } G_QanReportValidator.F_GetQFSFeedbackProperty = function( v_nQFSFeedbackProperties, v_sItemName ) { var v_nQFSProperty = v_nQFSFeedbackProperties; var v_oFileRequest = new C_MultiFileRequest( new C_RequestListenerRedirect( this, "f_showQFSFeedbackItem" ), [ "QFLogFormatting.xsl" ] ); v_oFileRequest.nQFSProperty = v_nQFSProperty; v_oFileRequest.sItemName = v_sItemName; D_Progress.F_SendRequest( v_oFileRequest, null, "Loading", 30 ); }; G_QanReportValidator.f_loadQFSFeedbackItems = function(v_oRequest) { var nQFSProperty = v_oRequest.nQFSProperty; var v_sItemName = v_oRequest.sItemName; { var v_asXML = []; v_asXML[0] = ""; if (nQFSProperty.length == 0) { var v_oLogDoc = new C_QanLogDoc( '' ); var v_iLogId = G_QanApp.F_AddLogDoc( v_oLogDoc ); var v_sQueryNames = "Query1.0"; v_asXML.push( "" ); v_asXML.push( "" ); } for( var iQuery = 0; iQuery < nQFSProperty.length; ++iQuery ) { var v_nQFSPropertyItem = nQFSProperty.item(iQuery); if( v_sItemName == "ExecutionPlan" ) { v_asXML.push( "" ); v_asXML.push( v_nQFSPropertyItem.childNodes[0].xml ); } else { var v_oLogDoc = new C_QanLogDoc( v_nQFSPropertyItem.childNodes[0].text ) var v_iLogId = G_QanApp.F_AddLogDoc( v_oLogDoc ); var v_sQueryNames = v_oLogDoc.F_GetRootQRDNames(); v_asXML.push( "" ); } v_asXML.push( "" ); } v_asXML.push( "" ); v_docXML = U_XML.F_LoadString( D_XmlError, v_asXML.join("\n\r") ); if ( !v_docXML || !v_docXML.documentElement ) return; } return v_docXML; } G_QanReportValidator.f_showQFSFeedbackItem = function(v_oRequest) { var v_sText = v_oRequest.F_GetFileContents()[ "QFLogFormatting.xsl" ]; var v_docXSL = U_XML.F_LoadString( D_XmlError, v_sText ); if ( !v_docXSL || !v_docXSL.documentElement ) return; G_QanApp.F_SetXslDoc( v_docXSL ); v_docXML = G_QanReportValidator.f_loadQFSFeedbackItems(v_oRequest); var v_frame = document.createElement( "iframe" ); v_frame.name = "idLoggingView"; v_frame.id = "idLoggingView"; v_frame.width = "100%"; v_frame.height = "100%"; document.body.insertBefore( v_frame, document.body.firstChild ); var v_oWin = v_frame.contentWindow; var v_sPlanHTML = v_docXML.transformNode( v_docXSL ); var v_sEntryFunctionCall; if( v_sItemName == "ExecutionPlan" ) v_sEntryFunctionCall = "openExecutionPlan( document.body )"; else v_sEntryFunctionCall = "showExecutionTree( document.body )"; v_sPlanHTML = v_sPlanHTML.replace( /\ 0 ) { alert( "Report has validation errors" ); return; } alert( "Report is valid" ); }; // ******************************************************************************************************** // QAN Validation Request: introduced to work around the obfuscation issue of C_BusRequest // function C_QanValidationRequest( v_oListener, v_sSpec, v_sSeverityOption, v_bInteractiveDataOption ) { this.m_bQIsPrompting = false; this.m_sQPromptReport = ""; this.m_oQListener = v_oListener; this.m_bQServerPrompting = true; this.m_aQNamespaces = []; this.F_QAddNamespace( C_QanValidationRequest.k_sBIBusNamespaceDecl ); this.F_QAddNamespace( C_QanValidationRequest.k_sBIBusRNSNamespaceDecl ); this.F_ConstructBaseClass( v_oListener, v_sSpec, v_sSeverityOption, v_bInteractiveDataOption ); }; C_QanValidationRequest.k_sBIBusNamespace = "http://developer.cognos.com/schemas/bibus/3"; C_QanValidationRequest.k_sBIBusNamespaceDecl = "xmlns:bus='" + C_QanValidationRequest.k_sBIBusNamespace + "/'"; C_QanValidationRequest.k_sBIBusRNSNamespaceDecl = "xmlns:rns1='http://developer.cognos.com/schemas/reportService/1'"; C_QanValidationRequest.F_Extends( C_ValidationRequest ); C_QanValidationRequest.prototype.F_SetNoServerPrompting = function() { this.m_bQServerPrompting = false; }; C_QanValidationRequest.prototype.F_QAddNamespace = function( v_sNamespace ) { this.m_aQNamespaces.push( v_sNamespace ); }; C_QanValidationRequest.prototype.F_IsReadyToProcess=function() { if(!C_QanValidationRequest.superClass.F_IsReadyToProcess.call(this)) {return false;} var v_sResponseText = this.F_GetResponseText(); var v_docResponse = U_XML.F_LoadString( null, v_sResponseText, false, true ); this.m_docQResponse = v_docResponse; this.m_docQResponse.setProperty( "SelectionNamespaces", "xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' " + this.m_aQNamespaces.join( " " ) ); if (this.m_bQServerPrompting && this.m_oQListener && G_BusServer.F_RequiresServerPrompting(v_docResponse)) { this.m_bQIsPrompting = true; if (G_BusServer.F_DoPrompting(this, v_docResponse, this.m_sQPromptReport)) { // Depending on what happens after prompting, either the request will be completed (failed) // or it will be re-executed delete this.m_docQResponse; return false; } this.m_bQIsPrompting = false; this.F_SetNewErrorRes( "IDS_CCHL_INITIATE_SERVERPROMTING_FAILED" ); return true; } return true; }