void CRUAuditRefreshTaskExecutor::ResetObjectsAvailable()
{
        CRUMVList &mvList = GetRefreshTask()->GetMVList();
	DSListPosition pos = mvList.GetHeadPosition();
	while (NULL != pos)
	{
		CRUMV *pMV = mvList.GetNext(pos);
                BOOL  mvUpdated = FALSE;
		
		// if hasn't been set to initialized, initialize it
                if( CDDObject::eINITIALIZED != pMV->GetMVStatus() )
                {
			pMV->SetMVStatus(CDDObject::eINITIALIZED);
                        mvUpdated = TRUE;
                }

                if (mvUpdated)
                {
			pMV->SaveMetadata();
                }

	}        

        if (TRUE == isPopindex_ && 0 < numOfIndexes_)
	{                
		// Turn all indexes to available state
		ExecuteIndexStatmenents(*pAuditAvailableIndeXdynamicContainer_,
					IDS_RU_INDEXSTATUS_FAILED);
	}	
}
void CRUAuditRefreshTaskExecutor::SetObjectsUnavailable()
{
	if (TRUE == isPopindex_ && 0 < numOfIndexes_)
	{
		// Turn all indexes to unavailable state
		ExecuteIndexStatmenents(*pAuditUnavailableIndeXdynamicContainer_,
					IDS_RU_INDEXSTATUS_FAILED);
	} 

        // first turn the audit flag ON for the MV table
        // and set the MV to unavailable
	CRUMVList &mvList = GetRefreshTask()->GetMVList();
	DSListPosition pos = mvList.GetHeadPosition();
	while (NULL != pos)
	{
		CRUMV *pMV = mvList.GetNext(pos);

		// Alter table audit uses "ALTER TABLE" syntax
		// and it cannot be performed if there is a DDL lock.
		// Due to the transaction protection , for any other transaction
		// the ddl locks will preserve continuity.
		pMV->ReleaseDDLLock();
		pMV->SetMVTableAudit(TRUE);               
		pMV->SaveMetadata();
		pMV->CreateDDLLock();
		
		// if hasn't been set to initialized, initialize it
                if( CDDObject::eINITIALIZED != pMV->GetMVStatus() )
                {
			pMV->SetMVStatus(CDDObject::eUNAVAILABLE);
			pMV->SaveMetadata();                
                }
	}        

        // Since the mv ddl lock was released and recreated, the popindex
        // sql statements need to be recomposed
        if( TRUE == isPopindex_ && 0 < numOfIndexes_ )
        {
        	ComposeIndexesSql();
        }
}
void CRUUnAuditRefreshTaskExecutor::ResetObjectsAvailable()
{
	CRUMVList &mvList = GetRefreshTask()->GetMVList();
	DSListPosition pos = mvList.GetHeadPosition();
	while (NULL != pos)
	{
		CRUMV *pMV = mvList.GetNext(pos);

		if (CDDObject::eNO_AUDIT != pMV->GetAuditType())
		{
			// Alter table audit uses "ALTER TABLE" syntax
			// and it cannot be performed if there is a DDL lock.
			// Due to the transaction protection , for any other transaction
			// the ddl locks will preserve continuity.
			pMV->ReleaseDDLLock();
			pMV->SetMVTableAudit(TRUE);
			pMV->SaveMetadata();
			pMV->CreateDDLLock();
		}

		RUASSERT(CDDObject::eUNAVAILABLE == pMV->GetMVStatus());

		pMV->SetMVStatus(CDDObject::eINITIALIZED);

		pMV->SaveMetadata();
	}

	if (TRUE == isPopindex_ && 0 < numOfIndexes_)
	{
		// must recompose since DDL locks were released/created        
		ComposeIndexesSql();

		// Turn all indexes to available state
		ExecuteIndexStatmenents(*pUnAuditAvailableIndeXdynamicContainer_,
								IDS_RU_INDEXSTATUS_FAILED);
	}
}