/**************************************************************************************************************************** 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. *****************************************************************************************************************************/ function C_QanExecPlan( oLogDoc ) { this.m_oLogDoc = oLogDoc; this.m_aAllTreeNodesByName = []; this.m_aAllTreeNodesByID = []; this.m_iNodeIdGen = 1; }; C_QanExecPlan.prototype.F_Init = function() { if (!this.m_oLogDoc) this.m_aPlanRoots = this.f_initSubtree( null ); else { var v_nRootSubtreeNode = this.m_oLogDoc.F_GetAsXMLDoc().documentElement; var v_nCoordinationPlannerMainCall = v_nRootSubtreeNode.selectSingleNode( "QFSSession/QFSQuery[@_provider='CoordinationPlanner']" ); if( !v_nCoordinationPlannerMainCall ) return; this.m_aPlanRoots = this.f_initSubtree( v_nCoordinationPlannerMainCall ); } }; C_QanExecPlan.prototype.F_GetLogDoc = function() { return this.m_oLogDoc; } C_QanExecPlan.prototype.f_execCommandCondition = function() { return "@method='QueryExecute1' or @method='QueryExecute2' or @method='QueryValidate1' or @method='QueryValidate2'"; } C_QanExecPlan.prototype.f_initSubtree = function( nSubtreeNode, oNestingParentPlanNode ) { if (nSubtreeNode) { var v_nlExecutionMethods = nSubtreeNode.selectNodes( "QFSQuery["+ this.f_execCommandCondition()+ "]" ); if( v_nlExecutionMethods.length == 0 ) return; var v_nlFullExecPlanMethod = v_nlExecutionMethods[v_nlExecutionMethods.length - 1]; var v_nlProviderQueries = v_nlFullExecPlanMethod.selectNodes( "parm[@type='input']/*/querySet/queries/providerQuery" ); var v_aRootPlanNodes = this.f_createExecutionPlan( v_nlProviderQueries, null, oNestingParentPlanNode ); for( var i = 0; i < v_nlExecutionMethods.length; ++i ) { var v_nOutmostOperation = v_nlExecutionMethods[i].selectSingleNode("parm[@type='input']/*/querySet/queries/providerQuery"); if( !v_nOutmostOperation ) continue; var v_sOutmostOperationName = v_nOutmostOperation.getAttribute("name"); var v_oPlanNode = this.m_aAllTreeNodesByName[ v_sOutmostOperationName ]; if( !v_oPlanNode ) continue; var v_nQueryFeedbackResult = v_nlExecutionMethods[i].selectSingleNode("parm[@type='output']/response/queryFeedbackResult"); v_oPlanNode.F_SetQueryFeedback( v_nQueryFeedbackResult ); var v_nNestedNodeTree = v_nlExecutionMethods[i].selectSingleNode("QFSQuery[@_provider='CoordinationPlanner']"); if( !v_nNestedNodeTree ) continue; this.f_initSubtree( v_nNestedNodeTree, v_oPlanNode ); } } return v_aRootPlanNodes; }; C_QanExecPlan.prototype.f_createExecutionPlan = function( nlProviderQueries, oParentPlanNode, oNestedCallsParentPlanNode ) { var v_aPlanNodes = []; for( var i = 0; i < nlProviderQueries.length; ++i ) { v_oPlanNode = new C_QanExecPlanNode( this.m_iNodeIdGen, nlProviderQueries[i], oParentPlanNode, oNestedCallsParentPlanNode ); v_aPlanNodes.push( v_oPlanNode ); this.m_aAllTreeNodesByName[ v_oPlanNode.F_GetName() ] = v_oPlanNode; this.m_aAllTreeNodesByID[ this.m_iNodeIdGen ] = v_oPlanNode; this.m_iNodeIdGen++; var v_nlChildProviderQueries = nlProviderQueries[i].selectNodes( "source/querySet/queries/providerQuery|source/providerQuery" ); this.f_createExecutionPlan( v_nlChildProviderQueries, v_oPlanNode, oNestedCallsParentPlanNode ); } return v_aPlanNodes; } C_QanExecPlan.prototype.F_GetPlanRootNodes = function() { return this.m_aPlanRoots; } C_QanExecPlan.prototype.F_GetPlanNodeByID = function( iID ) { return this.m_aAllTreeNodesByID[iID]; }