Reader

interface Reader<C : KlerkContext, D>

Properties

Link copied to clipboard
abstract val data: D

Functions

Link copied to clipboard
abstract fun <T : Any> firstOrNull(collection: ModelCollection<T, C>, filter: (Model<T>) -> Boolean): Model<T>?

Finds the first model in the Collection and passes the provided filter.

Link copied to clipboard
abstract fun <T : Any> get(id: ModelID<T>): Model<T>

Get a model.

Link copied to clipboard
abstract fun getAllRelatedIds(id: ModelID<*>): Set<ModelID<*>>

Finds all models that have a relation to the specified model.

Link copied to clipboard
abstract fun <T : Any> getFirstWhere(collection: ModelCollection<T, C>, filter: (Model<T>) -> Boolean): Model<T>

Gets the first model from the Collection and passes the provided filter.

Link copied to clipboard
abstract fun <T : Any> getIfAuthorizedOrNull(id: ModelID<T>): Model<T>?
Link copied to clipboard
abstract fun <T : Any> getOrNull(id: ModelID<T>): Model<T>?
Link copied to clipboard

Returns all non-void events for the statemachine along with a set of problems for each event given the provided context. Note that even if the set of problems for an event is empty, it doesn't necessarily mean that the event will succeed (e.g. if the provided parameters violates some rule).

Link copied to clipboard

Returns all void events for the statemachine along with a set of problems for each event given the provided context. Note that even if the set of problems for an event is empty, it doesn't necessarily mean that the event will succeed (e.g. if the provided parameters violates some rule).

Link copied to clipboard
abstract fun <T : Any> getPossibleEvents(id: ModelID<T>): Set<EventReference>

Returns a set of external events for the model that are possible given the current state and provided context

Link copied to clipboard
abstract fun <T : Any> getPossibleVoidEvents(clazz: KClass<T>): Set<EventReference>

Returns a set of external void events for the statemachine that are possible given the provided context

Link copied to clipboard
abstract fun <T : Any> getRelated(clazz: KClass<T>, id: ModelID<*>): Set<Model<T>>

Finds all models of a specified type that has a relation to the specified model.

abstract fun <T : Any, U : Any> getRelated(property: KProperty1<T, ModelID<U>?>, id: ModelID<*>): Set<Model<T>>
Link copied to clipboard
abstract fun <T : Any, U : Any> getRelatedInCollection(property: KProperty1<T, Collection<ModelID<U>>?>, id: ModelID<*>): Set<Model<T>>
Link copied to clipboard
abstract fun <T : Any> isInstanceEventPossible(eventReference: EventReference, model: Model<T>, parameters: Any?): Boolean

Checks if a normal event is possible

Link copied to clipboard
abstract fun isVoidEventPossible(eventReference: EventReference, parameters: Any?): Boolean

Checks if a void event is possible

Link copied to clipboard
abstract fun <T : Any> list(modelCollection: ModelCollection<T, C>, filter: (Model<T>) -> Boolean? = null): List<Model<T>>

Get all models in the Collection that passes the provided filter.

Link copied to clipboard
abstract fun <T : Any> listIfAuthorized(collection: ModelCollection<T, C>): List<Model<T>>

List all models that are specified in a Collection. Unauthorized models are removed from the result.

Link copied to clipboard
abstract fun <T : Any> query(collection: ModelCollection<T, C>, options: QueryOptions? = null, filter: (Model<T>) -> Boolean? = null): QueryResponse<T>