IProductionManagerGetProducedProductionsFromDocumentsAsync Method (Int32, String, Boolean)

Relativity.Productions.API
Retrieves a list of ProductionSlim of all produced productions based on the database token corresponding to a mass action. The key-value set is: [{ "DateProduced": DateTime} , { "BeginBates": String } , { "EndBates": String }]

Namespace:  Relativity.Productions.Services
Assembly:  Relativity.Productions.Services.Interfaces (in Relativity.Productions.Services.Interfaces.dll) Version: 11.1.0.1 9c084404c128f715df772c7792aa49f21535523c
Syntax

Task<List<ProductionSlim>> GetProducedProductionsFromDocumentsAsync(
	int workspaceArtifactID,
	string databaseToken,
	bool excludeNonReproducible
)

Parameters

workspaceArtifactID
Type: SystemInt32
Workspace Artifact ID.
databaseToken
Type: SystemString
Unique identifier representing the database token.
excludeNonReproducible
Type: SystemBoolean
If true, only productions that can be reproduced will be returned.

Return Value

Type: TaskListProductionSlim
Examples

GetProducedProductionsFromMassOpDatabaseToken_Example
using Relativity.Services.ServiceProxy;
using Relativity.Productions.Services;
using Relativity.Services.Exceptions;

public partial class Example
{
    public async Task GetProducedProductionsFromDocumentIds_Example()
    {
        int workspaceId = 12345;         // Workspace Productions exist in
        int documentId1 = 123;           // Document1's ArtifactID
        int documentId2 = 456;           // Document2's ArtifactID
        int documentId3 = 789;           // Document3's ArtifactID

        var userEmail = "user@test.com";  // User's login
        var password = "abc123456!";     // User's password

        var relativityServicesUri = "http://localhost/relativity.services";
        var relativityRestUri = "http://localhost/relativity.rest/api";

        var usernamePasswordCredentials = new UsernamePasswordCredentials(userEmail, password);
        ServiceFactorySettings settings = new ServiceFactorySettings(new Uri(relativityServicesUri), new Uri(relativityRestUri), usernamePasswordCredentials);
        ServiceFactory serviceFactory = new ServiceFactory(settings);

        using (IProductionManager productionManager = serviceFactory.CreateProxy<IProductionManager>())
        {
            try
            {
                List<int> documentIds = new List<int>
                {
                    documentId1,
                    documentId2,
                    documentId3
                };

                //This list contains every produced production that contains at least one of the above documents.
                List<ProductionSlim> producedProductions = await productionManager.GetProducedProductionsFromDocumentsAsync(workspaceId, documentIds);

                foreach (ProductionSlim producedProduction in producedProductions)
                {
                    Console.WriteLine($"This is the artifactId of the produced production: {producedProduction.ArtifactID}");
                    Console.WriteLine($"This is the name of the produced production: {producedProduction.Name}");
                    Console.WriteLine($"This is the first bates value of the produced production: {producedProduction.FieldValues["BeginBates"]}");
                    Console.WriteLine($"This is the last bates value of the produced production: {producedProduction.FieldValues["EndBates"]}");
                    Console.WriteLine($"This is the date produced of the produced production: {producedProduction.FieldValues["DateProduced"]}");
                }
            }
            catch (ValidationException e)
            {
                // Log validation exception details
                Console.WriteLine("There were validation errors: {0}", e.Message);
            }
            catch (ServiceException es)
            {
                // Log service exception details
                Console.WriteLine("There were errors: {0}", es.Message);
            }
        }
    }

    public async Task GetProducedProductionsFromDocumentIds_ExcludeNonReproducible_Example()
    {
        int workspaceId = 12345;         // Workspace Productions exist in
        int documentId1 = 123;           // Document1's ArtifactID
        int documentId2 = 456;           // Document2's ArtifactID
        int documentId3 = 789;           // Document3's ArtifactID

        var userEmail = "user@test.com";  // User's login
        var password = "abc123456!";     // User's password

        var relativityServicesUri = "http://localhost/relativity.services";
        var relativityRestUri = "http://localhost/relativity.rest/api";

        var usernamePasswordCredentials = new UsernamePasswordCredentials(userEmail, password);
        ServiceFactorySettings settings = new ServiceFactorySettings(new Uri(relativityServicesUri), new Uri(relativityRestUri), usernamePasswordCredentials);
        ServiceFactory serviceFactory = new ServiceFactory(settings);

        using (IProductionManager productionManager = serviceFactory.CreateProxy<IProductionManager>())
        {
            try
            {
                List<int> documentIds = new List<int>
                {
                    documentId1,
                    documentId2,
                    documentId3
                };

                //This list contains every produced production that contains at least one of the above documents, and can be re-produced.
                List<ProductionSlim> producedProductions = await productionManager.GetProducedProductionsFromDocumentsAsync(workspaceId, documentIds, true);

                foreach (ProductionSlim producedProduction in producedProductions)
                {
                    Console.WriteLine($"This is the artifactId of the produced production: {producedProduction.ArtifactID}");
                    Console.WriteLine($"This is the name of the produced production: {producedProduction.Name}");
                    Console.WriteLine($"This is the first bates value of the produced production: {producedProduction.FieldValues["BeginBates"]}");
                    Console.WriteLine($"This is the last bates value of the produced production: {producedProduction.FieldValues["EndBates"]}");
                    Console.WriteLine($"This is the date produced of the produced production: {producedProduction.FieldValues["DateProduced"]}");
                }
            }
            catch (ValidationException e)
            {
                // Log validation exception details
                Console.WriteLine("There were validation errors: {0}", e.Message);
            }
            catch (ServiceException es)
            {
                // Log service exception details
                Console.WriteLine("There were errors: {0}", es.Message);
            }
        }
    }

