From 38040206f2960fd91710be8275aa0ddbbfb02ed1 Mon Sep 17 00:00:00 2001
From: Mandy Chessell <mandy.e.chessell@gmail.com>
Date: Fri, 13 Dec 2024 21:15:01 +0000
Subject: [PATCH] Fix type hierarchy around DataManager

Signed-off-by: Mandy Chessell <mandy.e.chessell@gmail.com>
---
 .../handler/CollaborationManagerHandler.java      |  4 ++--
 .../opentypes/OpenMetadataTypesArchive.java       |  2 +-
 .../opentypes/OpenMetadataTypesArchive2_0.java    | 14 ++------------
 .../opentypes/OpenMetadataTypesArchive2_9.java    | 12 ++----------
 .../opentypes/OpenMetadataTypesArchive3_1.java    | 15 +++++++++++++++
 5 files changed, 22 insertions(+), 25 deletions(-)

diff --git a/open-metadata-implementation/view-server-generic-services/feedback-manager/feedback-manager-server/src/main/java/org/odpi/openmetadata/viewservices/feedbackmanager/handler/CollaborationManagerHandler.java b/open-metadata-implementation/view-server-generic-services/feedback-manager/feedback-manager-server/src/main/java/org/odpi/openmetadata/viewservices/feedbackmanager/handler/CollaborationManagerHandler.java
index bf9c7ef6264..718566d123a 100644
--- a/open-metadata-implementation/view-server-generic-services/feedback-manager/feedback-manager-server/src/main/java/org/odpi/openmetadata/viewservices/feedbackmanager/handler/CollaborationManagerHandler.java
+++ b/open-metadata-implementation/view-server-generic-services/feedback-manager/feedback-manager-server/src/main/java/org/odpi/openmetadata/viewservices/feedbackmanager/handler/CollaborationManagerHandler.java
@@ -717,7 +717,7 @@ public void   updateCommentVisibility(String  userId,
                                                                                               0,
                                                                                               0);
 
