@Test @DatabaseSetup("classpath:dbunit/event.xml") public void findEvent() { UUID tenantId = UUID.fromString("be41c7a0-31f5-11e7-9cfd-2786e6aa2046"); UUID entityId = UUID.fromString("be41c7a1-31f5-11e7-9cfd-2786e6aa2046"); String eventType = STATS; String eventUid = "be41c7a3-31f5-11e7-9cfd-2786e6aa2046"; Event event = eventDao.findEvent(tenantId, new DeviceId(entityId), eventType, eventUid); eventDao.find(AbstractServiceTest.SYSTEM_TENANT_ID).stream().forEach(System.out::println); assertNotNull("Event expected to be not null", event); assertEquals("be41c7a2-31f5-11e7-9cfd-2786e6aa2046", event.getId().getId().toString()); }
@Override public Event findEvent(UUID tenantId, EntityId entityId, String eventType, String eventUid) { return DaoUtil.getData(eventRepository.findByTenantIdAndEntityTypeAndEntityIdAndEventTypeAndEventUid( tenantId, entityId.getEntityType(), entityId.getId(), eventType, eventUid)); }
JpaBaseEventDao extends JpaAbstractDao<EventEntity, Event> implements EventDao { @Override public Event findEvent(UUID tenantId, EntityId entityId, String eventType, String eventUid) { return DaoUtil.getData(eventRepository.findByTenantIdAndEntityTypeAndEntityIdAndEventTypeAndEventUid( tenantId, entityId.getEntityType(), entityId.getId(), eventType, eventUid)); } }
JpaBaseEventDao extends JpaAbstractDao<EventEntity, Event> implements EventDao { @Override public Event findEvent(UUID tenantId, EntityId entityId, String eventType, String eventUid) { return DaoUtil.getData(eventRepository.findByTenantIdAndEntityTypeAndEntityIdAndEventTypeAndEventUid( tenantId, entityId.getEntityType(), entityId.getId(), eventType, eventUid)); }  }
JpaBaseEventDao extends JpaAbstractDao<EventEntity, Event> implements EventDao { @Override public Event findEvent(UUID tenantId, EntityId entityId, String eventType, String eventUid) { return DaoUtil.getData(eventRepository.findByTenantIdAndEntityTypeAndEntityIdAndEventTypeAndEventUid( tenantId, entityId.getEntityType(), entityId.getId(), eventType, eventUid)); }  @Override Event save(TenantId tenantId, 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 PageData<Event> findEvents(UUID tenantId, EntityId entityId, TimePageLink pageLink); @Override PageData<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 JpaAbstractDao<EventEntity, Event> implements EventDao { @Override public Event findEvent(UUID tenantId, EntityId entityId, String eventType, String eventUid) { return DaoUtil.getData(eventRepository.findByTenantIdAndEntityTypeAndEntityIdAndEventTypeAndEventUid( tenantId, entityId.getEntityType(), entityId.getId(), eventType, eventUid)); }  @Override Event save(TenantId tenantId, 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 PageData<Event> findEvents(UUID tenantId, EntityId entityId, TimePageLink pageLink); @Override PageData<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);  }