private async Task <IList <Tuple <Entry, FhirResponse> > > HandleTransaction( IList <Entry> interactions, IInteractionHandler interactionHandler, Mapper <string, IKey> mapper) { var responses = new List <Tuple <Entry, FhirResponse> >(); await _transfer.Internalize(interactions, mapper).ConfigureAwait(false); foreach (var interaction in interactions) { var response = await interactionHandler.HandleInteraction(interaction).ConfigureAwait(false); if (!response.IsValid) { throw new Exception(); } interaction.Resource = response.Resource; response.Resource = null; responses.Add( new Tuple <Entry, FhirResponse>( interaction, response)); //CCR: How to handle responses for transactions? //The specifications says only one response should be sent per EntryComponent, //but one EntryComponent might correspond to multiple atomic entries (Entry) //Example: conditional delete } _transfer.Externalize(interactions); return(responses); }
internal InteractionOutput(IntPtr interactionContext, IInteractionHandler interactionHandler, SynchronizationContext syncContext) { _interactionContext = interactionContext; _interactionHandler = interactionHandler; _syncContext = syncContext; Alive = true; }
public FhirResponse HandleOperation(ResourceManipulationOperation operation, IInteractionHandler interactionHandler, Mapper <string, IKey> mapper = null) { IList <Entry> interactions = operation.GetEntries().ToList(); if (mapper != null) { transfer.Internalize(interactions, mapper); } FhirResponse response = null; foreach (Entry interaction in interactions) { response = MergeFhirResponse(response, interactionHandler.HandleInteraction(interaction)); if (!response.IsValid) { throw new Exception(); } interaction.Resource = response.Resource; } transfer.Externalize(interactions); return(response); }
public DefaultPlayableSet(IControl player, IViewPort viewPort, IInteractionHandler interactionHandler, ICollection <IInstance> levelObjects) { _player = player; _viewPort = viewPort; _interactionHandler = interactionHandler; _levelInstances = levelObjects; }
private async Task <FhirResponse> HandleOperation( ResourceManipulationOperation operation, IInteractionHandler interactionHandler, Mapper <string, IKey> mapper = null) { IList <Entry> interactions = operation.GetEntries().ToList(); if (mapper != null) { await _transfer.Internalize(interactions, mapper).ConfigureAwait(false); } FhirResponse response = null; foreach (var interaction in interactions) { response = MergeFhirResponse( response, await interactionHandler.HandleInteraction(interaction).ConfigureAwait(false)); if (!response.IsValid) { throw new Exception(); } interaction.Resource = response.Resource; } _transfer.Externalize(interactions); return(response); }
public void Setup() { _gameState = new GameStateClass( new Map( new HardCodedLayerGenerator(), 3, new Player(new Position(), new Stats(1, 1, 1), "john", 10))); _sut = new InteractionHandler(); }
public IInteractionHandler getInteractionHandler() { if (ctx == null) { throw new Exception("Tenes que llamar a la funcion setTenant despues de inicializar esta clase"); } if (interactionHandler == null) { interactionHandler = new InteractionHandler(ctx); } return(interactionHandler); }
public ConcreteTurnExecutioner( IMoveValidator validator, ICharacterFormatter formatter, ITurnScheduler scheduler, IMoveExecutioner executioner, IInteractionHandler interactionHandler) { _validator = validator; _formatter = formatter; _turnScheduler = scheduler; _moveExecutioner = executioner; _interactionHandler = interactionHandler; }
internal static IntPtr CreateInteractionContext(IInteractionHandler interactionHandler, SynchronizationContext syncContext) { IntPtr ic; CreateInteractionContext(out ic); InteractionOutput io = new InteractionOutput(ic, interactionHandler, syncContext); lock (_lockObj) { _listeners.Add(ic.ToInt64(), io); } RegisterOutputCallbackInteractionContext(ic, Marshal.GetFunctionPointerForDelegate(_callback), ic); return(ic); }
public void Setup() { _uut = new InteractionHandler(); _state = Substitute.For <IGameState>(); _player = Substitute.For <IPlayer>(); _player.Position.X.Returns(5); _player.Position.Y.Returns(5); _interactiveObjects = new IInteractiveObject[10, 10]; _state.Player.Returns(_player); _state.Map.GetCurrentLayer().InteractiveObjects.Returns(_interactiveObjects); }
public IList <Tuple <Entry, FhirResponse> > HandleTransaction(Bundle bundle, IInteractionHandler interactionHandler) { if (interactionHandler == null) { throw new InvalidOperationException("Unable to run transaction operation"); } var entries = new List <Entry>(); Mapper <string, IKey> mapper = new Mapper <string, IKey>(); foreach (var operation in bundle.Entry.Select(e => ResourceManipulationOperationFactory.GetManipulationOperation(e, localhost, searchService))) { IList <Entry> atomicOperations = operation.GetEntries().ToList(); AddMappingsForOperation(mapper, operation, atomicOperations); entries.AddRange(atomicOperations); } return(HandleTransaction(entries, interactionHandler, mapper)); }
public async Task <IList <Tuple <Entry, FhirResponse> > > HandleTransaction( Bundle bundle, IInteractionHandler interactionHandler) { if (interactionHandler == null) { throw new InvalidOperationException("Unable to run transaction operation"); } var entries = new List <Entry>(); var mapper = new Mapper <string, IKey>(); foreach (var task in bundle.Entry.Select( e => ResourceManipulationOperationFactory.GetManipulationOperation(e, _localhost, _searchService))) { var operation = await task.ConfigureAwait(false); IList <Entry> atomicOperations = operation.GetEntries().ToList(); AddMappingsForOperation(mapper, operation, atomicOperations); entries.AddRange(atomicOperations); } return(await HandleTransaction(entries, interactionHandler, mapper).ConfigureAwait(false)); }
public IList <Tuple <Entry, FhirResponse> > HandleTransaction(IList <Entry> interactions, IInteractionHandler interactionHandler) { if (interactionHandler == null) { throw new InvalidOperationException("Unable to run transaction operation"); } return(HandleTransaction(interactions, interactionHandler, null)); }
public FhirResponse HandleTransaction(ResourceManipulationOperation operation, IInteractionHandler interactionHandler) { return(HandleOperation(operation, interactionHandler)); }
internal static IntPtr CreateInteractionContext(IInteractionHandler interactionHandler, SynchronizationContext syncContext) { IntPtr ic; CreateInteractionContext(out ic); InteractionOutput io = new InteractionOutput(ic, interactionHandler, syncContext); lock (_lockObj) { _listeners.Add(ic.ToInt64(), io); } RegisterOutputCallbackInteractionContext(ic, Marshal.GetFunctionPointerForDelegate(_callback), ic); return ic; }
public async Task <IList <Tuple <Entry, FhirResponse> > > HandleTransaction( IList <Entry> interactions, IInteractionHandler interactionHandler) => interactionHandler == null ? throw new InvalidOperationException("Unable to run transaction operation") : await HandleTransaction(interactions, interactionHandler, null).ConfigureAwait(false);
public Client(IInteractionHandler interactionHandler) { _interactionHandler = interactionHandler; }
protected ZApplicationBase(IInteractionHandler interactionHandler) { InteractionHandler = interactionHandler; }
public InteractionObject(IMapObject mapObject, Condition condition, IInteractionHandler handler) { this.mapObject = mapObject; this.handler = handler; this.condition = condition; }
public Task <FhirResponse> HandleTransaction( ResourceManipulationOperation operation, IInteractionHandler interactionHandler) => HandleOperation(operation, interactionHandler);
void setInteractionHander(IInteractionHandler h) { handler = h; }
public InteractionObject(IMapObject mapObject, IInteractionHandler handler) { this.mapObject = mapObject; this.handler = handler; }