diff options
author | 2017-05-08 12:59:44 -0700 | |
---|---|---|
committer | 2017-05-16 18:13:41 +0000 | |
commit | 753cb638fcb58f355f2c979e9e0a43cba2832984 (patch) | |
tree | 55526dce196663d6c5c4265e504882e3deec2cc2 /appc-dispatcher/appc-dispatcher-common/transaction-recorder/src/main/java | |
parent | f16391cacb2e91063bbe9ad66cb2310855c93695 (diff) |
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 <gary.i.wu@huawei.com>
Diffstat (limited to 'appc-dispatcher/appc-dispatcher-common/transaction-recorder/src/main/java')
2 files changed, 13 insertions, 13 deletions
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; } |