2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2020 Nordix Foundation.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.models.dao;
23 import java.util.ArrayList;
24 import java.util.List;
25 import javax.persistence.Column;
26 import javax.persistence.EmbeddedId;
27 import javax.persistence.Entity;
28 import javax.persistence.Table;
30 import lombok.EqualsAndHashCode;
31 import lombok.NonNull;
32 import org.onap.policy.models.base.PfConcept;
33 import org.onap.policy.models.base.PfKey;
34 import org.onap.policy.models.base.PfTimestampKey;
35 import org.onap.policy.models.base.PfValidationResult;
38 @Table(name = "DummyTimestampEntity")
40 @EqualsAndHashCode(callSuper = false)
41 public class DummyTimestampEntity extends PfConcept {
42 private static final long serialVersionUID = -2962570563281067895L;
46 private PfTimestampKey key;
49 private double doubleValue;
52 * Default constructor.
54 public DummyTimestampEntity() {
55 this.key = new PfTimestampKey();
56 this.doubleValue = 123.45;
59 public DummyTimestampEntity(DummyTimestampEntity source) {
60 this.key = source.key;
61 this.doubleValue = source.doubleValue;
68 * @param doubleValue the double value
70 public DummyTimestampEntity(final PfTimestampKey key, final double doubleValue) {
72 this.doubleValue = doubleValue;
76 public List<PfKey> getKeys() {
77 final List<PfKey> keyList = new ArrayList<>();
78 keyList.add(getKey());
83 public PfValidationResult validate(final PfValidationResult result) {
84 return key.validate(result);
93 public int compareTo(@NonNull final PfConcept otherObj) {
94 if (this == otherObj) {
97 if (getClass() != otherObj.getClass()) {
98 return this.getClass().getName().compareTo(otherObj.getClass().getName());
101 final DummyTimestampEntity other = (DummyTimestampEntity) otherObj;
103 return Double.compare(doubleValue, other.doubleValue);