public OrchestrationWorkflow(IOrchestrationCommand orch, ISyncCommand sync, IOrderCloudIntegrationsFunctionToken token, LogQuery log) { _orch = orch; _sync = sync; _log = log; _token = token; }
/**************************************************************************************************** * ****************************************************************************************************/ /// <summary> /// Calls the handler for the command /// </summary> public void DispatchCommand(ISyncCommand command) { { var arg = command as AddEntryCommand; if (arg != null) { _handler.AddValue (arg.TrackIndex, arg.TrackEntry); return; } } { var arg = command as RemoveEntryCommand; if (arg != null) { _handler.DeleteValue (arg.TrackIndex, arg.RowIndex); return; } } { var arg = command as SetRowIndexCommand; if (arg != null) { _handler.SetRowIndex (arg.RowIndex); return; } } { var arg = command as SetPauseCommand; if (arg != null) { _handler.SetPause (arg.IsPaused); return; } } { var arg = command as ExportCommand; if (arg != null) { _handler.Export (); return; } } throw new SyncException(string.Format("Unknown Sync Command: {0}", command.GetType().Name)); }
/// <inheritdoc cref="ISyncCommandMediary.Command{TContext,TResult}"/> public virtual TResult Command <TContext, TResult>(ISyncCommand <TContext, TResult> command, TContext context) { if (command == null) { throw new ArgumentNullException(nameof(command)); } if (context == null) { throw new ArgumentNullException(nameof(context)); } return(Decorator.Decorate(GetOperationName(command, nameof(command.Execute)), () => command.Execute(context))); }
public virtual void Command <TContext>(ISyncCommand <TContext> command, TContext context) { if (command == null) { throw new ArgumentNullException(nameof(command)); } if (context == null) { throw new ArgumentNullException(nameof(context)); } Decorator.Decorate(command, () => command.Execute(context)); }
public virtual TResult Command <TContext, TResult>(ISyncCommand <TContext, TResult> command) { return(Invoker.Command(command, GetContext <TContext>())); }
public virtual void Command <TContext>(ISyncCommand <TContext> command) { Invoker.Command(command, GetContext <TContext>()); }
/**************************************************************************************************** * Serialization ****************************************************************************************************/ public void SerializeCommand(ISyncCommand command) { switch (command.Id) { case CommandId.RequestTrack: { Write((byte)command.Id); Write((command as RequestTrackCommand).TrackName); break; } case CommandId.SetRowIndex: { Write((byte)command.Id); Write((command as SetRowIndexCommand).RowIndex); break; } default: throw new SyncException(string.Format("Unable to serialize sync command: {0} ", command.Id)); } }
/// <inheritdoc cref="ISyncCommandMagneto.Command{TContext,TResult}"/> public virtual TResult Command <TContext, TResult>(ISyncCommand <TContext, TResult> command) => Mediary.Command(command, GetContext <TContext>());
/// <inheritdoc cref="ISyncCommandMagneto.Command{TContext}"/> public virtual void Command <TContext>(ISyncCommand <TContext> command) => Mediary.Command(command, GetContext <TContext>());