//--------------------------------------------------------------------------//
//	CRURefreshTaskExecutor::VerifyForceTblListCorrectness()
//
// Check that the user did not refered to a un-existing base table
//--------------------------------------------------------------------------//
void CRURefreshTaskExecutor::VerifyForceTblListCorrectness()
{
	const CRUMVForceOptions &forceOption =
		*GetRefreshTask()->GetRootMV().GetMVForceOption();

	const CRUTableForceOptionsList &tblList = forceOption.GetTableForceList();

	DSListPosition pos = tblList.GetHeadPosition();

	while (NULL != pos) 
	{
		CRUTableForceOptions* forceOpt = tblList.GetNext(pos);
		
		CRUTbl *pTbl = GetRefreshTask()->GetRootMV().GetUsedTableByName(forceOpt->GetFullName());

		if(NULL == pTbl)
		{
			CRUException ex;
			ex.SetError(IDS_RU_FORCE_FILE_TABLE_NOT_EXISTS);
			ex.AddArgument(GetRefreshTask()->GetRootMV().GetFullName());
			ex.AddArgument(forceOpt->GetFullName());
			throw ex;
		}
	}
}
CRUTableForceOptions* CRURefreshTaskExecutor::GetForceOptionForTable(const CDSString &name) 
{
	CRUMV &rootMV = GetRefreshTask()->GetRootMV();

	const CRUMVForceOptions* pForceOption = rootMV.GetMVForceOption();

	if (NULL == pForceOption)
	{
		return NULL;
	}

	const CRUTableForceOptionsList &tblList = pForceOption->GetTableForceList();

	DSListPosition pos = tblList.GetHeadPosition();

	while (NULL != pos) 
	{
		CRUTableForceOptions* forceOpt = tblList.GetNext(pos);
		if (name == forceOpt->GetFullName())
		{
			return forceOpt;
		}
	}
	return NULL;
}
CRUForceOptions::MdamOptions CRUMVForceOptions::GetForceMdamOptionForTable(const CDSString& tableName) const
{
	DSListPosition pos = pTablesList_->GetHeadPosition();
	while (NULL != pos) 
	{
		CRUTableForceOptions* aTable = pTablesList_-> GetNext(pos);
		if (tableName == aTable->GetFullName())
		{
			return aTable->GetMdamOptions();
		}
	}
	return CRUForceOptions::MDAM_NO_FORCE;
}
CRUTableForceOptions::CRUTableForceOptions(const CRUTableForceOptions& srcTbl)
{
	tableName_ = srcTbl.GetFullName();
	mdam_ = srcTbl.GetMdamOptions();
}