示例#1
3
    /// <summary>
    /// Constructor
    /// </summary>
    /// <param name="onlineUrls"></param>
    /// <param name="login"></param>
    /// <param name="localUploadPath"></param>
    public UploadDatasources(
        TableauServerUrls onlineUrls, 
        TableauServerSignIn login,
        CredentialManager credentialManager,
        string localUploadPath,
        UploadBehaviorProjects uploadProjectBehavior,
        CustomerManualActionManager manualActions,
        bool attemptOwnershipAssignment,
        IEnumerable<SiteUser> siteUsers,
        int uploadChunkSizeBytes = TableauServerUrls.UploadFileChunkSize,
        int uploadChunkDelaySeconds = 0)
        : base(login)
    {
        System.Diagnostics.Debug.Assert(uploadChunkSizeBytes > 0, "Chunck size must be positive");

        _onlineUrls = onlineUrls;
        _localUploadPath = localUploadPath;
        _uploadProjectBehavior = uploadProjectBehavior;
        _credentialManager = credentialManager;
        _manualActions = manualActions;
        if(_manualActions == null)
        {
            _manualActions = new CustomerManualActionManager();
        }

        //If we are going to attempt to reassign ownership after publication we'll need this information
        _attemptOwnershipAssignment = attemptOwnershipAssignment;
        _siteUsers = siteUsers;

        //Test parameters
        _uploadChunkSizeBytes = uploadChunkSizeBytes;
        _uploadChunkDelaySeconds = uploadChunkDelaySeconds;
    }
示例#2
0
    /// <summary>
    /// Constructor
    /// </summary>
    /// <param name="onlineUrls"></param>
    /// <param name="login"></param>
    /// <param name="localUploadPath"></param>
    public UploadDatasources(
        TableauServerUrls onlineUrls,
        TableauServerSignIn login,
        CredentialManager credentialManager,
        string localUploadPath,
        UploadBehaviorProjects uploadProjectBehavior,
        CustomerManualActionManager manualActions,
        bool attemptOwnershipAssignment,
        IEnumerable <SiteUser> siteUsers,
        int uploadChunkSizeBytes    = TableauServerUrls.UploadFileChunkSize,
        int uploadChunkDelaySeconds = 0)
        : base(login)
    {
        System.Diagnostics.Debug.Assert(uploadChunkSizeBytes > 0, "Chunck size must be positive");

        _onlineUrls            = onlineUrls;
        _localUploadPath       = localUploadPath;
        _uploadProjectBehavior = uploadProjectBehavior;
        _credentialManager     = credentialManager;
        _manualActions         = manualActions;
        if (_manualActions == null)
        {
            _manualActions = new CustomerManualActionManager();
        }

        //If we are going to attempt to reassign ownership after publication we'll need this information
        _attemptOwnershipAssignment = attemptOwnershipAssignment;
        _siteUsers = siteUsers;

        //Test parameters
        _uploadChunkSizeBytes    = uploadChunkSizeBytes;
        _uploadChunkDelaySeconds = uploadChunkDelaySeconds;
    }
    /// <summary>
    /// Constructor
    /// </summary>
    /// <param name="onlineUrls"></param>
    /// <param name="login"></param>
    /// <param name="credentialManager">Set of database credentials to attach to associated content being published</param>
    /// <param name="localUploadPath">Path to upload from</param>
    /// <param name="remapWorkbookReferences">TRUE if we want to modify the workbooks to point datasource/other references to the new server</param>
    /// <param name="localPathTempWorkspace">Path to perform local file work in</param>
    /// <param name="uploadProjectBehavior">Instructions on whether to map content into projects</param>
    /// <param name="manualActions">Any manual actions that need to be performed by the user are written here</param>
    /// <param name="attemptOwnershipAssignment">TRUE: After upload attempt to reassign the ownership of the content based on local metadata we have</param>
    /// <param name="siteUsers">List of users to perform ownership assignement with</param>
    /// <param name="uploadChunkDelaySeconds">For testing, a delay we can inject</param>
    public UploadWorkbooks(
        TableauServerUrls onlineUrls,
        TableauServerSignIn login,
        CredentialManager credentialManager,
        string localUploadPath,
        bool remapWorkbookReferences,
        string localPathTempWorkspace,
        UploadBehaviorProjects uploadProjectBehavior,
        CustomerManualActionManager manualActions,
        bool attemptOwnershipAssignment,
        IEnumerable <SiteUser> siteUsers,
        int uploadChunkSizeBytes    = TableauServerUrls.UploadFileChunkSize,
        int uploadChunkDelaySeconds = 0)
        : base(login)
    {
        _onlineUrls              = onlineUrls;
        _localUploadPath         = localUploadPath;
        _remapWorkbookReferences = remapWorkbookReferences;
        _localPathTempWorkspace  = localPathTempWorkspace;
        _uploadProjectBehavior   = uploadProjectBehavior;
        _manualActions           = manualActions;
        _credentialManager       = credentialManager;
        if (_manualActions == null)
        {
            _manualActions = new CustomerManualActionManager();
        }

        //If we are going to attempt to reassign ownership after publication we'll need this information
        _attemptOwnershipAssignment = attemptOwnershipAssignment;
        _siteUsers = siteUsers;

        //Test parameters
        _uploadChunkSizeBytes    = uploadChunkSizeBytes;
        _uploadChunkDelaySeconds = uploadChunkDelaySeconds;
    }
