コード例 #1
0
    /// <summary>
    /// Get a page's worth of Users listings
    /// </summary>
    /// <param name="onlineUsers"></param>
    /// <param name="pageToRequest">Page # we are requesting (1 based)</param>
    /// <param name="totalNumberPages">Total # of pages of data that Server can return us</param>
    private void ExecuteRequest_ForPage(List <SiteUser> onlineUsers, int pageToRequest, out int totalNumberPages)
    {
        int pageSize = _onlineUrls.PageSize;
        var urlQuery = UrlForUsersListRequest(pageSize, pageToRequest);

        _onlineSession.StatusLog.AddStatus("Web request: " + urlQuery, -10);
        var xmlDoc = ResourceSafe_PerformWebRequest_GetXmlDocument(urlQuery, "get users list");

        //Get all the user nodes
        var nsManager = XmlHelper.CreateTableauXmlNamespaceManager("iwsOnline");
        var users     = xmlDoc.SelectNodes("//iwsOnline:user", nsManager);

        //Get information for each of the data sources
        foreach (XmlNode itemXml in users)
        {
            try
            {
                var ds = new SiteUser(itemXml);
                onlineUsers.Add(ds);
            }
            catch
            {
                AppDiagnostics.Assert(false, "User parse error");
                _onlineSession.StatusLog.AddError("Error parsing user: "******"//iwsOnline:pagination", nsManager),
            pageSize);
    }
コード例 #2
0
        private void _ExecuteRequest_ForPage(List <SiteView> onlineViews, int pageToRequest, out int totalNumberPages)
        {
            var pageSize   = _onlineUrls.PageSize;
            var urlQuery   = _onlineUrls.Url_ViewsListForSite(OnlineSession, pageSize, 1);
            var webRequest = CreateLoggedInWebRequest(urlQuery);

            webRequest.Method = "GET";
            OnlineSession.StatusLog.AddStatus($"Web request: {urlQuery}", -10);
            var response = GetWebResponseLogErrors(webRequest, "get views list");
            var xmlDoc   = GetWebResponseAsXml(response);

            var nsManager = XmlHelper.CreateTableauXmlNamespaceManager("iwsOnline");
            var workbooks = xmlDoc.SelectNodes("//iwsOnline:view", nsManager);

            _views = new List <SiteView>();
            foreach (XmlNode itemXml in workbooks)
            {
                try
                {
                    var ds = new SiteView(itemXml);
                    _views.Add(ds);
                }
                catch
                {
                    AppDiagnostics.Assert(false, "View parse error");
                    OnlineSession.StatusLog.AddError("Error parsing view: " + itemXml.InnerXml);
                }
            }
            totalNumberPages = DownloadPaginationHelper.GetNumberOfPagesFromPagination(
                xmlDoc.SelectSingleNode("//iwsOnline:pagination", nsManager),
                pageSize);
        }
コード例 #3
0
    /// <summary>
    /// Get a page's worth of Schedules listing
    /// </summary>
    /// <param name="onlineSchedules"></param>
    /// <param name="pageToRequest">Page # we are requesting (1 based)</param>
    /// <param name="totalNumberPages">Total # of pages of data that Server can return us</param>
    private void ExecuteRequest_ForPage(List <SiteSchedule> onlineSchedules, int pageToRequest, out int totalNumberPages)
    {
        int pageSize = _onlineUrls.PageSize;
        //Create a web request, in including the users logged-in auth information in the request headers

        var urlQuery = _onlineUrls.Url_SchedulesList(_onlineSession, pageSize, pageToRequest);

        _onlineSession.StatusLog.AddStatus("Web request: " + urlQuery, -10);
        XmlDocument xmlDoc = ResourceSafe_PerformWebRequest_GetXmlDocument(urlQuery, "get schedules list");
        //var webRequest = CreateLoggedInWebRequest(urlQuery);
        //webRequest.Method = "GET";
        //var response = GetWebReponseLogErrors(webRequest, "get schedules list");
        //var xmlDoc = GetWebResponseAsXml(response);

        //Get all the schedule nodes
        var nsManager = XmlHelper.CreateTableauXmlNamespaceManager("iwsOnline");
        var schedules = xmlDoc.SelectNodes("//iwsOnline:schedule", nsManager);

        //Get information for each of the data sources
        foreach (XmlNode itemXml in schedules)
        {
            try
            {
                var thisSchedule = new SiteSchedule(itemXml);
                onlineSchedules.Add(thisSchedule);

                SanityCheckSchedule(thisSchedule, itemXml);
            }
            catch
            {
                AppDiagnostics.Assert(false, "Schedule parse error");
                _onlineSession.StatusLog.AddError("Error parsing schedule: " + itemXml.OuterXml);
            }
        } //end: foreach

        //-------------------------------------------------------------------
        //Get the updated page-count
        //-------------------------------------------------------------------
        totalNumberPages = DownloadPaginationHelper.GetNumberOfPagesFromPagination(
            xmlDoc.SelectSingleNode("//iwsOnline:pagination", nsManager),
            pageSize);
    }
コード例 #4
0
    /// <summary>
    /// Get a page's worth of Tasks listing
    /// </summary>
    /// <param name="onlineTasks"></param>
    /// <param name="pageToRequest">Page # we are requesting (1 based)</param>
    /// <param name="totalNumberPages">Total # of pages of data that Server can return us</param>
    private void ExecuteRequest_ForPage(List <SiteTaskExtractRefresh> onlineTasks, int pageToRequest, out int totalNumberPages)
    {
        int pageSize = _onlineUrls.PageSize;
        //Create a web request, in including the users logged-in auth information in the request headers
        var urlQuery   = _onlineUrls.Url_TasksExtractRefreshesForScheduleList(_onlineSession, _scheduleId, pageSize, pageToRequest);
        var webRequest = CreateLoggedInWebRequest(urlQuery);

        webRequest.Method = "GET";

        _onlineSession.StatusLog.AddStatus("Web request: " + urlQuery, -10);
        var response = GetWebReponseLogErrors(webRequest, "get tasks list");
        var xmlDoc   = GetWebResponseAsXml(response);

        //Get all the task nodes
        var nsManager = XmlHelper.CreateTableauXmlNamespaceManager("iwsOnline");
        var tasks     = xmlDoc.SelectNodes("//iwsOnline:extract", nsManager);

        //Get information for each of the data sources
        foreach (XmlNode itemXml in tasks)
        {
            try
            {
                var thisTask = new SiteTaskExtractRefresh(itemXml, _scheduleId);
                onlineTasks.Add(thisTask);

                SanityCheckTask(thisTask, itemXml);
            }
            catch
            {
                AppDiagnostics.Assert(false, "Task parse error");
                _onlineSession.StatusLog.AddError("Error parsing task: " + itemXml.OuterXml);
            }
        } //end: foreach

        //-------------------------------------------------------------------
        //Get the updated page-count
        //-------------------------------------------------------------------
        totalNumberPages = DownloadPaginationHelper.GetNumberOfPagesFromPagination(
            xmlDoc.SelectSingleNode("//iwsOnline:pagination", nsManager),
            pageSize);
    }
コード例 #5
0
        /// <summary>
        /// Get a page's worth of Projects listing
        /// </summary>
        /// <param name="onlineProjects"></param>
        /// <param name="pageToRequest">Page # we are requesting (1 based)</param>
        /// <param name="totalNumberPages">Total # of pages of data that Server can return us</param>
        private void ExecuteRequest_ForPage(List <SiteProject> onlineProjects, int pageToRequest, out int totalNumberPages)
        {
            int pageSize = _onlineUrls.PageSize;
            //Create a web request, in including the users logged-in auth information in the request headers
            var urlQuery   = _onlineUrls.Url_ProjectsList(OnlineSession, pageSize, pageToRequest);
            var webRequest = CreateLoggedInWebRequest(urlQuery);

            webRequest.Method = "GET";

            OnlineSession.StatusLog.AddStatus("Web request: " + urlQuery, -10);
            var response = GetWebResponseLogErrors(webRequest, "get projects list");
            var xmlDoc   = GetWebResponseAsXml(response);

            //Get all the project nodes
            var nsManager = XmlHelper.CreateTableauXmlNamespaceManager("iwsOnline");
            var projects  = xmlDoc.SelectNodes("//iwsOnline:project", nsManager);

            //Get information for each of the data sources
            foreach (XmlNode itemXml in projects)
            {
                try
                {
                    var proj = new SiteProject(itemXml);
                    onlineProjects.Add(proj);

                    _SanityCheckProject(proj, itemXml);
                }
                catch
                {
                    AppDiagnostics.Assert(false, "Project parse error");
                    OnlineSession.StatusLog.AddError("Error parsing project: " + itemXml.OuterXml);
                }
            } //end: foreach

            //-------------------------------------------------------------------
            //Get the updated page-count
            //-------------------------------------------------------------------
            totalNumberPages = DownloadPaginationHelper.GetNumberOfPagesFromPagination(
                xmlDoc.SelectSingleNode("//iwsOnline:pagination", nsManager),
                pageSize);
        }
コード例 #6
0
    /// <summary>
    /// Get a page's worth of Workbook listings
    /// </summary>
    /// <param name="onlineWorkbooks"></param>
    /// <param name="pageToRequest">Page # we are requesting (1 based)</param>
    /// <param name="totalNumberPages">Total # of pages of data that Server can return us</param>
    private void ExecuteRequest_ForPage(List <SiteWorkbook> onlineWorkbooks, int pageToRequest, out int totalNumberPages)
    {
        int pageSize = _onlineUrls.PageSize;
        //Create a web request, in including the users logged-in auth information in the request headers
        var urlQuery = _onlineUrls.Url_WorkbooksListForUser(_onlineSession, _userIdForWorkbookQuery, pageSize, pageToRequest, SortDirectiveForContentQuery());

        _onlineSession.StatusLog.AddStatus("Web request: " + urlQuery, -10);
        var xmlDoc = ResourceSafe_PerformWebRequest_GetXmlDocument(urlQuery, "get workbooks list");
        //var webRequest = CreateLoggedInWebRequest(urlQuery);
        //webRequest.Method = "GET";
        //var response = GetWebReponseLogErrors(webRequest, "get workbooks list");
        //var xmlDoc = GetWebResponseAsXml(response);

        //Get all the workbook nodes
        var nsManager = XmlHelper.CreateTableauXmlNamespaceManager("iwsOnline");
        var workbooks = xmlDoc.SelectNodes("//iwsOnline:workbook", nsManager);

        //Get information for each of the data sources
        foreach (XmlNode itemXml in workbooks)
        {
            try
            {
                var ds = new SiteWorkbook(itemXml);
                onlineWorkbooks.Add(ds);
            }
            catch
            {
                AppDiagnostics.Assert(false, "Workbook parse error");
                _onlineSession.StatusLog.AddError("Error parsing workbook: " + itemXml.InnerXml);
            }
        } //end: foreach

        //-------------------------------------------------------------------
        //Get the updated page-count
        //-------------------------------------------------------------------
        totalNumberPages = DownloadPaginationHelper.GetNumberOfPagesFromPagination(
            xmlDoc.SelectSingleNode("//iwsOnline:pagination", nsManager),
            pageSize);
    }
コード例 #7
0
    /// <summary>
    /// Get a page's worth of Data Sources
    /// </summary>
    /// <param name="onlineDatasources"></param>
    /// <param name="pageToRequest">Page # we are requesting (1 based)</param>
    /// <param name="totalNumberPages">Total # of pages of data that Server can return us</param>
    private void ExecuteRequest_ForPage(List <SiteDatasource> onlineDatasources, int pageToRequest, out int totalNumberPages)
    {
        int pageSize = _onlineUrls.PageSize;
        //Create a web request, in including the users logged-in auth information in the request headers
        var urlQuery   = _onlineUrls.Url_DatasourcesList(_onlineSession, pageSize, pageToRequest);
        var webRequest = CreateLoggedInWebRequest(urlQuery);

        webRequest.Method = "GET";

        _onlineSession.StatusLog.AddStatus("Web request: " + urlQuery, -10);
        var xmlDoc = GetWebReponseLogErrors_AsXmlDoc(webRequest, "get datasources list");

        //Get all the workbook nodes
        var nsManager   = XmlHelper.CreateTableauXmlNamespaceManager("iwsOnline");
        var datasources = xmlDoc.SelectNodes("//iwsOnline:datasource", nsManager);

        //Get information for each of the data sources
        foreach (XmlNode itemXml in datasources)
        {
            try
            {
                var ds = new SiteDatasource(itemXml);
                onlineDatasources.Add(ds);
            }
            catch
            {
                AppDiagnostics.Assert(false, "Datasource parse error");
                _onlineSession.StatusLog.AddError("Error parsing datasource: " + itemXml.InnerXml);
            }
        } //end: foreach

        //-------------------------------------------------------------------
        //Get the updated page-count
        //-------------------------------------------------------------------
        totalNumberPages = DownloadPaginationHelper.GetNumberOfPagesFromPagination(
            xmlDoc.SelectSingleNode("//iwsOnline:pagination", nsManager),
            pageSize);
    }
コード例 #8
0
    /// <summary>
    /// Get a page's worth of Views listing
    /// </summary>
    /// <param name="onlineViews"></param>
    /// <param name="pageToRequest">Page # we are requesting (1 based)</param>
    /// <param name="totalNumberPages">Total # of pages of data that Server can return us</param>
    private void ExecuteRequest_ForPage(List <SiteView> onlineViews, int pageToRequest, out int totalNumberPages)
    {
        int pageSize = _onlineUrls.PageSize;
        //Create a web request, in including the users logged-in auth information in the request headers
        var urlQuery = _onlineUrls.Url_ViewsList(_onlineSession, pageSize, pageToRequest);

        _onlineSession.StatusLog.AddStatus("Web request: " + urlQuery, -10);
        var xmlDoc = ResourceSafe_PerformWebRequest_GetXmlDocument(urlQuery, "get views list");

        //Get all the view nodes
        var nsManager = XmlHelper.CreateTableauXmlNamespaceManager("iwsOnline");
        var views     = xmlDoc.SelectNodes("//iwsOnline:view", nsManager);

        //Get information for each of the data sources
        foreach (XmlNode itemXml in views)
        {
            try
            {
                var thisView = new SiteView(itemXml);
                onlineViews.Add(thisView);

                SanityCheckView(thisView, itemXml);
            }
            catch
            {
                AppDiagnostics.Assert(false, "View parse error");
                _onlineSession.StatusLog.AddError("Error parsing view: " + itemXml.OuterXml);
            }
        } //end: foreach

        //-------------------------------------------------------------------
        //Get the updated page-count
        //-------------------------------------------------------------------
        totalNumberPages = DownloadPaginationHelper.GetNumberOfPagesFromPagination(
            xmlDoc.SelectSingleNode("//iwsOnline:pagination", nsManager),
            pageSize);
    }
コード例 #9
0
    /*
     * /// <summary>
     * /// Gives us a query string for the sort we want
     * /// </summary>
     * /// <returns></returns>
     * private string SortDirectiveForContentQuery()
     * {
     *  switch(_sort)
     *  {
     *      case Sort.NoSort:
     *          return "";
     *      default:
     *          IwsDiagnostics.Assert(false, "Unknown flow sort");
     *          throw new Exception("Unknown flow sort");
     *  }
     * }
     */
    /// <summary>
    /// Get a page's worth of Flow listings
    /// </summary>
    /// <param name="onlineFlows"></param>
    /// <param name="pageToRequest">Page # we are requesting (1 based)</param>
    /// <param name="totalNumberPages">Total # of pages of data that Server can return us</param>
    private void ExecuteRequest_ForPage(List <SiteFlow> onlineFlows, int pageToRequest, out int totalNumberPages)
    {
        int pageSize = _onlineUrls.PageSize;
        //Create a web request, in including the users logged-in auth information in the request headers
//        var urlQuery = _onlineUrls.Url_FlowsListForUser(_onlineSession, _userIdForContentQuery, _filterToOwnedBy, pageSize, pageToRequest, SortDirectiveForContentQuery());
        var urlQuery = _onlineUrls.Url_FlowsList(_onlineSession, pageSize, pageToRequest);

        _onlineSession.StatusLog.AddStatus("Web request: " + urlQuery, -10);
        var xmlDoc = ResourceSafe_PerformWebRequest_GetXmlDocument(urlQuery, "get flows list");

        //Get all the flow nodes
        var nsManager = XmlHelper.CreateTableauXmlNamespaceManager("iwsOnline");
        var flows     = xmlDoc.SelectNodes("//iwsOnline:flow", nsManager);

        //Get information for each of the data sources
        foreach (XmlNode itemXml in flows)
        {
            try
            {
                var ds = new SiteFlow(itemXml);
                onlineFlows.Add(ds);
            }
            catch
            {
                AppDiagnostics.Assert(false, "Flow parse error");
                _onlineSession.StatusLog.AddError("Error parsing flow: " + itemXml.InnerXml);
            }
        } //end: foreach

        //-------------------------------------------------------------------
        //Get the updated page-count
        //-------------------------------------------------------------------
        totalNumberPages = DownloadPaginationHelper.GetNumberOfPagesFromPagination(
            xmlDoc.SelectSingleNode("//iwsOnline:pagination", nsManager),
            pageSize);
    }
コード例 #10
0
        protected int GetPageCount(XElement paginationElement, int pageSize)
        {
            var paginationNode = paginationElement.ToXmlNode();

            return(DownloadPaginationHelper.GetNumberOfPagesFromPagination(paginationNode, pageSize));
        }
コード例 #11
0
    /// <summary>
    /// Get a page's worth of Groups
    /// </summary>
    /// <param name="onlineGroups"></param>
    /// <param name="pageToRequest">Page # we are requesting (1 based)</param>
    /// <param name="totalNumberPages">Total # of pages of data that Server can return us</param>
    private void ExecuteRequest_ForPage(
        List <SiteGroup> onlineGroups,
        int pageToRequest,
        bool downloadMemberList,
        out int totalNumberPages)
    {
        int pageSize = _onlineUrls.PageSize;
        //Create a web request, in including the users logged-in auth information in the request headers
        var urlQuery = _onlineUrls.Url_GroupsList(_onlineSession, pageSize, pageToRequest);

        _onlineSession.StatusLog.AddStatus("Web request: " + urlQuery, -10);
        XmlDocument xmlDoc = ResourceSafe_PerformWebRequest_GetXmlDocument(urlQuery, "get groups list");

        //Get all the group nodes
        var nsManager = XmlHelper.CreateTableauXmlNamespaceManager("iwsOnline");
        var groups    = xmlDoc.SelectNodes("//iwsOnline:group", nsManager);

        //Get information for each of the data sources
        foreach (XmlNode itemXml in groups)
        {
            SiteGroup thisGroup = null;
            try
            {
                thisGroup = new SiteGroup(
                    itemXml,
                    null);   //We'll get and add the list of users later (see below)
                onlineGroups.Add(thisGroup);
                SanityCheckGroup(thisGroup, itemXml);
            }
            catch (Exception exGetGroup)
            {
                AppDiagnostics.Assert(false, "Group parse error");
                _onlineSession.StatusLog.AddError("Error parsing group: " + itemXml.OuterXml + ", " + exGetGroup.Message);
            }


            //==============================================================
            //Get the set of users in the group
            //==============================================================
            if ((thisGroup != null) && (downloadMemberList))
            {
                try
                {
                    var downloadUsersInGroup = new DownloadUsersListInGroup(
                        _onlineSession,
                        thisGroup.Id);
                    downloadUsersInGroup.ExecuteRequest();
                    thisGroup.AddUsers(downloadUsersInGroup.Users);
                }
                catch (Exception exGetUsers)
                {
                    _onlineSession.StatusLog.AddError("Error parsing group's users: " + exGetUsers.Message);
                }
            }
        } //end: foreach

        //-------------------------------------------------------------------
        //Get the updated page-count
        //-------------------------------------------------------------------
        totalNumberPages = DownloadPaginationHelper.GetNumberOfPagesFromPagination(
            xmlDoc.SelectSingleNode("//iwsOnline:pagination", nsManager),
            pageSize);
    }