Search in sources :

Example 1 with DecisioningMethod

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;
    }
}
Also used : TargetDeliveryResponse(com.adobe.target.edge.client.model.TargetDeliveryResponse) TargetRequestException(com.adobe.target.edge.client.exception.TargetRequestException) DecisioningMethod(com.adobe.target.edge.client.model.DecisioningMethod) TargetRequestException(com.adobe.target.edge.client.exception.TargetRequestException)

Example 2 with DecisioningMethod

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;
}
Also used : DecisioningMethod(com.adobe.target.edge.client.model.DecisioningMethod)

Example 3 with DecisioningMethod

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;
    }
}
Also used : TargetDeliveryResponse(com.adobe.target.edge.client.model.TargetDeliveryResponse) TargetRequestException(com.adobe.target.edge.client.exception.TargetRequestException) DecisioningMethod(com.adobe.target.edge.client.model.DecisioningMethod) TargetRequestException(com.adobe.target.edge.client.exception.TargetRequestException)

Aggregations

DecisioningMethod (com.adobe.target.edge.client.model.DecisioningMethod)3 TargetRequestException (com.adobe.target.edge.client.exception.TargetRequestException)2 TargetDeliveryResponse (com.adobe.target.edge.client.model.TargetDeliveryResponse)2