Esempio n. 1
0
SYNTAX_CHECK CAttributeNode::CheckSyntax()
{
	Dali::CEclExceptionVector errors;
	StlLinked<Dali::IDali> dali = Dali::AttachDali(GetIConfig(QUERYBUILDER_CFG)->Get(GLOBAL_SERVER_WORKUNIT), _T("Dali"));
	if (dali->CheckSyntax(_T("hthor"), GetIConfig(QUERYBUILDER_CFG)->Get(GLOBAL_QUEUE), m_attribute->GetModuleQualifiedLabel(), m_attribute->GetLabel(), _T(""), m_attribute->GetText(), -1, _T(""), false, false, errors))
	{
		m_syntaxCheck = SYNTAX_CHECK_PASS;
		m_syntaxSummary.clear();
		for(Dali::CEclExceptionVector::iterator itr = errors.begin(); itr != errors.end(); ++itr)
		{	
			if (itr->get()->m_severity.CompareNoCase(SYNTAXWARNING) == 0)
			{
				m_syntaxCheck = SYNTAX_CHECK_WARN;	
				if (m_syntaxSummary.length())
				{
					m_syntaxSummary += LF;
				}
				m_syntaxSummary += itr->get()->m_severity + _T(":  ") + itr->get()->m_message;
			}
			else if (itr->get()->m_severity.CompareNoCase(SYNTAXERROR) == 0)
			{
				m_syntaxCheck = SYNTAX_CHECK_FAIL;	
				m_syntaxSummary = itr->get()->m_severity + _T(":  ") + itr->get()->m_message;
				break;
			}
		}
	}
	return m_syntaxCheck;
}
LRESULT CRepositoryFilterView::OnSubmitDone(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam)
{
    ATLASSERT(wParam);
    StlLinked<IAttributeVectorPtr> results = reinterpret_cast<IAttributeVectorPtr *>(wParam);
    WTL::CLockWindowUpdate lock(m_hWnd);
    m_Tree.DeleteAllItems();
    if (results->size())
    {
        m_Root = new CRepositoryFilterNode(m_Owner, _T("Results"), results.get()); //  No attach as it is "in" the tree control also.
        m_Root->InsertBelow(m_Tree, TVI_ROOT);
        m_Root->Expand();
    }
    else if (lParam == 0)
    {
        CLoadingNode * loading = new CLoadingNode(NULL, _T("...No Matches Found..."));
        loading->InsertBelow(m_Tree, TVI_ROOT);
    }
    else
    {
        CLoadingNode * loading = new CLoadingNode(NULL, _T("...Search Failed (see error window)..."));
        loading->InsertBelow(m_Tree, TVI_ROOT);
    }
    m_search.EnableWindow(true);
    return 0;
}
Esempio n. 3
0
LAYOUTEVENT CGraphLeeLayoutImpl::pulse(const GraphTypes::RectF & extent)
{
	size_t verticy_count = m_meta.GetVisibleUnpinnedVertexCount(m_graph, m_canvas);

	if (verticy_count > 1)
	{
		GraphTypes::PointF vp;
		LeeRoutePlanner* plannerLee;

		// GraphTypes::SizeF gridSize;

		//gridSize.Width=32.0;
		//gridSize.Height=32.0;

		plannerLee=LeeRoutePlanner::Create(); //gridSize);
		assert(plannerLee);

		plannerLee->BeginAddPoints();

		for(StlLinked<IVertexIterator> itr = m_graph->GetUserVertexIterator(new MetaStateSkipper(m_meta, m_canvas, TRISTATE_TRUE, TRISTATE_FALSE)); itr->IsValidItem(); itr->NextItem())
		{
			CComPtr<IGraphVertex> vertex = itr->Get();
			CComPtr<IRenderer> ir=m_canvas->GetRenderer(vertex);
			ir->GetPosition(vp);
			plannerLee->AddPoint(vp, &vp);
			ir->SetPosition(vp);
		}

		plannerLee->EndAddPoints();

		IGraphEdgeVector edges;
		m_graph->GetEdges(edges);
		for (IGraphEdgeVector::iterator itr = edges.begin(); itr != edges.end(); ++itr)
		{
			IGraphEdge * edge = *itr;
			IGraphVertex * from = edge->GetSource();
			IGraphVertex * to = edge->GetTarget();
			GraphTypes::PointF start, end;
			GraphTypes::PointFVector path;
			CComPtr<IRenderer> irf=m_canvas->GetRenderer(from);
			CComPtr<IRenderer> irt=m_canvas->GetRenderer(to);
			CComQIPtr<IEdgeRenderer> ire=m_canvas->GetRenderer(edge);

			irf->GetPosition(start);
			irt->GetPosition(end);

			if ( plannerLee->GetShortestPath( 
				 start,
				 end,
				 path ) )
			{
				ire->SetPoints(path);
			}
		}

		plannerLee->Dispose();
	}

	return LAYOUTEVENT_FINISHED;
}
Esempio n. 4
0
 unsigned GetResultData(__int64 start, int count, ITable * result, __int64 & total) const
 {
     clib::recursive_mutex::scoped_lock proc(m_mutex);
     StlLinked<IDali> dali;
     dali = AttachDali((const TCHAR *)m_url, _T("Dali"));
     unsigned retVal = dali->GetResultData(m_wuid, m_sequence, start, count, result, total);
     if (m_total && m_total < total)
         total = m_total;
     return retVal;
 }
