use of com.adobe.target.edge.client.model.DecisioningMethod in project target-java-sdk by adobe.
the class DefaultTargetClient method getOffers.
@Override
public TargetDeliveryResponse getOffers(TargetDeliveryRequest request) {
try {
Objects.requireNonNull(request, "request cannot be null");
TargetDeliveryResponse targetDeliveryResponse;
DecisioningMethod decisioningMethod = getDecisioningMethod(request);
updatePropertyToken(request);
if (decisioningMethod == DecisioningMethod.ON_DEVICE || (decisioningMethod == DecisioningMethod.HYBRID && localService.evaluateLocalExecution(request).isAllLocal())) {
targetDeliveryResponse = localService.executeRequest(request);
} else {
targetDeliveryResponse = targetService.executeRequest(request);
}
return targetDeliveryResponse;
} catch (Exception e) {
TargetRequestException targetRequestException = new TargetRequestException(e.getMessage(), e, request);
logger.error(targetRequestException.getMessage());
throw targetRequestException;
}
}
use of com.adobe.target.edge.client.model.DecisioningMethod in project target-java-sdk by adobe.
the class TelemetryService method getDecisioningMethod.
private DecisioningMethod getDecisioningMethod(TargetDeliveryRequest request) {
DecisioningMethod requestDecisioning = request.getDecisioningMethod();
if (requestDecisioning != null) {
return requestDecisioning;
}
DecisioningMethod configDecisioning = clientConfig.getDefaultDecisioningMethod();
if (configDecisioning != null) {
return configDecisioning;
}
return DecisioningMethod.SERVER_SIDE;
}
use of com.adobe.target.edge.client.model.DecisioningMethod in project target-java-sdk by adobe.
the class DefaultTargetClient method getOffersAsync.
@Override
public CompletableFuture<TargetDeliveryResponse> getOffersAsync(TargetDeliveryRequest request) {
try {
Objects.requireNonNull(request, "request cannot be null");
CompletableFuture<TargetDeliveryResponse> targetDeliveryResponse;
DecisioningMethod decisioningMethod = getDecisioningMethod(request);
updatePropertyToken(request);
if (decisioningMethod == DecisioningMethod.ON_DEVICE || (decisioningMethod == DecisioningMethod.HYBRID && localService.evaluateLocalExecution(request).isAllLocal())) {
targetDeliveryResponse = localService.executeRequestAsync(request);
} else {
targetDeliveryResponse = targetService.executeRequestAsync(request);
}
return targetDeliveryResponse;
} catch (Exception e) {
TargetRequestException targetRequestException = new TargetRequestException(e.getMessage(), e, request);
logger.error(targetRequestException.getMessage());
throw targetRequestException;
}
}
Aggregations