public bool CanChangeStatus(ValueSetStatus current, ValueSetStatus target) { if (!PolicyMap.ContainsKey(current)) { throw new InvalidOperationException($"The status {current.ToString()} has not been mapped in {nameof(DefaultValueSetUpdateValidationPolicy)}"); } return(PolicyMap[current].Contains(target)); }
public Attempt <IValueSet> ChangeStatus(Guid valueSetGuid, ValueSetStatus newStatus) { var attempt = this.clientTermValueSetRepository.ChangeStatus(valueSetGuid, newStatus); if (attempt.Success) { Saved?.Invoke(this, attempt.Result); } return(attempt); }
public static string ToString(ValueSetStatus value) { if (value == ValueSetStatus.Draft) { return("draft"); } else if (value == ValueSetStatus.Active) { return("active"); } else if (value == ValueSetStatus.Retired) { return("retired"); } else { throw new ArgumentException("Unrecognized ValueSetStatus value: " + value.ToString()); } }
public Attempt <IValueSet> ChangeStatus(Guid valueSetGuid, ValueSetStatus newStatus) { return(this.AttemptValueSetAlteration(valueSetGuid, ChangeStatusAlteration)); void ChangeStatusAlteration(ValueSetDescriptionBaseDto vsd) { var currentStatus = GetValueSetStatus(vsd.StatusCD); if (!this.valueSetUpdateValidationPolicy.CanChangeStatus(currentStatus, newStatus)) { throw new ValueSetOperationException($"ValueSet status policy does not allow changing the status of a ValueSet from {currentStatus.ToString()} to {newStatus.ToString()}"); } vsd.StatusCD = newStatus.ToString(); var operation = new Operation { OperationType = OperationType.Update, Value = vsd }; var uow = this.uowManager.CreateUnitOfWork(operation); uow.Commit(); } }
public static bool TryParse(string value, out ValueSetStatus result) { result = default(ValueSetStatus); if (value == "draft") { result = ValueSetStatus.Draft; } else if (value == "active") { result = ValueSetStatus.Active; } else if (value == "retired") { result = ValueSetStatus.Retired; } else { return(false); } return(true); }
public static bool TryParse(string value, out ValueSetStatus result) { result = default(ValueSetStatus); if( value=="draft") result = ValueSetStatus.Draft; else if( value=="active") result = ValueSetStatus.Active; else if( value=="retired") result = ValueSetStatus.Retired; else return false; return true; }
public static string ToString(ValueSetStatus value) { if( value==ValueSetStatus.Draft ) return "draft"; else if( value==ValueSetStatus.Active ) return "active"; else if( value==ValueSetStatus.Retired ) return "retired"; else throw new ArgumentException("Unrecognized ValueSetStatus value: " + value.ToString()); }