Esempio n. 5
0
LRESULT CDfuFilterView::OnSubmitDone(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/)
{
	ATLASSERT(wParam);
	StlLinked<Dfu::IFileVectorPtr> results = reinterpret_cast<Dfu::IFileVectorPtr *>(wParam);
	WTL::CLockWindowUpdate lock(m_hWnd);
	m_Tree.DeleteAllItems();
	m_Root = new CDfuFilterNode(m_Owner, _T("Results"), results.get()); //  No attach as it is "in" the tree control also.
	m_Root->InsertBelow(m_Tree, TVI_ROOT);
	m_Root->Expand();
	m_search.EnableWindow(true);
	return 0;
}
Esempio n. 6
0
    void Update(const TpDropZone * c)
    {
        m_Name = CW2T(c->Name, CP_UTF8);
        m_Description = CW2T(c->Description, CP_UTF8);
        m_Path = CW2T(c->Path, CP_UTF8);
        m_Build = CW2T( c->Build, CP_UTF8);
        m_machine = new CMachine();
#if _COMMS_VER < 60000 
        m_machine->Update(c->TpMachines);
#else
        m_machine->Update(c->TpMachines._TpMachine);
#endif
        Refresh();
    }
void CDockablePropertyGridViews::SetTabPropertyGrid(const std::_tstring & label, const ITable* data)
{
    StringPropertyGridMap::const_iterator itr = m_propertyGridTabs.find(label);
    if (itr == m_propertyGridTabs.end())
    {
        bool edges = boost::algorithm::iequals(label, _T("edges"));
        StlLinked<CPropertyGridView> propertyGridView = new CPropertyGridView(edges ? XGMML_CAT_EDGE : XGMML_CAT_VERTEX);
        m_propertyGridTabs[label] = propertyGridView.get();
        propertyGridView->Create(NULL, label.c_str(), WS_CHILD | WS_VISIBLE, CRect(0, 0, 0, 0), &m_wndTab, 1);
        propertyGridView->SetFont(&afxGlobalData.fontRegular);
        m_wndTab.AddTab(propertyGridView, label.c_str(), 0, FALSE);
        propertyGridView->SetOwner(m_owner);
    }
    m_propertyGridTabs[label]->SetData(data);
}
Esempio n. 8
0
SYNTAX_CHECK CAttributeHistoryNode::CheckSyntax()
{
	m_errors.clear();
	StlLinked<Dali::IDali> dali = Dali::AttachDali(GetIConfig(QUERYBUILDER_CFG)->Get(GLOBAL_SERVER_WORKUNIT), _T("Dali"));
	if (dali->CheckSyntax(_T("hthor"), GetIConfig(QUERYBUILDER_CFG)->Get(GLOBAL_QUEUE), m_attributeHistory->GetAttribute()->GetModuleQualifiedLabel(), m_attributeHistory->GetAttribute()->GetLabel(), _T(""), m_attributeHistory->GetText(), -1, _T(""), false, false, m_errors))
	{
		m_syntaxCheck = SYNTAX_CHECK_PASS;
		for(Dali::CEclExceptionVector::iterator itr = m_errors.begin(); itr != m_errors.end(); ++itr)
		{	
			if (itr->get()->m_severity)
			{
				m_syntaxCheck = SYNTAX_CHECK_FAIL;
				break;
			}
		}
	}
	return m_syntaxCheck;
}
Esempio n. 9
0
    void Update(const std::_tstring & name, ITable * result)
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);

        m_name = name.c_str();

        m_result->LoadFrom(result);
        m_total = result->GetRowCount();
    }
