@Override @Transactional public EndpointGroupDto findEndpointGroupById(String id) { validateSqlId(id, "Can't find endpoint group by id. Incorrect id " + id); return getDto(endpointGroupDao.findById(id)); }
@Override public List<TopicDto> findVacantTopicsByEndpointGroupId(String endpointGroupId) { validateId(endpointGroupId, "Can't find vacant topics. Invalid endpoint group id " + endpointGroupId); List<TopicDto> topics = Collections.emptyList(); EndpointGroup endpointGroup = endpointGroupDao.findById(endpointGroupId); String applicationId = null; if (endpointGroup != null) { applicationId = endpointGroup.getApplicationId(); } if (isNotBlank(applicationId)) { topics = convertDtoList(topicDao.findVacantTopicsByGroupId(applicationId, endpointGroupId)); } else { LOG.warn("Can't get application id from endpoint group."); } return topics; }
@Override public List<TopicDto> findTopicsByEndpointGroupId(String endpointGroupId) { validateId(endpointGroupId, "Can't find topics. Invalid endpoint group id " + endpointGroupId); EndpointGroup endpointGroup = endpointGroupDao.findById(endpointGroupId); Set<Topic> topics = endpointGroup.getTopics(); return convertDtoList(topics); }
@Override public List<VersionDto> findVacantSchemasByEndpointGroupId(String endpointGroupId) { validateId(endpointGroupId, "Can't find vacant schemas. Invalid endpoint group id: " + endpointGroupId); EndpointGroup group = endpointGroupDao.findById(endpointGroupId); List<Configuration> configurations = configurationDao.findActualByEndpointGroupId( endpointGroupId); List<String> usedSchemaIds = new ArrayList<>(); for (Configuration configuration : configurations) { ConfigurationSchema schema = configuration.getConfigurationSchema(); if (schema != null) { usedSchemaIds.add(idToString(schema.getId())); } } List<ConfigurationSchema> schemas = configurationSchemaDao.findVacantSchemas( group.getApplicationId(), usedSchemaIds); List<VersionDto> schemaDtoList = new ArrayList<>(); for (ConfigurationSchema schema : schemas) { schemaDtoList.add(schema.toVersionDto()); } return schemaDtoList; }
private ChangeNotificationDto createNotification(ProfileFilterDto profileFilter, HistoryDto historyDto) { LOG.debug("Create notification after profile filter update."); ChangeNotificationDto changeNotificationDto = null; if (historyDto != null) { changeNotificationDto = new ChangeNotificationDto(); changeNotificationDto.setAppId(profileFilter.getApplicationId()); changeNotificationDto.setAppSeqNumber(historyDto.getSequenceNumber()); String endpointGroupId = profileFilter.getEndpointGroupId(); if (isValidId(endpointGroupId)) { EndpointGroup group = endpointGroupDao.findById(endpointGroupId); if (group != null) { changeNotificationDto.setGroupId(group.getId().toString()); changeNotificationDto.setGroupSeqNumber(group.getSequenceNumber()); } else { LOG.debug("Can't find endpoint group by id [{}].", endpointGroupId); } } else { LOG.debug("Incorrect endpoint group id [{}].", endpointGroupId); } } else { LOG.debug("Can't save history information."); } return changeNotificationDto; }
private ChangeNotificationDto createNotification(ConfigurationDto configurationDto, HistoryDto historyDto) { LOG.debug("Create notification after configuration update."); ChangeNotificationDto changeNotificationDto = null; if (historyDto != null) { changeNotificationDto = new ChangeNotificationDto(); changeNotificationDto.setAppId(configurationDto.getApplicationId()); changeNotificationDto.setAppSeqNumber(historyDto.getSequenceNumber()); String endpointGroupId = configurationDto.getEndpointGroupId(); if (isValidId(endpointGroupId)) { EndpointGroup group = endpointGroupDao.findById(endpointGroupId); if (group != null) { changeNotificationDto.setGroupId(idToString(group)); changeNotificationDto.setGroupSeqNumber(group.getSequenceNumber()); } else { LOG.debug("Can't find endpoint group by id [{}].", endpointGroupId); } } else { LOG.debug("Incorrect endpoint group id [{}].", endpointGroupId); } } else { LOG.debug("Can't save history information."); } return changeNotificationDto; }
validateSqlId(endpointGroupId, "Can't find vacant schemas. Invalid endpoint group id: " + endpointGroupId); EndpointGroup group = endpointGroupDao.findById(endpointGroupId); String appId = group.getApplicationId(); List<ServerProfileSchemaDto> serverSchemas = serverProfileService
ConfigurationSchemaDto configurationSchema) { try { EndpointGroup endpointGroup = endpointGroupDao.findById( currentConfiguration.getEndpointGroupId()); GenericAvroConverter<GenericRecord> avroConverter;
EndpointGroup endpointGroup = endpointGroupDao.findById(id); ChangeNotificationDto changeDto = null; if (endpointGroup
EndpointGroup previousGroup = endpointGroupDao.findById(id); if (previousGroup != null) {
@Test public void removeEndpointGroupTest() { Topic first = generateTopic(null, null, "first"); Topic second = generateTopic(first.getApplication(), null, "second"); Set<Topic> topicsOne = new HashSet<>(); topicsOne.add(first); Set<Topic> topicsTwo = new HashSet<>(); topicsTwo.add(second); EndpointGroup endpointGroupOne = generateEndpointGroup(first.getApplication(), topicsOne); generateEndpointGroup(first.getApplication(), topicsTwo); endpointGroupDao.removeById(endpointGroupOne.getStringId()); Assert.assertNull(endpointGroupDao.findById(endpointGroupOne.getStringId())); Topic f = topicDao.findById(first.getStringId()); Assert.assertNotNull(f); Assert.assertTrue(f.getEndpointGroups().isEmpty()); }
String srvProfSchemaId = profileFilterDto.getServerProfileSchemaId(); String groupId = profileFilterDto.getEndpointGroupId(); EndpointGroup group = endpointGroupDao.findById(groupId); if (group.getWeight() == 0) { throw new UpdateStatusConflictException(
String oid = oldProfileFilter.getGroupId(); if (oid != null) { EndpointGroup group = endpointGroupDao.findById(oid); if (group != null && group.getWeight() == 0) { throw new IncorrectParameterException("Can't deactivate default profile filter");