A client that provides all the methods required to perform Automation operations and REST CRUD operations on an instance of the Nuxeo Server.
Наследование: IDisposable
Пример #1
0
        public BusinessObjects()
        {
            client = new Client(Config.ServerUrl());
            client.AddDefaultSchema("dublincore");

            // populate
            document = (Document)client.DocumentFromPath("/").Post(new Document
            {
                Type = "Folder",
                Name = "bofolder",
                Properties = new Properties { { "dc:title", "Just a folder" } }
            }).Result;
        }
Пример #2
0
        public ContentEnrichers()
        {
            client = new Client(Config.ServerUrl());
            client.AddDefaultSchema("dublincore");

            // populate
            testDocument = (Document)client.DocumentFromPath("/").Post(new Document
            {
                Type = "Folder",
                Name = "folder2",
                Properties = new Properties { { "dc:title", "A Folder 2" } }
            }).Result;
        }
Пример #3
0
        public WorkflowAdapters()
        {
            client = new Client(Config.ServerUrl());
            client.AddDefaultSchema("dublincore");

            // populate
            document = (Document)client.DocumentFromPath("/").Post(new Document
            {
                Type = "File",
                Name = "JustAfile",
                Properties = new Properties { { "dc:title", "Just a file" } }
            }).Result;
        }
Пример #4
0
        public BatchUpload()
        {
            client = new Client(Config.ServerUrl());
            client.AddDefaultSchema("*");

            // populate
            testFolder = (Document)client.DocumentFromPath("/").Post(new Document
            {
                Type = "Folder",
                Name = "TestFolder3",
                Properties = new Properties { { "dc:title", "Upload Test Folder" } }
            }).Result;
        }
Пример #5
0
        public BlobUpload()
        {
            client = new Client(Config.ServerUrl());
            client.AddDefaultSchema("dublincore");

            // populate
            blobsFolder = (Document)client.Operation("Document.Create")
                                                   .SetInput("doc:/")
                                                   .SetParameter("type", "Folder")
                                                   .SetParameter("name", "TestBlobs")
                                                   .SetParameter("properties", new ParamProperties { { "dc:title", "Blob Operations" } })
                                                   .Execute()
                                                   .Result;

            blobContainer = (Document)client.Operation("Document.Create")
                                            .SetInput("doc:" + blobsFolder.Path)
                                            .SetParameter("type", "File")
                                            .SetParameter("name", "MyFileWithPics")
                                            .SetParameter("properties", new ParamProperties { { "dc:title", "My File With Pics" } })
                                            .Execute()
                                            .Result;
        }
Пример #6
0
        public Adapters()
        {
            client = new Client(Config.ServerUrl());
            client.AddDefaultSchema("dublincore");

            // populate
            folder = (Document)client.DocumentFromPath("/").Post(new Document
            {
                Type = "Folder",
                Name = "TestFolder4",
                Properties = new Properties { { "dc:title", "Adapter Tests" } }
            }).Result;
            Assert.NotNull(folder);

            Document document = (Document)client.DocumentFromPath(folder.Path).Post(new Document
            {
                Type = "File",
                Name = "TestFile1",
                Properties = new Properties { { "dc:title", "File 1" } }
            }).Result;
            Assert.NotNull(document);

            document = (Document)client.DocumentFromPath(folder.Path).Post(new Document
            {
                Type = "File",
                Name = "TestFIle2",
                Properties = new Properties { { "dc:title", "File 2" } }
            }).Result;
            Assert.NotNull(document);

            Blob blob = Blob.FromFile("Puppy.docx");
            document = (Document)client.Operation("FileManager.Import")
                                       .SetInput(blob)
                                       .SetContext("currentDocument", folder.Path)
                                       .Execute()
                                       .Result;
        }
Пример #7
0
 /// <summary>
 /// Initializes a new instance of <see cref="Operation"/>.
 /// </summary>
 /// <param name="client">The client through which the operation will be executed.</param>
 /// <param name="id">The operation id.</param>
 public Operation(Client client, string id)
 {
     this.client = client;
     Id = id;
     Input = null;
     Parameters = null;
     Context = null;
     Endpoint = UrlCombiner.Combine(this.client.AutomationPath, Id);
 }
