/// <summary> /// Protected constructor /// </summary> /// <param name="performer"></param> /// <param name="startTime"></param> /// <param name="transitionLogic"></param> protected PerformedStep(ActivityPerformer performer, DateTime?startTime, IFsmTransitionLogic <PerformedStepStatus> transitionLogic) : base(PerformedStepStatus.IP, transitionLogic) { _activities = new HashedSet <Activity>(); _startTime = startTime ?? Platform.Time; _performer = performer; }
/// <summary> /// Starts the activity, setting the state to <see cref="ActivityStatus.IP"/> and recording the specified performer /// and start-time. If start-time is null, the current time is used. /// </summary> /// <param name="performer"></param> /// <param name="startTime"></param> public virtual void Start(ActivityPerformer performer, DateTime?startTime) { Platform.CheckForNullReference(performer, "performer"); _performer = performer; _startTime = startTime ?? Platform.Time; ChangeState(ActivityStatus.IP); }
/// <summary> /// Completes the activity, setting the state to <see cref="ActivityStatus.CM"/>, and recording the specified end-time. /// If end-time is null, the current time is used. /// </summary> /// <remarks> /// This overload allows the performer to be specified, which is necessary if the activity is being completed directly /// from the scheduled state, and hence the performer was not previously established. Note that if a performer /// has been previously established, and the specified performer is different, an exception will be thrown. /// </remarks> public virtual void Complete(ActivityPerformer performer, DateTime?endTime) { Platform.CheckForNullReference(performer, "performer"); if (_performer == null) { _performer = performer; } else if (!_performer.Equals(performer)) { throw new WorkflowException("Peformer already assigned"); } this.Complete(endTime); }
/// <summary> /// Assigns this activity to be performed by the specified performer. The value may be null, /// in which case the activity is un-assigned. /// </summary> /// <param name="performer"></param> public virtual void Assign(ActivityPerformer performer) { if (this.State != ActivityStatus.SC) { throw new WorkflowException("Assignment of scheduled performer only allowed from scheduled state"); } if (_scheduling == null) { _scheduling = new ActivityScheduling(); } this.Scheduling.Performer = performer; OnSchedulingChanged(); }
/// <summary> /// Constructor that allows the performer to be set, and the start-time to be specified. /// </summary> /// <param name="performer"></param> /// <param name="startTime"></param> public PerformedStep(ActivityPerformer performer, DateTime?startTime) : this(performer, startTime, new PerformedStepStatusTransitionLogic()) { }
/// <summary> /// Constructor that allows the performer to be set /// </summary> /// <param name="performer"></param> public PerformedStep(ActivityPerformer performer) : this(performer, null, new PerformedStepStatusTransitionLogic()) { }
/// <summary> /// Completes the activity, setting the state to <see cref="ActivityStatus.CM"/>. /// </summary> /// <remarks> /// This overload allows the performer to be specified, which is necessary if the activity is being completed directly /// from the scheduled state, and hence the performer was not previously established. Note that if a performer /// has been previously established, and the specified performer is different, an exception will be thrown. /// </remarks> public virtual void Complete(ActivityPerformer performer) { Complete(performer, Platform.Time); }
/// <summary> /// Starts the activity, setting the state to <see cref="ActivityStatus.IP"/> and recording the specified performer. /// </summary> /// <param name="performer"></param> public virtual void Start(ActivityPerformer performer) { this.Start(performer, (DateTime?)null); }