Initial commit for AAI-UI(sparky-backend)
[aai/sparky-be.git] / src / main / java / org / openecomp / sparky / synchronizer / entity / IndexableEntity.java
1 /**
2  * ============LICENSE_START===================================================
3  * SPARKY (AAI UI service)
4  * ============================================================================
5  * Copyright © 2017 AT&T Intellectual Property.
6  * Copyright © 2017 Amdocs
7  * All rights reserved.
8  * ============================================================================
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  * ============LICENSE_END=====================================================
21  *
22  * ECOMP and OpenECOMP are trademarks
23  * and service marks of AT&T Intellectual Property.
24  */
25
26 package org.openecomp.sparky.synchronizer.entity;
27
28 import java.sql.Timestamp;
29 import java.text.SimpleDateFormat;
30
31 import org.openecomp.sparky.config.oxm.OxmModelLoader;
32
33 /**
34  * The Class IndexableEntity.
35  */
36 public abstract class IndexableEntity {
37   protected String id; // generated, SHA-256 digest
38   protected String entityType;
39   protected String entityPrimaryKeyValue;
40   protected String lastmodTimestamp;
41   protected String link;
42   protected OxmModelLoader loader;
43
44   private static final String TIMESTAMP_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
45
46   /**
47    * Instantiates a new indexable entity.
48    */
49   public IndexableEntity() {
50     SimpleDateFormat dateFormat = new SimpleDateFormat(TIMESTAMP_FORMAT);
51     Timestamp timestamp = new Timestamp(System.currentTimeMillis());
52     String currentFormattedTimeStamp = dateFormat.format(timestamp);
53     this.setEntityTimeStamp(currentFormattedTimeStamp);
54   }
55
56   /**
57    * Instantiates a new indexable entity.
58    *
59    * @param loader the loader
60    */
61   public IndexableEntity(OxmModelLoader loader) {
62     this();
63     this.loader = loader;
64   }
65
66   public String getId() {
67     return id;
68   }
69
70   public String getEntityType() {
71     return entityType;
72   }
73
74   public String getEntityPrimaryKeyValue() {
75     return entityPrimaryKeyValue;
76   }
77
78   public String getEntityTimeStamp() {
79     return lastmodTimestamp;
80   }
81
82   public void setId(String id) {
83     this.id = id;
84   }
85
86   public void setEntityType(String entityType) {
87     this.entityType = entityType;
88   }
89
90   public void setEntityPrimaryKeyValue(String fieldValue) {
91     this.entityPrimaryKeyValue = fieldValue;
92   }
93
94   public void setEntityTimeStamp(String lastmodTimestamp) {
95     this.lastmodTimestamp = lastmodTimestamp;
96   }
97
98   public String getLink() {
99     return link;
100   }
101
102   public void setLink(String link) {
103     this.link = link;
104   }
105
106 }