// TODO - remove this - do not want to copy the event id automatically ?? public SpBaseEventResponse(ISpToInt typeId, ISpEventMessage msg, ISpToInt returnCode, string returnStatus) : base(typeId, new SpIntToInt(msg.EventId)) { // Transfer the message guid to the response for correlation this.Uid = msg.Uid; this.ReturnCode = returnCode.ToInt(); this.ReturnStatus = ReturnStatus; }
/// <summary>Constructor</summary> /// <param name="parent">The parent state</param> /// <param name="msgFactory">Message Factory</param> /// <param name="idConverter">The integer id to string converter</param> /// <param name="id">Unique state id converter</param> /// <param name="wrappedObject">The generic object that the states represent</param> public SpStateBase(ISpState parent, ISpMsgFactory msgFactory, ISpIdConverter idConverter, ISpToInt id, T wrappedObject) { WrapErr.ChkParam(msgFactory, "msgFactory", 9999); WrapErr.ChkParam(wrappedObject, "wrappedObject", 50200); this.msgFactory = msgFactory; this.idConverter = idConverter; this.InitStateIds(parent, id.ToInt()); this.wrappedObject = wrappedObject; }
/// <summary> /// Register a state transition for an event /// </summary> /// <param name="eventId">The id converter of the event type</param> /// <param name="transition">The transition object</param> public static void RegisterTransition(string type, ISpToInt eventId, ISpStateTransition transition, Dictionary <int, ISpStateTransition> store) { WrapErr.ChkParam(eventId, "eventId", 51004); WrapErr.ChkParam(transition, "transition", 51005); WrapErr.ChkParam(store, "store", 51006); // Wrap the id converter separately int tmp = WrapErr.ToErrorReportException(51007, () => { return(String.Format("Error on Event Id Converter for '{0}' Event Type", type)); }, () => { return(eventId.ToInt()); }); // Duplicate transitions on same Event is a no no. WrapErr.ChkFalse(store.Keys.Contains(tmp), 51008, () => { return(String.Format("Already Contain a '{0}' Transition for Id:{1}", type, tmp)); }); store.Add(tmp, transition); }
/// <summary> /// Constructor /// </summary> /// <param name="typeId">The type id to cast to derived for payload retrieval</param> /// <param name="eventId">The event identifier</param> /// <param name="priority">The priority of the message</param> public SpBaseEventMsg(ISpToInt typeId, ISpToInt eventId, SpEventPriority priority) { this.typeId = typeId.ToInt(); this.eventId = eventId.ToInt(); this.priority = priority; }
/// <summary> /// Register a state transition for an event /// </summary> /// <param name="eventId">The id converter of the event type</param> /// <param name="transition">The transition object</param> public static void RegisterTransition(string type, ISpToInt eventId, ISpStateTransition transition, Dictionary<int, ISpStateTransition> store) { WrapErr.ChkParam(eventId, "eventId", 51004); WrapErr.ChkParam(transition, "transition", 51005); WrapErr.ChkParam(store, "store", 51006); // Wrap the id converter separately int tmp = WrapErr.ToErrorReportException(51007, () => { return String.Format("Error on Event Id Converter for '{0}' Event Type", type); }, () => { return eventId.ToInt(); }); // Duplicate transitions on same Event is a no no. WrapErr.ChkFalse(store.Keys.Contains(tmp), 51008, () => { return String.Format("Already Contain a '{0}' Transition for Id:{1}", type, tmp); }); store.Add(tmp, transition); }