Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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();
            }
        }
Ejemplo n.º 3
0
 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());
 }
Ejemplo n.º 4
0
 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());
     }
 }