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;
26 import javax.persistence.Column;
27 import javax.persistence.EmbeddedId;
28 import javax.persistence.Entity;
29 import javax.persistence.Table;
32 import lombok.EqualsAndHashCode;
33 import lombok.NonNull;
35 import org.onap.policy.common.utils.validation.Assertions;
36 import org.onap.policy.models.base.PfConcept;
37 import org.onap.policy.models.base.PfKey;
38 import org.onap.policy.models.base.PfTimestampKey;
39 import org.onap.policy.models.base.PfValidationResult;
42 @Table(name = "DummyTimestampEntity")
44 @EqualsAndHashCode(callSuper = false)
45 public class DummyTimestampEntity extends PfConcept {
46 private static final long serialVersionUID = -2962570563281067895L;
50 private PfTimestampKey key;
53 private double doubleValue;
56 * Default constructor.
58 public DummyTimestampEntity() {
59 this.key = new PfTimestampKey();
60 this.doubleValue = 123.45;
63 public DummyTimestampEntity(DummyTimestampEntity source) {
64 this.key = source.key;
65 this.doubleValue = source.doubleValue;
72 * @param doubleValue the double value
74 public DummyTimestampEntity(final PfTimestampKey key, final double doubleValue) {
76 this.doubleValue = doubleValue;
80 public List<PfKey> getKeys() {
81 final List<PfKey> keyList = new ArrayList<>();
82 keyList.add(getKey());
87 public PfValidationResult validate(final PfValidationResult result) {
88 return key.validate(result);
98 public int compareTo(@NonNull final PfConcept otherObj) {
99 if (this == otherObj) {
102 if (getClass() != otherObj.getClass()) {
103 return this.getClass().getName().compareTo(otherObj.getClass().getName());
106 final DummyTimestampEntity other = (DummyTimestampEntity) otherObj;
108 return Double.compare(doubleValue, other.doubleValue);