Skip to content

Commit 14455b0

Browse files
authored
Merge pull request #5099 from planetf1/release29_pr5095
2 parents 00893fd + 2c4b7b2 commit 14455b0

File tree

4 files changed

+30
-3
lines changed

4 files changed

+30
-3
lines changed

open-metadata-implementation/adapters/open-connectors/repository-services-connectors/open-metadata-collection-store-connectors/graph-repository-connector/src/main/java/org/odpi/openmetadata/adapters/repositoryservices/graphrepository/repositoryconnector/GraphOMRSConstants.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ private GraphOMRSConstants() {
2020
// Short names for core properties
2121

2222
public static final String PROPERTY_NAME_GUID = "guid";
23+
public static final String PROPERTY_NAME_REIDENTIFIED_FROM_GUID = "reIdentifiedFromGUID";
2324
public static final String PROPERTY_NAME_TYPE_NAME = "typeName";
2425
public static final String PROPERTY_NAME_METADATACOLLECTION_ID = "metadataCollectionId";
2526
public static final String PROPERTY_NAME_METADATACOLLECTION_NAME = "metadataCollectionName";
@@ -65,6 +66,7 @@ private GraphOMRSConstants() {
6566
put(PROPERTY_NAME_ENTITY_IS_PROXY, "java.lang.Boolean");
6667
put(PROPERTY_NAME_REPLICATED_BY, "java.lang.String");
6768
put(PROPERTY_NAME_MAPPING_PROPERTIES, "java.lang.String"); // map of string->serializable stored in serialized form
69+
put(PROPERTY_NAME_REIDENTIFIED_FROM_GUID, "java.lang.String");
6870
}};
6971

7072

