* ONAP Policy Model
* ================================================================================
* Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2021, 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
package org.onap.policy.models.tosca.simple.concepts;
import com.google.gson.annotations.SerializedName;
-import java.util.Date;
+import jakarta.persistence.EmbeddedId;
+import jakarta.persistence.Entity;
+import jakarta.persistence.Inheritance;
+import jakarta.persistence.InheritanceType;
+import jakarta.persistence.Table;
+import java.io.Serial;
+import java.sql.Timestamp;
+import java.time.Instant;
import java.util.List;
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.Inheritance;
-import javax.persistence.InheritanceType;
-import javax.persistence.Table;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
@Data
@EqualsAndHashCode(callSuper = false)
public class JpaToscaTimeInterval extends PfConcept {
+ @Serial
private static final long serialVersionUID = 9151467029611969980L;
@EmbeddedId
private PfReferenceKey key;
@SerializedName("start_time")
- private Date startTime;
+ private Timestamp startTime;
@SerializedName("end_time")
- private Date endTime;
+ private Timestamp endTime;
/**
* The Default Constructor creates a {@link JpaToscaTimeInterval} object with a null key.
* @param key the key
*/
public JpaToscaTimeInterval(@NonNull final PfReferenceKey key) {
- this(key, new Date(0), new Date(0));
+ this(key, Instant.EPOCH, Instant.EPOCH);
}
/**
*
* @param key the key
*/
- public JpaToscaTimeInterval(@NonNull final PfReferenceKey key, @NonNull final Date startTime,
- @NonNull final Date endTime) {
+ public JpaToscaTimeInterval(@NonNull final PfReferenceKey key, @NonNull final Instant startTime,
+ @NonNull final Instant endTime) {
this.key = key;
- this.startTime = startTime;
- this.endTime = endTime;
+ this.startTime = Timestamp.from(startTime);
+ this.endTime = Timestamp.from(endTime);
}
/**