class InstrumentTypeContractRepository {

    public InstrumentTypeContract findById(InstrumentTypeContract instrumentTypeContract) {

        String url = String.format("%s%s", hostUrl, SEARCH_URL);
        StringBuffer content = new StringBuffer();
        if (instrumentTypeContract.getId() != null)
            content.append("id=" + instrumentTypeContract.getId());

        if (instrumentTypeContract.getTenantId() != null)
            content.append("&tenantId=" + instrumentTypeContract.getTenantId());
        url = url + content.toString();
        InstrumentTypeResponse result = restTemplate.postForObject(url, null, InstrumentTypeResponse.class);

        if (result.getInstrumentTypes() != null && result.getInstrumentTypes().size() == 1)
            return result.getInstrumentTypes().get(0);
        else
            return null;

    }

    public  InstrumentTypeContractRepository(@Value("${egf.instrument.host.url}") String hostUrl,
            RestTemplate restTemplate);

}