Package cloud.quinimbus.persistence.api
Interface PersistenceContext
public interface PersistenceContext
The persistence context is the central object for using Quinimbus Persistence.
-
Method Summary
Modifier and TypeMethodDescription<T extends Record>
EntityReader<T> getRecordEntityReader
(EntityType type, Class<T> recordClass) <T extends Record>
EntityWriter<T> getRecordEntityWriter
(EntityType type, Class<T> recordClass) Get the schame registered by the given id.getSchemaProvider
(String alias) Get the schema provider registered by the given alias.<T extends PersistenceSchemaStorage>
Optional<? extends PersistenceStorageProvider<T>> getStorageProvider
(String alias) Get the storage provider registered by the given alias.importRecordSchema
(Class<? extends Record>... recordClasses) importSchema
(PersistenceSchemaProvider provider) importSchema
(PersistenceSchemaProvider provider, cloud.quinimbus.config.api.ConfigNode configNode) importSchemaFromSingleJson
(Reader reader) newEmbedded
(EmbeddedPropertyType type, EntityType parentType, List<String> path, Map<String, Object> properties) newEmbedded
(EmbeddedPropertyType type, EntityType parentType, List<String> path, Map<String, Object> properties, Map<String, Object> transientFields) <K> Entity
<K> newEntity
(K id, EntityType type) <K> Entity
<K> newEntity
(K id, EntityType type, Map<String, Object> properties) <K> Entity
<K> <T extends LifecycleEvent<K>,
K>
voidonLifecycleEvent
(String schema, Class<T> eventType, EntityType type, Consumer<T> consumer) <T extends LifecycleEvent<K>,
K>
voidonLifecycleEvent
(String schema, Class<T> eventType, String typeId, Consumer<T> consumer) setSchemaStorage
(String id, PersistenceSchemaStorage storage) void
upgradeSchema
(PersistenceSchemaStorage storage)
-
Method Details
-
getStorageProvider
<T extends PersistenceSchemaStorage> Optional<? extends PersistenceStorageProvider<T>> getStorageProvider(String alias) Get the storage provider registered by the given alias. -
getSchemaProvider
Get the schema provider registered by the given alias. -
getSchema
Get the schame registered by the given id. -
getSchemaStorage
-
setSchemaStorage
-
setInMemorySchemaStorage
-
newEntity
-
newEntity
<K> Entity<K> newEntity(K id, EntityType type, Map<String, Object> properties) throws UnparseableValueException- Throws:
UnparseableValueException
-
newEntity
<K> Entity<K> newEntity(K id, EntityType type, Map<String, Object> properties, Map<String, throws UnparseableValueExceptionObject> transientFields) - Throws:
UnparseableValueException
-
newEmbedded
EmbeddedObject newEmbedded(EmbeddedPropertyType type, EntityType parentType, List<String> path, Map<String, Object> properties) throws UnparseableValueException- Throws:
UnparseableValueException
-
newEmbedded
EmbeddedObject newEmbedded(EmbeddedPropertyType type, EntityType parentType, List<String> path, Map<String, Object> properties, Map<String, throws UnparseableValueExceptionObject> transientFields) - Throws:
UnparseableValueException
-
importSchema
- Throws:
InvalidSchemaException
-
importSchema
Schema importSchema(PersistenceSchemaProvider provider, cloud.quinimbus.config.api.ConfigNode configNode) throws InvalidSchemaException - Throws:
InvalidSchemaException
-
importSchemaFromSingleJson
- Throws:
InvalidSchemaException
IOException
-
importRecordSchema
- Throws:
InvalidSchemaException
-
getRecordEntityReader
<T extends Record> EntityReader<T> getRecordEntityReader(EntityType type, Class<T> recordClass) throws EntityReaderInitialisationException -
getRecordEntityWriter
<T extends Record> EntityWriter<T> getRecordEntityWriter(EntityType type, Class<T> recordClass) throws EntityWriterInitialisationException -
upgradeSchema
- Throws:
PersistenceException
-
getRecordEntityRegistry
RecordEntityRegistry getRecordEntityRegistry() -
onLifecycleEvent
<T extends LifecycleEvent<K>,K> void onLifecycleEvent(String schema, Class<T> eventType, EntityType type, Consumer<T> consumer) -
onLifecycleEvent
<T extends LifecycleEvent<K>,K> void onLifecycleEvent(String schema, Class<T> eventType, String typeId, Consumer<T> consumer)
-