aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap/nbi/apis/hub/service/EventFactory.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/onap/nbi/apis/hub/service/EventFactory.java')
-rw-r--r--src/main/java/org/onap/nbi/apis/hub/service/EventFactory.java29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/main/java/org/onap/nbi/apis/hub/service/EventFactory.java b/src/main/java/org/onap/nbi/apis/hub/service/EventFactory.java
index 3e04b84..e935a1c 100644
--- a/src/main/java/org/onap/nbi/apis/hub/service/EventFactory.java
+++ b/src/main/java/org/onap/nbi/apis/hub/service/EventFactory.java
@@ -1,17 +1,14 @@
/**
- * Copyright (c) 2018 Orange
+ * Copyright (c) 2018 Orange
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
*/
package org.onap.nbi.apis.hub.service;
@@ -19,6 +16,10 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.MappingJsonFactory;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.UUID;
import org.onap.nbi.apis.hub.model.Event;
import org.onap.nbi.apis.hub.model.EventType;
import org.onap.nbi.apis.serviceorder.model.ServiceOrder;
@@ -26,9 +27,6 @@ import org.onap.nbi.apis.serviceorder.model.ServiceOrderItem;
import org.onap.nbi.commons.JacksonFilter;
import org.onap.nbi.commons.JsonRepresentation;
-import java.util.Date;
-import java.util.UUID;
-
public class EventFactory {
private static final ObjectMapper mapper = new ObjectMapper(new MappingJsonFactory());
@@ -39,11 +37,14 @@ public class EventFactory {
event.setEventDate(new Date());
event.setEventType(eventType.value());
+ DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
+ mapper.setDateFormat(df);
+
JsonNode serviceOrderJson = mapper.valueToTree(filterServiceOrder(serviceOrder));
if (EventType.SERVICE_ORDER_ITEM_STATE_CHANGE.equals(eventType)) {
JsonNode serviceOrderItemJson = mapper.valueToTree(serviceOrderItem);
- ((ObjectNode)serviceOrderJson).putArray("orderItem").add(serviceOrderItemJson);
+ ((ObjectNode) serviceOrderJson).putArray("orderItem").add(serviceOrderItemJson);
}
event.setEvent(serviceOrderJson);