    /// <summary>
    /// Use this example if you are interested in creating a custom mass operation on the document object involving produced productions.
    /// A primer on custom mass operations: When a user selects documents and presses the custom mass operation button, a database token will
    /// be generated, corresponding to a table in the database that holds all of the selected documents. This API is designed to be used
    /// for these scenarios to avoid a second server trip to retrieve the requested documentIds of the custom mass operation.
    /// </summary>
    /// <returns></returns>
    public async Task GetProducedProductionsFromMassOpDatabaseToken_Example()
    {
        int workspaceId = 12345;                              // Workspace Productions exist in
        string databaseToken = "D6F3A251-2B5F-483E-B245-E9E7D5FC9560";       // Database Token retrieved from mass operation.

        var userEmail = "user@test.com";  // User's login
        var password = "abc123456!";     // User's password

        var relativityServicesUri = "http://localhost/relativity.services";
        var relativityRestUri = "http://localhost/relativity.rest/api";

        var usernamePasswordCredentials = new UsernamePasswordCredentials(userEmail, password);
        ServiceFactorySettings settings = new ServiceFactorySettings(new Uri(relativityServicesUri), new Uri(relativityRestUri), usernamePasswordCredentials);
        ServiceFactory serviceFactory = new ServiceFactory(settings);

        using (IProductionManager productionManager = serviceFactory.CreateProxy<IProductionManager>())
        {
            try
            {
                //This list contains every produced production that contains at least of the above documents.
                List<ProductionSlim> producedProductions = await productionManager.GetProducedProductionsFromDocumentsAsync(workspaceId, databaseToken);

                foreach (ProductionSlim producedProduction in producedProductions)
                {
                    Console.WriteLine($"This is the artifactId of the produced production: {producedProduction.ArtifactID}");
                    Console.WriteLine($"This is the name of the produced production: {producedProduction.Name}");
                    Console.WriteLine($"This is the first bates value of the produced production: {producedProduction.FieldValues["BeginBates"]}");
                    Console.WriteLine($"This is the last bates value of the produced production: {producedProduction.FieldValues["EndBates"]}");
                    Console.WriteLine($"This is the date produced of the produced production: {producedProduction.FieldValues["DateProduced"]}");
                }
            }
            catch (ValidationException e)
            {
                // Log validation exception details
                Console.WriteLine("There were validation errors: {0}", e.Message);
            }
            catch (ServiceException es)
            {
                // Log service exception details
                Console.WriteLine("There were errors: {0}", es.Message);
            }
        }
    }

    /// <summary>
    /// Use this example if you are interested in creating a custom mass operation on the document object involving produced productions.
    /// A primer on custom mass operations: When a user selects documents and presses the custom mass operation button, a database token will
    /// be generated, corresponding to a table in the database that holds all of the selected documents. This API is designed to be used
    /// for these scenarios to avoid a second server trip to retrieve the requested documentIds of the custom mass operation.
    /// </summary>
    /// <returns></returns>
    public async Task GetProducedProductionsFromMassOpDatabaseToken_ExcludeNonReproducible_Example()
    {
        int workspaceId = 12345;                              // Workspace Productions exist in
        string databaseToken = "D6F3A251-2B5F-483E-B245-E9E7D5FC9560";       // Database Token retrieved from mass operation.

        var userEmail = "user@test.com";  // User's login
        var password = "abc123456!";     // User's password

        var relativityServicesUri = "http://localhost/relativity.services";
        var relativityRestUri = "http://localhost/relativity.rest/api";

        var usernamePasswordCredentials = new UsernamePasswordCredentials(userEmail, password);
        ServiceFactorySettings settings = new ServiceFactorySettings(new Uri(relativityServicesUri), new Uri(relativityRestUri), usernamePasswordCredentials);
        ServiceFactory serviceFactory = new ServiceFactory(settings);

        using (IProductionManager productionManager = serviceFactory.CreateProxy<IProductionManager>())
        {
            try
            {
                //This list contains every produced production that contains at least of the above documents, and can be re-produced.
                List<ProductionSlim> producedProductions = await productionManager.GetProducedProductionsFromDocumentsAsync(workspaceId, databaseToken, true);

                foreach (ProductionSlim producedProduction in producedProductions)
                {
                    Console.WriteLine($"This is the artifactId of the produced production: {producedProduction.ArtifactID}");
                    Console.WriteLine($"This is the name of the produced production: {producedProduction.Name}");
                    Console.WriteLine($"This is the first bates value of the produced production: {producedProduction.FieldValues["BeginBates"]}");
                    Console.WriteLine($"This is the last bates value of the produced production: {producedProduction.FieldValues["EndBates"]}");
                    Console.WriteLine($"This is the date produced of the produced production: {producedProduction.FieldValues["DateProduced"]}");
                }
            }
            catch (ValidationException e)
            {
                // Log validation exception details
                Console.WriteLine("There were validation errors: {0}", e.Message);
            }
            catch (ServiceException es)
            {
                // Log service exception details
                Console.WriteLine("There were errors: {0}", es.Message);
            }
        }
    }
}
See Also

Reference