use of com.adobe.target.delivery.v1.model.PrefetchResponse in project target-java-sdk by adobe.
the class OnDeviceDecisioningService method buildDeliveryResponse.
private TargetDeliveryResponse buildDeliveryResponse(TargetDeliveryRequest deliveryRequest, String requestId) {
OnDeviceDecisioningEvaluation localEvaluation = evaluateLocalExecution(deliveryRequest);
int status = localEvaluation.isAllLocal() ? HttpStatus.SC_OK : HttpStatus.SC_PARTIAL_CONTENT;
DeliveryResponse deliveryResponse = new DeliveryResponse().client(clientConfig.getClient()).requestId(requestId).id(deliveryRequest.getDeliveryRequest().getId()).status(status);
PrefetchResponse prefetchResponse = new PrefetchResponse();
ExecuteResponse executeResponse = new ExecuteResponse();
deliveryResponse.setPrefetch(prefetchResponse);
deliveryResponse.setExecute(executeResponse);
TargetDeliveryResponse targetResponse = new TargetDeliveryResponse(deliveryRequest, deliveryResponse, status, localEvaluation.isAllLocal() ? "Local-decisioning response" : localEvaluation.getReason());
ResponseStatus responseStatus = targetResponse.getResponseStatus();
responseStatus.setGlobalMbox(localEvaluation.getGlobalMbox());
responseStatus.setRemoteMboxes(localEvaluation.getRemoteMBoxes());
responseStatus.setRemoteViews(localEvaluation.getRemoteViews());
return targetResponse;
}
use of com.adobe.target.delivery.v1.model.PrefetchResponse in project target-java-sdk by adobe.
the class OnDeviceDecisioningService method handleDetails.
private void handleDetails(List<RequestDetails> detailsList, Map<String, Object> requestContext, TargetDeliveryRequest deliveryRequest, String visitorId, Set<String> responseTokens, TraceHandler traceHandler, OnDeviceDecisioningRuleSet ruleSet, PrefetchResponse prefetchResponse, ExecuteResponse executeResponse, List<Notification> notifications) {
for (RequestDetails details : detailsList) {
Map<String, Object> detailsContext = new HashMap<>(requestContext);
collateParams(detailsContext, DETAILS_PARAMS_COLLATORS, deliveryRequest, details);
this.decisionHandler.executeDetails(deliveryRequest, this.onDeviceAllMatchingRulesMboxes, detailsContext, visitorId, responseTokens, traceHandler, ruleSet, details, prefetchResponse, executeResponse, notifications);
}
}
use of com.adobe.target.delivery.v1.model.PrefetchResponse in project target-java-sdk by adobe.
the class TargetAttributesResponse method toMap.
private static Map<String, Map<String, Object>> toMap(TargetDeliveryResponse targetResponse) {
if (targetResponse == null) {
return null;
}
Map<String, Map<String, Object>> result = new HashMap<>();
String globalMbox = getGlobalMbox(targetResponse);
DeliveryResponse response = targetResponse.getResponse();
PrefetchResponse prefetchResponse = response.getPrefetch();
ExecuteResponse executeResponse = response.getExecute();
processPrefetch(result, prefetchResponse, globalMbox);
processExecute(result, executeResponse, globalMbox);
return toReadOnlyMap(result);
}
Aggregations