@Override public List<VersionDto> findProfileSchemaVersionsByAppId(String applicationId) { validateSqlId(applicationId, "Can't find profile schemas. Invalid application id: " + applicationId); List<EndpointProfileSchema> endpointProfileSchemas = profileSchemaDao.findByApplicationId(applicationId); List<VersionDto> schemas = new ArrayList<>(); for (EndpointProfileSchema endpointProfileSchema : endpointProfileSchemas) { schemas.add(endpointProfileSchema.toVersionDto()); } return schemas; }
@Override public void removeProfileSchemasByAppId(String applicationId) { validateSqlId(applicationId, "Can't remove profile schema. Invalid application id: " + applicationId); List<EndpointProfileSchema> schemas = profileSchemaDao.findByApplicationId(applicationId); if (schemas != null && !schemas.isEmpty()) { LOG.debug("Remove profile shemas by application id {}", applicationId); for (EndpointProfileSchema schema : schemas) { removeProfileSchemaById(schema.getId().toString()); } } }
@Override public List<EndpointProfileSchemaDto> findProfileSchemasByAppId(String applicationId) { validateSqlId(applicationId, "Can't find profile schema. Invalid application id: " + applicationId); return convertDtoList(profileSchemaDao.findByApplicationId(applicationId)); }
@Test public void findByApplicationId() { List<EndpointProfileSchema> schemas = generateProfSchema(null, 3); Assert.assertEquals(3, schemas.size()); EndpointProfileSchema schema = schemas.get(0); Application app = schema.getApplication(); List<EndpointProfileSchema> found = profileSchemaDao.findByApplicationId(app.getId().toString()); Assert.assertEquals(3, found.size()); Assert.assertEquals(schemas, found); }