示例#4
0
    /// <summary>
    /// Constructor
    /// </summary>
    /// <param name="onlineUrls"></param>
    /// <param name="login"></param>
    /// <param name="credentialManager">Set of database credentials to attach to associated content being published</param>
    /// <param name="localUploadPath">Path to upload from</param>
    /// <param name="remapWorkbookReferences">TRUE if we want to modify the workbooks to point datasource/other references to the new server</param>
    /// <param name="localPathTempWorkspace">Path to perform local file work in</param>
    /// <param name="uploadProjectBehavior">Instructions on whether to map content into projects</param>
    /// <param name="manualActions">Any manual actions that need to be performed by the user are written here</param>
    /// <param name="attemptOwnershipAssignment">TRUE: After upload attempt to reassign the ownership of the content based on local metadata we have</param>
    /// <param name="siteUsers">List of users to perform ownership assignement with</param>
    /// <param name="uploadChunkDelaySeconds">For testing, a delay we can inject</param>
    public UploadWorkbooks(
        TableauServerUrls onlineUrls, 
        TableauServerSignIn login,
        CredentialManager credentialManager,
        string localUploadPath,
        bool remapWorkbookReferences,
        string localPathTempWorkspace,
        UploadBehaviorProjects uploadProjectBehavior,
        CustomerManualActionManager manualActions,
        bool attemptOwnershipAssignment,
        IEnumerable<SiteUser> siteUsers,
        int uploadChunkSizeBytes = TableauServerUrls.UploadFileChunkSize,
        int uploadChunkDelaySeconds = 0)
        : base(login)
    {
        _onlineUrls = onlineUrls;
        _localUploadPath = localUploadPath;
        _remapWorkbookReferences = remapWorkbookReferences;
        _localPathTempWorkspace = localPathTempWorkspace;
        _uploadProjectBehavior = uploadProjectBehavior;
        _manualActions = manualActions;
        _credentialManager = credentialManager;
        if (_manualActions == null)
        {
            _manualActions = new CustomerManualActionManager();
        }

        //If we are going to attempt to reassign ownership after publication we'll need this information
        _attemptOwnershipAssignment = attemptOwnershipAssignment;
        _siteUsers = siteUsers;

        //Test parameters
        _uploadChunkSizeBytes = uploadChunkSizeBytes;
        _uploadChunkDelaySeconds = uploadChunkDelaySeconds;
    }
示例#5
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="onlineUrls"></param>
 /// <param name="login"></param>
 /// <param name="credentialManager">Set of database credentials to attach to associated content being published</param>
 /// <param name="localUploadPath">Path to upload from</param>
 /// <param name="remapWorkbookReferences">TRUE if we want to modify the workbooks to point datasource/other references to the new server</param>
 /// <param name="localPathTempWorkspace">Path to perform local file work in</param>
 /// <param name="uploadProjectBehavior">Instructions on whether to map content into projects</param>
 /// <param name="manualActions">Any manual actions that need to be performed by the user are written here</param>
 /// <param name="uploadChunkDelaySeconds">For testing, a delay we can inject</param>
 public UploadWorkbooks(
     TableauServerUrls onlineUrls,
     TableauServerSignIn login,
     CredentialManager credentialManager,
     string localUploadPath,
     bool remapWorkbookReferences,
     string localPathTempWorkspace,
     UploadBehaviorProjects uploadProjectBehavior,
     CustomerManualActionManager manualActions,
     int uploadChunkSizeBytes    = TableauServerUrls.UploadFileChunkSize,
     int uploadChunkDelaySeconds = 0)
     : base(login)
 {
     _onlineUrls              = onlineUrls;
     _localUploadPath         = localUploadPath;
     _remapWorkbookReferences = remapWorkbookReferences;
     _localPathTempWorkspace  = localPathTempWorkspace;
     _uploadProjectBehavior   = uploadProjectBehavior;
     _manualActions           = manualActions;
     _credentialManager       = credentialManager;
     if (_manualActions == null)
     {
         _manualActions = new CustomerManualActionManager();
     }
     //Test parameters
     _uploadChunkSizeBytes    = uploadChunkSizeBytes;
     _uploadChunkDelaySeconds = uploadChunkDelaySeconds;
 }
