From 753cb638fcb58f355f2c979e9e0a43cba2832984 Mon Sep 17 00:00:00 2001 From: Gary Wu Date: Mon, 8 May 2017 12:59:44 -0700 Subject: Migrate to Java 8 Time API Migrate the uses of the old Date class in CommonHeader, RuntimeContext, QueueMessage, and TransactionRecord to Java 8 Time API. Change-Id: I3b0c18b2e63cdab06e37587d2010cb7f626a0396 Signed-off-by: Gary Wu --- .../impl/TransactionRecorderImpl.java | 6 +++--- .../objects/TransactionRecord.java | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'appc-dispatcher/appc-dispatcher-common/transaction-recorder') diff --git a/appc-dispatcher/appc-dispatcher-common/transaction-recorder/src/main/java/org/openecomp/appc/transactionrecorder/impl/TransactionRecorderImpl.java b/appc-dispatcher/appc-dispatcher-common/transaction-recorder/src/main/java/org/openecomp/appc/transactionrecorder/impl/TransactionRecorderImpl.java index 74040d3e4..c5278e57c 100644 --- a/appc-dispatcher/appc-dispatcher-common/transaction-recorder/src/main/java/org/openecomp/appc/transactionrecorder/impl/TransactionRecorderImpl.java +++ b/appc-dispatcher/appc-dispatcher-common/transaction-recorder/src/main/java/org/openecomp/appc/transactionrecorder/impl/TransactionRecorderImpl.java @@ -54,10 +54,10 @@ public class TransactionRecorderImpl implements TransactionRecorder { } connection = DBUtils.getConnection(APPCCTL_SCHEMA); stmt = connection.prepareStatement(queryString); - stmt.setTimestamp(1, new java.sql.Timestamp(record.getTimeStamp().getTime())); + stmt.setTimestamp(1, new java.sql.Timestamp(record.getTimeStamp().toEpochMilli())); stmt.setString(2, record.getRequestID()); - stmt.setTimestamp(3, new java.sql.Timestamp(record.getStartTime().getTime())); - stmt.setTimestamp(4, new java.sql.Timestamp(record.getEndTime().getTime())); + stmt.setTimestamp(3, new java.sql.Timestamp(record.getStartTime().toEpochMilli())); + stmt.setTimestamp(4, new java.sql.Timestamp(record.getEndTime().toEpochMilli())); stmt.setString(5, record.getTargetID()); stmt.setString(6, record.getTargetType()); stmt.setString(7, record.getSubComponent()); diff --git a/appc-dispatcher/appc-dispatcher-common/transaction-recorder/src/main/java/org/openecomp/appc/transactionrecorder/objects/TransactionRecord.java b/appc-dispatcher/appc-dispatcher-common/transaction-recorder/src/main/java/org/openecomp/appc/transactionrecorder/objects/TransactionRecord.java index 4807aed0a..c2c662703 100644 --- a/appc-dispatcher/appc-dispatcher-common/transaction-recorder/src/main/java/org/openecomp/appc/transactionrecorder/objects/TransactionRecord.java +++ b/appc-dispatcher/appc-dispatcher-common/transaction-recorder/src/main/java/org/openecomp/appc/transactionrecorder/objects/TransactionRecord.java @@ -21,7 +21,7 @@ package org.openecomp.appc.transactionrecorder.objects; -import java.util.Date; +import java.time.Instant; public class TransactionRecord { @@ -38,10 +38,10 @@ public class TransactionRecord { - Result - Success/Error code + description,as published to the initiator RequestHandlerResponse.ACCEPTED/RequestHandlerResponse.REJECTED + String (description) */ - private Date timeStamp; + private Instant timeStamp; private String requestID; - private Date startTime; - private Date endTime; + private Instant startTime; + private Instant endTime; private String targetID; private String targetType; private String subComponent; @@ -49,11 +49,11 @@ public class TransactionRecord { private String resultCode; private String description; - public Date getTimeStamp() { + public Instant getTimeStamp() { return timeStamp; } - public void setTimeStamp(Date timeStamp) { + public void setTimeStamp(Instant timeStamp) { this.timeStamp = timeStamp; } @@ -65,19 +65,19 @@ public class TransactionRecord { this.requestID = requestID; } - public Date getStartTime() { + public Instant getStartTime() { return startTime; } - public void setStartTime(Date startTime) { + public void setStartTime(Instant startTime) { this.startTime = startTime; } - public Date getEndTime() { + public Instant getEndTime() { return endTime; } - public void setEndTime(Date endTime) { + public void setEndTime(Instant endTime) { this.endTime = endTime; } -- cgit 1.2.3-korg