@Override public List<VersionDto> findLogSchemaVersionsByApplicationId(String applicationId) { validateId(applicationId, "Can't find log schemas. Invalid application id: " + applicationId); List<LogSchema> logSchemas = logSchemaDao.findByApplicationId(applicationId); List<VersionDto> schemas = new ArrayList<>(); for (LogSchema logSchema : logSchemas) { schemas.add(logSchema.toVersionDto()); } return schemas; }
@Override public void removeLogSchemasByAppId(String applicationId) { validateId(applicationId, "Can't remove log schema. Invalid application id: " + applicationId); List<LogSchema> schemas = logSchemaDao.findByApplicationId(applicationId); if (schemas != null && !schemas.isEmpty()) { LOG.debug("Remove log shemas by application id {}", applicationId); for (LogSchema schema : schemas) { removeLogSchemaById(schema.getStringId()); } } }
@Override public List<LogSchemaDto> findLogSchemasByAppId(String applicationId) { validateId(applicationId, "Can't find log schemas. Invalid application id: " + applicationId); return convertDtoList(logSchemaDao.findByApplicationId(applicationId)); }
@Test public void findByApplicationIdTest() { LogSchema logSchema = generateLogSchema(null, 1, null, 1).get(0); Assert.assertNotNull(logSchema); List<LogSchema> schemaList = logSchemaDao.findByApplicationId(logSchema.getApplication().getStringId()); Assert.assertNotNull(schemaList); LogSchema found = null; for (LogSchema schema : schemaList) { if (schema.getId().equals(logSchema.getId())) { found = schema; } } Assert.assertEquals(logSchema, found); }