return exchange;
}
protected static ExchangeData createExchange(Api api) {
ExchangeData exchange = new ExchangeData();
String provID = IDHelper.generateUID();
String encodedApiID = null;
String apiID = api.getId();
if (apiID != null) {
exchange.getProperties().put(ExchangeConstantKeys.E3_API_ID_CREATION_MODE.toString(), ExchangeConstantKeys.E3_API_ID_CREATION_MODE_PROVIDED.toString());
encodedApiID = IDHelper.encode(apiID);
if (LOG.isDebugEnabled())
LOG.debug("Found API ID: {}", apiID);
} else {
apiID = IDHelper.generateUID();
encodedApiID = IDHelper.encode(apiID);
api.setId(apiID);
exchange.getProperties().put(ExchangeConstantKeys.E3_API_ID_CREATION_MODE.toString(), ExchangeConstantKeys.E3_API_ID_CREATION_MODE_GENERATED.toString());
if (LOG.isDebugEnabled())
LOG.debug("Generating API ID is set to: {}", apiID);
}
exchange.getProperties().put(ExchangeConstantKeys.E3_API_ID.toString(), api.getId());
exchange.getProperties().put(ExchangeConstantKeys.E3_API_ID_ENCODED.toString(), encodedApiID);
exchange.getProperties().put(ExchangeConstantKeys.E3_REQUEST_PAYLOAD.toString(), api);
exchange.getProperties().put(ExchangeConstantKeys.E3_PROVISION_ID.toString(), provID);
return exchange;
}