public int GetFieldArtifactId(string fieldName, int workspaceId, IServicesMgr svcMgr, ExecutionIdentity identity) { int artifactId; try { using (IRSAPIClient client = svcMgr.CreateProxy <IRSAPIClient>(identity)) { client.APIOptions.WorkspaceID = workspaceId; Query <kCura.Relativity.Client.DTOs.Field> query = new Query <kCura.Relativity.Client.DTOs.Field>(); query.Fields = FieldValue.AllFields; query.Condition = new TextCondition("Name", TextConditionEnum.Like, fieldName); ResultSet <kCura.Relativity.Client.DTOs.Field> results = client.Repositories.Field.Query(query); kCura.Relativity.Client.DTOs.Field fieldArtifact = results.Results.FirstOrDefault().Artifact; artifactId = fieldArtifact.ArtifactID; } } catch (Exception) { //Instead of throwing an exception we want to set the artifactId = 0 artifactId = 0; } return(artifactId); }
/// <summary> /// Generic check to see if the userId has permissions (created to clean up other calls in controller). If the user also needs System Admin access, that is a option here. /// </summary> /// <param name="serviceManager"></param> /// <param name="userId"></param> /// <param name="checkIfAdmin"></param> /// <param name="sourceCall"></param> /// <returns></returns> public async Task <bool> DoesUserHavePermission(IServicesMgr serviceManager, int userId, bool checkIfAdmin, string sourceCall) { bool userExistsInGroup = false; try { userExistsInGroup = await DoesUserExistInGroup(serviceManager, userId, Constants.Group.GroupNameDynamicApi); } catch (Exception ex) { _logHelper.LogError(ex, $"DAPI - {nameof(DoesUserHavePermission)} - {sourceCall} - Error during check on user permissions to the Group ({Constants.Group.GroupNameDynamicApi}). Please ensure the group exists, and that the current OAuth user exists within it."); } bool userIsSystemAdmin = false; if (checkIfAdmin) { try { userIsSystemAdmin = await DoesUserExistInGroup(serviceManager, userId, Constants.Group.GroupNameSystemAdmin); } catch (Exception ex) { _logHelper.LogError(ex, $"DAPI - {nameof(DoesUserHavePermission)} - {sourceCall} - Error during check on user permissions to the Group ({Constants.Group.GroupNameSystemAdmin}). Please ensure the group exists, and that the current OAuth user exists within it."); } } return(userExistsInGroup && (userIsSystemAdmin || !checkIfAdmin)); }
private void LoadVariables() { SelectedObjectType = string.Empty; SvcManager = Helper.GetServicesManager(); Logger = GetLoggerAsync().Result; WorkspaceArtifactId = Helper.GetActiveCaseID(); IdentityCurrentUser = ExecutionIdentity.CurrentUser; IdentitySystem = ExecutionIdentity.System; CurrentArtifactId = ActiveArtifact.ArtifactID; CurrentUserArtifactId = Helper.GetAuthenticationManager().UserInfo.ArtifactID; DbContextEdds = Helper.GetDBContext(-1); DbContext = Helper.GetDBContext(WorkspaceArtifactId); ImportManagerResultsTableName = $"{Constant.Names.TablePrefix}Import_Manager_Results_{Guid.NewGuid()}"; ColObjectType = (ChoiceCollection)ActiveArtifact.Fields[GetArtifactIdByGuid(Constant.Guids.Field.ImportUtilityJob.ObjectType)].Value.Value; //Set the selected Object Type from the record foreach (Choice objectType in ColObjectType) { if (!objectType.IsSelected) { continue; } SelectedObjectType = objectType.Name; break; } ImportUtilityJob = new ImportConsoleJob(SvcManager, DbContextEdds, DbContext, IdentityCurrentUser, IdentitySystem, ArtifactQueries, SqlQueryHelper, Logger, WorkspaceArtifactId, CurrentArtifactId, CurrentUserArtifactId, string.Empty, SelectedObjectType, ImportManagerResultsTableName); }
public String GetExtractorSetNameForArtifactId(IServicesMgr svcMgr, ExecutionIdentity identity, Int32 workspaceArtifactId, Int32 extractorSetArtifactId) { String retVal; var errorContext = String.Format("An error occured when querying for Extractor Set name. [WorkspaceArtifactId: {0}, ExtractorSetArtifactId: {1}]", workspaceArtifactId, extractorSetArtifactId); try { using (var proxy = svcMgr.CreateProxy <IRSAPIClient>(identity)) { proxy.APIOptions.WorkspaceID = workspaceArtifactId; RDO extractorSetRdo; try { extractorSetRdo = proxy.Repositories.RDO.ReadSingle(Convert.ToInt32(extractorSetArtifactId)); } catch (Exception ex) { throw new CustomExceptions.TextExtractorException(errorContext + ". Field ReadSingle failed.", ex); } retVal = extractorSetRdo.TextIdentifier; } } catch (Exception ex) { throw new CustomExceptions.TextExtractorException(errorContext, ex); } return(retVal); }
/// <summary> /// Check to see if passed in credentials via Header Authentication is valid /// </summary> /// <param name="serviceManager"></param> /// <returns></returns> public async Task <string> RequestAuthTokenAsync(IServicesMgr serviceManager) { string retVal = null; using (IRSAPIClient rsapiClient = serviceManager.CreateProxy <IRSAPIClient>(ExecutionIdentity.System)) { try { rsapiClient.APIOptions = new APIOptions { WorkspaceID = -1 }; var readResult = await Task.Run(() => rsapiClient.GenerateRelativityAuthenticationToken(rsapiClient.APIOptions)); if (readResult.Success) { retVal = readResult.Artifact.getFieldByName("AuthenticationToken").ToString(); } else { _logHelper.LogError($"DAPI - {nameof(RequestAuthTokenAsync)} - Unable to receive authorization token"); } } catch (Exception ex) { _logHelper.LogError(ex, $"DAPI - {nameof(RequestAuthTokenAsync)} - Error while requesting authorization token: {ex}"); } } return(retVal); }
public void UpdateDocumentLongTextFieldValue(IServicesMgr svcMgr, ExecutionIdentity identity, Int32 workspaceArtifactId, Int32 documentArtifactId, Guid documentFieldGuid, String fieldValue) { var errorContext = String.Format("An error occured when updating Document TextExtractorDetails field value. [WorkspaceArtifactId: {0}, DocumentArtifactId: {1}]", workspaceArtifactId, documentArtifactId); try { using (var proxy = svcMgr.CreateProxy <IRSAPIClient>(identity)) { proxy.APIOptions.WorkspaceID = workspaceArtifactId; var documentDto = new Document(documentArtifactId); documentDto.Fields.Add(new FieldValue(documentFieldGuid) { Value = fieldValue }); try { proxy.Repositories.Document.UpdateSingle(documentDto); } catch (Exception ex) { throw new CustomExceptions.TextExtractorException(errorContext, ex); } } } catch (Exception ex) { throw new CustomExceptions.TextExtractorException(errorContext, ex); } }
public String GetDocumentIdentifierValue(IServicesMgr svcMgr, ExecutionIdentity identity, Int32 workspaceArtifactId, Int32 documentArtifactId) { var errorContext = String.Format("An error occured when querying for Document identifier value. [WorkspaceArtifactId: {0}, DocumentArtifactId: {1}]", workspaceArtifactId, documentArtifactId); String retVal; try { using (var proxy = svcMgr.CreateProxy <IRSAPIClient>(identity)) { proxy.APIOptions.WorkspaceID = workspaceArtifactId; Document documentRdo; try { documentRdo = proxy.Repositories.Document.ReadSingle(Convert.ToInt32(documentArtifactId)); } catch (Exception ex) { throw new CustomExceptions.TextExtractorException(errorContext + ". Document ReadSingle failed.", ex); } retVal = documentRdo.TextIdentifier; } } catch (Exception ex) { throw new CustomExceptions.TextExtractorException(errorContext, ex); } return(retVal); }
public RsapiDao(IServicesMgr servicesManager, int workspaceId, ExecutionIdentity executionIdentity, InvokeWithRetrySettings invokeWithRetrySettings = null, int batchSize = DefaultBatchSize) : this(servicesManager, workspaceId, executionIdentity, GetInvokeWithRetryService(invokeWithRetrySettings), batchSize) { }
private RsapiDao(IServicesMgr servicesManager, int workspaceId, ExecutionIdentity executionIdentity, InvokeWithRetryService invokeWithRetryService, int batchSize = DefaultBatchSize) : this(new RsapiProvider(servicesManager, executionIdentity, invokeWithRetryService, workspaceId, batchSize)) { this.invokeWithRetryService = invokeWithRetryService; }
public void Execute_TestFixtureSetup() { //Setup for testing //Setup for testing TestHelper helper = new TestHelper(); servicesManager = helper.GetServicesManager(); // implement_IHelper //create client _client = helper.GetServicesManager().GetProxy <IRSAPIClient>(ConfigurationHelper.ADMIN_USERNAME, ConfigurationHelper.DEFAULT_PASSWORD); _eddsDbContext = helper.GetDBContext(-1); //Create workspace _workspaceId = CreateWorkspace.CreateWorkspaceAsync(_workspaceName, ConfigurationHelper.TEST_WORKSPACE_TEMPLATE_NAME, servicesManager, ConfigurationHelper.ADMIN_USERNAME, ConfigurationHelper.DEFAULT_PASSWORD).Result; dbContext = helper.GetDBContext(_workspaceId); _client.APIOptions.WorkspaceID = _workspaceId; _rootFolderArtifactId = APIHelpers.GetRootFolderArtifactID(_client, _workspaceName); //Import Application containing script, fields, and choices Relativity.Test.Helpers.Application.ApplicationHelpers.ImportApplication(_client, _workspaceId, true, FilepathData); //Import custodians var custodians = GetCustodiansDatatable(); var identityFieldArtifactId = GetArtifactIDOfCustodianField("Full Name", _workspaceId, _client); ImportAPIHelpers.ImportObjects(_workspaceId, "Custodian", identityFieldArtifactId, custodians, String.Empty); //Import Documents var documents = GetDocumentDataTable(_rootFolderArtifactId, _workspaceId); ImportAPIHelpers.CreateDocuments(_workspaceId, _rootFolderArtifactId, documents); }
public async Task <Guid> ReadModelGuid(IServicesMgr serviceManager, int workspaceId, int modelId) { Guid returnValue = Guid.Empty; using (IObjectManager objectManager = serviceManager.CreateProxy <IObjectManager>(ExecutionIdentity.System)) { IEnumerable <FieldRef> fieldRefs = new List <FieldRef> { new FieldRef { Guid = Guids.Model.MODEL_GUID_FIELD } }; ReadRequest readRequest = new ReadRequest { Object = new RelativityObjectRef { ArtifactID = modelId }, Fields = fieldRefs }; ReadResult readReturnValue = await objectManager.ReadAsync(workspaceId, readRequest); ModelGuid = Guid.Parse(readReturnValue.Object.FieldValues.Find(x => x.Field.Guids.Contains(Guids.Model.MODEL_GUID_FIELD)).Value.ToString()); returnValue = ModelGuid; } return(returnValue); }
public static void UpdateJobField(IServicesMgr servicesMgr, int workspaceArtifactId, int jobArtifactId, Guid fieldGuid, object fieldValue) { try { using (IRSAPIClient rsapiClient = servicesMgr.CreateProxy <IRSAPIClient>(ExecutionIdentity.System)) { rsapiClient.APIOptions.WorkspaceID = workspaceArtifactId; RDO jobRdo = new RDO(jobArtifactId); jobRdo.ArtifactTypeGuids.Add(Constants.Guids.ObjectType.InstanceMetricsJob); jobRdo.Fields.Add(new FieldValue(fieldGuid, fieldValue)); try { rsapiClient.Repositories.RDO.UpdateSingle(jobRdo); } catch (Exception ex) { throw new Exception($"{Constants.ErrorMessages.UPDATE_APPLICATION_JOB_STATUS_ERROR}. UpdateSingle. [{nameof(workspaceArtifactId)}= {workspaceArtifactId}, {nameof(jobArtifactId)}= {jobArtifactId}, {nameof(fieldGuid)}= {fieldGuid}, {nameof(fieldValue)}= {fieldValue}]", ex); } } } catch (Exception ex) { throw new Exception(Constants.ErrorMessages.UPDATE_APPLICATION_JOB_STATUS_ERROR, ex); } }
public static RDO RetrieveJob(IServicesMgr servicesMgr, int workspaceArtifactId, int jobArtifactId) { RDO jobRdo; try { using (IRSAPIClient rsapiClient = servicesMgr.CreateProxy <IRSAPIClient>(ExecutionIdentity.System)) { rsapiClient.APIOptions.WorkspaceID = workspaceArtifactId; try { jobRdo = rsapiClient.Repositories.RDO.ReadSingle(jobArtifactId); } catch (Exception ex) { throw new Exception($"{Constants.ErrorMessages.RETRIEVE_APPLICATION_JOB_ERROR}. ReadSingle. [{nameof(workspaceArtifactId)}= {workspaceArtifactId}, {nameof(jobArtifactId)}= {jobArtifactId}]", ex); } } } catch (Exception ex) { throw new Exception(Constants.ErrorMessages.RETRIEVE_APPLICATION_JOB_ERROR, ex); } return(jobRdo); }
public static bool DoesUserHaveAccess(IServicesMgr svcMgr, ExecutionIdentity identity, Int32 workspaceArtifactId, Guid guid) { var result = RetrieveRdoByGuidAndArtifactTypeName(svcMgr, identity, workspaceArtifactId, guid); bool hasAccess = result.Success; return(hasAccess); }
public RDO GetExtractorSetRdo(IServicesMgr svcMgr, ExecutionIdentity identity, Int32 workspaceArtifactId, Int32 extractorSetArtifactId) { var errorContext = String.Format("An error occured when querying for Extractor Set RDO. [WorkspaceArtifactId: {0}, ExtractorSetArtifactId: {1}]", workspaceArtifactId, extractorSetArtifactId); try { using (var proxy = svcMgr.CreateProxy <IRSAPIClient>(identity)) { proxy.APIOptions.WorkspaceID = workspaceArtifactId; RDO jobRdo; try { jobRdo = proxy.Repositories.RDO.ReadSingle(extractorSetArtifactId); } catch (Exception ex) { throw new CustomExceptions.TextExtractorException(errorContext + ". ReadSingle failed.", ex); } return(jobRdo); } } catch (Exception ex) { throw new CustomExceptions.TextExtractorException(errorContext, ex); } }
public static Uri GetKeplerUrl(this IServicesMgr svcmgr, ConfigurationModel configs) { // Get Kepler URL Uri keplerUri = new Uri($"{configs.ServerHostBinding}://{configs.ServerHostName}/relativity.rest/api"); return(keplerUri); }
public void UpdateRdoStringFieldValue(IServicesMgr svcMgr, ExecutionIdentity identity, Int32 workspaceArtifactId, Guid objectGuid, Guid fieldGuid, Int32 objectArtifactId, String fieldValue) { using (var client = svcMgr.CreateProxy <IRSAPIClient>(identity)) { client.APIOptions.WorkspaceID = workspaceArtifactId; try { var rdo = new RDO(objectArtifactId); rdo.ArtifactTypeGuids.Add(objectGuid); rdo.Fields.Add(new FieldValue(fieldGuid, fieldValue)); var result = client.Repositories.RDO.Update(rdo); if (!result.Success) { var messageList = new StringBuilder(); messageList.AppendLine(result.Message); result.Results.ToList().ForEach(w => messageList.AppendLine(w.Message)); throw new Exception(messageList.ToString()); } } catch (Exception ex) { throw new Exception("Error encountered, ", ex); } } }
public static Int32 GetByName(IServicesMgr svcMgr, ExecutionIdentity identity, Int32 workspaceArtifactId, String custodianName) { using (var client = svcMgr.CreateProxy <IRSAPIClient>(identity)) { client.APIOptions.WorkspaceID = workspaceArtifactId; var q = new kCura.Relativity.Client.DTOs.Query <kCura.Relativity.Client.DTOs.RDO> { ArtifactTypeGuid = Helpers.Constants.Guids.ObjectType.Custodian, Condition = new TextCondition(Helpers.Constants.Guids.Fields.Custodian.Name, TextConditionEnum.EqualTo, custodianName) }; var results = client.Repositories.RDO.Query(q); var res = new Response <Int32> { Results = results.Results.Any() ? results.Results.FirstOrDefault().Artifact.ArtifactID : 0, Success = results.Success, Message = MessageFormatter.FormatMessage(results.Results.Select(x => x.Message).ToList(), results.Message, results.Success) }; if (res.Success) { return(res.Results); } throw new Exception(res.Message.ToString()); } }
public void AppendToDocumentLongTextFieldValue(IServicesMgr svcMgr, ExecutionIdentity identity, Int32 workspaceArtifactId, Int32 documentArtifactId, Guid documentFieldGuid, String fieldValue) { var currentFieldValue = GetDocumentLongTextFieldValue(svcMgr, identity, workspaceArtifactId, documentArtifactId, documentFieldGuid); String newFieldValue = String.Format("{0}{1}", string.IsNullOrEmpty(currentFieldValue) ? currentFieldValue : currentFieldValue + ". ", fieldValue); UpdateDocumentLongTextFieldValue(svcMgr, identity, workspaceArtifactId, documentArtifactId, documentFieldGuid, newFieldValue); }
private void ProcessSingleMetric(IServicesMgr servicesMgr, int workspaceArtifactId, int jobArtifactId, Guid metricGuid) { try { if (metricGuid.Equals(Constants.Guids.Choices.InstanceMetricsJob.Metrics_Workspaces)) { ProcessWorkspacesMetric(servicesMgr, workspaceArtifactId, jobArtifactId); } else if (metricGuid.Equals(Constants.Guids.Choices.InstanceMetricsJob.Metrics_Users)) { ProcessUsersMetric(servicesMgr, workspaceArtifactId, jobArtifactId); } else if (metricGuid.Equals(Constants.Guids.Choices.InstanceMetricsJob.Metrics_Groups)) { ProcessGroupsMetric(servicesMgr, workspaceArtifactId, jobArtifactId); } else { throw new Exception(Constants.ErrorMessages.INVALID_METRIC_ERROR); } } catch (Exception ex) { throw new Exception(Constants.ErrorMessages.PROCESS_SINGLE_JOB_METRIC_ERROR, ex); } }
public String GetFieldNameForArtifactId(IServicesMgr svcMgr, ExecutionIdentity identity, Int32 workspaceArtifactId, Int32 fieldArtifactId) { String retVal; var errorContext = String.Format("An error occured when querying for Field name. [WorkspaceArtifactId: {0}, FieldArtifactId: {1}]", workspaceArtifactId, fieldArtifactId); try { using (var proxy = svcMgr.CreateProxy <IRSAPIClient>(identity)) { proxy.APIOptions.WorkspaceID = workspaceArtifactId; kCura.Relativity.Client.DTOs.Field fieldRdo; try { fieldRdo = proxy.Repositories.Field.ReadSingle(Convert.ToInt32(fieldArtifactId)); } catch (Exception ex) { throw new CustomExceptions.TextExtractorException(errorContext + ". Field ReadSingle failed.", ex); } retVal = fieldRdo.Name; } } catch (Exception ex) { throw new CustomExceptions.TextExtractorException(errorContext, ex); } return(retVal); }
public override void Execute() { RaiseMessage("Enter Agent", 10); try { _logger = Helper.GetLoggerFactory().GetLogger(); IServicesMgr servicesMgr = Helper.GetServicesManager(); IDBContext eddsDbContext = Helper.GetDBContext(-1); RaiseMessage("Querying for workspaces where the application is installed.", 10); DataTable workspacesDataTable = SqlHelper.RetrieveApplicationWorkspaces(eddsDbContext, Constants.Guids.Application); if (workspacesDataTable == null || workspacesDataTable.Rows.Count <= 0) { return; } RaiseMessage($"Workspaces found({workspacesDataTable.Rows.Count})", 10); foreach (DataRow currentWorkspaceDataRow in workspacesDataTable.Rows) { int workspaceArtifactId = (int)currentWorkspaceDataRow["ArtifactID"]; ProcessWorkspace(servicesMgr, workspaceArtifactId); } RaiseMessage("Exit Agent", 10); } catch (Exception ex) { _logger.LogError(ex, $"{Constants.Names.APPLICATION} - An error occured in the Agent.", ex); RaiseMessage("An error occured in the Agent. Check Error Logs.", 10); } }
public String GetExtractorSetDetails(IServicesMgr svcMgr, ExecutionIdentity identity, Int32 workspaceArtifactId, Int32 extractorSetArtifactId) { var errorContext = String.Format("An error occured when querying for Extractor Set details. [WorkspaceArtifactId: {0}, ExtractorSetArtifactId: {1}]", workspaceArtifactId, extractorSetArtifactId); try { using (var proxy = svcMgr.CreateProxy <IRSAPIClient>(identity)) { proxy.APIOptions.WorkspaceID = workspaceArtifactId; RDO jobRdo; try { jobRdo = proxy.Repositories.RDO.ReadSingle(extractorSetArtifactId); } catch (Exception ex) { throw new CustomExceptions.TextExtractorException(errorContext + ". ReadSingle failed.", ex); } var details = jobRdo.Fields.Get(Constant.Guids.Fields.ExtractorSet.Details).ValueAsLongText ?? string.Empty; return(details); } } catch (Exception ex) { throw new CustomExceptions.TextExtractorException(errorContext, ex); } }
private void ProcessJob(IServicesMgr servicesMgr, int workspaceArtifactId, int jobArtifactId) { try { //Update job status to In Progress _apiChooser.UpdateJobField(servicesMgr, workspaceArtifactId, jobArtifactId, Constants.Guids.Fields.InstanceMetricsJob.Status_LongText, Constants.JobStatus.IN_PROGRESS); //Update job metrics if (selectedApiType == Helpers.Constants.ApiType.Rsapi) { RDO jobRdo = _apiChooser.RetrieveJob(servicesMgr, workspaceArtifactId, jobArtifactId); RaiseMessage("Calculating metrics for the job", 10); ProcessAllMetrics(servicesMgr, workspaceArtifactId, jobArtifactId, jobRdo); RaiseMessage("Calculated metrics for the job", 10); } else if (selectedApiType == Helpers.Constants.ApiType.Gravity) { } //Update job status to Completed _apiChooser.UpdateJobField(servicesMgr, workspaceArtifactId, jobArtifactId, Constants.Guids.Fields.InstanceMetricsJob.Status_LongText, Constants.JobStatus.COMPLETED); } catch (Exception ex) { //Update job status to Error string errorMessage = ExceptionMessageFormatter.GetInnerMostExceptionMessage(ex); _apiChooser.UpdateJobField(servicesMgr, workspaceArtifactId, jobArtifactId, Constants.Guids.Fields.InstanceMetricsJob.Status_LongText, Constants.JobStatus.ERROR); _apiChooser.UpdateJobField(servicesMgr, workspaceArtifactId, jobArtifactId, Constants.Guids.Fields.InstanceMetricsJob.Errors_LongText, errorMessage); } }
/// <summary> /// Will retrieve the data as a string from the YAML file to be parsed later /// </summary> /// <param name="serviceManager"></param> /// <param name="yamlFileArtifactID"></param> /// <param name="authToken"></param> /// <returns></returns> private async Task <string> DownloadYamlData(IServicesMgr serviceManager, int yamlFileArtifactID, string authToken) { string yamlData = ""; using (IRSAPIClient rsapiClient = serviceManager.CreateProxy <IRSAPIClient>(ExecutionIdentity.System)) { var domain = rsapiClient.EndpointUri.Host; var urlWIthoutProtocol = String.Format(Constants.URLs.ResourceFileDownload, domain, yamlFileArtifactID, authToken); try { //https vs http var yamlFileUrl = ((HttpContext.Current.Request.IsSecureConnection) ? Constants.Protocols.Https : Constants.Protocols.Http) + urlWIthoutProtocol; yamlData = await DownloadYamlFileAsync(new Uri(yamlFileUrl)); } catch (Exception ex) { _logHelper.LogError(ex, $"DAPI - {nameof(DownloadYamlData)} - Error attempting to download Yaml file: {ex}"); } } return(yamlData); }
public static Boolean DoesUserHaveAccessToArtifact(IServicesMgr svcMgr, ExecutionIdentity identity, Int32 workspaceArtifactId, Guid guid, String artifactTypeName) { var result = DoesUserHaveAccessToRdoByType(svcMgr, identity, workspaceArtifactId, guid, artifactTypeName); var hasAccess = result.Success; return(hasAccess); }
public DocumentBatch(IArtifactQueries artifactQueries, IServicesMgr servicesMgr) { ServicesMgr = servicesMgr; ArtQueries = artifactQueries; resultSet = new QueryResultSet <Document>(); }
public void UpdateExtractorSetDetails(IServicesMgr svcMgr, ExecutionIdentity identity, Int32 workspaceArtifactId, Int32 extractorSetArtifactId, String details) { using (var client = svcMgr.CreateProxy <IRSAPIClient>(identity)) { client.APIOptions.WorkspaceID = workspaceArtifactId; var jobRdo = new RDO(extractorSetArtifactId) { ArtifactTypeGuids = new List <Guid> { Constant.Guids.ObjectType.ExtractorSet }, Fields = new List <FieldValue> { new FieldValue(Constant.Guids.Fields.ExtractorSet.Details, details) } }; try { client.Repositories.RDO.UpdateSingle(jobRdo); } catch (Exception ex) { throw new CustomExceptions.TextExtractorException("An error occurred when updating Extractor Set Details field.", ex); } } }
public static Uri GetKeplerUrl(this IServicesMgr svcmgr) { // Get Kepler URL Uri keplerUri = new Uri(string.Format("{0}://{1}/relativity.rest/api", SharedTestHelpers.ConfigurationHelper.SERVER_BINDING_TYPE, SharedTestHelpers.ConfigurationHelper.REST_SERVER_ADDRESS)); return(keplerUri); }
public static IEnumerable <RDO> GetAll(IServicesMgr svcMgr, ExecutionIdentity identity, Int32 workspaceArtifactId) { using (var client = svcMgr.CreateProxy <IRSAPIClient>(identity)) { client.APIOptions.WorkspaceID = workspaceArtifactId; var r = new Query <RDO> { ArtifactTypeGuid = Helpers.Constants.Guids.ObjectType.ProcessingProfile }; r.Fields.Add(new FieldValue(Helpers.Constants.Guids.Fields.ProcessingProfile.DefaultDestinationFolder)); r.Fields.Add(new FieldValue(Helpers.Constants.Guids.Fields.ProcessingProfile.DefaultDocumentNumberingPrefix)); r.Fields.Add(new FieldValue(Helpers.Constants.Guids.Fields.ProcessingProfile.DefaultOcrLanguages)); r.Fields.Add(new FieldValue(Helpers.Constants.Guids.Fields.ProcessingProfile.DefaultTimeZone)); r.Fields.Add(new FieldValue(Helpers.Constants.Guids.Fields.ProcessingProfile.Name)); var sort = new Sort { Guid = Helpers.Constants.Guids.Fields.ProcessingProfile.Name }; r.Sorts.Add(sort); var results = client.Repositories.RDO.Query(r); var res = Response <RDO> .CompileQuerySubsets(client, results); if (res.Success) { return(res.Results); } throw new Exception(res.Message.ToString()); } }