EndpointGroupDto checkEndpointGroupId(String endpointGroupId) throws KaaAdminServiceException { try { if (isEmpty(endpointGroupId)) { throw new IllegalArgumentException("The endpointGroupId parameter is empty."); } EndpointGroupDto endpointGroup = controlService.getEndpointGroup(endpointGroupId); checkNotNull(endpointGroup); checkApplicationId(endpointGroup.getApplicationId()); return endpointGroup; } catch (Exception ex) { throw Utils.handleException(ex); } }
@Override public EndpointProfilesPageDto getEndpointProfileByEndpointGroupId(String endpointGroupId, String limit, String offset) throws KaaAdminServiceException { checkAuthority(KaaAuthorityDto.TENANT_DEVELOPER, KaaAuthorityDto.TENANT_USER); try { if (Integer.valueOf(limit) > MAX_LIMIT) { throw new IllegalArgumentException( "Incorrect limit parameter. You must enter value not more than " + MAX_LIMIT); } EndpointGroupDto endpointGroupDto = getEndpointGroup(endpointGroupId); PageLinkDto pageLinkDto = new PageLinkDto(endpointGroupId, limit, offset); if (isGroupAll(endpointGroupDto)) { pageLinkDto.setApplicationId(endpointGroupDto.getApplicationId()); } return controlService.getEndpointProfileByEndpointGroupId(pageLinkDto); } catch (Exception ex) { throw Utils.handleException(ex); } }
@Override public EndpointProfilesBodyDto getEndpointProfileBodyByEndpointGroupId(String endpointGroupId, String limit, String offset) throws KaaAdminServiceException { checkAuthority(KaaAuthorityDto.TENANT_DEVELOPER, KaaAuthorityDto.TENANT_USER); try { if (Integer.valueOf(limit) > MAX_LIMIT) { throw new IllegalArgumentException( "Incorrect limit parameter. You must enter value not more than " + MAX_LIMIT); } EndpointGroupDto endpointGroupDto = getEndpointGroup(endpointGroupId); PageLinkDto pageLinkDto = new PageLinkDto(endpointGroupId, limit, offset); if (isGroupAll(endpointGroupDto)) { pageLinkDto.setApplicationId(endpointGroupDto.getApplicationId()); } return controlService.getEndpointProfileBodyByEndpointGroupId(pageLinkDto); } catch (Exception ex) { throw Utils.handleException(ex); } }
private HistoryDto addHistory(EndpointGroupDto dto, ChangeType type, String topicId) { LOG.debug("Add history information about endpoint group update"); HistoryDto history = new HistoryDto(); history.setApplicationId(dto.getApplicationId()); ChangeDto change = new ChangeDto(); change.setEndpointGroupId(dto.getId()); change.setType(type); change.setTopicId(topicId); history.setChange(change); return historyService.saveHistory(history); }
@Test public void findEndpointGroupsByAppIdTest() { EndpointGroupDto group = generateEndpointGroupDto(null); List<EndpointGroupDto> groups = endpointService.findEndpointGroupsByAppId(group.getApplicationId()); Assert.assertNotNull(groups); Assert.assertFalse(groups.isEmpty()); Assert.assertEquals(2, groups.size()); ; }
+ endpointGroupDto); EndpointGroupDto savedGroup = null; String appId = endpointGroupDto.getApplicationId(); if (isValidId(appId)) { String id = endpointGroupDto.getId();
/** * Create instance of <code>EndpointGroup</code>. * * @param dto data transfer object */ public EndpointGroup(EndpointGroupDto dto) { if (dto != null) { this.id = getLongId(dto); this.name = dto.getName(); this.sequenceNumber = dto.getSequenceNumber(); this.weight = dto.getWeight(); this.description = dto.getDescription(); this.createdUsername = dto.getCreatedUsername(); this.createdTime = dto.getCreatedTime(); Long appId = getLongId(dto.getApplicationId()); this.application = appId != null ? new Application(appId) : null; this.topics = getTopic(dto.getTopics()); } }
@Override public EndpointGroupDto editEndpointGroup(EndpointGroupDto endpointGroup) throws KaaAdminServiceException { checkAuthority(KaaAuthorityDto.TENANT_DEVELOPER, KaaAuthorityDto.TENANT_USER); try { checkEndpointGroupWeight(endpointGroup.getWeight()); if (isEmpty(endpointGroup.getId())) { endpointGroup.setCreatedUsername(getCurrentUser().getUsername()); checkApplicationId(endpointGroup.getApplicationId()); } else { checkEndpointGroupId(endpointGroup.getId()); } return controlService.editEndpointGroup(endpointGroup); } catch (Exception ex) { throw Utils.handleException(ex); } }