public RDO RetrieveJob(int workspaceArtifactId, int jobArtifactId) { RDO jobRdo; try { try { RsapiApiOptions.WorkspaceID = workspaceArtifactId; jobRdo = RdoRepository.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 void UpdateJobField(int workspaceArtifactId, int jobArtifactId, Guid fieldGuid, object fieldValue) { try { RDO jobRdo = new RDO(jobArtifactId); jobRdo.ArtifactTypeGuids.Add(Constants.Guids.ObjectType.InstanceMetricsJob); jobRdo.Fields.Add(new FieldValue(fieldGuid, fieldValue)); try { RsapiApiOptions.WorkspaceID = workspaceArtifactId; RdoRepository.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 List <int> RetrieveJobsInWorkspaceWithStatus(int workspaceArtifactId, string status) { List <int> jobsList = new List <int>(); try { Query <RDO> rdoQuery = new Query <RDO> { ArtifactTypeGuid = Constants.Guids.ObjectType.InstanceMetricsJob, Fields = FieldValue.NoFields, Condition = new TextCondition(Constants.Guids.Fields.InstanceMetricsJob.Status_LongText, TextConditionEnum.EqualTo, status) }; QueryResultSet <RDO> rdoQueryResultSet; try { RsapiApiOptions.WorkspaceID = workspaceArtifactId; rdoQueryResultSet = RdoRepository.Query(rdoQuery); } catch (Exception ex) { throw new Exception($"{Constants.ErrorMessages.QUERY_APPLICATION_JOBS_ERROR}. Query. [{nameof(workspaceArtifactId)}= {workspaceArtifactId}]", ex); } if (!rdoQueryResultSet.Success) { throw new Exception($"{Constants.ErrorMessages.QUERY_APPLICATION_JOBS_ERROR}. Query. Error Message: {rdoQueryResultSet.Message}. [{nameof(workspaceArtifactId)}= {workspaceArtifactId}]"); } jobsList.AddRange(rdoQueryResultSet.Results.Select(x => x.Artifact.ArtifactID)); } catch (Exception ex) { throw new Exception(Constants.ErrorMessages.QUERY_APPLICATION_JOBS_ERROR, ex); } return(jobsList); }