示例#6
0
    /// <summary>
    /// Constructor
    /// </summary>
    /// <param name="onlineUrls"></param>
    /// <param name="login"></param>
    /// <param name="localUploadPath"></param>
    public UploadDatasources(
        TableauServerUrls onlineUrls,
        TableauServerSignIn login,
        CredentialManager credentialManager,
        string localUploadPath,
        UploadBehaviorProjects uploadProjectBehavior,
        CustomerManualActionManager manualActions,
        int uploadChunkSizeBytes    = TableauServerUrls.UploadFileChunkSize,
        int uploadChunkDelaySeconds = 0)
        : base(login)
    {
        System.Diagnostics.Debug.Assert(uploadChunkSizeBytes > 0, "Chunck size must be positive");

        _onlineUrls            = onlineUrls;
        _localUploadPath       = localUploadPath;
        _uploadProjectBehavior = uploadProjectBehavior;
        _credentialManager     = credentialManager;
        _manualActions         = manualActions;
        if (_manualActions == null)
        {
            _manualActions = new CustomerManualActionManager();
        }
        //Test parameters
        _uploadChunkSizeBytes    = uploadChunkSizeBytes;
        _uploadChunkDelaySeconds = uploadChunkDelaySeconds;
    }
示例#7
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="onlineUrls"></param>
 /// <param name="login"></param>
 /// <param name="credentialManager">Set of database credentials to attach to associated content being published</param>
 /// <param name="localUploadPath">Path to upload from</param>
 /// <param name="remapWorkbookReferences">TRUE if we want to modify the workbooks to point datasource/other references to the new server</param>
 /// <param name="localPathTempWorkspace">Path to perform local file work in</param>
 /// <param name="uploadProjectBehavior">Instructions on whether to map content into projects</param>
 /// <param name="manualActions">Any manual actions that need to be performed by the user are written here</param>
 /// <param name="uploadChunkDelaySeconds">For testing, a delay we can inject</param>
 public UploadWorkbooks(
     TableauServerUrls onlineUrls, 
     TableauServerSignIn login,
     CredentialManager credentialManager,
     string localUploadPath,
     bool remapWorkbookReferences,
     string localPathTempWorkspace,
     UploadBehaviorProjects uploadProjectBehavior,
     CustomerManualActionManager manualActions,
     int uploadChunkSizeBytes = TableauServerUrls.UploadFileChunkSize,
     int uploadChunkDelaySeconds = 0)
     : base(login)
 {
     _onlineUrls = onlineUrls;
     _localUploadPath = localUploadPath;
     _remapWorkbookReferences = remapWorkbookReferences;
     _localPathTempWorkspace = localPathTempWorkspace;
     _uploadProjectBehavior = uploadProjectBehavior;
     _manualActions = manualActions;
     _credentialManager = credentialManager; 
     if (_manualActions == null)
     {
         _manualActions = new CustomerManualActionManager();
     }
     //Test parameters
     _uploadChunkSizeBytes = uploadChunkSizeBytes;
     _uploadChunkDelaySeconds = uploadChunkDelaySeconds;
 }
    /// <summary>
    /// Constructor
    /// </summary>
    /// <param name="onlineUrls"></param>
    /// <param name="login"></param>
    /// <param name="localUploadPath"></param>
    public UploadDatasources(
        TableauServerUrls onlineUrls, 
        TableauServerSignIn login,
        CredentialManager credentialManager,
        string localUploadPath,
        UploadBehaviorProjects uploadProjectBehavior,
        CustomerManualActionManager manualActions,
        int uploadChunkSizeBytes = TableauServerUrls.UploadFileChunkSize,
        int uploadChunkDelaySeconds = 0)
        : base(login)
    {
        System.Diagnostics.Debug.Assert(uploadChunkSizeBytes > 0, "Chunck size must be positive");

        _onlineUrls = onlineUrls;
        _localUploadPath = localUploadPath;
        _uploadProjectBehavior = uploadProjectBehavior;
        _credentialManager = credentialManager;
        _manualActions = manualActions;
        if(_manualActions == null)
        {
            _manualActions = new CustomerManualActionManager();
        }
        //Test parameters
        _uploadChunkSizeBytes = uploadChunkSizeBytes;
        _uploadChunkDelaySeconds = uploadChunkDelaySeconds;
    }
