public static async Task StageProductionAsync(HttpClient httpClient, int productionId, int workspaceId) { try { string url = $"/Relativity.REST/api/Relativity.Productions.Services.IProductionModule/Production%20Manager/StageProductionAsync"; ProductionStageRequest productionStageRequest = new ProductionStageRequest() { productionArtifactId = productionId, workspaceArtifactId = workspaceId }; string request = JsonConvert.SerializeObject(productionStageRequest); Console2.WriteDisplayStartLine("Staging Production"); HttpResponseMessage response = RESTConnectionManager.MakePost(httpClient, url, request); string result = await response.Content.ReadAsStringAsync(); bool success = HttpStatusCode.OK == response.StatusCode; if (!success) { throw new Exception("Failed to stage production set."); } Console2.WriteDisplayEndLine("Staged Production!"); } catch (Exception ex) { throw new Exception("An error occured when Staging Production", ex); } }
public static async Task BuildDtSearchIndexAsync(HttpClient httpClient, int workspaceId, int dtSearchIndexId) { try { string url = $"Relativity.Rest/API/Relativity.DtSearchIndexes/workspace/{workspaceId}/dtsearchindexes/{dtSearchIndexId}/fullBuildIndex"; BuilddtSearchIndexRequest buildDtSearchIndexRequest = new BuilddtSearchIndexRequest { isActive = true }; string request = JsonConvert.SerializeObject(buildDtSearchIndexRequest); Console2.WriteDisplayStartLine("Building DtSearch Index"); HttpResponseMessage response = RESTConnectionManager.MakePost(httpClient, url, request); string result = await response.Content.ReadAsStringAsync(); bool success = HttpStatusCode.OK == response.StatusCode; if (!success) { throw new Exception("Failed to Build dtSearch Index"); } Console2.WriteDisplayEndLine("Built DtSearch Index!"); } catch (Exception ex) { throw new Exception("An error occured when building DtSearch Index", ex); } }
public static async Task RunProductionAsync(HttpClient httpClient, int productionId, int workspaceId) { try { Console2.WriteDisplayStartLine("Running Production"); string url = $"/Relativity.REST/api/Relativity.Productions.Services.IProductionModule/Production%20Manager/RunProductionAsync"; ProductionRunRequest runProductionRequest = new ProductionRunRequest() { workspaceArtifactID = workspaceId, overrideConflicts = true, productionArtifactID = productionId, suppressWarnings = true }; string request = JsonConvert.SerializeObject(runProductionRequest); HttpResponseMessage response = RESTConnectionManager.MakePost(httpClient, url, request); string result = await response.Content.ReadAsStringAsync(); bool success = HttpStatusCode.OK == response.StatusCode; if (!success) { throw new Exception("Failed to run production set."); } Console2.WriteDisplayEndLine("Ran Production!"); } catch (Exception ex) { throw new Exception("An error occured when Running Production", ex); } }
public static async Task PublishJobAsync(HttpClient httpClient, int processingSetId, int workspaceId) { try { string url = "Relativity.REST/api/Relativity.Processing.Services.IProcessingModule/Processing Job Manager/SubmitPublishJobsAsync"; PublishJobRequest publishJobRequest = new PublishJobRequest { PublishJob = new Publishjob { ProcessingSetId = processingSetId, WorkspaceArtifactId = workspaceId } }; string request = JsonConvert.SerializeObject(publishJobRequest); Console2.WriteDisplayStartLine("Starting Publish Job"); HttpResponseMessage response = RESTConnectionManager.MakePost(httpClient, url, request); string result = await response.Content.ReadAsStringAsync(); bool success = HttpStatusCode.OK == response.StatusCode; if (!success) { throw new Exception("Failed to Start Publish Job"); } Console2.WriteDisplayEndLine("Started Publish Job!"); } catch (Exception ex) { throw new Exception("An error occured when staring Processing Publish Job", ex); } }
public static async Task RunImagingJobAsync(HttpClient httpClient, int imagingSetId, int workspaceArtifactId) { try { string url = "Relativity.REST/api/Relativity.Imaging.Services.Interfaces.IImagingModule/Imaging Job Service/RunImagingSetAsync"; RunImagingJobRequest runImagingJobRequest = new RunImagingJobRequest { imagingJob = new Imagingjob { imagingSetId = imagingSetId, workspaceId = workspaceArtifactId } }; string request = JsonConvert.SerializeObject(runImagingJobRequest); Console2.WriteDisplayStartLine("Creating Imaging Job"); HttpResponseMessage response = RESTConnectionManager.MakePost(httpClient, url, request); string result = await response.Content.ReadAsStringAsync(); bool success = HttpStatusCode.OK == response.StatusCode; if (!success) { throw new Exception("Failed to Run Imaging Job"); } Console2.WriteDisplayEndLine("Created Imaging Job!"); } catch (Exception ex) { throw new Exception("An error occured when running Imaging Job", ex); } }
public static async Task CreateResponsiveFieldAsync(HttpClient httpClient, int workspaceId) { try { string url = $"Relativity.REST/Workspace/{workspaceId}/Field"; CreateResponsiveFieldRequest createResponsiveFieldRequest = new CreateResponsiveFieldRequest { ArtifactTypeName = "Field", Name = Constants.Workspace.ResponsiveField.Name, ParentArtifact = new ParentArtifact { ArtifactID = workspaceId }, ObjectType = new ObjectType { DescriptorArtifactTypeID = Constants.DOCUMENT_ARTIFACT_TYPE }, FieldTypeID = (int)Constants.Workspace.ResponsiveField.FIELD_TYPE_ID, IsRequired = Constants.Workspace.ResponsiveField.IS_REQUIRED, OpenToAssociations = Constants.Workspace.ResponsiveField.OPEN_TO_ASSOCIATIONS, Linked = Constants.Workspace.ResponsiveField.LINKED, AllowSortTally = Constants.Workspace.ResponsiveField.ALLOW_SORT_TALLY, Wrapping = Constants.Workspace.ResponsiveField.WRAPPING, AllowGroupBy = Constants.Workspace.ResponsiveField.ALLOW_GROUP_BY, AllowPivot = Constants.Workspace.ResponsiveField.ALLOW_PIVOT, Width = 123, IgnoreWarnings = Constants.Workspace.ResponsiveField.IGNORE_WARNINGS, NoValue = Constants.Workspace.ResponsiveField.NO_VALUE, YesValue = Constants.Workspace.ResponsiveField.YES_VALUE }; string request = JsonConvert.SerializeObject(createResponsiveFieldRequest); Console2.WriteDisplayStartLine($"Creating Responsive Field"); HttpResponseMessage response = RESTConnectionManager.MakePost(httpClient, url, request); string result = await response.Content.ReadAsStringAsync(); bool success = (HttpStatusCode.OK == response.StatusCode) || (HttpStatusCode.Created == response.StatusCode); if (!success) { throw new Exception("Failed to Create Responsive field"); } JObject resultObject = JObject.Parse(result); if (!resultObject["Results"][0]["Success"].Value <bool>()) { throw new Exception("Failed to Create Responsive field"); } int responsiveFieldArtifactId = resultObject["Results"][0]["ArtifactID"].Value <int>(); Console2.WriteDebugLine($"Responsive Field ArtifactId: {responsiveFieldArtifactId}"); Console2.WriteDisplayEndLine("Created Responsive Field!"); } catch (Exception ex) { throw new Exception("An error occurred when creating the Responsive field", ex); } }
public static async Task <bool> JobCompletedSuccessfullyAsync(HttpClient httpClient, int workspaceId, int imagingSetId) { bool jobComplete = false; const int maxTimeInMilliseconds = (Constants.Waiting.MAX_WAIT_TIME_IN_MINUTES * 60 * 1000); const int sleepTimeInMilliSeconds = Constants.Waiting.SLEEP_TIME_IN_SECONDS * 1000; int currentWaitTimeInMilliseconds = 0; Guid fieldGuid = Constants.Guids.Fields.ImagingSet.Status; string url = $"Relativity.REST/api/Relativity.Objects/workspace/{workspaceId}/object/read"; ReadRequest readRequest = new ReadRequest { Request = new request { Object = new Models.RDO.Object { ArtifactID = imagingSetId }, Fields = new[] { new field { Guid = fieldGuid.ToString() } } } }; string request = JsonConvert.SerializeObject(readRequest); try { while (currentWaitTimeInMilliseconds < maxTimeInMilliseconds && jobComplete == false) { Thread.Sleep(sleepTimeInMilliSeconds); HttpResponseMessage response = RESTConnectionManager.MakePost(httpClient, url, request); string result = await response.Content.ReadAsStringAsync(); bool success = HttpStatusCode.OK == response.StatusCode; if (!success) { throw new Exception("Failed to Check if the Job is Complete."); } JObject resultObject = JObject.Parse(result); jobComplete = resultObject["Object"]["FieldValues"][0]["Value"].Value <string>().Contains("Complete"); currentWaitTimeInMilliseconds += sleepTimeInMilliSeconds; } return(jobComplete); } catch (Exception ex) { throw new Exception($@"Error Checking for Imaging Job Completion: {ex.ToString()}"); } }
public static async Task AddProductionDataSourceAsync(HttpClient httpClient, int productionId, int workspaceId, int savedSearchArtifactId) { try { string url = $"/Relativity.REST/api/Relativity.Productions.Services.IProductionModule/Production%20Data%20Source%20Manager/CreateSingleAsync"; ProductionDataSourceObject productionDataSourceObject = new ProductionDataSourceObject { dataSource = new Datasource() { ProductionType = Constants.Production.DataSource.PRODUCTION_TYPE_AS_STRING, SavedSearch = new Savedsearch() { ArtifactID = savedSearchArtifactId }, Name = Constants.Production.DataSource.Name, MarkupSet = new Markupset(), BurnRedactions = Constants.Production.DataSource.BURN_REDACTIONS, UseImagePlaceholder = Constants.Production.DataSource.USE_IMAGE_PLACEHOLDER_AS_STRING, PlaceHolder = new ProductionPlaceholderRef() }, workspaceArtifactID = workspaceId, productionID = productionId, }; string request = JsonConvert.SerializeObject(productionDataSourceObject); Console2.WriteDisplayStartLine($"Creating Production Data Source [Name: {Constants.Production.DataSource.Name}]"); HttpResponseMessage response = RESTConnectionManager.MakePost(httpClient, url, request); string result = await response.Content.ReadAsStringAsync(); bool success = HttpStatusCode.OK == response.StatusCode; if (!success) { throw new Exception("Failed to create production data source."); } int dataSourceArtifactId = Int32.Parse(result); if (dataSourceArtifactId != 0) { Console2.WriteDebugLine($"Production Data Source ArtifactId: {dataSourceArtifactId}"); Console2.WriteDisplayEndLine("Created Production Data Source!"); } else { throw new Exception("Failed to create Production Data Source"); } } catch (Exception ex) { throw new Exception("An error occured when creating Production Data Source", ex); } }
public static async Task <int> CreateDtSearchIndexAsync(HttpClient httpClient, int workspaceId, int keywordSearchArtifactId) { try { int indexShareLocationId = await GetIndexShareLocationIdAsync(httpClient, workspaceId); string url = $"Relativity.REST/api/Relativity.DtSearchIndexes/workspace/{workspaceId}/dtsearchindexes/"; DtSearchIndexSaveRequest dtSearchIndexSaveRequest = new DtSearchIndexSaveRequest { dtSearchIndexRequest = new DtSearchIndexRequest { Name = Constants.Search.DtSearchIndex.NAME, Order = Constants.Search.DtSearchIndex.ORDER, SearchSearchID = keywordSearchArtifactId, RecognizeDates = Constants.Search.DtSearchIndex.RECOGNIZE_DATES, SkipNumericValues = Constants.Search.DtSearchIndex.SKIP_NUMERIC_VALUES, IndexShareCodeArtifactID = indexShareLocationId, EmailAddress = Constants.Search.DtSearchIndex.EMAIL_ADDRESS, NoiseWords = Constants.Search.DtSearchIndex.NOISE_WORDS, AlphabetText = Constants.Search.DtSearchIndex.ALPHABET_TEXT, DirtySettings = Constants.Search.DtSearchIndex.DIRTY_SETTINGS, SubIndexSize = Constants.Search.DtSearchIndex.SUB_INDEX_SIZE, FragmentationThreshold = Constants.Search.DtSearchIndex.FRAGMENTATION_THRESHOLD, Priority = Constants.Search.DtSearchIndex.PRIORITY } }; string request = JsonConvert.SerializeObject(dtSearchIndexSaveRequest); Console2.WriteDisplayStartLine("Creating DtSearch Index"); HttpResponseMessage response = RESTConnectionManager.MakePost(httpClient, url, request); string result = await response.Content.ReadAsStringAsync(); bool success = HttpStatusCode.OK == response.StatusCode; if (!success) { throw new Exception("Failed to Create dtSearch Index"); } int dtSearchIndexArtifactId = Int32.Parse(result); Console2.WriteDebugLine($"DtSearch Index ArtifactId: {dtSearchIndexArtifactId}"); Console2.WriteDisplayEndLine("Created DtSearch Index!"); return(dtSearchIndexArtifactId); } catch (Exception ex) { throw new Exception("An error occured when creating DtSearch Index", ex); } }
public static async Task CreateProcessingDataSourceAsync(HttpClient httpClient, int processingSetArtifactId, int custodianArtifactId, int timeZoneArtifactId, int destinationFolderArtifactId, int workspaceId) { try { string url = "Relativity.REST/api/Relativity.Processing.Services.IProcessingModule/Processing Data Source Manager/SaveAsync"; ProcessingDataSourceSaveRequest processingDataSourceSaveRequest = new ProcessingDataSourceSaveRequest { processingDataSource = new Processingdatasource { ProcessingSet = new ProcessingSet { ArtifactID = processingSetArtifactId }, Custodian = custodianArtifactId, DestinationFolder = destinationFolderArtifactId, DocumentNumberingPrefix = Constants.Processing.DataSource.DOCUMENT_NUMBERING_PREFIX, InputPath = Constants.Processing.DataSource.INPUT_PATH, Name = Constants.Processing.DataSource.NAME, OcrLanguages = new[] { "English" }, Order = Constants.Processing.DataSource.ORDER, TimeZone = timeZoneArtifactId, StartNumber = Constants.Processing.DataSource.START_NUMBER, IsStartNumberVisible = Constants.Processing.DataSource.IS_START_NUMBER_VISIBLE }, workspaceArtifactId = workspaceId }; string request = JsonConvert.SerializeObject(processingDataSourceSaveRequest); Console2.WriteDisplayStartLine($"Creating Processing Data Source [Name: {Constants.Processing.DataSource.NAME}]"); HttpResponseMessage response = RESTConnectionManager.MakePost(httpClient, url, request); string result = await response.Content.ReadAsStringAsync(); bool success = HttpStatusCode.OK == response.StatusCode; if (!success) { throw new Exception("Failed to Create Processing Data Source"); } int processingDataSourceArtifactId = Int32.Parse(result); Console2.WriteDebugLine($"Processing Data Source ArtifactId: {processingDataSourceArtifactId}"); Console2.WriteDisplayEndLine("Created Processing Data Source!"); } catch (Exception ex) { throw new Exception("An error occured when creating Processing Data Source", ex); } }
public static async Task <int> CreateImagingProfileAsync(HttpClient httpClient, int workspaceArtifactId) { try { string url = "Relativity.REST/api/Relativity.Imaging.Services.Interfaces.IImagingModule/Imaging Profile Service/SaveAsync"; ImagingProfileSaveRequest imagingProfileSaveRequest = new ImagingProfileSaveRequest { imagingProfile = new Imagingprofile { BasicOptions = new Basicoptions { ImageOutputDpi = Constants.Imaging.Profile.IMAGE_OUTPUT_DPI, BasicImageFormat = Constants.Imaging.Profile.BASIC_IMAGE_FORMAT_AS_STRING, ImageSize = Constants.Imaging.Profile.IMAGE_SIZE_AS_STRING }, Name = Constants.Imaging.Profile.NAME, ImagingMethod = Constants.Imaging.Profile.IMAGING_METHOD_AS_STRING }, workspaceId = workspaceArtifactId }; string request = JsonConvert.SerializeObject(imagingProfileSaveRequest); Console2.WriteDisplayStartLine($"Creating Imaging Profile [Name: {Constants.Imaging.Profile.NAME}]"); HttpResponseMessage response = RESTConnectionManager.MakePost(httpClient, url, request); string result = await response.Content.ReadAsStringAsync(); bool success = HttpStatusCode.OK == response.StatusCode; if (!success) { throw new Exception("Failed to Create Imaging Profile"); } int imagingProfileArtifactId = Int32.Parse(result); Console2.WriteDebugLine($"Imaging Profile ArtifactId: {imagingProfileArtifactId}"); Console2.WriteDisplayEndLine("Created Imaging Profile!"); return(imagingProfileArtifactId); } catch (Exception ex) { throw new Exception("An error occured when creating Imaging Profile", ex); } }
public static async Task <int> CreateImagingSetAsync(HttpClient httpClient, int savedSearchArtifactId, int imagingProfileId, int workspaceArtifactId) { try { string url = "Relativity.REST/api/Relativity.Imaging.Services.Interfaces.IImagingModule/Imaging Set Service/SaveAsync"; ImagingSetSaveRequest imagingSetSaveRequest = new ImagingSetSaveRequest { imagingSet = new Imagingset { DataSource = savedSearchArtifactId, Name = Constants.Imaging.Set.NAME, ImagingProfile = new ImagingProfile { ArtifactID = imagingProfileId }, EmailNotificationRecipients = Constants.Imaging.Set.EMAIL_NOTIFICATION_RECIPIENTS }, workspaceId = workspaceArtifactId }; string request = JsonConvert.SerializeObject(imagingSetSaveRequest); Console2.WriteDisplayStartLine($"Creating Imaging Set [Name: {Constants.Imaging.Set.NAME}]"); HttpResponseMessage response = RESTConnectionManager.MakePost(httpClient, url, request); string result = await response.Content.ReadAsStringAsync(); bool success = HttpStatusCode.OK == response.StatusCode; if (!success) { throw new Exception("Failed to Create Imaging Set"); } int imagingSetArtifactId = Int32.Parse(result); Console2.WriteDebugLine($"Imaging Set ArtifactId: {imagingSetArtifactId}"); Console2.WriteDisplayEndLine("Created Imaging Set!"); return(imagingSetArtifactId); } catch (Exception ex) { throw new Exception("An error occured when creating Imaging Set", ex); } }
public static async Task <int> CreateProcessingSetAsync(HttpClient httpClient, int processingProfileArtifactId, int workspaceId) { try { string url = "Relativity.REST/api/Relativity.Processing.Services.IProcessingModule/Processing Set Manager/SaveAsync"; ProcessingSetSaveRequest processingSetSaveRequest = new ProcessingSetSaveRequest { ProcessingSet = new Processingset { Name = Constants.Processing.Set.NAME, Profile = new Profile { ArtifactID = processingProfileArtifactId } }, workspaceArtifactId = workspaceId }; string request = JsonConvert.SerializeObject(processingSetSaveRequest); Console2.WriteDisplayStartLine($"Creating Processing Set [Name: {Constants.Processing.Set.NAME}]"); HttpResponseMessage response = RESTConnectionManager.MakePost(httpClient, url, request); string result = await response.Content.ReadAsStringAsync(); bool success = HttpStatusCode.OK == response.StatusCode; if (!success) { throw new Exception("Failed to Create Processing Set"); } int processingSetArtifactId = Int32.Parse(result); Console2.WriteDebugLine($"Processing Set ArtifactId: {processingSetArtifactId}"); Console2.WriteDisplayEndLine("Created Processing Set!"); return(processingSetArtifactId); } catch (Exception ex) { throw new Exception("An error occured when creating Processing Set", ex); } }
public static async Task <int> CreateCustodianAsync(HttpClient httpClient, int workspaceId) { try { string url = "Relativity.REST/api/Relativity.Processing.Services.IProcessingModule/Processing Custodian Manager/SaveAsync"; CustodianSaveRequest custodianSaveRequest = new CustodianSaveRequest { Custodian = new Custodian { DocumentNumberingPrefix = Constants.Processing.Custodian.DOCUMENT_NUMBERING_PREFIX, FirstName = Constants.Processing.Custodian.FIRST_NAME, LastName = Constants.Processing.Custodian.LAST_NAME, CustodianType = "Person" }, workspaceArtifactId = workspaceId }; string request = JsonConvert.SerializeObject(custodianSaveRequest); Console2.WriteDisplayStartLine($"Creating Custodian [FirstName: {Constants.Processing.Custodian.FIRST_NAME}, LastName: {Constants.Processing.Custodian.LAST_NAME}]"); HttpResponseMessage response = RESTConnectionManager.MakePost(httpClient, url, request); string result = await response.Content.ReadAsStringAsync(); bool success = HttpStatusCode.OK == response.StatusCode; if (!success) { throw new Exception("Failed to Create Custodian"); } int custodianArtifactId = Int32.Parse(result); Console2.WriteDebugLine($"Custodian ArtifactId: {custodianArtifactId}"); Console2.WriteDisplayEndLine("Created Custodian!"); return(custodianArtifactId); } catch (Exception ex) { throw new Exception("An error occured when creating Custodian", ex); } }
public static async Task <List <int> > GetDocumentsToTagAsync(HttpClient httpClient, int searchID, int workspaceID) { try { List <int> DocsToTag = new List <int>(); string url = $"/Relativity.REST/Workspace/{workspaceID}/Document/QueryResult"; string fields = "*"; GetDocs docsToTag = new GetDocs() { Condition = $"'ArtifactId' IN SAVEDSEARCH {searchID}", Fields = new string[] { fields } }; string request = JsonConvert.SerializeObject(docsToTag); Console2.WriteDisplayStartLine("Querying documents to Tag"); HttpResponseMessage response = RESTConnectionManager.MakePost(httpClient, url, request); string result = await response.Content.ReadAsStringAsync(); bool success = (HttpStatusCode.OK == response.StatusCode) || (HttpStatusCode.Created == response.StatusCode); if (!success) { throw new Exception("Failed to obtain documents."); } JObject resultObject = JObject.Parse(result); foreach (JToken token in resultObject["Results"]) { DocsToTag.Add(token["Artifact ID"].Value <int>()); } Console2.WriteDisplayEndLine($"Queried documents to Tag [Count: {DocsToTag.Count}]"); return(DocsToTag); } catch (Exception ex) { throw new Exception("An error occurred when Querying for documents to tag", ex); } }
public static async Task <int> GetDefaultFolderArtifactIdAsync(HttpClient httpClient, int workspaceId) { try { string url = $"Relativity.REST/api/Relativity.Objects/workspace/{workspaceId}/object/queryslim"; QueryRequest defaultFolderRequest = new QueryRequest { request = new Request { ObjectType = new Objecttype { ArtifactTypeID = 9 } }, start = 0, length = 100 }; string request = JsonConvert.SerializeObject(defaultFolderRequest); HttpResponseMessage response = RESTConnectionManager.MakePost(httpClient, url, request); string result = await response.Content.ReadAsStringAsync(); bool success = HttpStatusCode.OK == response.StatusCode; if (!success) { throw new Exception("Failed to Query for Default Folder ArtifactId."); } JObject resultObject = JObject.Parse(result); int defaultFolderArtifactId = resultObject["Objects"][0]["ArtifactID"].Value <int>(); return(defaultFolderArtifactId); } catch (Exception ex) { throw new Exception($@"Error getting Default Folder ArtifactId {ex.ToString()}"); } }
public static async Task CheckProductionStatusAsync(HttpClient httpClient, int productionId, int workspaceId) { try { string url = $"/Relativity.REST/api/Relativity.Productions.Services.IProductionModule/Production%20Manager/ReadSingleAsync"; string productionStatus = "Staged"; ReadProductionRequest readProductionRequest = new ReadProductionRequest() { DataSourceReadMode = 0, productionArtifactID = productionId, workspaceArtifactID = workspaceId }; string request = JsonConvert.SerializeObject(readProductionRequest); Console2.WriteDisplayStartLine("Waiting for Production Job to finish"); while (productionStatus != "Produced") { HttpResponseMessage response = RESTConnectionManager.MakePost(httpClient, url, request); string result = await response.Content.ReadAsStringAsync(); bool success = HttpStatusCode.OK == response.StatusCode; if (!success) { throw new Exception("Failed to read production set."); } JToken productionReadResults = JToken.Parse(result); var test2 = productionReadResults["ProductionMetadata"]; productionStatus = test2["Status"].Value <string>(); } Console2.WriteDisplayEndLine("Production Job Complete!"); } catch (Exception ex) { throw new Exception("Production Job failed to Complete", ex); } }
public static async Task <int> CreateProductionAsync(HttpClient httpClient, int workspaceId) { try { string url = $"/Relativity.REST/api/Relativity.Productions.Services.IProductionModule/Production%20Manager/CreateSingleAsync"; Production prodSettings = new Production() { Details = new Details() { BrandingFontSize = Constants.Production.BRANDING_FONT_SIZE, EmailRecipients = "", ScaleBrandingFont = false }, Footers = new Footers() { LeftFooter = new Leftfooter() { Type = "None", Field = new Field1() { ArtifactID = 0, Name = "", ViewFieldID = 0 }, FreeText = "", FriendlyName = "Left Header" } }, Headers = new Headers() { LeftHeader = new Leftheader() { Type = "None", Field = new Field() { ArtifactID = 0, Name = "", ViewFieldID = 0 }, FreeText = "", FriendlyName = "Left Header" } }, Name = Constants.Production.NAME, Numbering = new Numbering() { AttachmentRelationalField = new Attachmentrelationalfield() { ArtifactID = 0, Name = "", ViewFieldID = 0 }, BatesPrefix = Constants.Production.BATES_PREFIX, BatesStartNumber = Constants.Production.BATES_START_NUMBER, BatesSuffix = Constants.Production.BATES_SUFFIX, NumberOfDigitsForDocumentNumbering = Constants.Production.NUMBER_OF_DIGITS_FOR_DOCUMENT_NUMBERING, NumberingType = "PageLevel" }, ShouldCopyInstanceOnWorkspaceCreate = false, SortOrder = "" }; ProductionObject newProduction = new ProductionObject() { Production = prodSettings, workspaceArtifactID = workspaceId }; string request = JsonConvert.SerializeObject(newProduction); Console2.WriteDisplayStartLine($"Creating Production [Name: {Constants.Production.NAME}]"); HttpResponseMessage response = RESTConnectionManager.MakePost(httpClient, url, request); string result = response.Content.ReadAsStringAsync().Result; bool success = HttpStatusCode.OK == response.StatusCode; if (!success) { throw new Exception("Failed to create production set."); } int productionArtifactId = Convert.ToInt32(result); Console2.WriteDebugLine($"Production ArtifactId: {productionArtifactId}"); Console2.WriteDisplayEndLine("Created Production!"); return(productionArtifactId); } catch (Exception ex) { throw new Exception("An error occured when creating Production", ex); } }
public static async Task <int> CreateDtSearchAsync(HttpClient httpClient, int workspaceId, int dtSearchIndexId, string fieldName) { try { string url = "Relativity.REST/api/Relativity.Services.Search.ISearchModule/dtSearch Manager/CreateSingleAsync"; string searchName = Constants.Search.DtSearch.NAME; if (fieldName == Constants.Workspace.EXTRACTED_TEXT_FIELD_NAME) { searchName = Constants.Search.DtSearch.NAME_EXTRACTED_TEXT; } DtSearchSaveRequest dtSearchSaveRequest = new DtSearchSaveRequest { workspaceArtifactID = workspaceId, searchDTO = new searchdto { ArtifactTypeID = 10, Name = searchName, SearchIndex = new searchindex { ArtifactID = dtSearchIndexId, Name = Constants.Search.DtSearchIndex.NAME }, SearchCriteria = new searchcriteria { Conditions = new [] { new condition { condition1 = new condition1 { Operator = "Is Set", ConditionType = "Criteria", FieldIdentifier = new fieldidentifier { Name = fieldName } } }, } }, Fields = new [] { new Fields { Name = "Edit" }, new Fields { Name = "File Icon" }, new Fields { Name = "Control Number" } } } }; string request = JsonConvert.SerializeObject(dtSearchSaveRequest); Console2.WriteDisplayStartLine($"Creating DtSearch for Field [Name: {fieldName}]"); HttpResponseMessage response = RESTConnectionManager.MakePost(httpClient, url, request); string result = await response.Content.ReadAsStringAsync(); bool success = HttpStatusCode.OK == response.StatusCode; if (!success) { throw new Exception("Failed to Create dtSearch"); } int dtSearchArtifactId = Int32.Parse(result); Console2.WriteDebugLine($"DtSearch ArtifactId: {dtSearchArtifactId}"); Console2.WriteDisplayEndLine("Created DtSearch!"); return(dtSearchArtifactId); } catch (Exception ex) { throw new Exception("An error occured when creating DtSearch", ex); } }
public static async Task <int> CreateKeywordSearchAsync(HttpClient httpClient, int workspaceId) { try { string url = "Relativity.REST/api/Relativity.Services.Search.ISearchModule/Keyword Search Manager/CreateSingleAsync"; KeywordSearchCreateRequest keywordSearchCreateRequest = new KeywordSearchCreateRequest { workspaceArtifactID = workspaceId, searchDTO = new Searchdto { ArtifactTypeID = 10, Name = Constants.Search.KeywordSearch.NAME, SearchCriteria = new Searchcriteria { Conditions = new [] { new Condition { condition = new Condition1 { Operator = "Is Set", ConditionType = "Criteria", FieldIdentifier = new Fieldidentifier { Name = Constants.Search.KeywordSearch.CONDITION_FIELD_EXTRACTED_TEXT } } } } }, Fields = new [] { new Field { Name = "Edit" }, new Field { Name = "File Icon" }, new Field { Name = "Control Number" } } } }; string request = JsonConvert.SerializeObject(keywordSearchCreateRequest); Console2.WriteDisplayStartLine("Creating Keyword search for DtSearch Index"); HttpResponseMessage response = RESTConnectionManager.MakePost(httpClient, url, request); string result = await response.Content.ReadAsStringAsync(); bool success = HttpStatusCode.OK == response.StatusCode; if (!success) { throw new Exception("Failed to Create Keyword Search"); } int keywordSearchArtifactId = Int32.Parse(result); Console2.WriteDebugLine($"Keyword Search ArtifactId: {keywordSearchArtifactId}"); Console2.WriteDisplayEndLine("Created Keyword search for DtSearch Index!"); return(keywordSearchArtifactId); } catch (Exception ex) { throw new Exception("An error occured when creating Keyword Search", ex); } }
public static async Task <int> CreateProcessingProfileAsync(HttpClient httpClient, int timeZoneArtifactId, int destinationFolderArtifactId, int workspaceId) { try { string url = "Relativity.REST/api/Relativity.Processing.Services.IProcessingModule/Processing Profile Manager/SaveAsync"; ProcessingProfileSaveRequestStructure processingProfileSaveRequestStructure = new ProcessingProfileSaveRequestStructure { ProcessingProfileSaveRequest = new ProcessingProfileSaveRequest { ProcessingProfile = new ProcessingProfile { Name = Constants.Processing.Profile.NAME, NumberingSettings = new NumberingSettings { DefaultDocumentNumberingPrefix = Constants.Processing.Profile.DEFAULT_DOCUMENT_NUMBERING_PREFIX, NumberofDigits = Constants.Processing.Profile.NUMBER_OF_DIGITS4_AS_STRING, NumberingType = Constants.Processing.Profile.NUMBERING_TYPE_AS_STRING, ParentChildNumbering = Constants.Processing.Profile.PARENT_CHILD_NUMBERING_AS_STRING, Delimiter = Constants.Processing.Profile.DELIMITER, }, DeduplicationSettings = new DeduplicationSettings { DeduplicationMethod = Constants.Processing.Profile.DE_DUPLICATION_METHOD_AS_STRING, PropagateDeduplicationData = Constants.Processing.Profile.PROPAGATE_DE_DUPLICATION_DATA }, ExtractionSettings = new ExtractionSettings { Extractchildren = Constants.Processing.Profile.EXTRACT_CHILDREN, EmailOutput = Constants.Processing.Profile.EMAIL_OUTPUT_AS_STRING, ExcelTextExtractionMethod = Constants.Processing.Profile.EXCEL_TEXT_EXTRACTION_METHOD_AS_STRING, ExcelHeaderFooterExtraction = Constants.Processing.Profile.EXCEL_HEADER_FOOTER_EXTRACTION_AS_STRING, PowerPointTextExtractionMethod = Constants.Processing.Profile.POWER_POINT_TEXT_EXTRACTION_METHOD_AS_STRING, WordTextExtractionMethod = Constants.Processing.Profile.WORD_TEXT_EXTRACTION_METHOD_AS_STRING, OCR = Constants.Processing.Profile.OCR, OCRAccuracy = Constants.Processing.Profile.OCR_ACCURACY_AS_STRING, OCRTextSeparator = Constants.Processing.Profile.OCR_TEXT_SEPARATOR }, InventoryDiscoverSettings = new InventoryDiscoverSettings { DeNIST = Constants.Processing.Profile.DE_NIST, DefaultTimeZoneID = timeZoneArtifactId, DefaultOCRlanguages = Constants.Processing.Profile.DEFAULT_OCR_LANGUAGES }, PublishSettings = new PublishSettings { AutopublishSet = Constants.Processing.Profile.AUTO_PUBLISH_SET, DefaultDestinationFolder = new DefaultDestinationFolder { ArtifactID = destinationFolderArtifactId }, UseSourceFolderStructure = Constants.Processing.Profile.USE_SOURCE_FOLDER_STRUCTURE } }, WorkspaceId = workspaceId } }; string request = JsonConvert.SerializeObject(processingProfileSaveRequestStructure); Console2.WriteDisplayStartLine($"Creating Processing Profile [Name: {Constants.Processing.Profile.NAME}]"); HttpResponseMessage response = RESTConnectionManager.MakePost(httpClient, url, request); string result = await response.Content.ReadAsStringAsync(); bool success = HttpStatusCode.OK == response.StatusCode; if (!success) { throw new Exception("Failed to Create Processing Profile"); } JObject resultObject = JObject.Parse(result); int processingProfileArtifactId = resultObject["ProcessingProfileId"].Value <int>(); Console2.WriteDebugLine($"Processing Profile ArtifactId: {processingProfileArtifactId}"); Console2.WriteDisplayEndLine("Created Processing Profile!"); return(processingProfileArtifactId); } catch (Exception ex) { throw new Exception("An error occured when creating Processing Profile", ex); } }