Search in sources :

Example 1 with JsonResultForManufacturer

use of com.vmware.flowgate.nlyteworker.model.JsonResultForManufacturer in project flowgate by vmware.

the class NlyteAPIClient method getManufacturers.

public List<Manufacturer> getManufacturers(boolean isAllData) {
    initAuthenticationWebToken();
    List<Manufacturer> manufacturers = new LinkedList<Manufacturer>();
    JsonResultForManufacturer manufacturerResult = this.restTemplate.exchange(getNlyteServiceEndpoint() + GetManufacturersURL, HttpMethod.GET, getDefaultEntity(), JsonResultForManufacturer.class).getBody();
    manufacturers = manufacturerResult.getValue();
    if (!isAllData) {
        return manufacturers;
    }
    List<Manufacturer> nextPageManufacturers = null;
    while (manufacturerResult.getOdatanextLink() != null && !manufacturerResult.getOdatanextLink().equals("")) {
        nextPageManufacturers = new LinkedList<Manufacturer>();
        manufacturerResult = this.restTemplate.exchange(manufacturerResult.getOdatanextLink(), HttpMethod.GET, getDefaultEntity(), JsonResultForManufacturer.class).getBody();
        nextPageManufacturers = manufacturerResult.getValue();
        manufacturers.addAll(nextPageManufacturers);
    }
    return manufacturers;
}
Also used : Manufacturer(com.vmware.flowgate.nlyteworker.model.Manufacturer) JsonResultForManufacturer(com.vmware.flowgate.nlyteworker.model.JsonResultForManufacturer) JsonResultForManufacturer(com.vmware.flowgate.nlyteworker.model.JsonResultForManufacturer) LinkedList(java.util.LinkedList)

Aggregations

JsonResultForManufacturer (com.vmware.flowgate.nlyteworker.model.JsonResultForManufacturer)1 Manufacturer (com.vmware.flowgate.nlyteworker.model.Manufacturer)1 LinkedList (java.util.LinkedList)1