@Override public void onSuccess(EndpointProfilesPageDto result) { Set<EndpointProfileDto> hs = new HashSet<>(); hs.addAll(result.getEndpointProfiles()); hs.addAll(endpointProfilesList); endpointProfilesList.clear(); endpointProfilesList.addAll(hs); callback.onSuccess(endpointProfilesList); offset = result.getPageLinkDto().getOffset(); } });
@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(); }
String endpointGroupId = pageLink.getEndpointGroupId(); String limit = pageLink.getLimit(); ByteBuffer endpointKey = getByteBuffer(Base64.decodeBase64(pageLink.getOffset())); Statement queryStatement; if ("0".equals(pageLink.getOffset())) { queryStatement = select().from(getColumnFamilyName()) .where(eq(
@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; }
List<EndpointProfileBodyDto> profilesBody = new ArrayList<>(); int lim = Integer.valueOf(pageLink.getLimit()); int offs = Integer.valueOf(pageLink.getOffset()); Query query = Query.query( new Criteria()