Esempio n. 10
0
 void Update(const ns5__TpDropZone * c)
 {
     SAFE_ASSIGN(m_Name, c->Name);
     SAFE_ASSIGN(m_Description, c->Description);
     SAFE_ASSIGN(m_Path, c->Path);
     SAFE_ASSIGN(m_Build, c->Build);
     m_machine = new CMachine();
     m_machine->Update(c->TpMachines->TpMachine[0]);
     Refresh();
 }
Esempio n. 11
0
void CAttributeDlg::DoCheckComplexity()
{
    CWaitCursor wait;
    m_view.SyntaxClearAll();
    CString ecl;
    GetSource(ecl);
    StlLinked<Dali::IDali> server = Dali::AttachDali(GetIConfig(QUERYBUILDER_CFG)->Get(GLOBAL_SERVER_WORKUNIT), _T("Dali"));
    std::_tstring complexity, complexitDisplay;
    Dali::CEclExceptionVector errorResults;
    server->CheckComplexity(GetCluster(), GetIConfig(QUERYBUILDER_CFG)->Get(GLOBAL_QUEUE), ecl, m_attribute->GetModuleQualifiedLabel(), m_attribute->GetLabel(), complexity, errorResults);
    if (complexity.length() == 0)
    {
        complexitDisplay = ComplexityErrorMsg;
        SendMessage(CWM_SUBMITDONE, Dali::WUActionCheck, (LPARAM)&errorResults);
    }
    else
        complexitDisplay = _T("Complexity Count = \"") + complexity + _T("\"");
    MessageBox(complexitDisplay.c_str(), _T("Complexity Count"), MB_ICONINFORMATION);
}
Esempio n. 12
0
 void Update(const ServiceDetail * c)
 {
     m_Name = CW2T(c->Name, CP_UTF8);
     m_Description = CW2T(c->Description, CP_UTF8);
     //m_Path = CW2T(c->Path, CP_UTF8);
     m_Build = CW2T( c->Build, CP_UTF8);
     m_machine = new CMachine();
     m_machine->Update(c->Machines._Machine);
     Refresh();
 }
Esempio n. 13
0
void CMainFrame::DoLogin()
{
    StlLinked<IRepository> repLHS;
    StlLinked<IRepository> repRHS;
    if (DoModalLoginAMT(this, m_iniFile, repLHS, repRHS, m_daliLHS, m_daliRHS) != IDOK)
    {
        DestroyWindow();
        return;
    }

    std::_tstring source = _T("Source (");
    source += repLHS->GetLabel();
    source += _T(")");

    std::_tstring target = _T("Target (");
    target += repRHS->GetLabel();
    target += _T(")");

    m_repositoryDlg.Init(source, target, repLHS, repRHS, m_daliLHS);
    m_dependees.SetConfig(m_cfgRHS);
}
Esempio n. 14
0
    static void threadLoadWorkunit(CWorkspaceItem * self, CString wuids)
    {
        StlLinked<Dali::IDali> server = Dali::AttachDali();

        int wuCap = GetIConfig(QUERYBUILDER_CFG)->Get(GLOBAL_WORKUNIT_PERSISTLIMIT);
        StdStringVector wus;
        SortedDeserialize(static_cast<const TCHAR *>(wuids), wus, _T(","));
        for (StdStringVector::const_reverse_iterator ritr = wus.rbegin(); ritr != wus.rend(); ++ritr)
        {
            CString wuid = ritr->c_str();
            if (!wuid.IsEmpty() && !self->HasWorkunit(wuid))
            {
                StlLinked<Dali::IWorkunit> workunit = server->GetWorkunitFast(wuid, true);
                if (workunit.get())
                    self->AppendWorkunit(workunit.get());
            }

            if (--wuCap <= 0)
                break;
        }

        self->m_loaded = LOADING_FINISHED;
    }
