Search in sources :

Example 21 with DeliveryRequest

use of com.adobe.target.delivery.v1.model.DeliveryRequest in project target-java-sdk by adobe.

the class NotificationService method buildNotifications.

public void buildNotifications(TargetDeliveryRequest targetDeliveryRequest, TargetDeliveryResponse targetDeliveryResponse, List<Notification> notifications) {
    boolean noNotifications = notifications == null || notifications.isEmpty();
    if (noNotifications) {
        return;
    }
    DeliveryRequest deliveryRequest = targetDeliveryRequest.getDeliveryRequest();
    setBeaconToFalse(deliveryRequest);
    String locationHint = targetDeliveryRequest.getLocationHint() != null ? targetDeliveryRequest.getLocationHint() : this.clusterLocator.getLocationHint();
    TargetDeliveryRequest notificationRequest = TargetDeliveryRequest.builder().locationHint(locationHint).sessionId(targetDeliveryRequest.getSessionId()).visitor(targetDeliveryRequest.getVisitor()).decisioningMethod(DecisioningMethod.SERVER_SIDE).requestId(UUID.randomUUID().toString()).impressionId(UUID.randomUUID().toString()).id(deliveryRequest.getId() != null ? deliveryRequest.getId() : targetDeliveryResponse.getResponse().getId()).experienceCloud(deliveryRequest.getExperienceCloud()).context(deliveryRequest.getContext()).environmentId(deliveryRequest.getEnvironmentId()).qaMode(deliveryRequest.getQaMode()).property(deliveryRequest.getProperty()).notifications(notifications).trace(deliveryRequest.getTrace()).build();
    this.sendNotification(notificationRequest);
}
Also used : DeliveryRequest(com.adobe.target.delivery.v1.model.DeliveryRequest) TargetDeliveryRequest(com.adobe.target.edge.client.model.TargetDeliveryRequest) TargetDeliveryRequest(com.adobe.target.edge.client.model.TargetDeliveryRequest)

Example 22 with DeliveryRequest

use of com.adobe.target.delivery.v1.model.DeliveryRequest in project target-java-sdk by adobe.

the class TelemetryService method addTelemetry.

public void addTelemetry(TargetDeliveryRequest deliveryRequest, TimingTool timer, TargetDeliveryResponse targetDeliveryResponse) {
    TelemetryEntry telemetryEntry = createTelemetryEntry(deliveryRequest, targetDeliveryResponse, timer.timeEnd(TIMING_EXECUTE_REQUEST));
    if (telemetryEntry == null) {
        return;
    }
    storedTelemetries.add(telemetryEntry);
}
Also used : TelemetryEntry(com.adobe.target.delivery.v1.model.TelemetryEntry)

Example 23 with DeliveryRequest

use of com.adobe.target.delivery.v1.model.DeliveryRequest in project target-java-sdk by adobe.

the class LogUtils method getRequestDetails.

public static String getRequestDetails(TargetDeliveryRequest targetDeliveryRequest) {
    DeliveryRequest deliveryRequest = targetDeliveryRequest.getDeliveryRequest();
    StringBuilder builder = new StringBuilder();
    builder.append("(");
    Map<String, String> details = new HashMap<>();
    details.put("sessionId", targetDeliveryRequest.getSessionId());
    details.put("requestId", deliveryRequest.getRequestId());
    Iterator<Map.Entry<String, String>> entrySet = details.entrySet().iterator();
    while (entrySet.hasNext()) {
        Map.Entry<String, String> entry = entrySet.next();
        builder.append(entry.getKey() + ":" + entry.getValue());
        if (entrySet.hasNext()) {
            builder.append(", ");
        }
    }
    builder.append(")");
    return builder.toString();
}
Also used : DeliveryRequest(com.adobe.target.delivery.v1.model.DeliveryRequest) TargetDeliveryRequest(com.adobe.target.edge.client.model.TargetDeliveryRequest) HashMap(java.util.HashMap) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

DeliveryRequest (com.adobe.target.delivery.v1.model.DeliveryRequest)9 TargetDeliveryRequest (com.adobe.target.edge.client.model.TargetDeliveryRequest)8 TargetDeliveryResponse (com.adobe.target.edge.client.model.TargetDeliveryResponse)8 DeliveryResponse (com.adobe.target.delivery.v1.model.DeliveryResponse)6 TimingTool (com.adobe.target.edge.client.utils.TimingTool)6 Test (org.junit.jupiter.api.Test)5 Context (com.adobe.target.delivery.v1.model.Context)4 Telemetry (com.adobe.target.delivery.v1.model.Telemetry)4 HashMap (java.util.HashMap)4 ResponseStatus (com.adobe.target.edge.client.http.ResponseStatus)3 ResponseWrapper (com.adobe.target.edge.client.http.ResponseWrapper)3 Map (java.util.Map)3 ExecuteRequest (com.adobe.target.delivery.v1.model.ExecuteRequest)2 Geo (com.adobe.target.delivery.v1.model.Geo)2 PrefetchRequest (com.adobe.target.delivery.v1.model.PrefetchRequest)2 Property (com.adobe.target.delivery.v1.model.Property)2 RequestDetails (com.adobe.target.delivery.v1.model.RequestDetails)2 TelemetryEntry (com.adobe.target.delivery.v1.model.TelemetryEntry)2 ClientConfig (com.adobe.target.edge.client.ClientConfig)2 TargetTestDeliveryRequestUtils.getTestDeliveryResponse (com.adobe.target.edge.client.utils.TargetTestDeliveryRequestUtils.getTestDeliveryResponse)2