Search in sources :

Example 1 with EventRecordStorage

use of io.spine.server.storage.EventRecordStorage in project core-java by SpineEventEngine.

the class EventStorage method createStorage.

@Override
protected EventRecordStorage createStorage(StorageFactory factory) {
    final RecordStorage<EventId> recordStorage = super.createStorage(factory);
    final EventRecordStorage storage = factory.createEventStorage(recordStorage);
    return storage;
}
Also used : EventRecordStorage(io.spine.server.storage.EventRecordStorage) EventId(io.spine.base.EventId)

Example 2 with EventRecordStorage

use of io.spine.server.storage.EventRecordStorage in project core-java by SpineEventEngine.

the class EventStorage method iterator.

Iterator<Event> iterator(EventStreamQuery query) {
    final EventRecordStorage storage = recordStorage();
    final Map<EventId, EntityRecord> records = storage.readAll(query);
    final Collection<EventEntity> entities = transform(records.entrySet(), storageRecordToEntity());
    // TODO:2017-05-19:dmytro.dashenkov: Remove after the Entity Column approach is implemented.
    final Collection<EventEntity> filtered = filter(entities, createEntityFilter(query));
    final List<EventEntity> entityList = newArrayList(filtered);
    Collections.sort(entityList, EventEntity.comparator());
    final Iterator<Event> result = Iterators.transform(entityList.iterator(), getEventFunc());
    return result;
}
Also used : EntityRecord(io.spine.server.entity.EntityRecord) EventRecordStorage(io.spine.server.storage.EventRecordStorage) EventId(io.spine.base.EventId) Event(io.spine.base.Event)

Aggregations

EventId (io.spine.base.EventId)2 EventRecordStorage (io.spine.server.storage.EventRecordStorage)2 Event (io.spine.base.Event)1 EntityRecord (io.spine.server.entity.EntityRecord)1