2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * Copyright © 2017-2018 Amdocs
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
21 package org.onap.aai.sparky.sync.entity;
23 import java.sql.Timestamp;
24 import java.text.SimpleDateFormat;
26 import com.fasterxml.jackson.annotation.JsonIgnore;
27 import com.fasterxml.jackson.annotation.JsonProperty;
30 * The Class IndexableEntity.
32 public abstract class IndexableEntity {
33 protected String id; // generated, SHA-256 digest
34 protected String entityType;
35 protected String entityPrimaryKeyValue;
36 protected String lastmodTimestamp;
37 protected String link;
39 private static final String TIMESTAMP_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
42 * Instantiates a new indexable entity.
44 public IndexableEntity() {
45 SimpleDateFormat dateFormat = new SimpleDateFormat(TIMESTAMP_FORMAT);
46 Timestamp timestamp = new Timestamp(System.currentTimeMillis());
47 String currentFormattedTimeStamp = dateFormat.format(timestamp);
48 this.setEntityTimeStamp(currentFormattedTimeStamp);
52 public String getId() {
56 @JsonProperty("entityType")
57 public String getEntityType() {
61 @JsonProperty("entityPrimaryKeyValue")
62 public String getEntityPrimaryKeyValue() {
63 return entityPrimaryKeyValue;
66 @JsonProperty("lastmodTimestamp")
67 public String getEntityTimeStamp() {
68 return lastmodTimestamp;
71 public void setId(String id) {
75 public void setEntityType(String entityType) {
76 this.entityType = entityType;
79 public void setEntityPrimaryKeyValue(String fieldValue) {
80 this.entityPrimaryKeyValue = fieldValue;
83 public void setEntityTimeStamp(String lastmodTimestamp) {
84 this.lastmodTimestamp = lastmodTimestamp;
88 public String getLink() {
92 public void setLink(String link) {