class InstrumentContractRepository {

    public InstrumentContract findById(InstrumentContract instrumentContract) {

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

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

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

    }

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

}