Пример #1
0
        public void ExportLinks(string space, string protocol, string qvsCluster, string qvwsMachine, string category, string csvFileName)
        {
            protocol = string.IsNullOrEmpty(protocol) ? "http" : protocol;
            links    = new List <string>();
            try
            {
                if (client != null)
                {
                    ServiceInfo qvs = FindService(client, ServiceTypes.QlikViewServer, qvsCluster.Trim());
                    if (qvs == null)
                    {
                        commSupport.PrintMessage("Could not find QlikView Server", true);
                    }
                    ServiceInfo qvwsService = FindService(client, ServiceTypes.QlikViewWebServer, qvwsMachine.Trim());
                    if (qvwsService == null)
                    {
                        commSupport.PrintMessage("Could not find Qvws", true);
                    }

                    string qvwsUrl = qvwsService.Address.Scheme + "://" + qvwsService.Address.Host;

                    links.Add("Name" + delimiter + "URL" + delimiter + "Description" + delimiter + "Space" + delimiter + "Type" + delimiter + "DateCreated");
                    client.ClearQVSCache(QVSCacheObjects.UserDocumentList);
                    List <DocumentNode>   userDocs       = client.GetUserDocuments(qvs.ID);
                    List <DocumentFolder> userDocFolders = client.GetUserDocumentFolders(qvs.ID, DocumentFolderScope.All);

                    bool filterForCategories = !string.IsNullOrEmpty(category);
                    foreach (DocumentNode userDoc in userDocs)
                    {
                        DocumentFolder docFolder = userDocFolders.FirstOrDefault(x => x.ID.Equals(userDoc.FolderID));
                        string         mountName = string.Empty;
                        if (docFolder != null)
                        {
                            mountName = docFolder.General.Path.ToLower();
                        }
                        if (filterForCategories)
                        {
                            DocumentMetaData dmd = client.GetDocumentMetaData(userDoc, DocumentMetaDataScope.All);
                            if (dmd.DocumentInfo.Category.ToLower().Equals(category.ToLower()))
                            {
                                ComposeDocumentLinkUrl(mountName, userDoc.RelativePath, qvwsUrl, userDoc.Name, qvsCluster, space, "");
                            }
                        }
                        else
                        {
                            ComposeDocumentLinkUrl(mountName, userDoc.RelativePath, qvwsUrl, userDoc.Name, qvsCluster, space, "");
                        }
                    }
                    WriteToCSVFile(csvFileName);
                }
                else
                {
                    commSupport.PrintMessage("Could not create connection to QMS", true);
                }
            }
            catch (Exception e)
            {
                commSupport.PrintMessage("Exception when exporting links, run help command for information about usage: Exeception:" + e.Message, true);
            }
        }
Пример #2
0
 private static void SetUpStartValues()
 {
     client.ClearQVSCache(QVSCacheObjects.UserDocumentList);
     qvsId          = FindServiceId(ServiceTypes.QlikViewServer, qvsCluster);
     qvsSettings    = client.GetQVSSettings(qvsId, QVSSettingsScope.Folders);
     userDocFolders = client.GetUserDocumentFolders(qvsId, DocumentFolderScope.All);
     userDocs       = GetUserDocuments();
 }