@Test public void findEventsByEntityIdAndEventTypeAndPageLink() { UUID tenantId = UUIDs.timeBased(); UUID entityId1 = UUIDs.timeBased(); UUID entityId2 = UUIDs.timeBased(); long startTime = System.currentTimeMillis(); long endTime = createEventsTwoEntitiesTwoTypes(tenantId, entityId1, entityId2, startTime, 20); TimePageLink pageLink1 = new TimePageLink(30, null, null, true); List<Event> events1 = eventDao.findEvents(tenantId, new DeviceId(entityId1), ALARM, pageLink1); assertEquals(5, events1.size()); TimePageLink pageLink2 = new TimePageLink(30, startTime, null, true); List<Event> events2 = eventDao.findEvents(tenantId, new DeviceId(entityId1), ALARM, pageLink2); assertEquals(5, events2.size()); TimePageLink pageLink3 = new TimePageLink(30, startTime, endTime, true); List<Event> events3 = eventDao.findEvents(tenantId, new DeviceId(entityId1), ALARM, pageLink3); assertEquals(5, events3.size()); TimePageLink pageLink4 = new TimePageLink(4, startTime, endTime, true); List<Event> events4 = eventDao.findEvents(tenantId, new DeviceId(entityId1), ALARM, pageLink4); assertEquals(4, events4.size()); UUID idOffset = events3.get(2).getId().getId(); TimePageLink pageLink5 = new TimePageLink(10, startTime, endTime, true, idOffset); List<Event> events5 = eventDao.findEvents(tenantId, new DeviceId(entityId1), ALARM, pageLink5); assertEquals(2, events5.size()); }
@Override public List<Event> findEvents(UUID tenantId, EntityId entityId, TimePageLink pageLink) { return findEvents(tenantId, entityId, null, pageLink); }
JpaBaseEventDao extends JpaAbstractSearchTimeDao<EventEntity, Event> implements EventDao { @Override public List<Event> findEvents(UUID tenantId, EntityId entityId, TimePageLink pageLink) { return findEvents(tenantId, entityId, null, pageLink); } }
JpaBaseEventDao extends JpaAbstractSearchTimeDao<EventEntity, Event> implements EventDao { @Override public List<Event> findEvents(UUID tenantId, EntityId entityId, TimePageLink pageLink) { return findEvents(tenantId, entityId, null, pageLink); }  }
JpaBaseEventDao extends JpaAbstractSearchTimeDao<EventEntity, Event> implements EventDao { @Override public List<Event> findEvents(UUID tenantId, EntityId entityId, TimePageLink pageLink) { return findEvents(tenantId, entityId, null, pageLink); }  @Override Event save(Event event); @Override ListenableFuture<Event> saveAsync(Event event); @Override Optional<Event> saveIfNotExists(Event event); @Override Event findEvent(UUID tenantId, EntityId entityId, String eventType, String eventUid); @Override List<Event> findEvents(UUID tenantId, EntityId entityId, TimePageLink pageLink); @Override List<Event> findEvents(UUID tenantId, EntityId entityId, String eventType, TimePageLink pageLink); @Override List<Event> findLatestEvents(UUID tenantId, EntityId entityId, String eventType, int limit); Optional<Event> save(EventEntity entity, boolean ifNotExists); }
JpaBaseEventDao extends JpaAbstractSearchTimeDao<EventEntity, Event> implements EventDao { @Override public List<Event> findEvents(UUID tenantId, EntityId entityId, TimePageLink pageLink) { return findEvents(tenantId, entityId, null, pageLink); }  @Override Event save(Event event); @Override ListenableFuture<Event> saveAsync(Event event); @Override Optional<Event> saveIfNotExists(Event event); @Override Event findEvent(UUID tenantId, EntityId entityId, String eventType, String eventUid); @Override List<Event> findEvents(UUID tenantId, EntityId entityId, TimePageLink pageLink); @Override List<Event> findEvents(UUID tenantId, EntityId entityId, String eventType, TimePageLink pageLink); @Override List<Event> findLatestEvents(UUID tenantId, EntityId entityId, String eventType, int limit); Optional<Event> save(EventEntity entity, boolean ifNotExists);  }