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;
}
Example #2
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;
}
    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;
    }
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);
}
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);
}
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);
}
Example #8
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();
}
}
Example #9
0
 IMachine *GetMachine() const
 {
     return m_machine.get();
 }