BusinessObject

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

id

The unique ID of this BusinessObject.

state

The current State of this BusinessObject.

properties

The set of Property of this BusinessObject. There is one Property for each Attribute of the type. By default, all Propertys are set to null.

Constructors

Link copied to clipboard
constructor(type: BusinessObjectType, id: Long, state: State, properties: Set<Property> = emptySet(), masters: MutableMap<String, BusinessObject> = mutableMapOf())

Types

Link copied to clipboard

Properties

Link copied to clipboard
val id: Long
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
operator fun <T> get(propertyName: String): Either<InstanceError, T?>
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
fun master(dependencyName: String): Either<InstanceError, BusinessObject>
Link copied to clipboard
open override fun toJsonString(): String
Link copied to clipboard
open override fun toString(): String