@Override @Transactional public EndpointProfilesPageDto findEndpointProfileByEndpointGroupId(PageLinkDto pageLink) { validateSqlId(pageLink.getLimit(), "Can't find endpoint group by id. Incorrect limit parameter " + pageLink.getLimit()); validateString(pageLink.getOffset(), "Can't find endpoint group by id. Incorrect offset " + "parameter " + pageLink.getOffset()); return endpointProfileDao.findByEndpointGroupId(pageLink); }
@Override @Transactional public EndpointProfilesBodyDto findEndpointProfileBodyByEndpointGroupId(PageLinkDto pageLink) { validateSqlId(pageLink.getLimit(), "Can't find endpoint group by id. Incorrect limit parameter " + pageLink.getLimit()); validateString(pageLink.getOffset(), "Can't find endpoint group by id. Incorrect offset " + "parameter " + pageLink.getOffset()); return endpointProfileDao.findBodyByEndpointGroupId(pageLink); }
/** * Gets the endpoint profile body by endpoint group id. * * @param pageLink contains information about groupId, offset and limit */ public EndpointProfilesBodyDto getEndpointProfileBodyByEndpointGroupId(PageLinkDto pageLink) throws Exception { String endpointGroupId = pageLink.getEndpointGroupId(); String limit = pageLink.getLimit(); String offset = pageLink.getOffset(); ResponseEntity<EndpointProfilesBodyDto> entity = restTemplate.exchange(restTemplate.getUrl() + "endpointProfileBodyByGroupId?endpointGroupId=" + endpointGroupId + "&limit=" + limit + "&offset=" + offset, HttpMethod.GET, null, new ParameterizedTypeReference<EndpointProfilesBodyDto>() {}); return entity.getBody(); }
/** * Gets the endpoint profile by endpoint group id. * * @param pageLink contains information about groupId, offset and limit */ public EndpointProfilesPageDto getEndpointProfileByEndpointGroupId(PageLinkDto pageLink) throws Exception { String endpointGroupId = pageLink.getEndpointGroupId(); String limit = pageLink.getLimit(); String offset = pageLink.getOffset(); ParameterizedTypeReference<EndpointProfilesPageDto> typeRef = new ParameterizedTypeReference<EndpointProfilesPageDto>() {}; ResponseEntity<EndpointProfilesPageDto> entity = restTemplate.exchange(restTemplate.getUrl() + "endpointProfileByGroupId?endpointGroupId=" + endpointGroupId + "&limit=" + limit + "&offset=" + offset, HttpMethod.GET, null, typeRef); return entity.getBody(); }
@Override public EndpointProfilesBodyDto findBodyByEndpointGroupId(PageLinkDto pageLink) { LOG.debug("Try to find endpoint profile body by endpoint group id [{}]", pageLink.getEndpointGroupId()); List<EndpointProfileBodyDto> profilesBodyDto; ByteBuffer[] keyHashList; if (pageLink.getApplicationId() != null) { keyHashList = cassandraEpByAppIdDao.findEpByAppId( pageLink, pageLink.getApplicationId()); } else { keyHashList = cassandraEpByEndpointGroupIdDao.findEpByEndpointGroupId(pageLink); } profilesBodyDto = findEndpointProfilesBodyList(keyHashList, pageLink.getEndpointGroupId()); if (profilesBodyDto == null) { profilesBodyDto = Collections.emptyList(); } EndpointProfilesBodyDto endpointProfilesBodyDto = createNextBodyPage( profilesBodyDto, pageLink.getEndpointGroupId(), pageLink.getLimit()); return endpointProfilesBodyDto; }
@Override public EndpointProfilesPageDto findByEndpointGroupId(PageLinkDto pageLink) { LOG.debug("Try to find endpoint profile by endpoint group id [{}]", pageLink.getEndpointGroupId()); EndpointProfilesPageDto endpointProfilesPageDto; List<EndpointProfileDto> cassandraEndpointProfileList; ByteBuffer[] keyHashList; if (pageLink.getApplicationId() != null) { keyHashList = cassandraEpByAppIdDao.findEpByAppId( pageLink, pageLink.getApplicationId()); } else { keyHashList = cassandraEpByEndpointGroupIdDao.findEpByEndpointGroupId(pageLink); } cassandraEndpointProfileList = findEndpointProfilesList( keyHashList, pageLink.getEndpointGroupId()); endpointProfilesPageDto = createNextPage( cassandraEndpointProfileList, pageLink.getEndpointGroupId(), pageLink.getLimit()); return endpointProfilesPageDto; }
@Override public EndpointProfilesPageDto findByEndpointGroupId(PageLinkDto pageLink) { LOG.debug("Find endpoint profiles by endpoint group id [{}] ", pageLink.getEndpointGroupId()); EndpointProfilesPageDto endpointProfilesPageDto = new EndpointProfilesPageDto(); int lim = Integer.valueOf(pageLink.getLimit()); int offs = Integer.valueOf(pageLink.getOffset()); List<MongoEndpointProfile> mongoEndpointProfileList = find( query(new Criteria() .orOperator(where(EP_GROUP_STATE + "." + ENDPOINT_GROUP_ID) .is(pageLink.getEndpointGroupId()), where(EP_GROUP_STATE + "." + ENDPOINT_GROUP_ID) .is(pageLink.getEndpointGroupId()))) .skip(offs) .limit(lim + 1)); if (mongoEndpointProfileList.size() == (lim + 1)) { String offset = Integer.toString(lim + offs); pageLink.setOffset(offset); mongoEndpointProfileList.remove(lim); } else { pageLink.setNext(DaoConstants.LAST_PAGE_MESSAGE); } endpointProfilesPageDto.setPageLinkDto(pageLink); endpointProfilesPageDto.setEndpointProfiles(convertDtoList(mongoEndpointProfileList)); return endpointProfilesPageDto; }
String limit = pageLink.getLimit(); ByteBuffer endpointKey = getByteBuffer(Base64.decodeBase64(pageLink.getOffset())); Statement queryStatement;
String limit = pageLink.getLimit(); ByteBuffer endpointKey = getByteBuffer(Base64.decodeBase64(pageLink.getOffset())); Statement queryStatement;
pageLink.getEndpointGroupId()); List<EndpointProfileBodyDto> profilesBody = new ArrayList<>(); int lim = Integer.valueOf(pageLink.getLimit()); int offs = Integer.valueOf(pageLink.getOffset()); Query query = Query.query(