-        if (relationships != null)
+        if ((relationships != null) && (relationships.getElementList() != null))
         {
             for (OpenMetadataRelationship relationship : relationships.getElementList())
             {
@@ -809,7 +809,7 @@ public void clearAcceptedAnswer(String  userId,
                                                                                               0,
                                                                                               0);
 
-        if (relationships != null)
+        if ((relationships != null) && (relationships.getElementList() != null))
         {
             for (OpenMetadataRelationship relationship : relationships.getElementList())
             {
diff --git a/open-metadata-resources/open-metadata-archives/open-metadata-types/src/main/java/org/odpi/openmetadata/opentypes/OpenMetadataTypesArchive.java b/open-metadata-resources/open-metadata-archives/open-metadata-types/src/main/java/org/odpi/openmetadata/opentypes/OpenMetadataTypesArchive.java
index 0abfd0887d2..b8139dc5b06 100644
--- a/open-metadata-resources/open-metadata-archives/open-metadata-types/src/main/java/org/odpi/openmetadata/opentypes/OpenMetadataTypesArchive.java
+++ b/open-metadata-resources/open-metadata-archives/open-metadata-types/src/main/java/org/odpi/openmetadata/opentypes/OpenMetadataTypesArchive.java
@@ -174,7 +174,7 @@ private void update0050ApplicationsAndProcesses()
     private EntityDef addDataAccessManagerEntity()
     {
         return archiveHelper.getDefaultEntityDef(OpenMetadataType.DATA_ACCESS_MANAGER,
-                                                 this.archiveBuilder.getEntityDef(OpenMetadataType.SOFTWARE_SERVER_CAPABILITY.typeName));
+                                                 this.archiveBuilder.getEntityDef(OpenMetadataType.DATA_MANAGER.typeName));
     }
 
 
diff --git a/open-metadata-resources/open-metadata-archives/open-metadata-types/src/main/java/org/odpi/openmetadata/opentypes/OpenMetadataTypesArchive2_0.java b/open-metadata-resources/open-metadata-archives/open-metadata-types/src/main/java/org/odpi/openmetadata/opentypes/OpenMetadataTypesArchive2_0.java
index 9964c0bc0bf..ebe7862f8db 100644
--- a/open-metadata-resources/open-metadata-archives/open-metadata-types/src/main/java/org/odpi/openmetadata/opentypes/OpenMetadataTypesArchive2_0.java
+++ b/open-metadata-resources/open-metadata-archives/open-metadata-types/src/main/java/org/odpi/openmetadata/opentypes/OpenMetadataTypesArchive2_0.java
@@ -372,18 +372,8 @@ private void update0224Databases()
 
     private EntityDef addDatabaseManagerEntity()
     {
-        final String guid            = OpenMetadataType.DATABASE_MANAGER.typeGUID;
-        final String name            = OpenMetadataType.DATABASE_MANAGER.typeName;
-        final String description     = OpenMetadataType.DATABASE_MANAGER.description;
-        final String descriptionGUID = OpenMetadataType.DATABASE_MANAGER.descriptionGUID;
-        final String descriptionWiki = OpenMetadataType.DATABASE_MANAGER.wikiURL;
-
-        return archiveHelper.getDefaultEntityDef(guid,
-                                                 name,
-                                                 this.archiveBuilder.getEntityDef(OpenMetadataType.SOFTWARE_SERVER_CAPABILITY.typeName),
-                                                 description,
-                                                 descriptionGUID,
-                                                 descriptionWiki);
+        return archiveHelper.getDefaultEntityDef(OpenMetadataType.DATABASE_MANAGER,
+                                                 this.archiveBuilder.getEntityDef(OpenMetadataType.SOFTWARE_SERVER_CAPABILITY.typeName));
 
     }
 
diff --git a/open-metadata-resources/open-metadata-archives/open-metadata-types/src/main/java/org/odpi/openmetadata/opentypes/OpenMetadataTypesArchive2_9.java b/open-metadata-resources/open-metadata-archives/open-metadata-types/src/main/java/org/odpi/openmetadata/opentypes/OpenMetadataTypesArchive2_9.java
index 15a8763e357..1a04fe85066 100644
--- a/open-metadata-resources/open-metadata-archives/open-metadata-types/src/main/java/org/odpi/openmetadata/opentypes/OpenMetadataTypesArchive2_9.java
+++ b/open-metadata-resources/open-metadata-archives/open-metadata-types/src/main/java/org/odpi/openmetadata/opentypes/OpenMetadataTypesArchive2_9.java
@@ -207,12 +207,8 @@ private ClassificationDef getUserAccessDirectoryClassification()
 
     private ClassificationDef getMasterDataManagerClassification()
     {
-        return archiveHelper.getClassificationDef(OpenMetadataType.MASTER_DATA_MANAGER.typeGUID,
-                                                  OpenMetadataType.MASTER_DATA_MANAGER.typeName,
+        return archiveHelper.getClassificationDef(OpenMetadataType.MASTER_DATA_MANAGER,
                                                   null,
-                                                  OpenMetadataType.MASTER_DATA_MANAGER.description,
-                                                  OpenMetadataType.MASTER_DATA_MANAGER.descriptionGUID,
-                                                  OpenMetadataType.MASTER_DATA_MANAGER.wikiURL,
                                                   this.archiveBuilder.getEntityDef(OpenMetadataType.REFERENCEABLE.typeName),
                                                   false);
     }
@@ -234,12 +230,8 @@ private void update0137ToDos()
 
     private RelationshipDef getActionTargetRelationship()
     {
-        RelationshipDef relationshipDef = archiveHelper.getBasicRelationshipDef(OpenMetadataType.ACTION_TARGET_RELATIONSHIP.typeGUID,
-                                                                                OpenMetadataType.ACTION_TARGET_RELATIONSHIP.typeName,
+        RelationshipDef relationshipDef = archiveHelper.getBasicRelationshipDef(OpenMetadataType.ACTION_TARGET_RELATIONSHIP,
                                                                                 null,
-                                                                                OpenMetadataType.ACTION_TARGET_RELATIONSHIP.description,
-                                                                                OpenMetadataType.ACTION_TARGET_RELATIONSHIP.descriptionGUID,
-                                                                                OpenMetadataType.ACTION_TARGET_RELATIONSHIP.wikiURL,
                                                                                 ClassificationPropagationRule.NONE);
 
         RelationshipEndDef relationshipEndDef;
diff --git a/open-metadata-resources/open-metadata-archives/open-metadata-types/src/main/java/org/odpi/openmetadata/opentypes/OpenMetadataTypesArchive3_1.java b/open-metadata-resources/open-metadata-archives/open-metadata-types/src/main/java/org/odpi/openmetadata/opentypes/OpenMetadataTypesArchive3_1.java
index 00f234faca6..7e27fe1ccc0 100644
--- a/open-metadata-resources/open-metadata-archives/open-metadata-types/src/main/java/org/odpi/openmetadata/opentypes/OpenMetadataTypesArchive3_1.java
+++ b/open-metadata-resources/open-metadata-archives/open-metadata-types/src/main/java/org/odpi/openmetadata/opentypes/OpenMetadataTypesArchive3_1.java
@@ -615,6 +615,7 @@ private void update0050ApplicationsAndProcesses()
     {
         this.archiveBuilder.addEntityDef(addCatalogEntity());
         this.archiveBuilder.addEntityDef(addDataManagerEntity());
+        this.archiveBuilder.addTypeDefPatch(updateDatabaseManager());
     }
 
 
@@ -630,6 +631,20 @@ private EntityDef addDataManagerEntity()
                                                  this.archiveBuilder.getEntityDef(OpenMetadataType.SOFTWARE_SERVER_CAPABILITY.typeName));
     }
 
+    private TypeDefPatch updateDatabaseManager()
+    {
+        /*
+         * Create the Patch
+         */
+        TypeDefPatch typeDefPatch = archiveBuilder.getPatchForType(OpenMetadataType.DATABASE_MANAGER.typeName);
+
+        typeDefPatch.setUpdatedBy(originatorName);
+        typeDefPatch.setUpdateTime(creationDate);
+        typeDefPatch.setSuperType(this.archiveBuilder.getEntityDef(OpenMetadataType.DATA_MANAGER.typeName));
+
+        return typeDefPatch;
+    }
+
 
     /*
      * -------------------------------------------------------------------------------------------------------