Table of Contents

Class ReprocessRequestStateManager

Namespace
Geotab.Checkmate.ObjectModel.Reprocessing
Assembly
Geotab.Checkmate.ObjectModel.dll

A lightweight state machine used by ReprocessRequest and DeviceReprocessRequest.

public class ReprocessRequestStateManager
Inheritance
ReprocessRequestStateManager
Inherited Members

Constructors

ReprocessRequestStateManager(List<(ReprocessRequestStatus From, ReprocessRequestStatus To)>)

Initializes a new instance of the ReprocessRequestStateManager class.

public ReprocessRequestStateManager(List<(ReprocessRequestStatus From, ReprocessRequestStatus To)> validStateTransitions)

Parameters

validStateTransitions List<(ReprocessRequestStatus From, ReprocessRequestStatus To)>

The list of valid state transitions for this state machine.

Methods

IsTerminalState(ReprocessRequestStatus)

Check whether a state is terminal. A state is considered terminal if there are no valid transitions out of that state.

public bool IsTerminalState(ReprocessRequestStatus status)

Parameters

status ReprocessRequestStatus

The status to check.

Returns

bool

Returns true if the status is in a terminal state, otherwise false

IsValidStateTransition(ReprocessRequestStatus, ReprocessRequestStatus)

Check whether a state transition is valid.

public bool IsValidStateTransition(ReprocessRequestStatus oldStatus, ReprocessRequestStatus newStatus)

Parameters

oldStatus ReprocessRequestStatus

The existing status.

newStatus ReprocessRequestStatus

The status to transition to.

Returns

bool

true if the state can be transitioned from oldStatus to newStatus, otherwise false.

ThrowIfInvalidStateTransition(ReprocessRequestStatus?, ReprocessRequestStatus)

Check if a state transition is valid, and throw an exception if not.

public void ThrowIfInvalidStateTransition(ReprocessRequestStatus? oldStatus, ReprocessRequestStatus newStatus)

Parameters

oldStatus ReprocessRequestStatus?

The original status.

newStatus ReprocessRequestStatus

The status to transition to.

Exceptions

Exception

Throws an exception if the state transition is invalid.