use of io.spine.base.EventId 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;
}
use of io.spine.base.EventId 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;
}
use of io.spine.base.EventId in project core-java by SpineEventEngine.
the class EventIdSequence method next.
/**
* Generates the next event ID in the sequence.
*/
EventId next() {
count.incrementAndGet();
final String value = buildValue();
final EventId result = EventId.newBuilder().setValue(value).build();
return result;
}
use of io.spine.base.EventId in project core-java by SpineEventEngine.
the class EventsShould method provide_EventId_stringifier.
@Test
public void provide_EventId_stringifier() {
final EventId id = event.getId();
final String str = Stringifiers.toString(id);
final EventId convertedBack = Stringifiers.fromString(str, EventId.class);
assertEquals(id, convertedBack);
}
use of io.spine.base.EventId in project core-java by SpineEventEngine.
the class EventsShould method accept_generated_event_id.
@Test
public void accept_generated_event_id() {
final EventId eventId = event.getId();
assertEquals(eventId, checkValid(eventId));
}
Aggregations