private ITriggerOutcome ProcessUpdateOrDelete(ITriggerInput TriggerInput) { //Get any Compartment with the same FhirId DtoServiceSearchParameterLight TagSearchParameter = GetTagSearchParameters(TriggerInput.ResourceType.GetLiteral()); if (TriggerInput.DbTokenIndexList.Any(x => x.ServiceSearchParameterId == TagSearchParameter.Id && x.Code == _ProtectedCoding.Code && x.System == _ProtectedCoding.System)) { //The Resource is protected string Message = "Error Message Not Set"; if (TriggerInput.CrudOperationType == RestEnum.CrudOperationType.Update) { Message = $"The {TriggerInput.ResourceType.GetLiteral()} resource instance with Id: {TriggerInput.InboundResourceId} cannot be updated because it is a {_ProtectedCoding.Display}."; } else if (TriggerInput.CrudOperationType == RestEnum.CrudOperationType.Delete) { Message = $"The {TriggerInput.ResourceType.GetLiteral()} resource instance with Id: {TriggerInput.InboundResourceId} cannot be deleted because it is a {_ProtectedCoding.Display}."; } var ReturnOperationOutcome = FhirOperationOutcomeSupport.Create(OperationOutcome.IssueSeverity.Error, OperationOutcome.IssueType.BusinessRule, Message); var TriggerOutcome = new TriggerOutcome(); TriggerOutcome.Report = true; TriggerOutcome.HttpStatusCode = System.Net.HttpStatusCode.Conflict; TriggerOutcome.Resource = ReturnOperationOutcome; return(TriggerOutcome); } else { //The resource is not Protected return(new TriggerOutcome() { Report = false }); } }
public ITriggerOutcome ProcessTrigger(ITriggerInput TriggerInput) { if (TriggerInput.CrudOperationType == RestEnum.CrudOperationType.Update || TriggerInput.CrudOperationType == RestEnum.CrudOperationType.Delete) { return(ProcessUpdateOrDelete(TriggerInput)); } else if (TriggerInput.CrudOperationType == RestEnum.CrudOperationType.Create) { RemoveProtectedTag(TriggerInput.InboundResource); return(new TriggerOutcome() { Report = false }); } else if (TriggerInput.CrudOperationType == RestEnum.CrudOperationType.Read) { return(new TriggerOutcome() { Report = false }); } else { throw new FormatException("TriggerInput.CrudOperationType cannot be None."); } }
private ITriggerOutcome ProcessCreateUpdateOrDelete(ITriggerInput triggerInput) { if (IGlobalProperties.ServerReadOnlyMode) { //The Resource is protected string Message = $"The FHIR Server is currently in a read only mode. "; if (!string.IsNullOrWhiteSpace(IGlobalProperties.ServerReadOnlyModeMessage)) { Message += $"Administrator's Message: {IGlobalProperties.ServerReadOnlyModeMessage}"; } var ReturnOperationOutcome = FhirOperationOutcomeSupport.Create(OperationOutcome.IssueSeverity.Information, OperationOutcome.IssueType.Informational, Message); var TriggerOutcome = new TriggerOutcome(); TriggerOutcome.Report = true; TriggerOutcome.HttpStatusCode = System.Net.HttpStatusCode.ServiceUnavailable; TriggerOutcome.Resource = ReturnOperationOutcome; return(TriggerOutcome); } else { //The resource is not Protected return(new TriggerOutcome() { Report = false }); } }
protected override void OnBindingChange(IBindingKey key) { base.OnBindingChange(key); if (Equals(key, ShowMenu)) { ShowMenuInput = InputManager.Get(ShowMenu); } }
protected override Validation <string, PlayerInteraction> CreateService( string key, string displayName, Func <Option <IPlayerControl> > control, ITriggerInput input, ILoggerFactory loggerFactory) { return(new PlayerInteraction(key, displayName, control, input, Active, loggerFactory)); }
public PlayerInteraction( string key, string displayName, Func <Option <IPlayerControl> > playerControl, ITriggerInput input, bool active, ILoggerFactory loggerFactory) : base(key, displayName, playerControl, input, active, loggerFactory) { }
protected InputAction( string key, string displayName, ITriggerInput input, bool active, ILoggerFactory loggerFactory) : base(key, displayName, active, loggerFactory) { Ensure.That(input, nameof(input)).IsNotNull(); Input = input; }
protected override Validation <string, PlayerActionDelegate> CreateService( string key, string displayName, Func <Option <IPlayerControl> > control, ITriggerInput input, ILoggerFactory loggerFactory) { return(Action.TrimToOption() .ToValidation("Missing the action name.") .Map(action => new PlayerActionDelegate( key, displayName, action, control, input, Active, loggerFactory))); }
protected PlayerAction( string key, string displayName, Func <Option <IPlayerControl> > playerControl, ITriggerInput input, bool active, ILoggerFactory loggerFactory) : base(key, displayName, input, active, loggerFactory) { Ensure.That(playerControl, nameof(playerControl)).IsNotNull(); _playerControl = playerControl; }
public PlayerActionDelegate( string key, string displayName, string action, Func <Option <IPlayerControl> > playerControl, ITriggerInput input, bool active, ILoggerFactory loggerFactory) : base(key, displayName, playerControl, input, active, loggerFactory) { Ensure.That(action, nameof(action)).IsNotNull(); Action = action; }
protected UIAction( string key, string displayName, ITriggerInput input, Node node, bool modal, bool active, ILoggerFactory loggerFactory) : base(key, displayName, input, active, loggerFactory) { Ensure.That(node, nameof(node)).IsNotNull(); Modal = modal; Node = node; }
public ToggleUIAction( string key, string displayName, NodePath ui, ITriggerInput input, Node node, bool modal, bool active, ILoggerFactory loggerFactory) : base(key, displayName, input, node, modal, active, loggerFactory) { Ensure.That(ui, nameof(ui)).IsNotNull(); _ui = ui; }
private ITriggerOutcome ProcessUpdateOrDelete(ITriggerInput TriggerInput) { //Get any Compartment with the same FhirId var ServiceCompartment = IServiceCompartmentRepository.GetServiceCompartmentByFhirId(TriggerInput.InboundResourceId); if (ServiceCompartment != null) { string Message = "Error Message Not Set"; if (TriggerInput.CrudOperationType == RestEnum.CrudOperationType.Update) { //If so do not allow the update Message = $"The {FHIRAllTypes.CompartmentDefinition.GetLiteral()} resource cannot be updated because it is an active Compartment in the server. " + $"You must first set this compartment to Inactive before you can updated this resource. " + $"To do this you will need to call the server Operation ${FhirOperationEnum.OperationType.xSetCompartmentInActive.GetPyroLiteral()} on this resource instance. " + $"For example '[base]/{FHIRAllTypes.CompartmentDefinition.GetLiteral()}/{TriggerInput.InboundResourceId}/${FhirOperationEnum.OperationType.xSetCompartmentInActive.GetPyroLiteral()}' " + $"Once Inactive you will then be able to update this resource in the server. " + $"Caution should be taken as active Compartments affect how users interact with the server and the resources they have access to. " + $"To re-activate the Compartment after updating you must call the Operation ${FhirOperationEnum.OperationType.xSetCompartmentActive.GetPyroLiteral()}. " + $"For example '[base]/{FHIRAllTypes.CompartmentDefinition.GetLiteral()}/{TriggerInput.InboundResourceId}/${FhirOperationEnum.OperationType.xSetCompartmentActive.GetPyroLiteral()}' "; } else if (TriggerInput.CrudOperationType == RestEnum.CrudOperationType.Delete) { Message = $"The {FHIRAllTypes.CompartmentDefinition.GetLiteral()} resource cannot be deleted because it is an active Compartment in the server. " + $"You must first set this compartment to Inactive before you can delete this resource. " + $"To do this you will need to call the server Operation ${FhirOperationEnum.OperationType.xSetCompartmentInActive.GetPyroLiteral()} on this resource instance. " + $"For example '[base]/{FHIRAllTypes.CompartmentDefinition.GetLiteral()}/{TriggerInput.InboundResourceId}/${FhirOperationEnum.OperationType.xSetCompartmentInActive.GetPyroLiteral()}' " + $"Once Inactive you will then be able to delete this resource from the server. " + $"Caution should be taken as active Compartments affect how users interact with the server and the resources they have access to."; } var ReturnOperationOutcome = FhirOperationOutcomeSupport.Create(OperationOutcome.IssueSeverity.Error, OperationOutcome.IssueType.BusinessRule, Message); var TriggerOutcome = new TriggerOutcome(); TriggerOutcome.Report = true; TriggerOutcome.HttpStatusCode = System.Net.HttpStatusCode.Conflict; TriggerOutcome.Resource = ReturnOperationOutcome; return(TriggerOutcome); } else { //the Compartmentdefinition is not active so can be Updated or deleted, if updating then ensure //the active tags are not present and remove if they are RemoveActiveCompartmentTag(TriggerInput.InboundResource); } return(new TriggerOutcome() { Report = false }); }
public CreateUIAction( string key, string displayName, PackedScene ui, Option <Node> parent, ITriggerInput input, Node node, bool modal, bool active, ILoggerFactory loggerFactory) : base(key, displayName, input, node, modal, active, loggerFactory) { Ensure.That(ui, nameof(ui)).IsNotNull(); UI = ui; Parent = parent; }
protected override Validation <string, ToggleUIAction> CreateService( string key, string displayName, ITriggerInput input, ILoggerFactory loggerFactory) { return (from ui in Optional(UI).ToValidation("Missing the target UI.") select new ToggleUIAction( key, displayName, ui, input, this, Modal, Active, loggerFactory)); }
protected override Validation <string, CreateUIAction> CreateService( string key, string displayName, ITriggerInput input, ILoggerFactory loggerFactory) { var parent = Optional(Parent).Bind(this.FindComponent <Node>); return (from ui in Optional(UI).ToValidation("Missing the target UI.") select new CreateUIAction( key, displayName, ui, parent, input, this, Modal, Active, loggerFactory)); }
public TriggerSetEventArgs(ITriggerInput trigger) { Trigger = trigger; }
protected override Validation <string, T> CreateService( string key, string displayName, ITriggerInput input, ILoggerFactory loggerFactory) { return(CreateService(key, displayName, this.FindClosestAncestor <IPlayerControl>, input, loggerFactory)); }
protected abstract Validation <string, T> CreateService( string key, string displayName, Func <Option <IPlayerControl> > control, ITriggerInput input, ILoggerFactory loggerFactory);
protected abstract Validation <string, T> CreateService( string key, string displayName, ITriggerInput input, ILoggerFactory loggerFactory);
public ITriggerOutcome ProcessTrigger(ITriggerInput TriggerInput) { //If triggers are not active then just return Report as False if (!_TriggersActive) { return new TriggerOutcome() { Report = false } } ; //Validate TriggerInput if (TriggerInput.CrudOperationType == RestEnum.CrudOperationType.None) { throw new System.NullReferenceException("TriggerInput.CrudOperationType cannot be None"); } if (TriggerInput.CrudOperationType == RestEnum.CrudOperationType.Create || TriggerInput.CrudOperationType == RestEnum.CrudOperationType.Update) { if (TriggerInput.InboundResource == null) { throw new System.NullReferenceException("TriggerInput.InboundResource cannot be null"); } } if (TriggerInput.CrudOperationType == RestEnum.CrudOperationType.Create || TriggerInput.CrudOperationType == RestEnum.CrudOperationType.Update || TriggerInput.CrudOperationType == RestEnum.CrudOperationType.Delete) { if (string.IsNullOrWhiteSpace(TriggerInput.InboundResourceId)) { throw new System.NullReferenceException("TriggerInput.InboundResourceId cannot be null or empty"); } if (TriggerInput.ResourceType == ResourceType.Resource) { throw new System.NullReferenceException("TriggerInput.ResourceType cannot be equal to 'Resource'"); } } if (TriggerInput.CrudOperationType == RestEnum.CrudOperationType.Update || TriggerInput.CrudOperationType == RestEnum.CrudOperationType.Delete) { if (TriggerInput.DbTokenIndexList == null) { throw new System.NullReferenceException("TriggerInput.DbTokenIndexList cannot be null for Update or Delete actions"); } } ITriggerOutcome TriggerOutcomeMain = null; //Resource Specific var ResourceSpecificList = ITriggerServiceList.Where(x => x.ResourceTypeToTriggerFor == TriggerInput.ResourceType); foreach (var TriggerService in ResourceSpecificList) { TriggerOutcomeMain = CollateOutcomes(TriggerOutcomeMain, TriggerService.ProcessTrigger(TriggerInput)); } //All Resource Types ResourceSpecificList = ITriggerServiceList.Where(x => x.ResourceTypeToTriggerFor == ResourceType.Resource); foreach (var TriggerService in ResourceSpecificList) { TriggerOutcomeMain = CollateOutcomes(TriggerOutcomeMain, TriggerService.ProcessTrigger(TriggerInput)); } return(TriggerOutcomeMain); }