com.sap.cloud.sdk.odatav2.connectivity.ODataCreateResult Maven / Gradle / Ivy
/*******************************************************************************
* (c) 201X SAP SE or an SAP affiliate company. All rights reserved.
******************************************************************************/
package com.sap.cloud.sdk.odatav2.connectivity;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.apache.http.HttpResponse;
import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.sap.cloud.sdk.odatav2.connectivity.batch.ChangeSetResultPart;
import com.sap.cloud.sdk.odatav2.connectivity.internal.ODataHttpResponseWrapper;
import com.sap.cloud.servicesdk.prov.jacksonutil.JacksonMapper;
public class ODataCreateResult extends ODataHttpResponseWrapper implements ChangeSetResultPart {
Map resultData = null;
public ODataCreateResult(HttpResponse httpResponse, Map map) {
setResponse(httpResponse);
this.resultData = map;
}
public ODataCreateResult(Map map, Map> headerMap, int statusCode) {
this.resultData = map;
super.headersMap = headerMap;
super.responseStatusCode = statusCode;
}
/**
* Returns the create response as a map.
* @return
*/
public Map asMap() {
Map result = new HashMap<>();
for (Entry property : resultData.entrySet()) {
if (property.getValue() instanceof ODataFeed) {// implies we are handling a Navigation property here
ODataFeed feed = (ODataFeed) property.getValue();
List