示例#9
0
    /// <summary>
    /// Called to perform Uploads of the workbooks
    /// </summary>
    /// <param name="onlineLogin"></param>
    /// <param name="localBasePath"></param>
    /// <param name="remapWorkbookReferences">TRUE is we want to transform workbooks to remap any published datasources to the new server/site we are uploading to</param>
    /// <param name="credentialManager">Database credentials to associate with content we are uploading</param>
    private void Execute_UploadWorkbooks(
        TableauServerSignIn onlineLogin,
        string localBasePath,
        bool remapWorkbookReferences,
        CredentialManager credentialManager)
    {
        StatusLog.AddStatusHeader("Upload workbooks");

        if (string.IsNullOrWhiteSpace(localBasePath))
        {
            _statusLog.AddError("Abort uploads. Local path is not specified");
            return;
        }

        string pathWorkbooks = Path.Combine(localBasePath, "workbooks");

        if (!Directory.Exists(pathWorkbooks))
        {
            _statusLog.AddStatus("Skipping workbooks upload. Local workbooks path does not exist: \"" + pathWorkbooks + "\"");
            return;
        }

        //Do we have a directory to perform remapping
        string pathRemappingTempspace = Path.Combine(localBasePath, "_remapTempspace");

        if (!Directory.Exists(pathRemappingTempspace))
        {
            Directory.CreateDirectory(pathRemappingTempspace);
        }


        //Upload all the files
        var uploadProjectBehavior = new UploadBehaviorProjects(
            _taskOptions.IsOptionSet(TaskMasterOptions.Option_UploadCreateNeededProjects),
            true);

        var dsUploader = new UploadWorkbooks(
            _onlineUrls,
            onlineLogin,
            credentialManager,
            pathWorkbooks,
            remapWorkbookReferences,
            pathRemappingTempspace,
            uploadProjectBehavior,
            _manualActions,
            this.UploadChunksSizeBytes,
            this.UploadChunksDelaySeconds);

        try
        {
            dsUploader.ExecuteRequest();
        }
        catch (Exception exUploader)
        {
            StatusLog.AddError("Aborted upload workbooks. Unexpected error + " + exUploader.Message);
        }
    }
    //    private readonly
    /// <summary>
    /// Constructor
    /// </summary>
    /// <param name="onlineUrls"></param>
    /// <param name="login"></param>
    public ProjectFindCreateHelper(
        TableauServerUrls onlineUrls,
        TableauServerSignIn login,
        UploadBehaviorProjects uploadProjectBehavior)
        : base(login)
    {
        _onlineUrls            = onlineUrls;
        _uploadProjectBehavior = uploadProjectBehavior;

        //Ask server for the list of projects
        var projectsList = new DownloadProjectsList(_onlineUrls, _onlineSession);

        projectsList.ExecuteRequest();
        _projectsList = projectsList;
    }
示例#11
0
    /// <summary>
    /// Called to perform Uploads of the data sources
    /// </summary>
    /// <param name="onlineLogin"></param>
    /// <param name="localBasePath"></param>
    /// <param name="credentialManager">Database credentials that will be associaed with uploaded content</param>
    private void Execute_UploadDatasources(
        TableauServerSignIn onlineLogin,
        string localBasePath,
        CredentialManager credentialManager)
    {
        StatusLog.AddStatusHeader("Upload datasources");

        if (string.IsNullOrWhiteSpace(localBasePath))
        {
            _statusLog.AddError("Abort uploads. Local path is not specified");
            return;
        }

        string pathDataSources = Path.Combine(localBasePath, "datasources");

        if (!Directory.Exists(pathDataSources))
        {
            _statusLog.AddStatus("Skipping datasources upload. Local datasources path does not exist: \"" + pathDataSources + "\"");
            return;
        }

        //Upload all the files
        var uploadProjectBehavior = new UploadBehaviorProjects(
            _taskOptions.IsOptionSet(TaskMasterOptions.Option_UploadCreateNeededProjects),
            true);


        var dsUploader = new UploadDatasources(
            _onlineUrls,
            onlineLogin,
            credentialManager,
            pathDataSources,
            uploadProjectBehavior,
            _manualActions,
            this.UploadChunksSizeBytes,
            this.UploadChunksDelaySeconds);

        try
        {
            dsUploader.ExecuteRequest();
        }
        catch (Exception exUploader)
        {
            StatusLog.AddError("Aborted upload datasources. Unexpected error + " + exUploader.Message);
        }
    }
