Search in sources :

Example 1 with FindRequestBuilder

use of com.linkedin.restli.client.FindRequestBuilder in project rest.li by linkedin.

the class ExampleRequestResponseGenerator method buildFinderRequest.

private FindRequest<RecordTemplatePlaceholder> buildFinderRequest(FinderSchema finderSchema) {
    FindRequestBuilder<Object, RecordTemplatePlaceholder> finder = new FindRequestBuilder<Object, RecordTemplatePlaceholder>(_uriTemplate, RecordTemplatePlaceholder.class, _resourceSpec, _requestOptions);
    finder.name(finderSchema.getName());
    if (finderSchema.hasAssocKeys()) {
        CompoundKey key = (CompoundKey) generateKey();
        for (String partKey : finderSchema.getAssocKeys()) {
            finder.assocKey(partKey, key.getPart(partKey));
        }
    } else if (// why do we have a separate field for the singular form?  assocKeys and assocKey.
    finderSchema.hasAssocKey()) {
        String partKey = finderSchema.getAssocKey();
        CompoundKey key = (CompoundKey) generateKey();
        finder.assocKey(partKey, key.getPart(partKey));
    }
    if (finderSchema.hasParameters() && !finderSchema.getParameters().isEmpty()) {
        addParams(finder, finderSchema.getParameters());
    }
    addPathKeys(finder);
    return finder.build();
}
Also used : CompoundKey(com.linkedin.restli.common.CompoundKey) FindRequestBuilder(com.linkedin.restli.client.FindRequestBuilder)

Aggregations

FindRequestBuilder (com.linkedin.restli.client.FindRequestBuilder)1 CompoundKey (com.linkedin.restli.common.CompoundKey)1