2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 * Copyright © 2017 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 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
23 package org.onap.aai.sparky.synchronizer.entity;
25 import java.sql.Timestamp;
26 import java.text.SimpleDateFormat;
28 import org.onap.aai.sparky.config.oxm.OxmModelLoader;
31 * The Class IndexableEntity.
33 public abstract class IndexableEntity {
34 protected String id; // generated, SHA-256 digest
35 protected String entityType;
36 protected String entityPrimaryKeyValue;
37 protected String lastmodTimestamp;
40 * @return the lastmodTimestamp
42 public String getLastmodTimestamp() {
43 return lastmodTimestamp;
47 * @param lastmodTimestamp the lastmodTimestamp to set
49 public void setLastmodTimestamp(String lastmodTimestamp) {
50 this.lastmodTimestamp = lastmodTimestamp;
56 public OxmModelLoader getLoader() {
61 * @param loader the loader to set
63 public void setLoader(OxmModelLoader loader) {
68 * @return the timestampFormat
70 public static String getTimestampFormat() {
71 return TIMESTAMP_FORMAT;
74 protected String link;
75 protected OxmModelLoader loader;
77 private static final String TIMESTAMP_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
80 * Instantiates a new indexable entity.
82 public IndexableEntity() {
83 SimpleDateFormat dateFormat = new SimpleDateFormat(TIMESTAMP_FORMAT);
84 Timestamp timestamp = new Timestamp(System.currentTimeMillis());
85 String currentFormattedTimeStamp = dateFormat.format(timestamp);
86 this.setEntityTimeStamp(currentFormattedTimeStamp);
90 * Instantiates a new indexable entity.
92 * @param loader the loader
94 public IndexableEntity(OxmModelLoader loader) {
99 public String getId() {
103 public String getEntityType() {
107 public String getEntityPrimaryKeyValue() {
108 return entityPrimaryKeyValue;
111 public String getEntityTimeStamp() {
112 return lastmodTimestamp;
115 public void setId(String id) {
119 public void setEntityType(String entityType) {
120 this.entityType = entityType;
123 public void setEntityPrimaryKeyValue(String fieldValue) {
124 this.entityPrimaryKeyValue = fieldValue;
127 public void setEntityTimeStamp(String lastmodTimestamp) {
128 this.lastmodTimestamp = lastmodTimestamp;
131 public String getLink() {
135 public void setLink(String link) {