示例#12
0
    /// <summary>
    /// Called to perform Uploads of the workbooks
    /// </summary>
    /// <param name="onlineLogin"></param>
    /// <param name="localBasePath"></param>
    /// <param name="remapWorkbookReferences">TRUE is we want to transform workbooks to remap any published datasources to the new server/site we are uploading to</param>
    /// <param name="attemptContentOwnershipAssignment">TRUE: Look for content metadata files, and attempt to assign the owner to the published content</param>
    /// <param name="credentialManager">Database credentials to associate with content we are uploading</param>
    /// <param name="siteUsers">Users in site, needed for content ownership remapping</param>
    private void Execute_UploadWorkbooks(
        TableauServerSignIn onlineLogin, 
        string localBasePath, 
        bool remapWorkbookReferences, 
        CredentialManager credentialManager,
        bool attemptContentOwnershipAssignment,
        IEnumerable<SiteUser> siteUsers)
    {
        StatusLog.AddStatusHeader("Upload workbooks");

        if (string.IsNullOrWhiteSpace(localBasePath))
        {
            _statusLog.AddError("Abort uploads. Local path is not specified");
            return;
        }

        string pathWorkbooks = Path.Combine(localBasePath, "workbooks");
        if (!Directory.Exists(pathWorkbooks))
        {
            _statusLog.AddStatus("Skipping workbooks upload. Local workbooks path does not exist: \"" + pathWorkbooks + "\"");
            return;
        }

        //Do we have a directory to perform remapping
        string pathRemappingTempspace = Path.Combine(localBasePath, "_remapTempspace");
        if (!Directory.Exists(pathRemappingTempspace))
        {
            Directory.CreateDirectory(pathRemappingTempspace);
        }

        //Upload all the files
        var uploadProjectBehavior = new UploadBehaviorProjects(
            _taskOptions.IsOptionSet(TaskMasterOptions.Option_UploadCreateNeededProjects),
            true);

        var dsUploader = new UploadWorkbooks(
            _onlineUrls,
            onlineLogin,
            credentialManager,
            pathWorkbooks,
            remapWorkbookReferences,
            pathRemappingTempspace,
            uploadProjectBehavior,
            _manualActions,
            attemptContentOwnershipAssignment,
            siteUsers,
            this.UploadChunksSizeBytes,
            this.UploadChunksDelaySeconds
            );
        try
        {
            dsUploader.ExecuteRequest();
        }
        catch (Exception exUploader)
        {
            StatusLog.AddError("Aborted upload workbooks. Unexpected error + " + exUploader.Message);
        }
    }
示例#13
0
    /// <summary>
    /// Called to perform Uploads of the data sources
    /// </summary>
    /// <param name="onlineLogin"></param>
    /// <param name="localBasePath"></param>
    /// <param name="credentialManager">Database credentials that will be associaed with uploaded content</param>
    private void Execute_UploadDatasources(
        TableauServerSignIn onlineLogin, 
        string localBasePath,
        CredentialManager credentialManager)
    {
        StatusLog.AddStatusHeader("Upload datasources");

        if (string.IsNullOrWhiteSpace(localBasePath))
        {
            _statusLog.AddError("Abort uploads. Local path is not specified");
            return;
        }

        string pathDataSources = Path.Combine(localBasePath, "datasources");
        if(!Directory.Exists(pathDataSources))
        {
            _statusLog.AddStatus("Skipping datasources upload. Local datasources path does not exist: \"" + pathDataSources+ "\"");
            return;
        }

        //Upload all the files
        var uploadProjectBehavior = new UploadBehaviorProjects(
            _taskOptions.IsOptionSet(TaskMasterOptions.Option_UploadCreateNeededProjects), 
            true);


        var dsUploader = new UploadDatasources(
            _onlineUrls, 
            onlineLogin,
            credentialManager,
            pathDataSources, 
            uploadProjectBehavior, 
            _manualActions,
            this.UploadChunksSizeBytes,
            this.UploadChunksDelaySeconds);
        try
        {
            dsUploader.ExecuteRequest();
        }
        catch(Exception exUploader)
        {
            StatusLog.AddError("Aborted upload datasources. Unexpected error + " + exUploader.Message);
        }
    }