Esempio n. 15
0
    void Update(const ThorCluster *thorCluster, CStructArrayOut<ActiveWorkunit> &running)
#endif
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
        m_cluster = thorCluster->ClusterName;
        m_queue.clear();
#if _COMMS_VER < 505
        StlLinked<Dali::IDali> server = Dali::AttachDali(GetIConfig(QUERYBUILDER_CFG)->Get(GLOBAL_SERVER_WORKUNIT), _T("Dali4Smc"));  //Must different from "Dali"
        m_paused = thorCluster->QueuePaused;
        m_stopped = thorCluster->QueueStopped;
        CString wuid = thorCluster->Running.Wuid;
        if (wuid.IsEmpty())
            m_running = NULL;
        else
            m_running = server->GetWorkunit(wuid);

        ActiveWorkunit * wuq = thorCluster->Queue;
        for(int i = 0; i < thorCluster->__Queue_nSizeIs; ++i, ++wuq)
            m_queue.push_back(server->GetWorkunit(wuq->Wuid));
#else
        m_status = thorCluster->QueueStatus;
        for(int i = 0; i < running.GetCount(); ++i)
        {
#if _COMMS_VER < 700000
            if (m_cluster.CompareNoCase(CW2T(running.GetItem(i)->Instance, CP_UTF8)) == 0)
#else
            if (m_cluster.CompareNoCase(CW2T(running.GetItem(i)->ServerInstance, CP_UTF8)) == 0)
#endif
            {
                //  Creating a workunit can cause a deadlock with the active tree, so set noBroadcast to true.
                CComPtr<Dali::IWorkunit> wu  = Dali::CreateWorkunit(GetIConfig(QUERYBUILDER_CFG)->Get(GLOBAL_SERVER_WORKUNIT), _T("Dali"), running.GetItem(i), true);
                ATLASSERT(wu);
                m_queue.push_back(wu.p);
            }
        }
#endif
    }
Esempio n. 16
0
 unsigned GetResultData(__int64 start, int count, ITable * result, __int64 & total) const
 {
     clib::recursive_mutex::scoped_lock proc(m_mutex);
     if (m_result->GetRowCount() - start < count)
         count = m_result->GetRowCount() - start;
     for(__int64 i = start; i < start + count; ++i)
     {
         for (unsigned int j = 0; j < m_result->GetColumnCount(); ++j)
         {
             int newCol = result->FindColumn(m_result->GetColumn(j), true, m_result->GetColumnType(j));
             if (newCol >= 0)
                 result->SetCell(i, newCol, m_result->GetCell(i, j));
             else
                 result->SetCell(i, j, m_result->GetCell(i, j));
         }
     }
     return count;
 }
