use of org.odata4j.format.Feed in project teiid by teiid.
the class BaseQueryExecution method executeWithReturnEntity.
protected ODataEntitiesResponse executeWithReturnEntity(String method, String uri, String payload, String entityTable, EdmDataServices edsMetadata, String eTag, Status... expectedStatus) throws TranslatorException {
Map<String, List<String>> headers = getDefaultHeaders();
if (eTag != null) {
// $NON-NLS-1$
headers.put("If-Match", Arrays.asList(eTag));
}
if (payload != null) {
// $NON-NLS-1$ //$NON-NLS-2$
headers.put("Content-Type", Arrays.asList("application/atom+xml"));
}
BinaryWSProcedureExecution execution = executeDirect(method, uri, payload, headers);
for (Status status : expectedStatus) {
if (status.getStatusCode() == execution.getResponseCode()) {
if (execution.getResponseCode() != Status.NO_CONTENT.getStatusCode() && execution.getResponseCode() != Status.NOT_FOUND.getStatusCode()) {
Blob blob = (Blob) execution.getOutputParameterValues().get(0);
ODataVersion version = getODataVersion(execution);
Feed feed = parse(blob, version, entityTable, edsMetadata);
return new ODataEntitiesResponse(uri, feed, entityTable, edsMetadata);
}
// this is success with no-data
return new ODataEntitiesResponse();
}
}
// throw an error
return new ODataEntitiesResponse(buildError(execution));
}
Aggregations