Пример #8
0
 /// <summary>
 /// Initializes a new instance of <see cref="Uploader"/>.
 /// </summary>
 /// <param name="client">The Nuxeo <see cref="Client"/> throw which the upload requests will be made.</param>
 public Uploader(Client client)
 {
     this.client = client;
     semaphore = new SemaphoreSlim(NumConcurrentUploads);
 }
Пример #9
0
 public Marshalling()
 {
     client = new Client(Config.ServerUrl());
     client.AddDefaultSchema("dublincore");
     creationFields = @"[
     {
     ""fieldType"": ""string"",
     ""description"": ""desc field0"",
     ""roles"": [
     ""Decision"",
     ""Score""
     ],
     ""name"": ""field0"",
     ""columnName"": ""col0"",
     ""sqlTypeHint"": ""whatever""
     },
     {
     ""fieldType"": ""string"",
     ""description"": ""desc field1"",
     ""roles"": [
     ""Decision"",
     ""Score""
     ],
     ""name"": ""field1"",
     ""columnName"": ""col1"",
     ""sqlTypeHint"": ""whatever""
     },
     {
     ""fieldType"": ""string"",
     ""description"": ""desc field2"",
     ""roles"": [
     ""Decision"",
     ""Score""
     ],
     ""name"": ""field2"",
     ""columnName"": ""col2"",
     ""sqlTypeHint"": ""whatever""
     },
     {
     ""fieldType"": ""string"",
     ""description"": ""desc field3"",
     ""roles"": [
     ""Decision"",
     ""Score""
     ],
     ""name"": ""field3"",
     ""columnName"": ""col3"",
     ""sqlTypeHint"": ""whatever""
     },
     {
     ""fieldType"": ""string"",
     ""description"": ""desc field4"",
     ""roles"": [
     ""Decision"",
     ""Score""
     ],
     ""name"": ""field4"",
     ""columnName"": ""col4"",
     ""sqlTypeHint"": ""whatever""
     }
     ]";
     updateFields = @"[
     {
     ""fieldType"":""string"",
     ""description"":""desc fieldA"",
     ""name"":""fieldA"",
     ""columnName"":""colA"",
     ""sqlTypeHint"":""whatever""
     },
     {
     ""fieldType"":""string"",
     ""description"":""desc fieldB"",
     ""name"":""fieldB"",
     ""columnName"":""colB"",
     ""sqlTypeHint"":""whatever""
     }
     ]";
 }
Пример #10
0
 public CRUD()
 {
     client = new Client(Config.ServerUrl());
     client.AddDefaultSchema("dublincore");
 }
Пример #11
0
 /// <summary>
 /// Initializes a new instance of <see cref="Marshaller"/>.
 /// </summary>
 /// <param name="client">The client throw which objects are received and sent through.</param>
 public Marshaller(Client client)
 {
     this.client = client;
     businessObjects = new Dictionary<string, Type>();
     entityMap = new Dictionary<string, Type>();
 }
Пример #12
0
        private async System.Threading.Tasks.Task UpdateServerInfo()
        {
            StartProgressRing();
            client = new Client(Properties.Settings.Default.ServerURL,
                                new NuxeoClient.Authorization(Properties.Settings.Default.Username,
                                                              Properties.Settings.Default.Password))
                                                              .AddDefaultSchema("dublincore");

            webClient = new WebClient();
            webClient.Headers[HttpRequestHeader.Authorization] = client.Authorization.GenerateAuthorizationParameter();

            Title = Properties.Settings.Default.ServerURL;

            try
            {
                EntityList<Entity> ents = (EntityList<Entity>)await client.Operation("UserGroup.Suggestion").SetParameter("searchType", "USER_TYPE").Execute();
                userList.Clear();
                foreach (Entity entity in ents)
                {
                    string username = ((UnknowEntity)entity).Json["username"].ToObject<string>();
                    if (username != Properties.Settings.Default.Username)
                    {
                        userList.Add(new UserViewModel(username));
                    }
                }
            }
            catch (Exception ex)
            {
                await DisplayError("Could not get user list", ex);
            }
            StopProgressRing();
        }