void CDockableDataViews::SetTabEcl(Dali::IWorkunit * wu, int row, const CUniqueID & id)
{
    std::_tstring label = _T("Builder");
    StringSourceMap::iterator itr = m_sourceTabs.find(label);
    if (itr == m_sourceTabs.end())
    {
        StlLinked<CBuilderDataView> builderDataView = new CBuilderDataView();
        m_sourceTabs[label] = builderDataView.get();
        builderDataView->Create(NULL, label.c_str(), WS_CHILD | WS_VISIBLE, CRect(0, 0, 0, 0), &m_wndTab, 1);
        builderDataView->SetFont(&afxGlobalData.fontRegular);
        m_wndTab.InsertTab(builderDataView, label.c_str(), 0, 0, FALSE);
        builderDataView->SetOwner(m_owner);
        builderDataView->SetSource(wu);
        builderDataView->LoadText();
    }
    if (row >= 0)
        m_sourceTabs[label]->SetBreakpointLocation(row, id);
}
void CDockableDataViews::SetTabEcl(const std::_tstring & moduleLabel, const std::_tstring & attributeLabel, int row, const CUniqueID & id)
{
    std::_tstring label = moduleLabel + _T(".") + attributeLabel;
    StringSourceMap::iterator itr = m_sourceTabs.find(label);
    if (itr == m_sourceTabs.end())
    {
        StlLinked<CAttributeDataView> attributeDataView = new CAttributeDataView();
        m_sourceTabs[label] = attributeDataView.get();
        attributeDataView->Create(NULL, label.c_str(), WS_CHILD | WS_VISIBLE, CRect(0, 0, 0, 0), &m_wndTab, 1);
        attributeDataView->SetFont(&afxGlobalData.fontRegular);
        m_wndTab.AddTab(attributeDataView, label.c_str(), 0, FALSE);
        attributeDataView->SetOwner(m_owner);
        attributeDataView->SetSource(moduleLabel, attributeLabel);
    }
    m_sourceTabs[label]->SetBreakpointLocation(row, id);
}
void CDockableDataViews::SetTabEcl(const std::_tstring & localFile, int row, const CUniqueID & id)
{
    std::_tstring label = localFile;
    StringSourceMap::iterator itr = m_sourceTabs.find(localFile);
    if (itr == m_sourceTabs.end())
    {
        StlLinked<CLocalDataView> attributeDataView = new CLocalDataView();
        m_sourceTabs[localFile] = attributeDataView.get();
        attributeDataView->Create(NULL, localFile.c_str(), WS_CHILD | WS_VISIBLE, CRect(0, 0, 0, 0), &m_wndTab, 1);
        attributeDataView->SetFont(&afxGlobalData.fontRegular);
        boost::filesystem::path p = stringToPath(localFile);
        m_wndTab.AddTab(attributeDataView, pathToWString(p.filename()).c_str(), 0, FALSE);
        attributeDataView->SetOwner(m_owner);
        attributeDataView->SetSource(localFile);
    }
    m_sourceTabs[localFile]->SetBreakpointLocation(row, id);
}
Esempio n. 20
0
 IMachine *GetMachine() const
 {
     return m_machine.get();
 }
