| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- using Quadarax.Foundation.Core.Business.Processor.Enums;
- using Quadarax.Foundation.Core.Business.Processor.Exceptons;
- namespace Quadarax.Foundation.Core.Business.Processor.Task;
- public interface ITaskItem : ITaskItemData
- {
- #region *** Operations ***
- /// <summary>
- /// Re-Schedules inactive task to future and sets <see cref="Status"/> to <see cref="ProcessStatusEnum.Pending"/> (affects <see cref="ProcessingValidFrom"/> and <see cref="ProcessingValidTo"/>).
- /// <list type="bullet">
- /// <item><description>Allowed state: <see cref="ProcessStatusEnum.Pending"/>, <see cref="ProcessStatusEnum.Paused"/></description></item>
- /// <item><description>Set state to: <see cref="ProcessStatusEnum.Pending"/></description></item>
- /// </list>
- /// <exception cref="InvalidTaskStateException">When task state is invalid for operation.</exception>
- /// </summary>
- /// <param name="postponeInterval">Interval to shift to future.</param>
- /// <param name="reason">Reason message to postpone.</param>
- void Postpone(TimeSpan postponeInterval, string reason);
- /// <summary>
- /// Stops running task and sets <see cref="Status"/> to <see cref="ProcessStatusEnum.Paused"/> or
- /// <see cref="ProcessStatusEnum.ProcessedSucc"/> or <see cref="ProcessStatusEnum.ProcessedFail"/> (target status is depends on input arguments)..
- /// <list type="bullet">
- /// <item><description>Allowed state: <see cref="ProcessStatusEnum.Started"/></description></item>
- /// <item><description>Set state to: <see cref="ProcessStatusEnum.Paused"/> or <see cref="ProcessStatusEnum.ProcessedSucc"/> or <see cref="ProcessStatusEnum.ProcessedFail"/></description></item>
- /// </list>
- /// <exception cref="InvalidTaskStateException">When task state is invalid for operation.</exception>
- /// </summary>
- /// <param name="reason">Reason message to stop.</param>
- /// <param name="willPause">If true, then <see cref="Status"/> will be set to <see cref="ProcessStatusEnum.Paused"/> otherwise to <see cref="ProcessStatusEnum.ProcessedSucc"/> or <see cref="ProcessStatusEnum.ProcessedFail"/>.</param>
- /// <param name="willFail">If true, then <see cref="Status"/> will be set to <see cref="ProcessStatusEnum.ProcessedFail"/> otherwise to <see cref="ProcessStatusEnum.ProcessedSucc"/>.</param>
- void Stop(string reason, bool willPause = true, bool willFail = false);
- /// <summary>
- /// Resets task to initial state and sets <see cref="Status"/> to <see cref="ProcessStatusEnum.Pending"/>.
- /// Uses current validity to re-calculate <see cref="ProcessingValidFrom"/> and <see cref="ProcessingValidTo"/> to now + <see cref="postponeValid"/>.
- /// <list type="bullet">
- /// <item><description>Allowed state: <see cref="ProcessStatusEnum.Attached"/>, <see cref="ProcessStatusEnum.ProcessedSucc"/>, <see cref="ProcessStatusEnum.ProcessedFail"/>, <see cref="ProcessStatusEnum.Paused"/></description></item>
- /// <item><description>Set state to: <see cref="ProcessStatusEnum.Pending"/></description></item>
- /// </list>
- /// <exception cref="InvalidTaskStateException">When task state is invalid for operation.</exception>
- /// </summary>
- /// <param name="reason">Reason to reset task.</param>
- /// <param name="postponeValid">Postpone current validity from now.</param>
- void Reset(string reason, TimeSpan postponeValid);
- /// <summary>
- /// Deletes task and sets <see cref="Status"/> to <see cref="ProcessStatusEnum.Deleted"/>.
- /// </summary>
- /// <param name="reason">Reason to delete current task.</param>
- /// <param name="immediate">Flag is true, deletes task immediately (afters status change)</param>
- void Delete(string reason, bool immediate = false);
- #endregion
- }
|