use of org.bf2.srs.fleetmanager.spi.ams.impl.model.response.OrganizationList in project srs-fleet-manager by bf2fc6cc711aee1a0c2a.
the class AccountManagementSystemRestClient method getOrganizationByExternalId.
public Organization getOrganizationByExternalId(String externalOrgId) {
String search = "external_id='ORG_ID'".replace("ORG_ID", externalOrgId);
Map<String, List<String>> queryParams = new HashMap<>();
queryParams.put("search", Collections.singletonList(search));
OrganizationList rval = this.client.sendRequest(new Request.RequestBuilder<OrganizationList>().operation(Operation.GET).path(Paths.ORGANIZATIONS_PATH).queryParams(queryParams).responseType(new TypeReference<OrganizationList>() {
}).build());
if (rval.getTotal() < 1) {
throw new AccountManagementSystemClientException("Organization not found with external id: " + externalOrgId);
}
return rval.getItems().get(0);
}
Aggregations