Business Object
data class BusinessObject(val type: BusinessObjectType, val id: Long, val state: State, val properties: Set<Property> = emptySet(), val masters: MutableMap<String, BusinessObject> = mutableMapOf()) : JsonSerializable
BusinessObjects are instances of BusinessObjectTypes.
Parameters
type
The BusinessObjectType of this BusinessObject.
id
The unique ID of this BusinessObject.
state
The current State of this BusinessObject.
Constructors
Link copied to clipboard
constructor(type: BusinessObjectType, id: Long, state: State, properties: Set<Property> = emptySet(), masters: MutableMap<String, BusinessObject> = mutableMapOf())
Functions
Link copied to clipboard
suspend fun handleEvent(objectStore: BusinessObjectStore, event: Event): EitherNel<EventHandlingError, BusinessObject>
This method applies an Event to this BusinessObject, potentially changing its state and properties. The new state is derived by using the type's StateMachine to determine the next State for the state and Event.type. The new property values are updated if they are provided in the Event.properties map. Otherwise, the old values are kept.
Link copied to clipboard
Link copied to clipboard