Ejemplo n.º 1
0
        private void UpdateViabilityForTarget(IDisableable target)
        {
            var container = target as CohortAggregateContainer;

            //don't let them disable the root container
            if (container != null && container.IsRootContainer() && !container.IsDisabled)
            {
                SetImpossible("You cannot disable the root container of a cic");
            }

            var aggregateConfiguration = target as AggregateConfiguration;

            if (aggregateConfiguration != null)
            {
                if (!aggregateConfiguration.IsCohortIdentificationAggregate)
                {
                    SetImpossible("Only cohort identification aggregates can be disabled");
                }
                else
                if (aggregateConfiguration.IsJoinablePatientIndexTable() && !aggregateConfiguration.IsDisabled)
                {
                    SetImpossible("Joinable Patient Index Tables cannot be disabled");
                }
            }

            if (target is IMightBeReadOnly ro && ro.ShouldBeReadOnly(out string reason))
            {
                SetImpossible(reason);
            }
        }
Ejemplo n.º 2
0
        public ExecuteCommandDisableOrEnable(IActivateItems itemActivator, IDisableable target) : base(itemActivator)
        {
            _target = target;

            var container = _target as CohortAggregateContainer;

            //don't let them disable the root container
            if (container != null && container.IsRootContainer() && !container.IsDisabled)
            {
                SetImpossible("You cannot disable the root container of a cic");
            }

            var aggregateConfiguration = _target as AggregateConfiguration;

            if (aggregateConfiguration != null)
            {
                if (!aggregateConfiguration.IsCohortIdentificationAggregate)
                {
                    SetImpossible("Only cohort identification aggregates can be disabled");
                }
                else
                if (aggregateConfiguration.IsJoinablePatientIndexTable() && !aggregateConfiguration.IsDisabled)
                {
                    SetImpossible("Joinable Patient Index Tables cannot be disabled");
                }
            }
        }
Ejemplo n.º 3
0
 public ExecuteCommandDisableOrEnable(IActivateItems itemActivator, IDisableable target) : base(itemActivator)
 {
     UpdateViabilityForTarget(target);
     _targets = new [] { target };
 }