Esempio n. 21
0
    bool GetActive(IClusterVector * clusters)
    {
        CComInitialize com;
        ServerT server;
        CString url = GetIConfig(QUERYBUILDER_CFG)->Get(GLOBAL_SERVER_SMC);
        server.SetUrl(url);

        CStructArrayOut<ActiveWorkunit> running;
#if _COMMS_VER < 499
        bool thorQueueManagement;
        if (server.Index(exceptions.GetArrayAddress(), exceptions.GetCountAddress(), &build, thorClusters.GetArrayAddress(), thorClusters.GetCountAddress(), holeClusters.GetArrayAddress() , holeClusters.GetCountAddress(), dfuJobs.GetArrayAddress(), dfuJobs.GetCountAddress(), &thorQueueManagement) == S_OK)
#elif _COMMS_VER < 505
        bool thorQueueManagement;
        CStructArrayOut<ActiveWorkunit> running;
        if (server.Index(exceptions.GetArrayAddress(), exceptions.GetCountAddress(), &build, thorClusters.GetArrayAddress(), thorClusters.GetCountAddress(), holeClusters.GetArrayAddress() , holeClusters.GetCountAddress(), dfuJobs.GetArrayAddress(), dfuJobs.GetCountAddress(), running.GetArrayAddress(), running.GetCountAddress(), &thorQueueManagement) == S_OK)
#elif _COMMS_VER < 50509
        CStructArrayOut<ActiveWorkunit> running;
        if (server.Index(exceptions.GetArrayAddress(), exceptions.GetCountAddress(), &build, thorClusters.GetArrayAddress(), thorClusters.GetCountAddress(), holeClusters.GetArrayAddress() , holeClusters.GetCountAddress(), dfuJobs.GetArrayAddress(), dfuJobs.GetCountAddress(), running.GetArrayAddress(), running.GetCountAddress()) == S_OK)
#elif _COMMS_VER < 51100
        CStructArrayOut<ActiveWorkunit> running;
        if (server.Activity(false, exceptions.GetArrayAddress(), exceptions.GetCountAddress(), &build, thorClusters.GetArrayAddress(), thorClusters.GetCountAddress(), holeClusters.GetArrayAddress() , holeClusters.GetCountAddress(), dfuJobs.GetArrayAddress(), dfuJobs.GetCountAddress(), running.GetArrayAddress(), running.GetCountAddress()) == S_OK)
#elif _COMMS_VER < 67205
        CComBSTR build;
        CStructArrayOut<ThorCluster> thorClusters;
        CStructArrayOut<HoleCluster> holeClusters;
        CStructArrayOut<DFUJob> dfuJobs;
        ESP_EXCEPTION_LOG(EspException);
        if (server.Activity(exceptions.GetArrayAddress(), exceptions.GetCountAddress(), &build, thorClusters.GetArrayAddress(), thorClusters.GetCountAddress(), holeClusters.GetArrayAddress() , holeClusters.GetCountAddress(), dfuJobs.GetArrayAddress(), dfuJobs.GetCountAddress(), running.GetArrayAddress(), running.GetCountAddress()) == S_OK)
        {
            if (build)
                m_version = CreateVersion(url, CString(build));

            //  Multi thor support - there could be some jobs running on a multi thor!
            for(int i = 0; i < running.GetCount(); ++i)
            {
                CComBSTR thorClusterName = running.GetItem(i)->Instance;
#elif _COMMS_VER < 700000
        CComBSTR build;
        CStructArrayOut<ThorCluster> thorClusters;
        CStructArrayOut<HoleCluster> holeClusters;
        CStructArrayOut<DFUJob> dfuJobs;
        ESP_EXCEPTION_LOG2(EspException);
        if (server.Activity(exceptions, &build, thorClusters.GetArrayAddress(), thorClusters.GetCountAddress(), holeClusters.GetArrayAddress() , holeClusters.GetCountAddress(), dfuJobs.GetArrayAddress(), dfuJobs.GetCountAddress(), running.GetArrayAddress(), running.GetCountAddress()) == S_OK)
        {
            if (build)
                m_version = CreateVersion(url, CString(build));

            //  Multi thor support - there could be some jobs running on a multi thor!
            for(int i = 0; i < running.GetCount(); ++i)
            {
                CComBSTR thorClusterName = running.GetItem(i)->Instance;
#else
        ESP_STATUS_LOG;
        if (server.ListActiveOrQueuedWorkunits(running.GetArrayAddress(), running.GetCountAddress(), &status.m_statusCode, &status.m_statusMessage) == S_OK)
        {
            //  Multi thor support - there could be some jobs running on a multi thor!
            for(int i = 0; i < running.GetCount(); ++i)
            {
                CComBSTR thorClusterName = running.GetItem(i)->ServerInstance;
#endif
                CComBSTR thorClusterStatus = running.GetItem(i)->State;
                ThorCluster thorCluster;
                thorCluster.ClusterName = thorClusterName;
                thorCluster.QueueStatus = thorClusterStatus;
                StlLinked<ICluster> cluster = CreateCluster(m_url, &thorCluster, running);
                if (std::find(clusters->begin(), clusters->end(), cluster) == clusters->end())
                {
                    clusters->push_back(cluster.get());
                }
            }
            return true;
        }
        else
            _DBGLOG(m_url, LEVEL_WARNING, server.GetClientError());

        return false;
    }

    IVersion * GetBuild()
    {
        if (m_version)
            return m_version;
        IClusterVector results;
        if (GetActive(&results))
            return m_version;
        return m_unknown;
    }

    bool SetPriority(const std::_tstring &cluster, const std::_tstring &wuid, PRIORITY priority)
    {
        CComInitialize com;
        ServerT server;
        server.SetUrl(CString(GetIConfig(QUERYBUILDER_CFG)->Get(GLOBAL_SERVER_SMC)));

        CComBSTR inCluster = CT2W(cluster.c_str(), CP_UTF8);
        CComBSTR inWuid = CT2W(wuid.c_str(), CP_UTF8);

        HRESULT result;
#if _COMMS_VER < 67205 
        ESP_EXCEPTION_LOG(EspException);
#elif _COMMS_VER < 700000 
        ESP_EXCEPTION_LOG2(EspException);
#else
        ESP_STATUS_LOG;
#endif
        switch (priority)
        {
        case PRIORITY_UP:
            {
#if _COMMS_VER < 51100 
                result = server.MoveJobUp(inCluster, inWuid);
#elif _COMMS_VER < 67205
                result = server.MoveJobUp(inCluster, inWuid, exceptions.GetArrayAddress(), exceptions.GetCountAddress());
#elif _COMMS_VER < 700000 
                result = server.MoveJobUp(inCluster, inWuid, exceptions);
#else
                CComBSTR position = _T("up");
                result = server.SetWorkunitPositionInSamePriority(inCluster, inWuid, position, &status.m_statusCode, &status.m_statusMessage);
#endif
            }
            break;
        case PRIORITY_DOWN:
            {
#if _COMMS_VER < 51100 
                result = server.MoveJobDown(inCluster, inWuid);
#elif _COMMS_VER < 67205
                result = server.MoveJobDown(inCluster, inWuid, exceptions.GetArrayAddress(), exceptions.GetCountAddress());
#elif _COMMS_VER < 700000 
                result = server.MoveJobDown(inCluster, inWuid, exceptions);
#else
                CComBSTR position = _T("down");
                result = server.SetWorkunitPositionInSamePriority(inCluster, inWuid, position, &status.m_statusCode, &status.m_statusMessage);
#endif
            }
            break;
        case PRIORITY_TOP:
            {
#if _COMMS_VER < 51100 
                result = server.MoveJobFront(inCluster, inWuid);
#elif _COMMS_VER < 67205
                result = server.MoveJobFront(inCluster, inWuid, exceptions.GetArrayAddress(), exceptions.GetCountAddress());
#elif _COMMS_VER < 700000 
                result = server.MoveJobFront(inCluster, inWuid, exceptions);
#else
                CComBSTR position = _T("front");
                result = server.SetWorkunitPositionInSamePriority(inCluster, inWuid, position, &status.m_statusCode, &status.m_statusMessage);
#endif
            }
            break;
        case PRIORITY_BOTTOM:
            {
#if _COMMS_VER < 51100 
                result = server.MoveJobBack(inCluster, inWuid);
#elif _COMMS_VER < 67205
                result = server.MoveJobBack(inCluster, inWuid, exceptions.GetArrayAddress(), exceptions.GetCountAddress());
#elif _COMMS_VER < 700000 
                result = server.MoveJobBack(inCluster, inWuid, exceptions);
#else
                CComBSTR position = _T("end");
                result = server.SetWorkunitPositionInSamePriority(inCluster, inWuid, position, &status.m_statusCode, &status.m_statusMessage);
#endif
            }
            break;
        default:
            _DBGLOG(m_url, LEVEL_WARNING, server.GetClientError());
            return false;
        }
        if(result == S_OK)
        {
            return true;
        }
        else
            _DBGLOG(m_url, LEVEL_WARNING, server.GetClientError());
        return false;
    }

    bool SetPriority(Dali::IWorkunitVector *workunits, PRIORITY priority)
    {
        switch (priority)
        {
        case PRIORITY_UP:
        case PRIORITY_TOP:
            {
                for(Dali::IWorkunitVector::iterator itr = workunits->begin(); itr != workunits->end(); ++itr)
                {
                    Dali::IWorkunitAdapt& workunit = *itr;
                    SetPriority(workunit->GetCluster(), workunit->GetWuid(), priority);
                }
            }
            break;
        case PRIORITY_DOWN:
        case PRIORITY_BOTTOM:
            {
                for (Dali::IWorkunitVector::reverse_iterator itr = workunits->rbegin(); itr != workunits->rend(); ++itr)
                {
                    Dali::IWorkunitAdapt& workunit = *itr;
                    SetPriority(workunit->GetCluster(), workunit->GetWuid(), priority);
                }
            }
            break;
        }
        return true;
    }
};
#endif

CacheT<std::_tstring, CSMC> SMCCache;
ISMC * AttachSMC(const std::_tstring & url, const std::_tstring & label)
{
    return SMCCache.Get(new CSMC(url.c_str(), label.c_str()));
}
COMMS_API ISMC * AttachSMC(const _variant_t & url, const std::_tstring & label)
{
    return SMCCache.Get(new CSMC(url, label.c_str()));
}
void ClearSingletons()
{
    ClearVersionCache();
    ClearClusterCache();
    SMCCache.clear();
}
}