// 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;
 }
 // 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;
 }
Example #3
0
        /// <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);
        }
Example #4
0
        /// <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);
        }
Example #5
0
 /// <summary>
 /// Register a state transition from the result of state processing.
 /// </summary>
 /// <param name="eventId">The id converter of the event as the result of state processing</param>
 /// <param name="transition">The transition object</param>
 public void RegisterOnResultTransition(ISpToInt eventId, ISpStateTransition transition)
 {
     SpTools.RegisterTransition("OnResult", eventId, transition, this.onResultTransitions);
 }
Example #6
0
 /// <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;
 }
Example #7
0
 /// <summary>Constructor for first level state</summary>
 /// <param name="msgFactory">Message Factory</param>
 /// <param name="idConverter">The integer id to string converter</param>
 /// <param name="id">Unique state id</param>
 /// <param name="wrappedObject">The generic object that the states represent</param>
 public SpStateBase(ISpMsgFactory msgFactory, ISpIdConverter idConverter, ISpToInt id, T wrappedObject)
     : this(null, msgFactory, idConverter, id, wrappedObject)
 {
 }
 /// <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</param>
 /// <param name="wrappedObject">The generic object that the states represent</param>
 public SpSuperState(ISpState parent, ISpMsgFactory msgFactory, ISpIdConverter idConverter, ISpToInt id, T wrappedObject)
     : base(parent, msgFactory, idConverter, id, wrappedObject)
 {
 }
 /// <summary>
 /// Constructor for Normal Priority messages
 /// </summary>
 /// <param name="typeId">The type id to cast to derived for payload retrieval</param>
 /// <param name="eventId">The event identifier</param>
 public SpBaseEventMsg(ISpToInt typeId, ISpToInt eventId)
     : this(typeId, eventId, SpEventPriority.Normal)
 {
 }
 /// <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>
 /// Constructor for Normal Priority messages
 /// </summary>
 /// <param name="typeId">The type id to cast to derived for payload retrieval</param>
 /// <param name="eventId">The event identifier</param>
 public SpBaseEventMsg(ISpToInt typeId, ISpToInt eventId)
     : this(typeId, eventId, SpEventPriority.Normal)
 {
 }
 /// <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;
 }