diff options
Diffstat (limited to 'models-interactions/model-actors')
-rw-r--r-- | models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java | 47 |
1 files changed, 1 insertions, 46 deletions
diff --git a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java index 2a00edda4..a26f6a77f 100644 --- a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java +++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java @@ -22,15 +22,7 @@ package org.onap.policy.controlloop.actor.so; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonToken; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.time.format.DateTimeParseException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -68,6 +60,7 @@ import org.onap.policy.so.SoRequestInfo; import org.onap.policy.so.SoRequestParameters; import org.onap.policy.so.SoRequestStatus; import org.onap.policy.so.SoResponse; +import org.onap.policy.so.util.SoLocalDateTimeTypeAdapter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -498,44 +491,6 @@ public abstract class SoOperation extends HttpOperation<SoResponse> { return coder; } - /* - * TODO: combine this adapter with existing LocalDateTimeTypeAdapter and eliminate the - * following two classes. - */ - - /** - * GSON Type Adapter for "LocalDateTime" fields, that uses the standard - * RFC_1123_DATE_TIME formatter. - */ - private static class SoLocalDateTimeTypeAdapter extends TypeAdapter<LocalDateTime> { - private static final DateTimeFormatter FORMATTER = DateTimeFormatter.RFC_1123_DATE_TIME; - - @Override - public LocalDateTime read(JsonReader in) throws IOException { - try { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } else { - return LocalDateTime.parse(in.nextString(), FORMATTER); - } - - } catch (DateTimeParseException e) { - throw new JsonParseException("invalid date", e); - } - } - - @Override - public void write(JsonWriter out, LocalDateTime value) throws IOException { - if (value == null) { - out.nullValue(); - } else { - String text = value.format(FORMATTER); - out.value(text); - } - } - } - private static class SoCoder extends StandardCoder { /** |