@@ -77,6 +79,7 @@ private GraphOMRSConstants() {
7779
public static final String PROPERTY_KEY_PREFIX_ENTITY = "ve";
7880

7981
public static final String PROPERTY_KEY_ENTITY_GUID = PROPERTY_KEY_PREFIX_ENTITY + PROPERTY_NAME_GUID;
82+
public static final String PROPERTY_KEY_ENTITY_REIDENTIFIED_FROM_GUID = PROPERTY_KEY_PREFIX_ENTITY + PROPERTY_NAME_REIDENTIFIED_FROM_GUID;
8083
public static final String PROPERTY_KEY_ENTITY_TYPE_NAME = PROPERTY_KEY_PREFIX_ENTITY + PROPERTY_NAME_TYPE_NAME;
8184
public static final String PROPERTY_KEY_ENTITY_METADATACOLLECTION_ID = PROPERTY_KEY_PREFIX_ENTITY + PROPERTY_NAME_METADATACOLLECTION_ID;
8285
public static final String PROPERTY_KEY_ENTITY_METADATACOLLECTION_NAME = PROPERTY_KEY_PREFIX_ENTITY + PROPERTY_NAME_METADATACOLLECTION_NAME;
@@ -130,6 +133,7 @@ public static String getPropertyKeyEntity(String propertyName) {
130133

131134

132135
public static final String PROPERTY_KEY_RELATIONSHIP_GUID = PROPERTY_KEY_PREFIX_RELATIONSHIP+PROPERTY_NAME_GUID;
136+
public static final String PROPERTY_KEY_RELATIONSHIP_REIDENTIFIED_FROM_GUID = PROPERTY_KEY_PREFIX_RELATIONSHIP+PROPERTY_NAME_REIDENTIFIED_FROM_GUID;
133137
public static final String PROPERTY_KEY_RELATIONSHIP_TYPE_NAME = PROPERTY_KEY_PREFIX_RELATIONSHIP+PROPERTY_NAME_TYPE_NAME;
134138
public static final String PROPERTY_KEY_RELATIONSHIP_METADATACOLLECTION_ID = PROPERTY_KEY_PREFIX_RELATIONSHIP+PROPERTY_NAME_METADATACOLLECTION_ID;
135139
public static final String PROPERTY_KEY_RELATIONSHIP_METADATACOLLECTION_NAME = PROPERTY_KEY_PREFIX_RELATIONSHIP+PROPERTY_NAME_METADATACOLLECTION_NAME;
@@ -150,6 +154,7 @@ public static String getPropertyKeyEntity(String propertyName) {
150154
// Map of names to property key names
151155
protected static final Map<String, String> corePropertiesRelationship = new HashMap<String,String>() {{
152156
put(PROPERTY_NAME_GUID, PROPERTY_KEY_RELATIONSHIP_GUID);
157+
put(PROPERTY_NAME_REIDENTIFIED_FROM_GUID, PROPERTY_KEY_RELATIONSHIP_REIDENTIFIED_FROM_GUID);
153158
put(PROPERTY_NAME_TYPE_NAME, PROPERTY_KEY_RELATIONSHIP_TYPE_NAME);
154159
put(PROPERTY_NAME_METADATACOLLECTION_ID, PROPERTY_KEY_RELATIONSHIP_METADATACOLLECTION_ID);
155160
put(PROPERTY_NAME_METADATACOLLECTION_NAME, PROPERTY_KEY_RELATIONSHIP_METADATACOLLECTION_NAME);

open-metadata-implementation/adapters/open-connectors/repository-services-connectors/open-metadata-collection-store-connectors/graph-repository-connector/src/main/java/org/odpi/openmetadata/adapters/repositoryservices/graphrepository/repositoryconnector/GraphOMRSEntityMapper.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ private void mapEntitySummaryToVertex(EntitySummary entity, Vertex vertex)
253253

254254
// Some properties are mandatory. If any of these are null then throw exception
255255
boolean missingAttribute = false;
256-
String missingAttributeName = null;
256+
String missingAttributeName = null;
257257

258258
if (entity.getGUID() != null)
259259
vertex.property(PROPERTY_KEY_ENTITY_GUID, entity.getGUID());
@@ -284,8 +284,8 @@ private void mapEntitySummaryToVertex(EntitySummary entity, Vertex vertex)
284284
if (missingAttribute) {
285285
log.error("{} entity is missing core attribute {}", methodName, missingAttributeName);
286286
throw new RepositoryErrorException(GraphOMRSErrorCode.ENTITY_PROPERTIES_ERROR.getMessageDefinition(entity.getGUID(), methodName,
287-
this.getClass().getName(),
288-
repositoryName),
287+
this.getClass().getName(),
288+
repositoryName),
289289
this.getClass().getName(),
290290
methodName);
291291
}
@@ -295,6 +295,13 @@ private void mapEntitySummaryToVertex(EntitySummary entity, Vertex vertex)
295295

296296
// Other properties can be removed if set to null
297297

298+
if (entity.getReIdentifiedFromGUID() != null) {
299+
vertex.property(PROPERTY_KEY_ENTITY_REIDENTIFIED_FROM_GUID, entity.getReIdentifiedFromGUID());
300+
}
301+
else {
302+
removeCoreProperty(vertex, PROPERTY_KEY_ENTITY_REIDENTIFIED_FROM_GUID);
303+
}
304+
298305
if (entity.getMetadataCollectionName() != null) {
299306
vertex.property(PROPERTY_KEY_ENTITY_METADATACOLLECTION_NAME, entity.getMetadataCollectionName());
300307
}
@@ -570,6 +577,7 @@ void mapVertexToEntitySummary(Vertex vertex, EntitySummary entity)
570577

571578

572579
entity.setGUID((String) getVertexProperty( vertex, PROPERTY_KEY_ENTITY_GUID));
580+
entity.setReIdentifiedFromGUID((String) getVertexProperty( vertex, PROPERTY_KEY_ENTITY_REIDENTIFIED_FROM_GUID));
573581
entity.setMetadataCollectionId((String) getVertexProperty( vertex, PROPERTY_KEY_ENTITY_METADATACOLLECTION_ID));
574582
entity.setMetadataCollectionName((String) getVertexProperty( vertex, PROPERTY_KEY_ENTITY_METADATACOLLECTION_NAME));
575583
entity.setCreatedBy((String) getVertexProperty( vertex, PROPERTY_KEY_ENTITY_CREATED_BY));

open-metadata-implementation/adapters/open-connectors/repository-services-connectors/open-metadata-collection-store-connectors/graph-repository-connector/src/main/java/org/odpi/openmetadata/adapters/repositoryservices/graphrepository/repositoryconnector/GraphOMRSGraphFactory.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ private void initialize(JanusGraph graph)
340340
createMixedIndexForVertexCoreProperty(PROPERTY_NAME_INSTANCE_LICENSE, PROPERTY_KEY_ENTITY_INSTANCE_LICENSE);
341341
createMixedIndexForVertexCoreProperty(PROPERTY_NAME_REPLICATED_BY, PROPERTY_KEY_ENTITY_REPLICATED_BY);
342342
createMixedIndexForVertexCoreProperty(PROPERTY_NAME_MAPPING_PROPERTIES, PROPERTY_KEY_ENTITY_MAPPING_PROPERTIES); // mappingProperties is a serialized map of String,Serializable so use Text mapping
343+
createMixedIndexForVertexCoreProperty(PROPERTY_NAME_REIDENTIFIED_FROM_GUID, PROPERTY_KEY_ENTITY_REIDENTIFIED_FROM_GUID);
343344

344345
/*
345346
* Relationship core property indexes
@@ -376,6 +377,7 @@ private void initialize(JanusGraph graph)
376377
createMixedIndexForEdgeCoreProperty(PROPERTY_NAME_INSTANCE_LICENSE, PROPERTY_KEY_RELATIONSHIP_INSTANCE_LICENSE);
377378
createMixedIndexForEdgeCoreProperty(PROPERTY_NAME_REPLICATED_BY, PROPERTY_KEY_RELATIONSHIP_REPLICATED_BY);
378379
createMixedIndexForEdgeCoreProperty(PROPERTY_NAME_MAPPING_PROPERTIES, PROPERTY_KEY_RELATIONSHIP_MAPPING_PROPERTIES);
380+
createMixedIndexForEdgeCoreProperty(PROPERTY_NAME_REIDENTIFIED_FROM_GUID, PROPERTY_KEY_RELATIONSHIP_REIDENTIFIED_FROM_GUID);
379381

380382
/*
381383
* Classification core property indexes
@@ -425,6 +427,7 @@ private void initialize(JanusGraph graph)
425427
put(PROPERTY_KEY_ENTITY_INSTANCE_LICENSE, MixedIndexMapping.String);
426428
put(PROPERTY_KEY_ENTITY_REPLICATED_BY, MixedIndexMapping.String);
427429
put(PROPERTY_KEY_ENTITY_MAPPING_PROPERTIES, MixedIndexMapping.Text ); // mappingProperties is stored as a serialized map of String,Serializable so uses Text mapping
430+
put(PROPERTY_KEY_ENTITY_REIDENTIFIED_FROM_GUID, MixedIndexMapping.String);
428431

429432
put(PROPERTY_KEY_RELATIONSHIP_CREATED_BY, MixedIndexMapping.String);
430433
put(PROPERTY_KEY_RELATIONSHIP_UPDATED_BY, MixedIndexMapping.String);
@@ -436,6 +439,7 @@ private void initialize(JanusGraph graph)
436439
put(PROPERTY_KEY_RELATIONSHIP_INSTANCE_LICENSE, MixedIndexMapping.String);
437440
put(PROPERTY_KEY_RELATIONSHIP_REPLICATED_BY, MixedIndexMapping.String);
438441
put(PROPERTY_KEY_RELATIONSHIP_MAPPING_PROPERTIES, MixedIndexMapping.Text ); // mappingProperties is stored as a serialized map of String,Serializable so uses Text mapping
442+
put(PROPERTY_KEY_RELATIONSHIP_REIDENTIFIED_FROM_GUID, MixedIndexMapping.String);
439443

440444
put(PROPERTY_KEY_CLASSIFICATION_CLASSIFICATION_NAME, MixedIndexMapping.String);
441445
put(PROPERTY_KEY_CLASSIFICATION_CREATED_BY, MixedIndexMapping.String);

open-metadata-implementation/adapters/open-connectors/repository-services-connectors/open-metadata-collection-store-connectors/graph-repository-connector/src/main/java/org/odpi/openmetadata/adapters/repositoryservices/graphrepository/repositoryconnector/GraphOMRSRelationshipMapper.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,15 @@ void mapRelationshipToEdge(Relationship relationship, Edge edge)
139139

140140
// Other properties can be removed if set to null
141141

142+
if (relationship.getReIdentifiedFromGUID() != null) {
143+
edge.property(PROPERTY_KEY_RELATIONSHIP_REIDENTIFIED_FROM_GUID, relationship.getReIdentifiedFromGUID());
144+
}
145+
else {
146+
Property ep = edge.property(PROPERTY_KEY_RELATIONSHIP_REIDENTIFIED_FROM_GUID);
147+
if (ep != null)
148+
ep.remove();
149+
}
150+
142151
if (relationship.getMetadataCollectionName() != null) {
143152
edge.property(PROPERTY_KEY_RELATIONSHIP_METADATACOLLECTION_NAME, relationship.getMetadataCollectionName());
144153
}
@@ -372,6 +381,7 @@ void mapEdgeToRelationship(Edge edge, Relationship relationship)
372381
final String methodName = "mapEdgeToRelationship";
373382

374383
relationship.setGUID((String) getEdgeProperty(edge, PROPERTY_KEY_RELATIONSHIP_GUID));
384+
relationship.setReIdentifiedFromGUID((String) getEdgeProperty(edge, PROPERTY_KEY_RELATIONSHIP_REIDENTIFIED_FROM_GUID));
375385
relationship.setMetadataCollectionId((String) getEdgeProperty(edge, PROPERTY_KEY_RELATIONSHIP_METADATACOLLECTION_ID));
376386
relationship.setMetadataCollectionName((String) getEdgeProperty(edge, PROPERTY_KEY_RELATIONSHIP_METADATACOLLECTION_NAME));
377387
relationship.setCreatedBy((String) getEdgeProperty(edge, PROPERTY_KEY_RELATIONSHIP_CREATED_BY));

0 commit comments

Comments
 (0)