aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorShafique, Mubashsharul (ms642y) <Mubashsharul.Shafique@amdocs.com>2017-05-31 13:27:37 -0400
committerShafique, Mubashsharul (ms642y) <Mubashsharul.Shafique@amdocs.com>2017-05-31 13:30:32 -0400
commitaf22a5fce1d17e3cc419b0f71a9a522908f27f06 (patch)
treefb1fc1334736e8cf6252fbbd210b295251762b09 /src
parent0b700f8d4d3603b87853708837665a234270ff43 (diff)
Use URL to generate document ID
Change-Id: I7b4645a21cb152f57bc87a2f4949586547c7a2fe Signed-off-by: Shafique <Mubashsharul.Shafique@amdocs.com>
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/openecomp/datarouter/entity/AaiEventEntity.java24
1 files changed, 3 insertions, 21 deletions
diff --git a/src/main/java/org/openecomp/datarouter/entity/AaiEventEntity.java b/src/main/java/org/openecomp/datarouter/entity/AaiEventEntity.java
index 418c0d3..12400ad 100644
--- a/src/main/java/org/openecomp/datarouter/entity/AaiEventEntity.java
+++ b/src/main/java/org/openecomp/datarouter/entity/AaiEventEntity.java
@@ -61,6 +61,8 @@ import java.util.List;
import javax.json.Json;
import javax.json.JsonObject;
+import org.openecomp.datarouter.util.NodeUtils;
+
/**
* Note: AAIEventEntity is a port forward of IndexDocument Has been renamed here to move forward
* with abstraction of document store technology.
@@ -128,26 +130,6 @@ public class AaiEventEntity implements DocumentStoreDataEntity, Serializable {
}
- /*
- * We'll try and create a unique identity key that we can use for differencing the previously
- * imported record sets as we won't have granular control of what is created/removed and when. The
- * best we can hope for is identification of resources by generated Id until the Identity-Service
- * UUID is tagged against all resources, then we can use that instead.
- */
-
- private static String generateUniqueShaDigest(String entityType, String fieldName,
- String fieldValue) throws NoSuchAlgorithmException {
-
- /*
- * Basically SHA-256 will result in an identity with a guaranteed uniqueness compared to just a
- * java hashcode value.
- */
- MessageDigest digest = MessageDigest.getInstance("SHA-256");
- digest.update(String.format("%s.%s.%s", entityType, fieldName, fieldValue).getBytes());
- return convertBytesToHexString(digest.digest());
- }
-
-
public AaiEventEntity() {
SimpleDateFormat dateFormat = new SimpleDateFormat(TIMESTAMP_FORMAT);
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
@@ -156,7 +138,7 @@ public class AaiEventEntity implements DocumentStoreDataEntity, Serializable {
}
public void deriveFields() throws NoSuchAlgorithmException {
- this.id = generateUniqueShaDigest(entityType, entityPrimaryKeyName, entityPrimaryKeyValue);
+ this.id = NodeUtils.generateUniqueShaDigest(this.getLink());
this.searchTags = concatArray(searchTagCollection, ';');
this.searchTagIds = concatArray(searchTagIdCollection, ';');
this.crossReferenceEntityValues = concatArray(crossEntityReferenceCollection, ';');