diff --git a/open-metadata-implementation/access-services/asset-consumer/asset-consumer-server/build.gradle b/open-metadata-implementation/access-services/asset-consumer/asset-consumer-server/build.gradle index 47751e162d..14fa884609 100644 --- a/open-metadata-implementation/access-services/asset-consumer/asset-consumer-server/build.gradle +++ b/open-metadata-implementation/access-services/asset-consumer/asset-consumer-server/build.gradle @@ -14,6 +14,7 @@ dependencies { implementation project(':open-metadata-implementation:frameworks:governance-action-framework') implementation project(':open-metadata-implementation:common-services:ffdc-services') implementation project(':open-metadata-implementation:admin-services:admin-services-api') + implementation project(':open-metadata-implementation:common-services:mermaid-services') implementation project(':open-metadata-implementation:common-services:repository-handler') implementation project(':open-metadata-implementation:common-services:metadata-security:metadata-security-server') implementation project(':open-metadata-implementation:common-services:generic-handlers') diff --git a/open-metadata-implementation/access-services/asset-consumer/asset-consumer-server/src/main/java/org/odpi/openmetadata/accessservices/assetconsumer/server/AssetConsumerRESTServices.java b/open-metadata-implementation/access-services/asset-consumer/asset-consumer-server/src/main/java/org/odpi/openmetadata/accessservices/assetconsumer/server/AssetConsumerRESTServices.java index a2206302fc..2bd9543579 100644 --- a/open-metadata-implementation/access-services/asset-consumer/asset-consumer-server/src/main/java/org/odpi/openmetadata/accessservices/assetconsumer/server/AssetConsumerRESTServices.java +++ b/open-metadata-implementation/access-services/asset-consumer/asset-consumer-server/src/main/java/org/odpi/openmetadata/accessservices/assetconsumer/server/AssetConsumerRESTServices.java @@ -2,6 +2,8 @@ /* Copyright Contributors to the ODPi Egeria project. */ package org.odpi.openmetadata.accessservices.assetconsumer.server; +import org.odpi.openmetadata.commonservices.mermaid.AssetGraphMermaidGraphBuilder; +import org.odpi.openmetadata.commonservices.mermaid.AssetLineageGraphMermaidGraphBuilder; import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException; @@ -320,7 +322,9 @@ public AssetGraphResponse getAssetGraph(String serverName, assetGraph.setRelationships(metadataRelationships); } - assetGraph.setMermaidGraph(this.getAssetMermaidGraph(assetGraph)); + AssetGraphMermaidGraphBuilder graphBuilder = new AssetGraphMermaidGraphBuilder(assetGraph); + assetGraph.setMermaidGraph(graphBuilder.getMermaidGraph()); + response.setAssetGraph(assetGraph); } } @@ -334,232 +338,6 @@ public AssetGraphResponse getAssetGraph(String serverName, } - /** - * Constructing the mermaid graph for the retrieved asset. - * - * @param assetGraph retrieved asset graph - * @return mermaid string - */ - private String getAssetMermaidGraph(AssetGraph assetGraph) - { - StringBuilder mermaidGraph = new StringBuilder(); - - mermaidGraph.append("---\n"); - mermaidGraph.append("title: Asset - "); - mermaidGraph.append(assetGraph.getProperties().getDisplayName()); - mermaidGraph.append(" ["); - mermaidGraph.append(assetGraph.getElementHeader().getGUID()); - mermaidGraph.append("]\n---\nflowchart LR\n%%{init: {\"flowchart\": {\"htmlLabels\": false}} }%%\n\n"); - - List usedQualifiedNames = new ArrayList<>(); - - String currentQualifiedName = assetGraph.getProperties().getQualifiedName(); - String currentDisplayName = assetGraph.getProperties().getDisplayName(); - - appendMermaidNode(mermaidGraph, - currentQualifiedName, - currentDisplayName, - assetGraph.getElementHeader().getType().getTypeName()); - - usedQualifiedNames.add(currentQualifiedName); - - if (assetGraph.getAnchoredElements() != null) - { - for (MetadataElementSummary node : assetGraph.getAnchoredElements()) - { - if (node != null) - { - currentQualifiedName = node.getProperties().get(OpenMetadataProperty.QUALIFIED_NAME.name); - currentDisplayName = node.getProperties().get(OpenMetadataProperty.DISPLAY_NAME.name); - if (currentDisplayName == null) - { - currentDisplayName = node.getProperties().get(OpenMetadataProperty.NAME.name); - } - if (currentDisplayName == null) - { - currentDisplayName = node.getProperties().get(OpenMetadataProperty.RESOURCE_NAME.name); - } - if (currentDisplayName == null) - { - currentDisplayName = node.getProperties().get(OpenMetadataProperty.QUALIFIED_NAME.name); - } - - if (!usedQualifiedNames.contains(currentQualifiedName)) - { - appendMermaidNode(mermaidGraph, - currentQualifiedName, - currentDisplayName, - node.getElementHeader().getType().getTypeName()); - - usedQualifiedNames.add(currentQualifiedName); - } - } - } - - for (MetadataRelationship line : assetGraph.getRelationships()) - { - if (line != null) - { - mermaidGraph.append(this.removeSpaces(line.getEnd1().getUniqueName())); - mermaidGraph.append("-->|"); - mermaidGraph.append(line.getType().getTypeName()); - mermaidGraph.append("|"); - mermaidGraph.append(this.removeSpaces(line.getEnd2().getUniqueName())); - mermaidGraph.append("\n"); - } - } - } - - return mermaidGraph.toString(); - } - - - /** - * Create a node in the mermaid graph. - * - * @param mermaidGraph current state of the graph - * @param currentNodeName unique name/identifier - * @param currentDisplayName display name - * @param currentType type of element - */ - private void appendMermaidNode(StringBuilder mermaidGraph, - String currentNodeName, - String currentDisplayName, - String currentType) - { - mermaidGraph.append(this.removeSpaces(currentNodeName)); - mermaidGraph.append("(\"`*"); - mermaidGraph.append(currentType); - mermaidGraph.append("*\n**"); - mermaidGraph.append(currentDisplayName); - mermaidGraph.append("**`\")\n"); - } - - - /** - * Remove all the spaces from the qualifiedName along with the curly braces - found in the templates. - * - * @param currentQualifiedName qualifiedName - * @return qualified name without spaces - */ - private String removeSpaces(String currentQualifiedName) - { - String noSpaces = currentQualifiedName.replaceAll("\\s+",""); - return noSpaces.replaceAll("[\\[\\](){}]", ""); - } - - - /** - * Constructing the mermaid graph for the retrieved asset. - * - * @param assetLineageGraph retrieved asset graph - * @return mermaid string - */ - private String getAssetLineageMermaidGraph(AssetLineageGraph assetLineageGraph) - { - StringBuilder mermaidGraph = new StringBuilder(); - - mermaidGraph.append("---\n"); - mermaidGraph.append("title: Lineage Graph for Asset - "); - mermaidGraph.append(assetLineageGraph.getProperties().getDisplayName()); - mermaidGraph.append(" ["); - mermaidGraph.append(assetLineageGraph.getElementHeader().getGUID()); - mermaidGraph.append("]\n---\nflowchart TD\n%%{init: {\"flowchart\": {\"htmlLabels\": false}} }%%\n\n"); - - List usedNodeNames = new ArrayList<>(); - - String currentNodeName = assetLineageGraph.getElementHeader().getGUID(); - String currentDisplayName = assetLineageGraph.getProperties().getDisplayName(); - - appendMermaidNode(mermaidGraph, - currentNodeName, - currentDisplayName, - assetLineageGraph.getElementHeader().getType().getTypeName()); - - usedNodeNames.add(currentNodeName); - - if (assetLineageGraph.getLinkedAssets() != null) - { - for (AssetLineageGraphNode node : assetLineageGraph.getLinkedAssets()) - { - if (node != null) - { - currentNodeName = node.getElementHeader().getGUID(); - currentDisplayName = node.getProperties().getDisplayName(); - if (currentDisplayName == null) - { - currentDisplayName = node.getProperties().getName(); - } - if (currentDisplayName == null) - { - currentDisplayName = node.getProperties().getResourceName(); - } - if (currentDisplayName == null) - { - currentDisplayName = node.getProperties().getQualifiedName(); - } - - if (!usedNodeNames.contains(currentNodeName)) - { - appendMermaidNode(mermaidGraph, - currentNodeName, - currentDisplayName, - node.getElementHeader().getType().getTypeName()); - - usedNodeNames.add(currentNodeName); - } - } - } - - for (AssetLineageGraphRelationship line : assetLineageGraph.getLineageRelationships()) - { - if (line != null) - { - mermaidGraph.append(line.getEnd1AssetGUID()); - mermaidGraph.append("-->|"); - mermaidGraph.append(this.getListLabel(line.getRelationshipTypes())); - mermaidGraph.append("|"); - mermaidGraph.append(line.getEnd2AssetGUID()); - mermaidGraph.append("\n"); - } - } - } - - return mermaidGraph.toString(); - } - - - /** - * Convert an array into a comma separated string. - * - * @param labelValues array of labels - * @return string value without square brackets (Mermaid does not allow them) - */ - private String getListLabel(List labelValues) - { - if (labelValues != null) - { - StringBuilder stringBuilder = new StringBuilder(); - boolean firstValue = true; - - for (String labelValue : labelValues) - { - if (! firstValue) - { - stringBuilder.append(","); - } - - firstValue = false; - stringBuilder.append(labelValue); - } - - return stringBuilder.toString(); - } - - return ""; - } - - /** * Return all the elements that are linked to an asset using lineage relationships. The relationships are * retrieved both from the asset, and the anchored schema elements @@ -624,7 +402,9 @@ public AssetLineageGraphResponse getAssetLineageGraph(String serverName, } assetLineageGraph.setLineageRelationships(this.deDupLineageRelationships(lineageRelationships)); - assetLineageGraph.setMermaidGraph(this.getAssetLineageMermaidGraph(assetLineageGraph)); + + AssetLineageGraphMermaidGraphBuilder graphBuilder = new AssetLineageGraphMermaidGraphBuilder(assetLineageGraph); + assetLineageGraph.setMermaidGraph(graphBuilder.getMermaidGraph()); response.setAssetLineageGraph(assetLineageGraph); } diff --git a/open-metadata-implementation/access-services/asset-manager/asset-manager-client/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/client/AssetManagerBaseClient.java b/open-metadata-implementation/access-services/asset-manager/asset-manager-client/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/client/AssetManagerBaseClient.java index bf95910795..8c389f7b9f 100644 --- a/open-metadata-implementation/access-services/asset-manager/asset-manager-client/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/client/AssetManagerBaseClient.java +++ b/open-metadata-implementation/access-services/asset-manager/asset-manager-client/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/client/AssetManagerBaseClient.java @@ -2005,7 +2005,7 @@ protected List getRelatedElements(String UserNotAuthorizedException, PropertyServerException { - List relatedMetadataElements = openMetadataStoreClient.getRelatedMetadataElements(userId, + RelatedMetadataElementList relatedMetadataElements = openMetadataStoreClient.getRelatedMetadataElements(userId, startingElementGUID, startingAtEnd, relationshipTypeName, diff --git a/open-metadata-implementation/access-services/asset-manager/asset-manager-client/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/client/exchange/StewardshipExchangeClient.java b/open-metadata-implementation/access-services/asset-manager/asset-manager-client/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/client/exchange/StewardshipExchangeClient.java index c0ea7e7e6a..c1fec8c36c 100644 --- a/open-metadata-implementation/access-services/asset-manager/asset-manager-client/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/client/exchange/StewardshipExchangeClient.java +++ b/open-metadata-implementation/access-services/asset-manager/asset-manager-client/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/client/exchange/StewardshipExchangeClient.java @@ -16,9 +16,7 @@ import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException; -import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataElement; -import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataRelationship; -import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElement; +import org.odpi.openmetadata.frameworks.governanceaction.properties.*; import org.odpi.openmetadata.frameworks.governanceaction.search.ElementProperties; import org.odpi.openmetadata.frameworks.governanceaction.search.PropertyComparisonOperator; import org.odpi.openmetadata.frameworks.governanceaction.search.PropertyValue; @@ -2602,7 +2600,7 @@ public List getRelatedElements(String { final String methodName = "getRelatedElements"; - List relatedMetadataElements; + RelatedMetadataElementList relatedMetadataElements; if (findProperties == null) { @@ -2641,7 +2639,7 @@ public List getRelatedElements(String { List results = new ArrayList<>(); - for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements) + for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements.getElementList()) { if (relatedMetadataElement != null) { @@ -2705,7 +2703,7 @@ public List getRelatedElementsWithPropertyValue(S invalidParameterHandler.validateObject(findProperties.getPropertyValue(), propertyValueProperty, methodName); invalidParameterHandler.validateObject(findProperties.getPropertyNames(), propertyNamesProperty, methodName); - List relatedMetadataElements = openMetadataStoreClient.getRelatedMetadataElements(userId, + RelatedMetadataElementList relatedMetadataElements = openMetadataStoreClient.getRelatedMetadataElements(userId, elementGUID, startingAtEnd, relationshipTypeName, @@ -2723,7 +2721,7 @@ public List getRelatedElementsWithPropertyValue(S { List results = new ArrayList<>(); - for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements) + for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements.getElementList()) { if (relatedMetadataElement != null) { @@ -2807,7 +2805,7 @@ public List findRelatedElementsWithPropertyValue( invalidParameterHandler.validateObject(findProperties.getPropertyValue(), propertyValueProperty, methodName); invalidParameterHandler.validateObject(findProperties.getPropertyNames(), propertyNamesProperty, methodName); - List relatedMetadataElements = openMetadataStoreClient.getRelatedMetadataElements(userId, + RelatedMetadataElementList relatedMetadataElements = openMetadataStoreClient.getRelatedMetadataElements(userId, elementGUID, startingAtEnd, relationshipTypeName, @@ -2825,7 +2823,7 @@ public List findRelatedElementsWithPropertyValue( { List results = new ArrayList<>(); - for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements) + for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements.getElementList()) { if (relatedMetadataElement != null) { @@ -2893,7 +2891,7 @@ public List getRelationships(String use { final String methodName = "getRelationships"; - List openMetadataRelationships; + OpenMetadataRelationshipList openMetadataRelationships; if (findProperties == null) { @@ -2967,7 +2965,7 @@ public List getRelationshipsWithPropertyValue(Strin { final String methodName = "getRelationships"; - List openMetadataRelationships; + OpenMetadataRelationshipList openMetadataRelationships; if (findProperties == null) { @@ -3044,7 +3042,7 @@ public List findRelationshipsWithPropertyValue(Stri { final String methodName = "getRelationships"; - List openMetadataRelationships; + OpenMetadataRelationshipList openMetadataRelationships; if (findProperties == null) { diff --git a/open-metadata-implementation/access-services/asset-manager/asset-manager-client/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/client/exchange/ValidValuesExchangeClient.java b/open-metadata-implementation/access-services/asset-manager/asset-manager-client/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/client/exchange/ValidValuesExchangeClient.java index a09b634f46..067ef99aa6 100644 --- a/open-metadata-implementation/access-services/asset-manager/asset-manager-client/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/client/exchange/ValidValuesExchangeClient.java +++ b/open-metadata-implementation/access-services/asset-manager/asset-manager-client/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/client/exchange/ValidValuesExchangeClient.java @@ -16,6 +16,7 @@ import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException; +import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElementList; import org.odpi.openmetadata.frameworks.governanceaction.search.PropertyComparisonOperator; import org.odpi.openmetadata.frameworks.openmetadata.enums.ElementStatus; import org.odpi.openmetadata.frameworks.openmetadata.properties.validvalues.*; @@ -1000,7 +1001,7 @@ public List getValidValueSetMembers(String userId, invalidParameterHandler.validateGUID(validValueSetGUID, validValueGUIDParameterName, methodName); invalidParameterHandler.validatePaging(startFrom, pageSize, methodName); - List linkedResources = openMetadataStoreClient.getRelatedMetadataElements(userId, + RelatedMetadataElementList linkedResources = openMetadataStoreClient.getRelatedMetadataElements(userId, validValueSetGUID, 1, OpenMetadataType.VALID_VALUE_MEMBER_RELATIONSHIP.typeName, @@ -1018,7 +1019,7 @@ public List getValidValueSetMembers(String userId, { List validValueMembers = new ArrayList<>(); - for (RelatedMetadataElement relatedMetadataElement : linkedResources) + for (RelatedMetadataElement relatedMetadataElement : linkedResources.getElementList()) { if (propertyHelper.isTypeOf(relatedMetadataElement, OpenMetadataType.VALID_VALUE_DEFINITION.typeName)) { @@ -1087,7 +1088,7 @@ public List getSetsForValidValue(String userId, invalidParameterHandler.validateGUID(validValueGUID, validValueGUIDParameterName, methodName); invalidParameterHandler.validatePaging(startFrom, pageSize, methodName); - List linkedResources = openMetadataStoreClient.getRelatedMetadataElements(userId, + RelatedMetadataElementList linkedResources = openMetadataStoreClient.getRelatedMetadataElements(userId, validValueGUID, 2, OpenMetadataType.VALID_VALUE_MEMBER_RELATIONSHIP.typeName, @@ -1105,7 +1106,7 @@ public List getSetsForValidValue(String userId, { List validValueSets = new ArrayList<>(); - for (RelatedMetadataElement relatedMetadataElement : linkedResources) + for (RelatedMetadataElement relatedMetadataElement : linkedResources.getElementList()) { if (propertyHelper.isTypeOf(relatedMetadataElement.getElement(), OpenMetadataType.VALID_VALUE_SET.typeName)) { @@ -1166,7 +1167,7 @@ public List getReferenceValueAssignedItems( invalidParameterHandler.validateGUID(validValueGUID, validValueGUIDParameterName, methodName); invalidParameterHandler.validatePaging(startFrom, pageSize, methodName); - List linkedResources = openMetadataStoreClient.getRelatedMetadataElements(userId, + RelatedMetadataElementList linkedResources = openMetadataStoreClient.getRelatedMetadataElements(userId, validValueGUID, 2, OpenMetadataType.REFERENCE_VALUE_ASSIGNMENT_RELATIONSHIP.typeName, @@ -1184,7 +1185,7 @@ public List getReferenceValueAssignedItems( { List results = new ArrayList<>(); - for (RelatedMetadataElement relatedMetadataElement : linkedResources) + for (RelatedMetadataElement relatedMetadataElement : linkedResources.getElementList()) { if (propertyHelper.isTypeOf(relatedMetadataElement, OpenMetadataType.REFERENCEABLE.typeName)) { @@ -1251,25 +1252,25 @@ public List getReferenceValueAssignme invalidParameterHandler.validateGUID(referenceableGUID, itemGUIDParameterName, methodName); invalidParameterHandler.validatePaging(startFrom, pageSize, methodName); - List linkedResources = openMetadataStoreClient.getRelatedMetadataElements(userId, - referenceableGUID, - 1, - OpenMetadataType.REFERENCE_VALUE_ASSIGNMENT_RELATIONSHIP.typeName, - null, - null, - null, - SequencingOrder.CREATION_DATE_RECENT, - forLineage, - forDuplicateProcessing, - effectiveTime, - startFrom, - pageSize); + RelatedMetadataElementList linkedResources = openMetadataStoreClient.getRelatedMetadataElements(userId, + referenceableGUID, + 1, + OpenMetadataType.REFERENCE_VALUE_ASSIGNMENT_RELATIONSHIP.typeName, + null, + null, + null, + SequencingOrder.CREATION_DATE_RECENT, + forLineage, + forDuplicateProcessing, + effectiveTime, + startFrom, + pageSize); if (linkedResources != null) { List results = new ArrayList<>(); - for (RelatedMetadataElement relatedMetadataElement : linkedResources) + for (RelatedMetadataElement relatedMetadataElement : linkedResources.getElementList()) { if (propertyHelper.isTypeOf(relatedMetadataElement, OpenMetadataType.VALID_VALUE_DEFINITION.typeName)) { diff --git a/open-metadata-implementation/access-services/community-profile/community-profile-client/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/client/ToDoActionManagement.java b/open-metadata-implementation/access-services/community-profile/community-profile-client/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/client/ToDoActionManagement.java index 280df74086..02b61614af 100644 --- a/open-metadata-implementation/access-services/community-profile/community-profile-client/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/client/ToDoActionManagement.java +++ b/open-metadata-implementation/access-services/community-profile/community-profile-client/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/client/ToDoActionManagement.java @@ -4,6 +4,7 @@ package org.odpi.openmetadata.accessservices.communityprofile.client; import org.odpi.openmetadata.accessservices.communityprofile.api.ToDoManagementInterface; +import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElementList; import org.odpi.openmetadata.frameworks.openmetadata.metadataelements.ToDoElement; import org.odpi.openmetadata.frameworks.governanceaction.converters.ToDoConverter; import org.odpi.openmetadata.frameworks.openmetadata.properties.actions.ToDoActionTargetProperties; @@ -357,23 +358,23 @@ public void reassignToDo(String userId, invalidParameterHandler.validateGUID(toDoGUID, toDoGUIDParameterName, methodName); invalidParameterHandler.validateGUID(actorGUID, parentGUIDParameterName, methodName); - List assignedActors = openMetadataStoreClient.getRelatedMetadataElements(userId, - toDoGUID, - 2, - OpenMetadataType.ACTION_ASSIGNMENT_RELATIONSHIP.typeName, - null, - null, - null, - SequencingOrder.CREATION_DATE_RECENT, - false, - false, - new Date(), - 0, - 0); + RelatedMetadataElementList assignedActors = openMetadataStoreClient.getRelatedMetadataElements(userId, + toDoGUID, + 2, + OpenMetadataType.ACTION_ASSIGNMENT_RELATIONSHIP.typeName, + null, + null, + null, + SequencingOrder.CREATION_DATE_RECENT, + false, + false, + new Date(), + 0, + 0); if (assignedActors != null) { - for (RelatedMetadataElement assignedActor : assignedActors) + for (RelatedMetadataElement assignedActor : assignedActors.getElementList()) { openMetadataStoreClient.deleteRelatedElementsInStore(userId, null, @@ -460,7 +461,7 @@ public ToDoElement getToDo(String userId, if ((openMetadataElement != null) && (propertyHelper.isTypeOf(openMetadataElement, OpenMetadataType.TO_DO.typeName))) { - List relatedMetadataElements = openMetadataStoreClient.getRelatedMetadataElements(userId, + RelatedMetadataElementList relatedMetadataElements = openMetadataStoreClient.getRelatedMetadataElements(userId, openMetadataElement.getElementGUID(), 0, null, @@ -509,7 +510,7 @@ public List getActionsForActionTarget(String userId, invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateGUID(elementGUID, guidParameterName, methodName); - List relatedMetadataElements = openMetadataStoreClient.getRelatedMetadataElements(userId, + RelatedMetadataElementList relatedMetadataElements = openMetadataStoreClient.getRelatedMetadataElements(userId, elementGUID, 2, OpenMetadataType.ACTION_TARGET_RELATIONSHIP.typeName, @@ -556,7 +557,7 @@ public List getActionsForSponsor(String userId, invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateGUID(elementGUID, guidParameterName, methodName); - List relatedMetadataElements = openMetadataStoreClient.getRelatedMetadataElements(userId, + RelatedMetadataElementList relatedMetadataElements = openMetadataStoreClient.getRelatedMetadataElements(userId, elementGUID, 1, OpenMetadataType.ACTION_SPONSOR_RELATIONSHIP.typeName, @@ -601,7 +602,7 @@ public List getAssignedActions(String userId, invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateGUID(actorGUID, guidParameterName, methodName); - List relatedMetadataElements = openMetadataStoreClient.getRelatedMetadataElements(userId, + RelatedMetadataElementList relatedMetadataElements = openMetadataStoreClient.getRelatedMetadataElements(userId, actorGUID, 1, OpenMetadataType.ACTION_ASSIGNMENT_RELATIONSHIP.typeName, @@ -614,6 +615,7 @@ public List getAssignedActions(String userId, new Date(), startFrom, pageSize); + return this.convertRelatedToDos(userId, relatedMetadataElements, toDoStatus, methodName); } @@ -738,7 +740,7 @@ private List convertToDos(String userId, { if (openMetadataElement != null) { - List relatedMetadataElements = openMetadataStoreClient.getRelatedMetadataElements(userId, + RelatedMetadataElementList relatedMetadataElements = openMetadataStoreClient.getRelatedMetadataElements(userId, openMetadataElement.getElementGUID(), 0, null, @@ -786,7 +788,7 @@ private List convertToDos(String userId, * @throws UserNotAuthorizedException the calling user is not authorized to issue the call */ private List convertRelatedToDos(String userId, - List relatedMetadataElements, + RelatedMetadataElementList relatedMetadataElements, ToDoStatus toDoStatus, String methodName) throws PropertyServerException, InvalidParameterException, @@ -796,11 +798,11 @@ private List convertRelatedToDos(String userI { List toDoElements = new ArrayList<>(); - for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements) + for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements.getElementList()) { if (relatedMetadataElement != null) { - List relatedElements = openMetadataStoreClient.getRelatedMetadataElements(userId, + RelatedMetadataElementList relatedElements = openMetadataStoreClient.getRelatedMetadataElements(userId, relatedMetadataElement.getElement().getElementGUID(), 0, null, @@ -813,10 +815,22 @@ private List convertRelatedToDos(String userI new Date(), 0, 0); - ToDoElement toDoElement = toDoConverter.getNewComplexBean(toDoBeanClass, - relatedMetadataElement.getElement(), - relatedElements, - methodName); + + ToDoElement toDoElement; + if (relatedElements != null) + { + toDoElement = toDoConverter.getNewComplexBean(toDoBeanClass, + relatedMetadataElement.getElement(), + relatedElements, + methodName); + } + else + { + toDoElement = toDoConverter.getNewComplexBean(toDoBeanClass, + null, + relatedElements, + methodName); + } if ((toDoStatus == null) || (toDoStatus == toDoElement.getProperties().getToDoStatus())) { diff --git a/open-metadata-implementation/access-services/digital-service/digital-service-client/src/main/java/org/odpi/openmetadata/accessservices/digitalservice/client/CollectionsClient.java b/open-metadata-implementation/access-services/digital-service/digital-service-client/src/main/java/org/odpi/openmetadata/accessservices/digitalservice/client/CollectionsClient.java index e117eeb5bd..8ebb014391 100644 --- a/open-metadata-implementation/access-services/digital-service/digital-service-client/src/main/java/org/odpi/openmetadata/accessservices/digitalservice/client/CollectionsClient.java +++ b/open-metadata-implementation/access-services/digital-service/digital-service-client/src/main/java/org/odpi/openmetadata/accessservices/digitalservice/client/CollectionsClient.java @@ -9,6 +9,7 @@ import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException; import org.odpi.openmetadata.frameworks.governanceaction.converters.CollectionConverter; import org.odpi.openmetadata.frameworks.governanceaction.converters.CollectionMemberConverter; +import org.odpi.openmetadata.frameworks.governanceaction.properties.*; import org.odpi.openmetadata.frameworks.governanceaction.search.*; import org.odpi.openmetadata.frameworks.openmetadata.enums.ElementStatus; import org.odpi.openmetadata.frameworks.openmetadata.enums.CollectionMemberStatus; @@ -23,9 +24,6 @@ import org.odpi.openmetadata.frameworks.openmetadata.properties.resources.ResourceListProperties; import org.odpi.openmetadata.frameworks.openmetadata.types.OpenMetadataProperty; import org.odpi.openmetadata.frameworks.openmetadata.types.OpenMetadataType; -import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataElement; -import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElement; -import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataRelationship; import java.util.ArrayList; import java.util.Arrays; @@ -138,25 +136,25 @@ public List getAttachedCollections(String userId, invalidParameterHandler.validateGUID(parentGUID, parentGUIDParameterName, methodName); invalidParameterHandler.validatePaging(startFrom, pageSize, methodName); - List linkedResources = openMetadataStoreClient.getRelatedMetadataElements(userId, - parentGUID, - 1, - OpenMetadataType.RESOURCE_LIST_RELATIONSHIP.typeName, - null, - null, - null, - SequencingOrder.CREATION_DATE_RECENT, - false, - false, - new Date(), - startFrom, - pageSize); + RelatedMetadataElementList linkedResources = openMetadataStoreClient.getRelatedMetadataElements(userId, + parentGUID, + 1, + OpenMetadataType.RESOURCE_LIST_RELATIONSHIP.typeName, + null, + null, + null, + SequencingOrder.CREATION_DATE_RECENT, + false, + false, + new Date(), + startFrom, + pageSize); if (linkedResources != null) { List filteredCollections = new ArrayList<>(); - for (RelatedMetadataElement relatedMetadataElement : linkedResources) + for (RelatedMetadataElement relatedMetadataElement : linkedResources.getElementList()) { if (propertyHelper.isTypeOf(relatedMetadataElement.getElement(), OpenMetadataType.COLLECTION.typeName)) { @@ -958,7 +956,7 @@ public List getCollectionMembers(String userId, invalidParameterHandler.validateGUID(collectionGUID, collectionGUIDParameterName, methodName); invalidParameterHandler.validatePaging(startFrom, pageSize, methodName); - List linkedResources = openMetadataStoreClient.getRelatedMetadataElements(userId, + RelatedMetadataElementList linkedResources = openMetadataStoreClient.getRelatedMetadataElements(userId, collectionGUID, 1, OpenMetadataType.COLLECTION_MEMBERSHIP_RELATIONSHIP.typeName, @@ -976,7 +974,7 @@ public List getCollectionMembers(String userId, { List collectionMembers = new ArrayList<>(); - for (RelatedMetadataElement relatedMetadataElement : linkedResources) + for (RelatedMetadataElement relatedMetadataElement : linkedResources.getElementList()) { collectionMembers.add(collectionMemberConverter.getNewBean(collectionMemberBeanClass, relatedMetadataElement, methodName)); } @@ -1009,23 +1007,23 @@ private String getMembershipRelationshipGUID(String userId, PropertyServerException, UserNotAuthorizedException { - List linkedResources = openMetadataStoreClient.getMetadataElementRelationships(userId, - collectionGUID, - elementGUID, - OpenMetadataType.COLLECTION_MEMBERSHIP_RELATIONSHIP.typeName, - null, - null, - null, - null, - false, - false, - new Date(), - 0, - 0); + OpenMetadataRelationshipList linkedResources = openMetadataStoreClient.getMetadataElementRelationships(userId, + collectionGUID, + elementGUID, + OpenMetadataType.COLLECTION_MEMBERSHIP_RELATIONSHIP.typeName, + null, + null, + null, + null, + false, + false, + new Date(), + 0, + 0); if (linkedResources != null) { - for (OpenMetadataRelationship relatedMetadataElement : linkedResources) + for (OpenMetadataRelationship relatedMetadataElement : linkedResources.getElementList()) { if (relatedMetadataElement != null) { diff --git a/open-metadata-implementation/access-services/project-management/project-management-client/src/main/java/org/odpi/openmetadata/accessservices/projectmanagement/client/ProjectManagement.java b/open-metadata-implementation/access-services/project-management/project-management-client/src/main/java/org/odpi/openmetadata/accessservices/projectmanagement/client/ProjectManagement.java index 9bbec4df89..fd0fcd38b8 100644 --- a/open-metadata-implementation/access-services/project-management/project-management-client/src/main/java/org/odpi/openmetadata/accessservices/projectmanagement/client/ProjectManagement.java +++ b/open-metadata-implementation/access-services/project-management/project-management-client/src/main/java/org/odpi/openmetadata/accessservices/projectmanagement/client/ProjectManagement.java @@ -6,6 +6,7 @@ import org.odpi.openmetadata.frameworks.governanceaction.converters.ProjectConverter; import org.odpi.openmetadata.frameworks.governanceaction.converters.TeamMemberConverter; import org.odpi.openmetadata.accessservices.projectmanagement.client.rest.ProjectManagementRESTClient; +import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElementList; import org.odpi.openmetadata.frameworks.openmetadata.enums.SequencingOrder; import org.odpi.openmetadata.frameworks.openmetadata.metadataelements.ActorProfileElement; import org.odpi.openmetadata.frameworks.openmetadata.metadataelements.PersonRoleElement; @@ -651,25 +652,25 @@ public List getLinkedProjects(String userId, invalidParameterHandler.validateGUID(parentGUID, parentGUIDParameterName, methodName); invalidParameterHandler.validatePaging(startFrom, pageSize, methodName); - List linkedProjects = openMetadataStoreClient.getRelatedMetadataElements(userId, - parentGUID, - 1, - null, - null, - null, - null, - SequencingOrder.CREATION_DATE_RECENT, - false, - false, - new Date(), - startFrom, - pageSize); + RelatedMetadataElementList linkedProjects = openMetadataStoreClient.getRelatedMetadataElements(userId, + parentGUID, + 1, + null, + null, + null, + null, + SequencingOrder.CREATION_DATE_RECENT, + false, + false, + new Date(), + startFrom, + pageSize); if (linkedProjects != null) { List filteredProjects = new ArrayList<>(); - for (RelatedMetadataElement relatedMetadataElement : linkedProjects) + for (RelatedMetadataElement relatedMetadataElement : linkedProjects.getElementList()) { if (propertyHelper.isTypeOf(relatedMetadataElement.getElement(), OpenMetadataType.PROJECT.typeName)) { @@ -767,7 +768,7 @@ public List getProjectMembers(String userId, invalidParameterHandler.validateGUID(projectGUID, parentGUIDParameterName, methodName); invalidParameterHandler.validatePaging(startFrom, pageSize, methodName); - List linkedActors = openMetadataStoreClient.getRelatedMetadataElements(userId, + RelatedMetadataElementList linkedActors = openMetadataStoreClient.getRelatedMetadataElements(userId, projectGUID, 1, null, @@ -785,7 +786,7 @@ public List getProjectMembers(String userId, { List teamMembers = new ArrayList<>(); - for (RelatedMetadataElement relatedMetadataElement : linkedActors) + for (RelatedMetadataElement relatedMetadataElement : linkedActors.getElementList()) { if (propertyHelper.isTypeOf(relatedMetadataElement, OpenMetadataType.PROJECT_MANAGEMENT_RELATIONSHIP.typeName)) { diff --git a/open-metadata-implementation/access-services/stewardship-action/stewardship-action-client/src/main/java/org/odpi/openmetadata/accessservices/stewardshipaction/client/StewardshipAction.java b/open-metadata-implementation/access-services/stewardship-action/stewardship-action-client/src/main/java/org/odpi/openmetadata/accessservices/stewardshipaction/client/StewardshipAction.java index 9fb8cb61ee..47a01b2677 100644 --- a/open-metadata-implementation/access-services/stewardship-action/stewardship-action-client/src/main/java/org/odpi/openmetadata/accessservices/stewardshipaction/client/StewardshipAction.java +++ b/open-metadata-implementation/access-services/stewardship-action/stewardship-action-client/src/main/java/org/odpi/openmetadata/accessservices/stewardshipaction/client/StewardshipAction.java @@ -6,6 +6,7 @@ import org.odpi.openmetadata.accessservices.stewardshipaction.api.DuplicateManagementInterface; import org.odpi.openmetadata.accessservices.stewardshipaction.api.SurveyReportInterface; import org.odpi.openmetadata.commonservices.ffdc.rest.*; +import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElementList; import org.odpi.openmetadata.frameworks.openmetadata.enums.SequencingOrder; import org.odpi.openmetadata.frameworks.surveyaction.converters.SurveyReportConverter; import org.odpi.openmetadata.frameworks.openmetadata.metadataelements.DuplicateElement; @@ -257,29 +258,29 @@ public List getSurveyReports(String userId, invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateGUID(assetGUID, elementGUIDParameter, methodName); - List reportElements = openMetadataStoreClient.getRelatedMetadataElements(userId, - assetGUID, - 1, - OpenMetadataType.ASSET_SURVEY_REPORT_RELATIONSHIP.typeName, - null, - null, - null, - SequencingOrder.CREATION_DATE_RECENT, - false, - false, - new Date(), - startFrom, - pageSize); + RelatedMetadataElementList reportElements = openMetadataStoreClient.getRelatedMetadataElements(userId, + assetGUID, + 1, + OpenMetadataType.ASSET_SURVEY_REPORT_RELATIONSHIP.typeName, + null, + null, + null, + SequencingOrder.CREATION_DATE_RECENT, + false, + false, + new Date(), + startFrom, + pageSize); if (reportElements != null) { List surveyReports = new ArrayList<>(); - for (RelatedMetadataElement reportElement : reportElements) + for (RelatedMetadataElement reportElement : reportElements.getElementList()) { if (reportElement != null) { - List engineActionElements = openMetadataStoreClient.getRelatedMetadataElements(userId, + RelatedMetadataElementList engineActionElements = openMetadataStoreClient.getRelatedMetadataElements(userId, reportElement.getElement().getElementGUID(), 2, OpenMetadataType.ENGINE_ACTION_SURVEY_REPORT_RELATIONSHIP.typeName, diff --git a/open-metadata-implementation/adapters/open-connectors/data-manager-connectors/postgres-server-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/postgres/catalog/PostgresServerIntegrationConnector.java b/open-metadata-implementation/adapters/open-connectors/data-manager-connectors/postgres-server-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/postgres/catalog/PostgresServerIntegrationConnector.java index 192f700632..28ab20a202 100644 --- a/open-metadata-implementation/adapters/open-connectors/data-manager-connectors/postgres-server-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/postgres/catalog/PostgresServerIntegrationConnector.java +++ b/open-metadata-implementation/adapters/open-connectors/data-manager-connectors/postgres-server-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/postgres/catalog/PostgresServerIntegrationConnector.java @@ -14,6 +14,7 @@ import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException; import org.odpi.openmetadata.frameworks.connectors.properties.beans.ConnectorType; +import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElementList; import org.odpi.openmetadata.frameworks.openmetadata.enums.ElementStatus; import org.odpi.openmetadata.frameworks.openmetadata.enums.OperationalStatus; import org.odpi.openmetadata.frameworks.openmetadata.enums.ServerAssetUseType; @@ -190,14 +191,14 @@ private String getDatabaseManagerGUID(String databaseServerGUID, OpenMetadataAccess openMetadataAccess = getContext().getIntegrationGovernanceContext().getOpenMetadataAccess(); int startFrom = 0; - List relatedCapabilities = openMetadataAccess.getRelatedMetadataElements(databaseServerGUID, - 1, - OpenMetadataType.SUPPORTED_CAPABILITY_RELATIONSHIP.typeName, - startFrom, - getContext().getMaxPageSize()); + RelatedMetadataElementList relatedCapabilities = openMetadataAccess.getRelatedMetadataElements(databaseServerGUID, + 1, + OpenMetadataType.SUPPORTED_CAPABILITY_RELATIONSHIP.typeName, + startFrom, + getContext().getMaxPageSize()); while (relatedCapabilities != null) { - for (RelatedMetadataElement relatedCapability : relatedCapabilities) + for (RelatedMetadataElement relatedCapability : relatedCapabilities.getElementList()) { if (OpenMetadataType.DATABASE_MANAGER.typeName.equals(relatedCapability.getElement().getType().getTypeName())) { diff --git a/open-metadata-implementation/adapters/open-connectors/data-manager-connectors/unity-catalog-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/unitycatalog/sync/OSSUnityCatalogInsideCatalogSyncTables.java b/open-metadata-implementation/adapters/open-connectors/data-manager-connectors/unity-catalog-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/unitycatalog/sync/OSSUnityCatalogInsideCatalogSyncTables.java index 0f29ac7116..c9d8a9ee8c 100644 --- a/open-metadata-implementation/adapters/open-connectors/data-manager-connectors/unity-catalog-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/unitycatalog/sync/OSSUnityCatalogInsideCatalogSyncTables.java +++ b/open-metadata-implementation/adapters/open-connectors/data-manager-connectors/unity-catalog-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/unitycatalog/sync/OSSUnityCatalogInsideCatalogSyncTables.java @@ -12,6 +12,7 @@ import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException; +import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElementList; import org.odpi.openmetadata.frameworks.openmetadata.enums.ElementStatus; import org.odpi.openmetadata.frameworks.openmetadata.controls.PlaceholderProperty; import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElement; @@ -599,15 +600,15 @@ private List getUCColumnsForTable(MemberElement memberElement) throw int startFrom = 0; - List schemaAttributes = openMetadataAccess.getRelatedMetadataElements(memberElement.getRootSchemaType().getElement().getElementGUID(), - 1, - OpenMetadataType.TYPE_TO_ATTRIBUTE_RELATIONSHIP_TYPE_NAME, - startFrom, - context.getMaxPageSize()); + RelatedMetadataElementList schemaAttributes = openMetadataAccess.getRelatedMetadataElements(memberElement.getRootSchemaType().getElement().getElementGUID(), + 1, + OpenMetadataType.TYPE_TO_ATTRIBUTE_RELATIONSHIP_TYPE_NAME, + startFrom, + context.getMaxPageSize()); while (schemaAttributes != null) { - for (RelatedMetadataElement schemaAttribute : schemaAttributes) + for (RelatedMetadataElement schemaAttribute : schemaAttributes.getElementList()) { if (schemaAttribute != null) { diff --git a/open-metadata-implementation/adapters/open-connectors/data-manager-connectors/unity-catalog-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/unitycatalog/sync/OSSUnityCatalogServerSyncConnector.java b/open-metadata-implementation/adapters/open-connectors/data-manager-connectors/unity-catalog-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/unitycatalog/sync/OSSUnityCatalogServerSyncConnector.java index 2fffff08ba..f91b778ff5 100644 --- a/open-metadata-implementation/adapters/open-connectors/data-manager-connectors/unity-catalog-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/unitycatalog/sync/OSSUnityCatalogServerSyncConnector.java +++ b/open-metadata-implementation/adapters/open-connectors/data-manager-connectors/unity-catalog-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/unitycatalog/sync/OSSUnityCatalogServerSyncConnector.java @@ -15,6 +15,7 @@ import org.odpi.openmetadata.frameworks.connectors.ffdc.ConnectorCheckedException; import org.odpi.openmetadata.frameworks.governanceaction.properties.CatalogTarget; import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElement; +import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElementList; import org.odpi.openmetadata.frameworks.integration.connectors.CatalogTargetIntegrator; import org.odpi.openmetadata.frameworks.integration.ffdc.OIFAuditCode; import org.odpi.openmetadata.frameworks.integration.properties.RequestedCatalogTarget; @@ -451,15 +452,15 @@ private boolean isCatalogForTargetServer(String catalogGUID, { int startFrom = 0; - List relatedServers = integrationContext.getIntegrationGovernanceContext().getOpenMetadataAccess().getRelatedMetadataElements(catalogGUID, - 2, - OpenMetadataType.SUPPORTED_CAPABILITY_RELATIONSHIP.typeName, - startFrom, - integrationContext.getMaxPageSize()); + RelatedMetadataElementList relatedServers = integrationContext.getIntegrationGovernanceContext().getOpenMetadataAccess().getRelatedMetadataElements(catalogGUID, + 2, + OpenMetadataType.SUPPORTED_CAPABILITY_RELATIONSHIP.typeName, + startFrom, + integrationContext.getMaxPageSize()); while (relatedServers != null) { - for (RelatedMetadataElement relatedServer : relatedServers) + for (RelatedMetadataElement relatedServer : relatedServers.getElementList()) { if ((relatedServer != null) && (serverGUID.equals(relatedServer.getElement().getElementGUID()))) { diff --git a/open-metadata-implementation/adapters/open-connectors/governance-action-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/governanceactions/provisioning/MoveCopyFileGovernanceActionConnector.java b/open-metadata-implementation/adapters/open-connectors/governance-action-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/governanceactions/provisioning/MoveCopyFileGovernanceActionConnector.java index 993cf0ad72..3c67c6220f 100644 --- a/open-metadata-implementation/adapters/open-connectors/governance-action-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/governanceactions/provisioning/MoveCopyFileGovernanceActionConnector.java +++ b/open-metadata-implementation/adapters/open-connectors/governance-action-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/governanceactions/provisioning/MoveCopyFileGovernanceActionConnector.java @@ -510,13 +510,13 @@ private String getPathName(OpenMetadataElement asset) try { - List connectionLinks = store.getRelatedMetadataElements(asset.getElementGUID(), + RelatedMetadataElementList connectionLinks = store.getRelatedMetadataElements(asset.getElementGUID(), 2, connectionRelationshipName, 0, 0); - if ((connectionLinks == null) || (connectionLinks.isEmpty())) + if ((connectionLinks == null) || (connectionLinks.getElementList().isEmpty())) { if (auditLog != null) { @@ -525,9 +525,9 @@ private String getPathName(OpenMetadataElement asset) asset.getElementGUID())); } } - else if (connectionLinks.size() > 1) + else if (connectionLinks.getElementList().size() > 1) { - for (RelatedMetadataElement connectionLink : connectionLinks) + for (RelatedMetadataElement connectionLink : connectionLinks.getElementList()) { if (connectionLink != null) { @@ -547,7 +547,7 @@ else if (connectionLinks.size() > 1) { auditLog.logMessage(methodName, GovernanceActionConnectorsAuditCode.TOO_MANY_CONNECTIONS.getMessageDefinition(governanceServiceName, - Integer.toString(connectionLinks.size()), + Integer.toString(connectionLinks.getElementList().size()), asset.getElementGUID(), connectionLinks.toString())); } @@ -567,7 +567,7 @@ else if (connectionLinks.size() > 1) } else { - pathName = this.getPathNameFromConnection(asset.getElementGUID(), connectionLinks.get(0)); + pathName = this.getPathNameFromConnection(asset.getElementGUID(), connectionLinks.getElementList().get(0)); if (pathName != null) { @@ -643,13 +643,13 @@ private String getPathNameFromConnection(String assetGUID, } else { - List endpointLinks = store.getRelatedMetadataElements(connection.getElementGUID(), + RelatedMetadataElementList endpointLinks = store.getRelatedMetadataElements(connection.getElementGUID(), 2, endpointRelationshipName, 0, 0); - if ((endpointLinks == null) || (endpointLinks.isEmpty())) + if ((endpointLinks == null) || (endpointLinks.getElementList().isEmpty())) { if (auditLog != null) { @@ -659,7 +659,7 @@ private String getPathNameFromConnection(String assetGUID, connection.getElementGUID())); } } - else if (endpointLinks.size() > 1) + else if (endpointLinks.getElementList().size() > 1) { if (auditLog != null) { @@ -668,13 +668,13 @@ else if (endpointLinks.size() > 1) assetGUID, connection.getElementGUID(), Integer.toString( - endpointLinks.size()), + endpointLinks.getElementList().size()), endpointLinks.toString())); } } else { - OpenMetadataElement endpoint = endpointLinks.get(0).getElement(); + OpenMetadataElement endpoint = endpointLinks.getElementList().get(0).getElement(); if (endpoint == null) { @@ -682,7 +682,7 @@ else if (endpointLinks.size() > 1) { auditLog.logMessage(methodName, GovernanceActionConnectorsAuditCode.NO_RELATED_ASSET.getMessageDefinition(governanceServiceName, - endpointLinks.get(0).toString())); + endpointLinks.getElementList().get(0).toString())); } } else @@ -955,15 +955,16 @@ private String getFolderGUID(String fileGUID) throws InvalidParameterException, { String folderGUID = null; - List relatedMetadataElementList = governanceContext.getOpenMetadataStore().getRelatedMetadataElements(fileGUID, - 2, - OpenMetadataType.NESTED_FILE_TYPE_NAME, - 0, - 0); + RelatedMetadataElementList relatedMetadataElementList + = governanceContext.getOpenMetadataStore().getRelatedMetadataElements(fileGUID, + 2, + OpenMetadataType.NESTED_FILE_TYPE_NAME, + 0, + 0); if (relatedMetadataElementList != null) { - for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElementList) + for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElementList.getElementList()) { if (relatedMetadataElement != null) { diff --git a/open-metadata-implementation/adapters/open-connectors/governance-action-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/governanceactions/remediation/OriginSeekerGovernanceActionConnector.java b/open-metadata-implementation/adapters/open-connectors/governance-action-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/governanceactions/remediation/OriginSeekerGovernanceActionConnector.java index 625c8f28e6..6285f6d9d8 100644 --- a/open-metadata-implementation/adapters/open-connectors/governance-action-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/governanceactions/remediation/OriginSeekerGovernanceActionConnector.java +++ b/open-metadata-implementation/adapters/open-connectors/governance-action-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/governanceactions/remediation/OriginSeekerGovernanceActionConnector.java @@ -232,18 +232,18 @@ private List getOrigins(OpenMetadataElement asset, * Note this is only working with lineage relationships between Assets. It would need * extending to work with lineage between ports and schema elements. */ - List lineageLinks = store.getRelatedMetadataElements(asset.getElementGUID(), - 2, - null, - 0, - 0); + RelatedMetadataElementList lineageLinks = store.getRelatedMetadataElements(asset.getElementGUID(), + 2, + null, + 0, + 0); - if ((lineageLinks != null) && (! lineageLinks.isEmpty())) + if ((lineageLinks != null) && (! lineageLinks.getElementList().isEmpty())) { /* * Explore each branch in the lineage map. */ - for (RelatedMetadataElement lineageLink : lineageLinks) + for (RelatedMetadataElement lineageLink : lineageLinks.getElementList()) { if (lineageLink != null) { diff --git a/open-metadata-implementation/adapters/open-connectors/governance-action-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/governanceactions/stewardship/EvaluateAnnotationsGovernanceActionConnector.java b/open-metadata-implementation/adapters/open-connectors/governance-action-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/governanceactions/stewardship/EvaluateAnnotationsGovernanceActionConnector.java index 153dfd2980..05431b8293 100644 --- a/open-metadata-implementation/adapters/open-connectors/governance-action-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/governanceactions/stewardship/EvaluateAnnotationsGovernanceActionConnector.java +++ b/open-metadata-implementation/adapters/open-connectors/governance-action-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/governanceactions/stewardship/EvaluateAnnotationsGovernanceActionConnector.java @@ -9,10 +9,7 @@ import org.odpi.openmetadata.frameworks.connectors.ffdc.ConnectorCheckedException; import org.odpi.openmetadata.frameworks.governanceaction.GeneralGovernanceActionService; import org.odpi.openmetadata.frameworks.governanceaction.controls.ActionTarget; -import org.odpi.openmetadata.frameworks.governanceaction.properties.ActionTargetElement; -import org.odpi.openmetadata.frameworks.governanceaction.properties.CompletionStatus; -import org.odpi.openmetadata.frameworks.governanceaction.properties.NewActionTarget; -import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElement; +import org.odpi.openmetadata.frameworks.governanceaction.properties.*; import org.odpi.openmetadata.frameworks.openmetadata.enums.ToDoType; import org.odpi.openmetadata.frameworks.openmetadata.types.OpenMetadataType; import org.odpi.openmetadata.frameworks.surveyaction.controls.SurveyActionTarget; @@ -95,14 +92,14 @@ else if (stewardGUID == null) */ int startFrom = 0; int rfaCount = 0; - List reportedAnnotations = governanceContext.getOpenMetadataStore().getRelatedMetadataElements(surveyReport.getActionTargetGUID(), - 1, - OpenMetadataType.REPORTED_ANNOTATION_RELATIONSHIP.typeName, - startFrom, - governanceContext.getMaxPageSize()); + RelatedMetadataElementList reportedAnnotations = governanceContext.getOpenMetadataStore().getRelatedMetadataElements(surveyReport.getActionTargetGUID(), + 1, + OpenMetadataType.REPORTED_ANNOTATION_RELATIONSHIP.typeName, + startFrom, + governanceContext.getMaxPageSize()); while (reportedAnnotations != null) { - for (RelatedMetadataElement reportedAnnotation : reportedAnnotations) + for (RelatedMetadataElement reportedAnnotation : reportedAnnotations.getElementList()) { if (reportedAnnotation != null) { diff --git a/open-metadata-implementation/adapters/open-connectors/governance-action-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/governanceactions/watchdog/GenericFolderWatchdogGovernanceActionConnector.java b/open-metadata-implementation/adapters/open-connectors/governance-action-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/governanceactions/watchdog/GenericFolderWatchdogGovernanceActionConnector.java index 1b56d922a7..47850a80e1 100644 --- a/open-metadata-implementation/adapters/open-connectors/governance-action-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/governanceactions/watchdog/GenericFolderWatchdogGovernanceActionConnector.java +++ b/open-metadata-implementation/adapters/open-connectors/governance-action-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/governanceactions/watchdog/GenericFolderWatchdogGovernanceActionConnector.java @@ -7,6 +7,7 @@ import org.odpi.openmetadata.frameworks.connectors.ffdc.*; import org.odpi.openmetadata.frameworks.governanceaction.events.*; import org.odpi.openmetadata.frameworks.governanceaction.ffdc.GovernanceServiceException; +import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElementList; import org.odpi.openmetadata.frameworks.openmetadata.types.OpenMetadataProperty; import org.odpi.openmetadata.frameworks.openmetadata.types.OpenMetadataType; import org.odpi.openmetadata.frameworks.governanceaction.properties.ActionTargetElement; @@ -406,11 +407,11 @@ private String getFolderGUID(String fileGUID, { String folderGUID = null; - List relatedMetadataElementList = governanceContext.getOpenMetadataStore().getRelatedMetadataElements(fileGUID, - 2, - relationshipName, - 0, - 0); + RelatedMetadataElementList relatedMetadataElementList = governanceContext.getOpenMetadataStore().getRelatedMetadataElements(fileGUID, + 2, + relationshipName, + 0, + 0); /* * It is possible that the folders have not yet been added - give the cataloguing process time to complete. @@ -435,7 +436,7 @@ private String getFolderGUID(String fileGUID, if (relatedMetadataElementList != null) { - for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElementList) + for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElementList.getElementList()) { if (relatedMetadataElement != null) { diff --git a/open-metadata-implementation/adapters/open-connectors/integration-connectors/csv-lineage-import-integration-connector/src/main/java/org/odpi/openmetadata/adapters/connectors/integration/csvlineageimporter/CSVLineageImporterConnector.java b/open-metadata-implementation/adapters/open-connectors/integration-connectors/csv-lineage-import-integration-connector/src/main/java/org/odpi/openmetadata/adapters/connectors/integration/csvlineageimporter/CSVLineageImporterConnector.java index 779091d841..32d13ab489 100644 --- a/open-metadata-implementation/adapters/open-connectors/integration-connectors/csv-lineage-import-integration-connector/src/main/java/org/odpi/openmetadata/adapters/connectors/integration/csvlineageimporter/CSVLineageImporterConnector.java +++ b/open-metadata-implementation/adapters/open-connectors/integration-connectors/csv-lineage-import-integration-connector/src/main/java/org/odpi/openmetadata/adapters/connectors/integration/csvlineageimporter/CSVLineageImporterConnector.java @@ -14,11 +14,11 @@ import org.odpi.openmetadata.frameworks.connectors.properties.EndpointProperties; import org.odpi.openmetadata.frameworks.connectors.properties.beans.Connection; import org.odpi.openmetadata.frameworks.connectors.properties.beans.ConnectorType; +import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataRelationshipList; import org.odpi.openmetadata.frameworks.openmetadata.enums.ElementStatus; import org.odpi.openmetadata.frameworks.connectors.properties.beans.Endpoint; import org.odpi.openmetadata.frameworks.openmetadata.types.OpenMetadataProperty; import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataElement; -import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataRelationship; import org.odpi.openmetadata.frameworks.governanceaction.search.ElementProperties; import org.odpi.openmetadata.frameworks.governanceaction.search.PropertyHelper; import org.odpi.openmetadata.frameworks.integration.context.OpenMetadataAccess; @@ -261,11 +261,11 @@ private void setupOpenMetadataRelationship(String openMetadataObjectTypeGUID, } - List existingRelationships = openMetadataAccess.getMetadataElementRelationships(end1GUID, - end2GUID, - openMetadataRelationshipType, - 0, - 0); + OpenMetadataRelationshipList existingRelationships = openMetadataAccess.getMetadataElementRelationships(end1GUID, + end2GUID, + openMetadataRelationshipType, + 0, + 0); if (existingRelationships == null) { ElementProperties properties = null; diff --git a/open-metadata-implementation/adapters/open-connectors/nanny-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/nannyconnectors/harvestopenmetadata/HarvestOpenMetadataCatalogTargetProcessor.java b/open-metadata-implementation/adapters/open-connectors/nanny-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/nannyconnectors/harvestopenmetadata/HarvestOpenMetadataCatalogTargetProcessor.java index e0989b7850..5d1480cc7e 100644 --- a/open-metadata-implementation/adapters/open-connectors/nanny-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/nannyconnectors/harvestopenmetadata/HarvestOpenMetadataCatalogTargetProcessor.java +++ b/open-metadata-implementation/adapters/open-connectors/nanny-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/nannyconnectors/harvestopenmetadata/HarvestOpenMetadataCatalogTargetProcessor.java @@ -14,7 +14,6 @@ import org.odpi.openmetadata.adapters.connectors.nannyconnectors.harvestopenmetadata.schema.HarvestOpenMetadataTable; import org.odpi.openmetadata.adapters.connectors.nannyconnectors.harvestsurveys.ffdc.HarvestSurveysErrorCode; import org.odpi.openmetadata.adapters.connectors.nannyconnectors.harvestsurveys.schema.HarvestSurveysColumn; -import org.odpi.openmetadata.adapters.connectors.nannyconnectors.harvestsurveys.schema.HarvestSurveysTable; import org.odpi.openmetadata.adapters.connectors.resource.jdbc.JDBCResourceConnector; import org.odpi.openmetadata.adapters.connectors.resource.jdbc.controls.JDBCConfigurationProperty; import org.odpi.openmetadata.adapters.connectors.resource.jdbc.ddl.postgres.PostgreSQLSchemaDDL; @@ -462,7 +461,7 @@ public void refresh() throws ConnectorCheckedException startFrom = 0; - List personRoleAppointments = openMetadataAccess.findRelationshipsBetweenMetadataElements(OpenMetadataType.PERSON_ROLE_APPOINTMENT_RELATIONSHIP.typeName, + OpenMetadataRelationshipList personRoleAppointments = openMetadataAccess.findRelationshipsBetweenMetadataElements(OpenMetadataType.PERSON_ROLE_APPOINTMENT_RELATIONSHIP.typeName, null, null, null, @@ -473,7 +472,7 @@ public void refresh() throws ConnectorCheckedException while (personRoleAppointments != null) { - for (OpenMetadataRelationship personRoleAppointment : personRoleAppointments) + for (OpenMetadataRelationship personRoleAppointment : personRoleAppointments.getElementList()) { if (personRoleAppointment != null) { @@ -525,7 +524,7 @@ private String getUserIdentityForRole(String roleGUID, try { - List profileIdentities = openMetadataAccess.getRelatedMetadataElements(profileGUID, + RelatedMetadataElementList profileIdentities = openMetadataAccess.getRelatedMetadataElements(profileGUID, 1, OpenMetadataType.PROFILE_IDENTITY_RELATIONSHIP.typeName, 0, @@ -534,7 +533,7 @@ private String getUserIdentityForRole(String roleGUID, if (profileIdentities != null) { - for (RelatedMetadataElement profileIdentity : profileIdentities) + for (RelatedMetadataElement profileIdentity : profileIdentities.getElementList()) { if (profileIdentity != null) { @@ -671,7 +670,7 @@ private OpenMetadataElement getAssociatedAssetLocation(String assetGUID) try { - List relatedElements = openMetadataAccess.getRelatedMetadataElements(assetGUID, + RelatedMetadataElementList relatedElements = openMetadataAccess.getRelatedMetadataElements(assetGUID, 2, OpenMetadataType.ASSET_LOCATION_RELATIONSHIP.typeName, 0, @@ -682,7 +681,7 @@ private OpenMetadataElement getAssociatedAssetLocation(String assetGUID) */ if (relatedElements != null) { - for (RelatedMetadataElement relatedMetadataElement : relatedElements) + for (RelatedMetadataElement relatedMetadataElement : relatedElements.getElementList()) { if (relatedMetadataElement != null) { @@ -719,7 +718,7 @@ private String getAssociatedProfileLocation(String profileGUID) try { - List relatedElements = openMetadataAccess.getRelatedMetadataElements(profileGUID, + RelatedMetadataElementList relatedElements = openMetadataAccess.getRelatedMetadataElements(profileGUID, 1, OpenMetadataType.PROFILE_LOCATION_RELATIONSHIP.typeName, 0, @@ -730,7 +729,7 @@ private String getAssociatedProfileLocation(String profileGUID) */ if (relatedElements != null) { - for (RelatedMetadataElement relatedMetadataElement : relatedElements) + for (RelatedMetadataElement relatedMetadataElement : relatedElements.getElementList()) { if (relatedMetadataElement != null) { @@ -767,7 +766,7 @@ private OpenMetadataElement getAssociatedLicense(String elementGUID) try { - List relatedElements = openMetadataAccess.getRelatedMetadataElements(elementGUID, + RelatedMetadataElementList relatedElements = openMetadataAccess.getRelatedMetadataElements(elementGUID, 1, OpenMetadataType.REFERENCEABLE_TO_LICENSE_TYPE_NAME, 0, @@ -778,7 +777,7 @@ private OpenMetadataElement getAssociatedLicense(String elementGUID) */ if (relatedElements != null) { - for (RelatedMetadataElement relatedMetadataElement : relatedElements) + for (RelatedMetadataElement relatedMetadataElement : relatedElements.getElementList()) { if (relatedMetadataElement != null) { @@ -818,7 +817,7 @@ private String getAssociatedTags(String assetGUID) try { int startFrom = 0; - List relatedElements = openMetadataAccess.getRelatedMetadataElements(assetGUID, + RelatedMetadataElementList relatedElements = openMetadataAccess.getRelatedMetadataElements(assetGUID, 1, OpenMetadataType.ATTACHED_TAG_RELATIONSHIP.typeName, startFrom, @@ -829,7 +828,7 @@ private String getAssociatedTags(String assetGUID) */ while (relatedElements != null) { - for (RelatedMetadataElement relatedMetadataElement : relatedElements) + for (RelatedMetadataElement relatedMetadataElement : relatedElements.getElementList()) { if (relatedMetadataElement != null) { @@ -887,7 +886,7 @@ private String getAssociatedMeaning(String elementGUID) try { - List relatedElements = openMetadataAccess.getRelatedMetadataElements(elementGUID, + RelatedMetadataElementList relatedElements = openMetadataAccess.getRelatedMetadataElements(elementGUID, 1, OpenMetadataType.SEMANTIC_ASSIGNMENT.typeName, 0, @@ -898,7 +897,7 @@ private String getAssociatedMeaning(String elementGUID) */ if (relatedElements != null) { - for (RelatedMetadataElement relatedMetadataElement : relatedElements) + for (RelatedMetadataElement relatedMetadataElement : relatedElements.getElementList()) { if (relatedMetadataElement != null) { @@ -956,7 +955,7 @@ private void findAssociatedElements(ElementHeader elementHeade int numberOfLikes = 0; int startFrom = 0; - List relatedElements = openMetadataAccess.getRelatedMetadataElements(elementHeader.getGUID(), + RelatedMetadataElementList relatedElements = openMetadataAccess.getRelatedMetadataElements(elementHeader.getGUID(), 1, null, startFrom, @@ -964,7 +963,7 @@ private void findAssociatedElements(ElementHeader elementHeade while (relatedElements != null) { - for (RelatedMetadataElement relatedMetadataElement : relatedElements) + for (RelatedMetadataElement relatedMetadataElement : relatedElements.getElementList()) { String relationshipType = relatedMetadataElement.getType().getTypeName(); @@ -1068,7 +1067,7 @@ private int countAttachedComments(String elementGUID) try { int startFrom = 0; - List relatedElements = openMetadataAccess.getRelatedMetadataElements(elementGUID, + RelatedMetadataElementList relatedElements = openMetadataAccess.getRelatedMetadataElements(elementGUID, 1, "AttachedComment", startFrom, @@ -1079,7 +1078,7 @@ private int countAttachedComments(String elementGUID) */ while (relatedElements != null) { - for (RelatedMetadataElement relatedMetadataElement : relatedElements) + for (RelatedMetadataElement relatedMetadataElement : relatedElements.getElementList()) { if (relatedMetadataElement != null) { @@ -1185,7 +1184,7 @@ private String getTeamManagerGUID(String teamGUID) try { - List relatedMetadataElements = openMetadataAccess.getRelatedMetadataElements(teamGUID, + RelatedMetadataElementList relatedMetadataElements = openMetadataAccess.getRelatedMetadataElements(teamGUID, 2, OpenMetadataType.TEAM_LEADERSHIP_RELATIONSHIP.typeName, 0, @@ -1193,18 +1192,18 @@ private String getTeamManagerGUID(String teamGUID) if (relatedMetadataElements != null) { - for (RelatedMetadataElement personRoleElement : relatedMetadataElements) + for (RelatedMetadataElement personRoleElement : relatedMetadataElements.getElementList()) { if (personRoleElement != null) { - List appointees = openMetadataAccess.getRelatedMetadataElements(teamGUID, + RelatedMetadataElementList appointees = openMetadataAccess.getRelatedMetadataElements(teamGUID, 2, OpenMetadataType.PERSON_ROLE_APPOINTMENT_RELATIONSHIP.typeName, 0, openMetadataAccess.getMaxPagingSize()); if (appointees != null) { - for (RelatedMetadataElement appointee : appointees) + for (RelatedMetadataElement appointee : appointees.getElementList()) { if (appointee != null) { @@ -1277,7 +1276,7 @@ private void processUserIdentity(OpenMetadataElement userIdentityElement) String organizationName = null; RelatedMetadataElement profileElement = null; - List relatedMetadataElements = openMetadataAccess.getRelatedMetadataElements(userIdentityElement.getElementGUID(), + RelatedMetadataElementList relatedMetadataElements = openMetadataAccess.getRelatedMetadataElements(userIdentityElement.getElementGUID(), 2, OpenMetadataType.PROFILE_IDENTITY_RELATIONSHIP.typeName, 0, @@ -1285,7 +1284,7 @@ private void processUserIdentity(OpenMetadataElement userIdentityElement) if (relatedMetadataElements != null) { - for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements) + for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements.getElementList()) { if (relatedMetadataElement != null) { @@ -1368,7 +1367,7 @@ private void processToDo(OpenMetadataElement toDoElement) RelatedMetadataElement toDoSourceElement = null; RelatedMetadataElement actionAssignmentElement = null; - List relatedMetadataElements = openMetadataAccess.getRelatedMetadataElements(toDoElement.getElementGUID(), + RelatedMetadataElementList relatedMetadataElements = openMetadataAccess.getRelatedMetadataElements(toDoElement.getElementGUID(), 2, OpenMetadataType.TO_DO_SOURCE_RELATIONSHIP.typeName, 0, @@ -1376,7 +1375,7 @@ private void processToDo(OpenMetadataElement toDoElement) if (relatedMetadataElements != null) { - for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements) + for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements.getElementList()) { if (relatedMetadataElement != null) { @@ -1394,7 +1393,7 @@ private void processToDo(OpenMetadataElement toDoElement) if (relatedMetadataElements != null) { - for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements) + for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements.getElementList()) { if (relatedMetadataElement != null) { @@ -1429,7 +1428,7 @@ private String getAssociatedDepartment(String profileGUID) try { - List roleElements = openMetadataAccess.getRelatedMetadataElements(profileGUID, + RelatedMetadataElementList roleElements = openMetadataAccess.getRelatedMetadataElements(profileGUID, 1, OpenMetadataType.PERSON_ROLE_APPOINTMENT_RELATIONSHIP.typeName, 0, @@ -1437,11 +1436,11 @@ private String getAssociatedDepartment(String profileGUID) if (roleElements != null) { - for (RelatedMetadataElement roleElement : roleElements) + for (RelatedMetadataElement roleElement : roleElements.getElementList()) { if (roleElement != null) { - List teamElements = openMetadataAccess.getRelatedMetadataElements(profileGUID, + RelatedMetadataElementList teamElements = openMetadataAccess.getRelatedMetadataElements(profileGUID, 1, OpenMetadataType.TEAM_MEMBERSHIP_RELATIONSHIP.typeName, 0, @@ -1458,7 +1457,7 @@ private String getAssociatedDepartment(String profileGUID) if (teamElements != null) { - for (RelatedMetadataElement team : teamElements) + for (RelatedMetadataElement team : teamElements.getElementList()) { if (team != null) { @@ -1497,7 +1496,7 @@ private OpenMetadataElement getAssociatedParentTeam(String departmentGUID) try { - List relatedMetadataElements = openMetadataAccess.getRelatedMetadataElements(departmentGUID, + RelatedMetadataElementList relatedMetadataElements = openMetadataAccess.getRelatedMetadataElements(departmentGUID, 2, OpenMetadataType.TEAM_STRUCTURE_RELATIONSHIP.typeName, 0, @@ -1505,7 +1504,7 @@ private OpenMetadataElement getAssociatedParentTeam(String departmentGUID) if (relatedMetadataElements != null) { - for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements) + for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements.getElementList()) { if (relatedMetadataElement != null) { @@ -1574,14 +1573,14 @@ private void processAssetSchemaType(String assetGUID, /* * Start by processing related schema types. */ - List relatedMetadataElementList = openMetadataAccess.getRelatedMetadataElements(schemaType.getElement().getElementGUID(), + RelatedMetadataElementList relatedMetadataElementList = openMetadataAccess.getRelatedMetadataElements(schemaType.getElement().getElementGUID(), 1, null, startFrom, openMetadataAccess.getMaxPagingSize()); while (relatedMetadataElementList != null) { - for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElementList) + for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElementList.getElementList()) { if (propertyHelper.isTypeOf(relatedMetadataElement.getElement(), OpenMetadataType.SCHEMA_TYPE.typeName)) { @@ -1756,7 +1755,7 @@ private boolean hasProfile(String dataFieldGUID) try { - List reports = openMetadataAccess.getRelatedMetadataElements(dataFieldGUID, + RelatedMetadataElementList reports = openMetadataAccess.getRelatedMetadataElements(dataFieldGUID, 1, OpenMetadataType.ASSOCIATED_ANNOTATION_RELATIONSHIP.typeName, 0, @@ -1940,7 +1939,7 @@ private void processGlossaryTerm(String glossaryGUID, try { int startFrom = 0; - List relatedMetadataElements = openMetadataAccess.getRelatedMetadataElements(glossaryTerm.getElementHeader().getGUID(), + RelatedMetadataElementList relatedMetadataElements = openMetadataAccess.getRelatedMetadataElements(glossaryTerm.getElementHeader().getGUID(), 0, null, startFrom, @@ -1948,7 +1947,7 @@ private void processGlossaryTerm(String glossaryGUID, while (relatedMetadataElements != null) { - for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements) + for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements.getElementList()) { String relationshipName = relatedMetadataElement.getType().getTypeName(); diff --git a/open-metadata-implementation/adapters/open-connectors/nanny-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/nannyconnectors/harvestsurveys/HarvestSurveysCatalogTargetProcessor.java b/open-metadata-implementation/adapters/open-connectors/nanny-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/nannyconnectors/harvestsurveys/HarvestSurveysCatalogTargetProcessor.java index 2994bd347a..9ba6859d56 100644 --- a/open-metadata-implementation/adapters/open-connectors/nanny-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/nannyconnectors/harvestsurveys/HarvestSurveysCatalogTargetProcessor.java +++ b/open-metadata-implementation/adapters/open-connectors/nanny-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/nannyconnectors/harvestsurveys/HarvestSurveysCatalogTargetProcessor.java @@ -23,6 +23,7 @@ import org.odpi.openmetadata.frameworks.governanceaction.properties.CatalogTarget; import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataElement; import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElement; +import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElementList; import org.odpi.openmetadata.frameworks.integration.connectors.CatalogTargetProcessorBase; import org.odpi.openmetadata.frameworks.integration.context.OpenMetadataAccess; import org.odpi.openmetadata.frameworks.openmetadata.types.OpenMetadataProperty; @@ -236,15 +237,15 @@ private void processSurveyReport(OpenMetadataElement surveyReportElement) throws List relatedOtherAnnotations = new ArrayList<>(); int startFrom = 0; - List relatedMetadataElements = openMetadataAccess.getRelatedMetadataElements(surveyReportElement.getElementGUID(), - 0, - null, - startFrom, - openMetadataAccess.getMaxPagingSize()); + RelatedMetadataElementList relatedMetadataElements = openMetadataAccess.getRelatedMetadataElements(surveyReportElement.getElementGUID(), + 0, + null, + startFrom, + openMetadataAccess.getMaxPagingSize()); while (relatedMetadataElements != null) { - for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements) + for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements.getElementList()) { if (relatedMetadataElement != null) { @@ -357,14 +358,14 @@ private void processRequestForActionAnnotations(String sur List relatedSubjects = this.syncAnnotation(surveyReportGUID, relatedAnnotationElement.getElement(), relatedAsset); List relatedActionTargets = null; int startFrom = 0; - List relatedMetadataElements = openMetadataAccess.getRelatedMetadataElements(relatedAnnotationElement.getElement().getElementGUID(), + RelatedMetadataElementList relatedMetadataElements = openMetadataAccess.getRelatedMetadataElements(relatedAnnotationElement.getElement().getElementGUID(), 1, OpenMetadataType.REQUEST_FOR_ACTION_TARGET.typeName, startFrom, openMetadataAccess.getMaxPagingSize()); while (relatedMetadataElements != null) { - for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements) + for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements.getElementList()) { if (relatedMetadataElement != null) { @@ -467,14 +468,14 @@ private void processDataProfileLogAnnotations(String surve RelatedMetadataElement relatedLogFile = null; List relatedAnnotationSubjects = this.syncAnnotation(surveyReportGUID, relatedAnnotationElement.getElement(), relatedAsset); int startFrom = 0; - List relatedMetadataElements = openMetadataAccess.getRelatedMetadataElements(relatedAnnotationElement.getElement().getElementGUID(), + RelatedMetadataElementList relatedMetadataElements = openMetadataAccess.getRelatedMetadataElements(relatedAnnotationElement.getElement().getElementGUID(), 1, OpenMetadataType.RESOURCE_PROFILE_DATA_RELATIONSHIP.typeName, startFrom, openMetadataAccess.getMaxPagingSize()); while (relatedMetadataElements != null) { - for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements) + for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements.getElementList()) { if (relatedMetadataElement != null) { @@ -722,14 +723,14 @@ private List syncAnnotation(String surve { List relatedAnnotationSubjects = new ArrayList<>(); int startFrom = 0; - List relatedMetadataElements = openMetadataAccess.getRelatedMetadataElements(annotationElement.getElementGUID(), + RelatedMetadataElementList relatedMetadataElements = openMetadataAccess.getRelatedMetadataElements(annotationElement.getElementGUID(), 2, OpenMetadataType.ASSOCIATED_ANNOTATION_RELATIONSHIP.typeName, startFrom, openMetadataAccess.getMaxPagingSize()); while (relatedMetadataElements != null) { - for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements) + for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements.getElementList()) { if (relatedMetadataElement != null) { diff --git a/open-metadata-implementation/adapters/open-connectors/report-generating-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/reports/surveyreport/SurveyReportService.java b/open-metadata-implementation/adapters/open-connectors/report-generating-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/reports/surveyreport/SurveyReportService.java index 0acc986fc2..38102766c0 100644 --- a/open-metadata-implementation/adapters/open-connectors/report-generating-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/reports/surveyreport/SurveyReportService.java +++ b/open-metadata-implementation/adapters/open-connectors/report-generating-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/reports/surveyreport/SurveyReportService.java @@ -12,6 +12,7 @@ import org.odpi.openmetadata.frameworks.governanceaction.GeneralGovernanceActionService; import org.odpi.openmetadata.frameworks.governanceaction.OpenMetadataStore; import org.odpi.openmetadata.frameworks.governanceaction.controls.Guard; +import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElementList; import org.odpi.openmetadata.frameworks.openmetadata.types.OpenMetadataProperty; import org.odpi.openmetadata.frameworks.openmetadata.types.OpenMetadataType; import org.odpi.openmetadata.frameworks.governanceaction.properties.ActionTargetElement; @@ -188,17 +189,17 @@ private void printReport(int reportIndentLevel, int startFrom = 0; int maxPageSize = 100; - List annotationElements = openMetadataStoreClient.getRelatedMetadataElements(surveyReportElement.getElementGUID(), - 1, - OpenMetadataType.REPORTED_ANNOTATION_RELATIONSHIP.typeName, - startFrom, - maxPageSize); + RelatedMetadataElementList annotationElements = openMetadataStoreClient.getRelatedMetadataElements(surveyReportElement.getElementGUID(), + 1, + OpenMetadataType.REPORTED_ANNOTATION_RELATIONSHIP.typeName, + startFrom, + maxPageSize); if (annotationElements != null) { while (annotationElements != null) { - for (RelatedMetadataElement reportedAnnotationLink : annotationElements) + for (RelatedMetadataElement reportedAnnotationLink : annotationElements.getElementList()) { if ((reportedAnnotationLink != null) && (reportedAnnotationLink.getElement() != null)) { @@ -236,7 +237,7 @@ private void printReport(int reportIndentLevel, while (annotationElements != null) { - for (RelatedMetadataElement reportedAnnotationElement : annotationElements) + for (RelatedMetadataElement reportedAnnotationElement : annotationElements.getElementList()) { if ((reportedAnnotationElement != null) && (reportedAnnotationElement.getElement() != null)) { @@ -428,17 +429,17 @@ private void printAnnotation(int annotationIndentLevel, outputReport); } - List associatedElements = openMetadataStoreClient.getRelatedMetadataElements(reportedAnnotationElement.getElement().getElementGUID(), - 2, - OpenMetadataType.ASSOCIATED_ANNOTATION_RELATIONSHIP.typeName, - startFrom, - maxPageSize); + RelatedMetadataElementList associatedElements = openMetadataStoreClient.getRelatedMetadataElements(reportedAnnotationElement.getElement().getElementGUID(), + 2, + OpenMetadataType.ASSOCIATED_ANNOTATION_RELATIONSHIP.typeName, + startFrom, + maxPageSize); while (associatedElements != null) { int associatedElementIndentLevel = annotationIndentLevel + 1; - for (RelatedMetadataElement associatedElement : associatedElements) + for (RelatedMetadataElement associatedElement : associatedElements.getElementList()) { if (associatedElement != null) { diff --git a/open-metadata-implementation/adapters/open-connectors/system-connectors/apache-atlas-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/apacheatlas/integration/modules/AtlasRelatedElementsIntegrationModule.java b/open-metadata-implementation/adapters/open-connectors/system-connectors/apache-atlas-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/apacheatlas/integration/modules/AtlasRelatedElementsIntegrationModule.java index 7162aa4ad6..902c850da0 100644 --- a/open-metadata-implementation/adapters/open-connectors/system-connectors/apache-atlas-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/apacheatlas/integration/modules/AtlasRelatedElementsIntegrationModule.java +++ b/open-metadata-implementation/adapters/open-connectors/system-connectors/apache-atlas-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/apacheatlas/integration/modules/AtlasRelatedElementsIntegrationModule.java @@ -18,6 +18,7 @@ import org.odpi.openmetadata.frameworks.connectors.properties.ConnectionProperties; import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataElement; import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElement; +import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElementList; import org.odpi.openmetadata.frameworks.governanceaction.search.PropertyHelper; import org.odpi.openmetadata.integrationservices.catalog.connector.CatalogIntegratorContext; @@ -354,14 +355,14 @@ private Map getReferenceValueAssignments(String try { int startFrom = 0; - List relatedMetadataElements = openMetadataAccess.getRelatedMetadataElements(egeriaGUID, + RelatedMetadataElementList relatedMetadataElements = openMetadataAccess.getRelatedMetadataElements(egeriaGUID, 1, referenceValueAssignmentRelationshipName, startFrom, myContext.getMaxPageSize()); while (relatedMetadataElements != null) { - for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements) + for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements.getElementList()) { String attributeName = propertyHelper.getStringProperty(connectorName, attributeNamePropertyName, @@ -430,14 +431,14 @@ private List getAllRelatedMetadataElements(String egeria try { int startFrom = 0; - List relatedMetadataElements = openMetadataAccess.getRelatedMetadataElements(egeriaGUID, + RelatedMetadataElementList relatedMetadataElements = openMetadataAccess.getRelatedMetadataElements(egeriaGUID, 1, null, startFrom, myContext.getMaxPageSize()); while (relatedMetadataElements != null) { - results.addAll(relatedMetadataElements); + results.addAll(relatedMetadataElements.getElementList()); startFrom = startFrom + myContext.getMaxPageSize(); relatedMetadataElements = openMetadataAccess.getRelatedMetadataElements(egeriaGUID, @@ -481,7 +482,7 @@ private void processRelatedEntities(AtlasEntityWithExtInfo atlasEntity, OpenMetadataElement egeriaEntity, List relatedMetadataElements) { - if ((relatedMetadataElements != null) || (! relatedMetadataElements.isEmpty())) + if ((relatedMetadataElements != null) && (! relatedMetadataElements.isEmpty())) { // todo } diff --git a/open-metadata-implementation/adapters/open-connectors/system-connectors/apache-kafka-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/apachekafka/integration/KafkaTopicIntegrationConnector.java b/open-metadata-implementation/adapters/open-connectors/system-connectors/apache-kafka-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/apachekafka/integration/KafkaTopicIntegrationConnector.java index da8e829eaa..9e48a30bac 100644 --- a/open-metadata-implementation/adapters/open-connectors/system-connectors/apache-kafka-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/apachekafka/integration/KafkaTopicIntegrationConnector.java +++ b/open-metadata-implementation/adapters/open-connectors/system-connectors/apache-kafka-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/apachekafka/integration/KafkaTopicIntegrationConnector.java @@ -6,6 +6,7 @@ import org.apache.kafka.clients.admin.Admin; import org.odpi.openmetadata.accessservices.datamanager.properties.TemplateProperties; +import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElementList; import org.odpi.openmetadata.frameworks.openmetadata.metadataelements.TopicElement; import org.odpi.openmetadata.frameworks.openmetadata.properties.assets.topics.TopicProperties; import org.odpi.openmetadata.adapters.connectors.apachekafka.integration.ffdc.KafkaIntegrationConnectorAuditCode; @@ -282,15 +283,15 @@ private String getEventBrokerQualifiedName(ElementStub server) throws ConnectorC OpenMetadataAccess openMetadataAccess = getContext().getIntegrationGovernanceContext().getOpenMetadataAccess(); - List capabilities = openMetadataAccess.getRelatedMetadataElements(server.getGUID(), - 1, - OpenMetadataType.SUPPORTED_CAPABILITY_RELATIONSHIP.typeName, - 0, - 0); + RelatedMetadataElementList capabilities = openMetadataAccess.getRelatedMetadataElements(server.getGUID(), + 1, + OpenMetadataType.SUPPORTED_CAPABILITY_RELATIONSHIP.typeName, + 0, + 0); if (capabilities != null) { - for (RelatedMetadataElement capability : capabilities) + for (RelatedMetadataElement capability : capabilities.getElementList()) { if (capability != null) { diff --git a/open-metadata-implementation/common-services/mermaid-services/README.md b/open-metadata-implementation/common-services/mermaid-services/README.md new file mode 100644 index 0000000000..8be7d2c4f1 --- /dev/null +++ b/open-metadata-implementation/common-services/mermaid-services/README.md @@ -0,0 +1,19 @@ + + + +![Released](../../../images/egeria-content-status-released.png#pagewidth) + +# Mermaid Services + +The Mermaid Services provide common functions for building mermaid graphs. + +* [Documentation](https://egeria-project.org/services/mermaid-services) + + +---- +* Return to [common-services](..) + + +---- +License: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), +Copyright Contributors to the ODPi Egeria project. \ No newline at end of file diff --git a/open-metadata-implementation/common-services/mermaid-services/build.gradle b/open-metadata-implementation/common-services/mermaid-services/build.gradle new file mode 100644 index 0000000000..139637e203 --- /dev/null +++ b/open-metadata-implementation/common-services/mermaid-services/build.gradle @@ -0,0 +1,23 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * Copyright Contributors to the ODPi Egeria project. + */ + + +dependencies { + implementation project(':open-metadata-implementation:frameworks:open-metadata-framework') + implementation project(':open-metadata-implementation:frameworks:governance-action-framework') + compileOnly 'com.fasterxml.jackson.core:jackson-annotations' +} + +description = 'Mermaid Common Services' + +java { + withJavadocJar() +} + +test { + useTestNG() + // This will default to standard search pattern - see https://docs.gradle.org/current/userguide/java_testing.html#sec:test_detection + scanForTestClasses = false +} diff --git a/open-metadata-implementation/common-services/mermaid-services/src/main/java/org/odpi/openmetadata/commonservices/mermaid/AssetGraphMermaidGraphBuilder.java b/open-metadata-implementation/common-services/mermaid-services/src/main/java/org/odpi/openmetadata/commonservices/mermaid/AssetGraphMermaidGraphBuilder.java new file mode 100644 index 0000000000..7968c324a2 --- /dev/null +++ b/open-metadata-implementation/common-services/mermaid-services/src/main/java/org/odpi/openmetadata/commonservices/mermaid/AssetGraphMermaidGraphBuilder.java @@ -0,0 +1,89 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* Copyright Contributors to the ODPi Egeria project. */ + +package org.odpi.openmetadata.commonservices.mermaid; + +import org.odpi.openmetadata.frameworks.openmetadata.metadataelements.*; +import org.odpi.openmetadata.frameworks.openmetadata.types.OpenMetadataProperty; + +import java.util.ArrayList; +import java.util.List; + + +public class AssetGraphMermaidGraphBuilder extends MermaidGraphBuilderBase +{ + /** + * Constructor for the graph + * + * @param assetGraph contents + */ + public AssetGraphMermaidGraphBuilder(AssetGraph assetGraph) + { + mermaidGraph.append("---\n"); + mermaidGraph.append("title: Asset - "); + mermaidGraph.append(assetGraph.getProperties().getDisplayName()); + mermaidGraph.append(" ["); + mermaidGraph.append(assetGraph.getElementHeader().getGUID()); + mermaidGraph.append("]\n---\nflowchart LR\n%%{init: {\"flowchart\": {\"htmlLabels\": false}} }%%\n\n"); + + List usedNodeNames = new ArrayList<>(); + + String currentNodeName = assetGraph.getElementHeader().getGUID(); + String currentDisplayName = assetGraph.getProperties().getDisplayName(); + + appendMermaidNode(mermaidGraph, + currentNodeName, + currentDisplayName, + assetGraph.getElementHeader().getType().getTypeName()); + + usedNodeNames.add(currentNodeName); + + + if (assetGraph.getAnchoredElements() != null) + { + for (MetadataElementSummary node : assetGraph.getAnchoredElements()) + { + if (node != null) + { + currentNodeName = node.getElementHeader().getGUID(); + currentDisplayName = node.getProperties().get(OpenMetadataProperty.DISPLAY_NAME.name); + if (currentDisplayName == null) + { + currentDisplayName = node.getProperties().get(OpenMetadataProperty.NAME.name); + } + if (currentDisplayName == null) + { + currentDisplayName = node.getProperties().get(OpenMetadataProperty.RESOURCE_NAME.name); + } + if (currentDisplayName == null) + { + currentDisplayName = node.getProperties().get(OpenMetadataProperty.QUALIFIED_NAME.name); + } + + if (!usedNodeNames.contains(currentNodeName)) + { + appendMermaidNode(mermaidGraph, + currentNodeName, + currentDisplayName, + node.getElementHeader().getType().getTypeName()); + + usedNodeNames.add(currentNodeName); + } + } + } + + for (MetadataRelationship line : assetGraph.getRelationships()) + { + if (line != null) + { + mermaidGraph.append(this.removeSpaces(line.getEnd1().getGUID())); + mermaidGraph.append("-->|"); + mermaidGraph.append(line.getType().getTypeName()); + mermaidGraph.append("|"); + mermaidGraph.append(this.removeSpaces(line.getEnd2().getGUID())); + mermaidGraph.append("\n"); + } + } + } + } +} diff --git a/open-metadata-implementation/common-services/mermaid-services/src/main/java/org/odpi/openmetadata/commonservices/mermaid/AssetLineageGraphMermaidGraphBuilder.java b/open-metadata-implementation/common-services/mermaid-services/src/main/java/org/odpi/openmetadata/commonservices/mermaid/AssetLineageGraphMermaidGraphBuilder.java new file mode 100644 index 0000000000..56496359f7 --- /dev/null +++ b/open-metadata-implementation/common-services/mermaid-services/src/main/java/org/odpi/openmetadata/commonservices/mermaid/AssetLineageGraphMermaidGraphBuilder.java @@ -0,0 +1,91 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* Copyright Contributors to the ODPi Egeria project. */ + +package org.odpi.openmetadata.commonservices.mermaid; + +import org.odpi.openmetadata.frameworks.openmetadata.metadataelements.*; + +import java.util.ArrayList; +import java.util.List; + + +/** + * Creates a mermaid graph rendering of the Open Metadata Framework's asset lineage graph. + */ +public class AssetLineageGraphMermaidGraphBuilder extends MermaidGraphBuilderBase +{ + /** + * Construct a mermaid markdown graph. + * + * @param assetLineageGraph content + */ + public AssetLineageGraphMermaidGraphBuilder(AssetLineageGraph assetLineageGraph) + { + mermaidGraph.append("---\n"); + mermaidGraph.append("title: Lineage Graph for Asset - "); + mermaidGraph.append(assetLineageGraph.getProperties().getDisplayName()); + mermaidGraph.append(" ["); + mermaidGraph.append(assetLineageGraph.getElementHeader().getGUID()); + mermaidGraph.append("]\n---\nflowchart TD\n%%{init: {\"flowchart\": {\"htmlLabels\": false}} }%%\n\n"); + + List usedNodeNames = new ArrayList<>(); + + String currentNodeName = assetLineageGraph.getElementHeader().getGUID(); + String currentDisplayName = assetLineageGraph.getProperties().getDisplayName(); + + appendMermaidNode(mermaidGraph, + currentNodeName, + currentDisplayName, + assetLineageGraph.getElementHeader().getType().getTypeName()); + + usedNodeNames.add(currentNodeName); + + + if (assetLineageGraph.getLinkedAssets() != null) + { + for (AssetLineageGraphNode node : assetLineageGraph.getLinkedAssets()) + { + if (node != null) + { + currentNodeName = node.getElementHeader().getGUID(); + currentDisplayName = node.getProperties().getDisplayName(); + if (currentDisplayName == null) + { + currentDisplayName = node.getProperties().getName(); + } + if (currentDisplayName == null) + { + currentDisplayName = node.getProperties().getResourceName(); + } + if (currentDisplayName == null) + { + currentDisplayName = node.getProperties().getQualifiedName(); + } + + if (!usedNodeNames.contains(currentNodeName)) + { + appendMermaidNode(mermaidGraph, + currentNodeName, + currentDisplayName, + node.getElementHeader().getType().getTypeName()); + + usedNodeNames.add(currentNodeName); + } + } + } + + for (AssetLineageGraphRelationship line : assetLineageGraph.getLineageRelationships()) + { + if (line != null) + { + mermaidGraph.append(line.getEnd1AssetGUID()); + mermaidGraph.append("-->|"); + mermaidGraph.append(this.getListLabel(line.getRelationshipTypes())); + mermaidGraph.append("|"); + mermaidGraph.append(line.getEnd2AssetGUID()); + mermaidGraph.append("\n"); + } + } + } + } +} diff --git a/open-metadata-implementation/common-services/mermaid-services/src/main/java/org/odpi/openmetadata/commonservices/mermaid/MermaidGraphBuilderBase.java b/open-metadata-implementation/common-services/mermaid-services/src/main/java/org/odpi/openmetadata/commonservices/mermaid/MermaidGraphBuilderBase.java new file mode 100644 index 0000000000..1cdf1cca20 --- /dev/null +++ b/open-metadata-implementation/common-services/mermaid-services/src/main/java/org/odpi/openmetadata/commonservices/mermaid/MermaidGraphBuilderBase.java @@ -0,0 +1,90 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* Copyright Contributors to the ODPi Egeria project. */ + +package org.odpi.openmetadata.commonservices.mermaid; + +import java.util.List; + +/** + * Provides the basic functions for building flowchart based graph visualizations + */ +public class MermaidGraphBuilderBase +{ + protected final StringBuilder mermaidGraph = new StringBuilder(); + + /** + * Convert an array into a comma separated string. + * + * @param labelValues array of labels + * @return string value without square brackets (Mermaid does not allow them) + */ + String getListLabel(List labelValues) + { + if (labelValues != null) + { + StringBuilder stringBuilder = new StringBuilder(); + boolean firstValue = true; + + for (String labelValue : labelValues) + { + if (! firstValue) + { + stringBuilder.append(","); + } + + firstValue = false; + stringBuilder.append(labelValue); + } + + return stringBuilder.toString(); + } + + return ""; + } + + + /** + * Create a node in the mermaid graph. + * + * @param mermaidGraph current state of the graph + * @param currentNodeName unique name/identifier + * @param currentDisplayName display name + * @param currentType type of element + */ + void appendMermaidNode(StringBuilder mermaidGraph, + String currentNodeName, + String currentDisplayName, + String currentType) + { + mermaidGraph.append(this.removeSpaces(currentNodeName)); + mermaidGraph.append("(\"`*"); + mermaidGraph.append(currentType); + mermaidGraph.append("*\n**"); + mermaidGraph.append(currentDisplayName); + mermaidGraph.append("**`\")\n"); + } + + + /** + * Remove all the spaces from the qualifiedName along with the curly braces - found in the templates. + * + * @param currentQualifiedName qualifiedName + * @return qualified name without spaces + */ + String removeSpaces(String currentQualifiedName) + { + String noSpaces = currentQualifiedName.replaceAll("\\s+",""); + return noSpaces.replaceAll("[\\[\\](){}]", ""); + } + + + /** + * Return the built mermaid graph. + * + * @return string markdown + */ + public String getMermaidGraph() + { + return mermaidGraph.toString(); + } +} diff --git a/open-metadata-implementation/common-services/mermaid-services/src/main/java/org/odpi/openmetadata/commonservices/mermaid/OpenMetadataMermaidGraphBuilder.java b/open-metadata-implementation/common-services/mermaid-services/src/main/java/org/odpi/openmetadata/commonservices/mermaid/OpenMetadataMermaidGraphBuilder.java new file mode 100644 index 0000000000..4b4a0d5e17 --- /dev/null +++ b/open-metadata-implementation/common-services/mermaid-services/src/main/java/org/odpi/openmetadata/commonservices/mermaid/OpenMetadataMermaidGraphBuilder.java @@ -0,0 +1,370 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* Copyright Contributors to the ODPi Egeria project. */ + +package org.odpi.openmetadata.commonservices.mermaid; + +import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataElement; +import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataElementGraph; +import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataRelationship; +import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElement; +import org.odpi.openmetadata.frameworks.governanceaction.search.ElementProperties; +import org.odpi.openmetadata.frameworks.governanceaction.search.PropertyHelper; +import org.odpi.openmetadata.frameworks.openmetadata.types.OpenMetadataProperty; + +import java.util.ArrayList; +import java.util.List; + +/** + * Construct mermaid markdown graph from Governance Action Framework open metadata store structures. + */ +public class OpenMetadataMermaidGraphBuilder extends MermaidGraphBuilderBase +{ + private final PropertyHelper propertyHelper = new PropertyHelper(); + private final String serviceName = "Mermaid Graph Builder"; + + /** + * Construct a graph. + * + * @param elementGraph content + */ + public OpenMetadataMermaidGraphBuilder(OpenMetadataElementGraph elementGraph) + { + mermaidGraph.append("---\n"); + mermaidGraph.append("title: Anchor Element - "); + mermaidGraph.append(this.getDisplayName(elementGraph.getElementProperties(), elementGraph.getType().getTypeName())); + mermaidGraph.append(" ["); + mermaidGraph.append(elementGraph.getElementGUID()); + mermaidGraph.append("]\n---\nflowchart LR\n%%{init: {\"flowchart\": {\"htmlLabels\": false}} }%%\n\n"); + + List usedNodeNames = new ArrayList<>(); + + String currentNodeName = elementGraph.getElementGUID(); + String currentDisplayName = this.getDisplayName(elementGraph.getElementProperties(), elementGraph.getType().getTypeName()); + + appendMermaidNode(mermaidGraph, + currentNodeName, + currentDisplayName, + elementGraph.getType().getTypeName()); + + usedNodeNames.add(currentNodeName); + + if (elementGraph.getAnchoredElements() != null) + { + for (OpenMetadataElement node : elementGraph.getAnchoredElements()) + { + if (node != null) + { + currentNodeName = node.getElementGUID(); + currentDisplayName = this.getDisplayName(node.getElementProperties(), node.getType().getTypeName()); + + if (!usedNodeNames.contains(currentNodeName)) + { + appendMermaidNode(mermaidGraph, + currentNodeName, + currentDisplayName, + node.getType().getTypeName()); + + usedNodeNames.add(currentNodeName); + } + } + } + + for (OpenMetadataRelationship line : elementGraph.getRelationships()) + { + if (line != null) + { + mermaidGraph.append(this.removeSpaces(line.getElementGUIDAtEnd1())); + mermaidGraph.append("-->|"); + mermaidGraph.append(line.getType().getTypeName()); + mermaidGraph.append("|"); + mermaidGraph.append(this.removeSpaces(line.getElementGUIDAtEnd2())); + mermaidGraph.append("\n"); + } + } + } + } + + + /** + * Construct a graph of related metadata elements. + * + * @param elementGUID central guid + * @param relatedMetadataElements list of related metadata elements + */ + public OpenMetadataMermaidGraphBuilder(String elementGUID, + List relatedMetadataElements) + { + mermaidGraph.append("---\n"); + mermaidGraph.append("title: Starting Element - "); + mermaidGraph.append(elementGUID); + mermaidGraph.append("\n---\nflowchart LR\n%%{init: {\"flowchart\": {\"htmlLabels\": false}} }%%\n\n"); + + List usedNodeNames = new ArrayList<>(); + + String currentNodeName = elementGUID; + String currentDisplayName = elementGUID; + + appendMermaidNode(mermaidGraph, + currentNodeName, + currentDisplayName, + "Starting from"); + + usedNodeNames.add(currentNodeName); + + if (relatedMetadataElements != null) + { + for (RelatedMetadataElement node : relatedMetadataElements) + { + if (node != null) + { + currentNodeName = node.getElement().getElementGUID(); + currentDisplayName = this.getDisplayName(node.getElement().getElementProperties(), node.getElement().getType().getTypeName()); + + if (!usedNodeNames.contains(currentNodeName)) + { + appendMermaidNode(mermaidGraph, + currentNodeName, + currentDisplayName, + node.getType().getTypeName()); + + usedNodeNames.add(currentNodeName); + } + } + } + + for (RelatedMetadataElement line : relatedMetadataElements) + { + if (line != null) + { + mermaidGraph.append(this.removeSpaces(elementGUID)); + mermaidGraph.append("-->|"); + mermaidGraph.append(line.getType().getTypeName()); + mermaidGraph.append("|"); + mermaidGraph.append(this.removeSpaces(line.getElement().getElementGUID())); + mermaidGraph.append("\n"); + } + } + } + } + + + /** + * Construct a graph of related metadata elements. + * + * @param end1GUID end guid + * @param end2GUID end guid + * @param openMetadataRelationships list of related metadata elements + */ + public OpenMetadataMermaidGraphBuilder(String end1GUID, + String end2GUID, + List openMetadataRelationships) + { + mermaidGraph.append("---\n"); + mermaidGraph.append("title: Relationships for Element - "); + mermaidGraph.append(end1GUID); + mermaidGraph.append(" - Linked to - "); + mermaidGraph.append(end2GUID); + mermaidGraph.append("]\n---\nflowchart LR\n%%{init: {\"flowchart\": {\"htmlLabels\": false}} }%%\n\n"); + + List usedNodeNames = new ArrayList<>(); + + String currentNodeName; + String currentDisplayName; + + if (openMetadataRelationships != null) + { + for (OpenMetadataRelationship node : openMetadataRelationships) + { + if (node != null) + { + currentNodeName = node.getElementGUIDAtEnd1(); + + if (node.getElementAtEnd1().getUniqueName() != null) + { + currentDisplayName = node.getElementAtEnd1().getUniqueName(); + } + else + { + currentDisplayName = node.getElementAtEnd1().getType().getTypeName(); + } + + if (!usedNodeNames.contains(currentNodeName)) + { + appendMermaidNode(mermaidGraph, + currentNodeName, + currentDisplayName, + node.getType().getTypeName()); + + usedNodeNames.add(currentNodeName); + } + + currentNodeName = node.getElementGUIDAtEnd2(); + + if (node.getElementAtEnd2().getUniqueName() != null) + { + currentDisplayName = node.getElementAtEnd2().getUniqueName(); + } + else + { + currentDisplayName = node.getElementAtEnd2().getType().getTypeName(); + } + + if (!usedNodeNames.contains(currentNodeName)) + { + appendMermaidNode(mermaidGraph, + currentNodeName, + currentDisplayName, + node.getType().getTypeName()); + + usedNodeNames.add(currentNodeName); + } + } + } + + for (OpenMetadataRelationship line : openMetadataRelationships) + { + if (line != null) + { + mermaidGraph.append(this.removeSpaces(line.getElementGUIDAtEnd1())); + mermaidGraph.append("-->|"); + mermaidGraph.append(line.getType().getTypeName()); + mermaidGraph.append("|"); + mermaidGraph.append(this.removeSpaces(line.getElementGUIDAtEnd2())); + mermaidGraph.append("\n"); + } + } + } + } + + + /** + * Construct a graph of related metadata elements. + * + * @param openMetadataRelationships list of related metadata elements + */ + public OpenMetadataMermaidGraphBuilder(List openMetadataRelationships) + { + mermaidGraph.append("---\n"); + mermaidGraph.append("title: Relationships matching Query"); + mermaidGraph.append("\n---\nflowchart LR\n%%{init: {\"flowchart\": {\"htmlLabels\": false}} }%%\n\n"); + + List usedNodeNames = new ArrayList<>(); + + String currentNodeName; + String currentDisplayName; + + if (openMetadataRelationships != null) + { + for (OpenMetadataRelationship node : openMetadataRelationships) + { + if (node != null) + { + currentNodeName = node.getElementGUIDAtEnd1(); + + if (node.getElementAtEnd1().getUniqueName() != null) + { + currentDisplayName = node.getElementAtEnd1().getUniqueName(); + } + else + { + currentDisplayName = node.getElementAtEnd1().getType().getTypeName(); + } + + if (!usedNodeNames.contains(currentNodeName)) + { + appendMermaidNode(mermaidGraph, + currentNodeName, + currentDisplayName, + node.getType().getTypeName()); + + usedNodeNames.add(currentNodeName); + } + + currentNodeName = node.getElementGUIDAtEnd2(); + + if (node.getElementAtEnd2().getUniqueName() != null) + { + currentDisplayName = node.getElementAtEnd2().getUniqueName(); + } + else + { + currentDisplayName = node.getElementAtEnd2().getType().getTypeName(); + } + + if (!usedNodeNames.contains(currentNodeName)) + { + appendMermaidNode(mermaidGraph, + currentNodeName, + currentDisplayName, + node.getType().getTypeName()); + + usedNodeNames.add(currentNodeName); + } + } + } + + for (OpenMetadataRelationship line : openMetadataRelationships) + { + if (line != null) + { + mermaidGraph.append(this.removeSpaces(line.getElementGUIDAtEnd1())); + mermaidGraph.append("-->|"); + mermaidGraph.append(line.getType().getTypeName()); + mermaidGraph.append("|"); + mermaidGraph.append(this.removeSpaces(line.getElementGUIDAtEnd2())); + mermaidGraph.append("\n"); + } + } + } + } + + + /** + * Extract a display name from a variety of properties. + * + * @param elementProperties properties from the element + * @param typeName type name as a last resource + * @return display name to use + */ + private String getDisplayName(ElementProperties elementProperties, + String typeName) + { + final String methodName = "getDisplayName"; + + String currentDisplayName = propertyHelper.getStringProperty(serviceName, + OpenMetadataProperty.NAME.name, + elementProperties, + methodName); + if (currentDisplayName == null) + { + currentDisplayName = propertyHelper.getStringProperty(serviceName, + OpenMetadataProperty.DISPLAY_NAME.name, + elementProperties, + methodName); + } + + if (currentDisplayName == null) + { + currentDisplayName = propertyHelper.getStringProperty(serviceName, + OpenMetadataProperty.RESOURCE_NAME.name, + elementProperties, + methodName); + } + + if (currentDisplayName == null) + { + currentDisplayName = propertyHelper.getStringProperty(serviceName, + OpenMetadataProperty.QUALIFIED_NAME.name, + elementProperties, + methodName); + } + + if (currentDisplayName == null) + { + currentDisplayName = typeName; + } + + return currentDisplayName; + } + +} diff --git a/open-metadata-implementation/common-services/mermaid-services/src/main/java/org/odpi/openmetadata/commonservices/mermaid/package-info.java b/open-metadata-implementation/common-services/mermaid-services/src/main/java/org/odpi/openmetadata/commonservices/mermaid/package-info.java new file mode 100644 index 0000000000..e8f3fa1881 --- /dev/null +++ b/open-metadata-implementation/common-services/mermaid-services/src/main/java/org/odpi/openmetadata/commonservices/mermaid/package-info.java @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* Copyright Contributors to the ODPi Egeria project. */ + +/** + * The Mermaid Services provide common routines for building Mermaid Markdown visualizations. + */ +package org.odpi.openmetadata.commonservices.mermaid; diff --git a/open-metadata-implementation/framework-services/gaf-metadata-management/gaf-metadata-api/src/main/java/org/odpi/openmetadata/frameworkservices/gaf/rest/OpenMetadataRelationshipListResponse.java b/open-metadata-implementation/framework-services/gaf-metadata-management/gaf-metadata-api/src/main/java/org/odpi/openmetadata/frameworkservices/gaf/rest/OpenMetadataRelationshipListResponse.java index 6e3eac66df..369d7b866d 100644 --- a/open-metadata-implementation/framework-services/gaf-metadata-management/gaf-metadata-api/src/main/java/org/odpi/openmetadata/frameworkservices/gaf/rest/OpenMetadataRelationshipListResponse.java +++ b/open-metadata-implementation/framework-services/gaf-metadata-management/gaf-metadata-api/src/main/java/org/odpi/openmetadata/frameworkservices/gaf/rest/OpenMetadataRelationshipListResponse.java @@ -6,11 +6,8 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; -import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataRelationship; +import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataRelationshipList; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; import java.util.Objects; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; @@ -25,7 +22,7 @@ @JsonIgnoreProperties(ignoreUnknown=true) public class OpenMetadataRelationshipListResponse extends OMAGGAFAPIResponse { - private List elementList = null; + private OpenMetadataRelationshipList relationshipList = null; /** @@ -47,7 +44,7 @@ public OpenMetadataRelationshipListResponse(OpenMetadataRelationshipListResponse if (template != null) { - elementList = template.getElementList(); + relationshipList = template.getRelationshipList(); } } @@ -57,31 +54,20 @@ public OpenMetadataRelationshipListResponse(OpenMetadataRelationshipListResponse * * @return result object */ - public List getElementList() + public OpenMetadataRelationshipList getRelationshipList() { - if (elementList == null) - { - return null; - } - else if (elementList.isEmpty()) - { - return null; - } - else - { - return new ArrayList<>(elementList); - } + return relationshipList; } /** * Set up the metadata element to return. * - * @param elementList result object + * @param relationshipList result object */ - public void setElementList(List elementList) + public void setRelationshipList(OpenMetadataRelationshipList relationshipList) { - this.elementList = elementList; + this.relationshipList = relationshipList; } @@ -93,19 +79,9 @@ public void setElementList(List elementList) @Override public String toString() { - return "OpenMetadataElementsResponse{" + - "elementList=" + elementList + - ", exceptionClassName='" + getExceptionClassName() + '\'' + - ", exceptionCausedBy='" + getExceptionCausedBy() + '\'' + - ", actionDescription='" + getActionDescription() + '\'' + - ", relatedHTTPCode=" + getRelatedHTTPCode() + - ", exceptionErrorMessage='" + getExceptionErrorMessage() + '\'' + - ", exceptionErrorMessageId='" + getExceptionErrorMessageId() + '\'' + - ", exceptionErrorMessageParameters=" + Arrays.toString(getExceptionErrorMessageParameters()) + - ", exceptionSystemAction='" + getExceptionSystemAction() + '\'' + - ", exceptionUserAction='" + getExceptionUserAction() + '\'' + - ", exceptionProperties=" + getExceptionProperties() + - '}'; + return "OpenMetadataRelationshipListResponse{" + + "relationshipList=" + relationshipList + + "} " + super.toString(); } @@ -131,7 +107,7 @@ public boolean equals(Object objectToCompare) return false; } OpenMetadataRelationshipListResponse that = (OpenMetadataRelationshipListResponse) objectToCompare; - return Objects.equals(elementList, that.elementList); + return Objects.equals(relationshipList, that.relationshipList); } @@ -143,6 +119,6 @@ public boolean equals(Object objectToCompare) @Override public int hashCode() { - return Objects.hash(super.hashCode(), elementList); + return Objects.hash(super.hashCode(), relationshipList); } } diff --git a/open-metadata-implementation/framework-services/gaf-metadata-management/gaf-metadata-api/src/main/java/org/odpi/openmetadata/frameworkservices/gaf/rest/RelatedMetadataElementListResponse.java b/open-metadata-implementation/framework-services/gaf-metadata-management/gaf-metadata-api/src/main/java/org/odpi/openmetadata/frameworkservices/gaf/rest/RelatedMetadataElementListResponse.java index 4155702011..4603b1fdba 100644 --- a/open-metadata-implementation/framework-services/gaf-metadata-management/gaf-metadata-api/src/main/java/org/odpi/openmetadata/frameworkservices/gaf/rest/RelatedMetadataElementListResponse.java +++ b/open-metadata-implementation/framework-services/gaf-metadata-management/gaf-metadata-api/src/main/java/org/odpi/openmetadata/frameworkservices/gaf/rest/RelatedMetadataElementListResponse.java @@ -6,11 +6,8 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; -import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElement; +import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElementList; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; import java.util.Objects; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; @@ -25,7 +22,7 @@ @JsonIgnoreProperties(ignoreUnknown=true) public class RelatedMetadataElementListResponse extends OMAGGAFAPIResponse { - private List elementList = null; + private RelatedMetadataElementList relatedElementList = null; /** @@ -47,7 +44,7 @@ public RelatedMetadataElementListResponse(RelatedMetadataElementListResponse tem if (template != null) { - elementList = template.getElementList(); + relatedElementList = template.getRelatedElementList(); } } @@ -57,31 +54,20 @@ public RelatedMetadataElementListResponse(RelatedMetadataElementListResponse tem * * @return result object */ - public List getElementList() + public RelatedMetadataElementList getRelatedElementList() { - if (elementList == null) - { - return null; - } - else if (elementList.isEmpty()) - { - return null; - } - else - { - return new ArrayList<>(elementList); - } + return relatedElementList; } /** * Set up the metadata element to return. * - * @param elementList result object + * @param relatedElementList result object */ - public void setElementList(List elementList) + public void setRelatedElementList(RelatedMetadataElementList relatedElementList) { - this.elementList = elementList; + this.relatedElementList = relatedElementList; } @@ -94,18 +80,8 @@ public void setElementList(List elementList) public String toString() { return "RelatedMetadataElementListResponse{" + - "elementList=" + elementList + - ", exceptionClassName='" + getExceptionClassName() + '\'' + - ", exceptionCausedBy='" + getExceptionCausedBy() + '\'' + - ", actionDescription='" + getActionDescription() + '\'' + - ", relatedHTTPCode=" + getRelatedHTTPCode() + - ", exceptionErrorMessage='" + getExceptionErrorMessage() + '\'' + - ", exceptionErrorMessageId='" + getExceptionErrorMessageId() + '\'' + - ", exceptionErrorMessageParameters=" + Arrays.toString(getExceptionErrorMessageParameters()) + - ", exceptionSystemAction='" + getExceptionSystemAction() + '\'' + - ", exceptionUserAction='" + getExceptionUserAction() + '\'' + - ", exceptionProperties=" + getExceptionProperties() + - '}'; + "relatedElementList=" + relatedElementList + + "} " + super.toString(); } @@ -131,7 +107,7 @@ public boolean equals(Object objectToCompare) return false; } RelatedMetadataElementListResponse that = (RelatedMetadataElementListResponse) objectToCompare; - return Objects.equals(elementList, that.elementList); + return Objects.equals(relatedElementList, that.relatedElementList); } @@ -143,6 +119,6 @@ public boolean equals(Object objectToCompare) @Override public int hashCode() { - return Objects.hash(super.hashCode(), elementList); + return Objects.hash(super.hashCode(), relatedElementList); } } diff --git a/open-metadata-implementation/framework-services/gaf-metadata-management/gaf-metadata-client/src/main/java/org/odpi/openmetadata/frameworkservices/gaf/client/OpenMetadataClientBase.java b/open-metadata-implementation/framework-services/gaf-metadata-management/gaf-metadata-client/src/main/java/org/odpi/openmetadata/frameworkservices/gaf/client/OpenMetadataClientBase.java index f2746ff6da..2c8e94b9b6 100644 --- a/open-metadata-implementation/framework-services/gaf-metadata-management/gaf-metadata-client/src/main/java/org/odpi/openmetadata/frameworkservices/gaf/client/OpenMetadataClientBase.java +++ b/open-metadata-implementation/framework-services/gaf-metadata-management/gaf-metadata-client/src/main/java/org/odpi/openmetadata/frameworkservices/gaf/client/OpenMetadataClientBase.java @@ -903,7 +903,7 @@ public List findMetadataElementsWithString(String * @throws PropertyServerException there is a problem accessing the metadata store */ @Override - public List getRelatedMetadataElements(String userId, + public RelatedMetadataElementList getRelatedMetadataElements(String userId, String elementGUID, int startingAtEnd, String relationshipTypeName, @@ -969,7 +969,7 @@ public List getRelatedMetadataElements(String pageSize); } - return restResult.getElementList(); + return restResult.getRelatedElementList(); } @@ -1060,7 +1060,7 @@ public RelatedMetadataElement getRelatedMetadataElement(String userId, { final String methodName = "getRelatedMetadataElement"; - List relationships = this.getRelatedMetadataElements(userId, + RelatedMetadataElementList relationships = this.getRelatedMetadataElements(userId, elementGUID, startingAtEnd, relationshipTypeName, @@ -1074,17 +1074,17 @@ public RelatedMetadataElement getRelatedMetadataElement(String userId, 0, 0); - if ((relationships != null) && (!relationships.isEmpty())) + if ((relationships != null) && (!relationships.getElementList().isEmpty())) { - if (relationships.size() == 1) + if (relationships.getElementList().size() == 1) { - return relationships.get(0); + return relationships.getElementList().get(0); } else { RelatedMetadataElement result = null; - for (RelatedMetadataElement relatedMetadataElement : relationships) + for (RelatedMetadataElement relatedMetadataElement : relationships.getElementList()) { if (relatedMetadataElement != null) { @@ -1198,7 +1198,7 @@ public List getMetadataElementHistory(String userId, * @throws PropertyServerException there is a problem accessing the metadata store */ @Override - public List getMetadataElementRelationships(String userId, + public OpenMetadataRelationshipList getMetadataElementRelationships(String userId, String metadataElementAtEnd1GUID, String metadataElementAtEnd2GUID, String relationshipTypeName, @@ -1264,7 +1264,7 @@ public List getMetadataElementRelationships(String pageSize); } - return restResult.getElementList(); + return restResult.getRelationshipList(); } @@ -2199,20 +2199,20 @@ public List findMetadataElements(String user * @throws PropertyServerException there is a problem accessing the metadata store */ @Override - public List findRelationshipsBetweenMetadataElements(String userId, - String relationshipTypeName, - SearchProperties searchProperties, - List limitResultsByStatus, - Date asOfTime, - String sequencingProperty, - SequencingOrder sequencingOrder, - boolean forLineage, - boolean forDuplicateProcessing, - Date effectiveTime, - int startFrom, - int pageSize) throws InvalidParameterException, - UserNotAuthorizedException, - PropertyServerException + public OpenMetadataRelationshipList findRelationshipsBetweenMetadataElements(String userId, + String relationshipTypeName, + SearchProperties searchProperties, + List limitResultsByStatus, + Date asOfTime, + String sequencingProperty, + SequencingOrder sequencingOrder, + boolean forLineage, + boolean forDuplicateProcessing, + Date effectiveTime, + int startFrom, + int pageSize) throws InvalidParameterException, + UserNotAuthorizedException, + PropertyServerException { final String methodName = "findRelationshipsBetweenMetadataElements"; final String urlTemplate = serverPlatformURLRoot + "/servers/{0}/open-metadata/framework-services/{1}/open-metadata-store/users/{2}/relationships/by-search-specification?forLineage={3}&forDuplicateProcessing={4}&startFrom={5}&pageSize={6}"; @@ -2240,7 +2240,7 @@ public List findRelationshipsBetweenMetadataElements(S startFrom, pageSize); - return restResult.getElementList(); + return restResult.getRelationshipList(); } @@ -2313,7 +2313,7 @@ public OpenMetadataRelationship getRelationshipByGUID(String userId, * @throws PropertyServerException there is a problem accessing the metadata store */ @Override - public List getRelationshipHistory(String userId, + public OpenMetadataRelationshipList getRelationshipHistory(String userId, String relationshipGUID, Date fromTime, Date toTime, @@ -2350,7 +2350,7 @@ public List getRelationshipHistory(String userId, startFrom, pageSize); - return restResult.getElementList(); + return restResult.getRelationshipList(); } @@ -5256,7 +5256,7 @@ public Map>> getSpecification(String userId, Map>> specification = new HashMap<>(); - List refDataElements = this.getRelatedMetadataElements(userId, + RelatedMetadataElementList refDataElements = this.getRelatedMetadataElements(userId, elementGUID, 1, OpenMetadataType.SPECIFICATION_PROPERTY_ASSIGNMENT_RELATIONSHIP.typeName, @@ -5272,7 +5272,7 @@ public Map>> getSpecification(String userId, if (refDataElements != null) { - for (RelatedMetadataElement refDataElement : refDataElements) + for (RelatedMetadataElement refDataElement : refDataElements.getElementList()) { if (refDataElement != null) { @@ -5868,7 +5868,7 @@ public Map> getVendorProperties(String userId, { final String methodName = "getVendorProperties"; - List propertyFacets = this.getRelatedMetadataElements(userId, + RelatedMetadataElementList propertyFacets = this.getRelatedMetadataElements(userId, openMetadataElementGUID, 1, OpenMetadataType.REFERENCEABLE_FACET.typeName, @@ -5885,7 +5885,7 @@ public Map> getVendorProperties(String userId, { Map> vendorProperties = new HashMap<>(); - for (RelatedMetadataElement relatedMetadataElement : propertyFacets) + for (RelatedMetadataElement relatedMetadataElement : propertyFacets.getElementList()) { if (relatedMetadataElement != null) { diff --git a/open-metadata-implementation/framework-services/gaf-metadata-management/gaf-metadata-server/build.gradle b/open-metadata-implementation/framework-services/gaf-metadata-management/gaf-metadata-server/build.gradle index 5c7837dfc9..1f6480469b 100644 --- a/open-metadata-implementation/framework-services/gaf-metadata-management/gaf-metadata-server/build.gradle +++ b/open-metadata-implementation/framework-services/gaf-metadata-management/gaf-metadata-server/build.gradle @@ -14,6 +14,7 @@ dependencies { implementation project(':open-metadata-implementation:framework-services:gaf-metadata-management:gaf-metadata-api') implementation project(':open-metadata-implementation:common-services:multi-tenant') implementation project(':open-metadata-implementation:common-services:ffdc-services') + implementation project(':open-metadata-implementation:common-services:mermaid-services') implementation project(':open-metadata-implementation:frameworks:audit-log-framework') implementation project(':open-metadata-implementation:common-services:metadata-security:metadata-security-server') implementation project(':open-metadata-implementation:common-services:repository-handler') diff --git a/open-metadata-implementation/framework-services/gaf-metadata-management/gaf-metadata-server/src/main/java/org/odpi/openmetadata/frameworkservices/gaf/server/OpenMetadataStoreRESTServices.java b/open-metadata-implementation/framework-services/gaf-metadata-management/gaf-metadata-server/src/main/java/org/odpi/openmetadata/frameworkservices/gaf/server/OpenMetadataStoreRESTServices.java index f2d6b52b7a..c589362b5c 100644 --- a/open-metadata-implementation/framework-services/gaf-metadata-management/gaf-metadata-server/src/main/java/org/odpi/openmetadata/frameworkservices/gaf/server/OpenMetadataStoreRESTServices.java +++ b/open-metadata-implementation/framework-services/gaf-metadata-management/gaf-metadata-server/src/main/java/org/odpi/openmetadata/frameworkservices/gaf/server/OpenMetadataStoreRESTServices.java @@ -9,24 +9,25 @@ import org.odpi.openmetadata.commonservices.ffdc.rest.*; import org.odpi.openmetadata.commonservices.generichandlers.OpenMetadataAPIGenericConverter; import org.odpi.openmetadata.commonservices.generichandlers.ValidValuesHandler; +import org.odpi.openmetadata.commonservices.mermaid.OpenMetadataMermaidGraphBuilder; import org.odpi.openmetadata.frameworks.auditlog.AuditLog; import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException; -import org.odpi.openmetadata.frameworks.governanceaction.search.ElementProperties; -import org.odpi.openmetadata.frameworks.governanceaction.search.PropertyHelper; +import org.odpi.openmetadata.frameworks.governanceaction.properties.*; import org.odpi.openmetadata.frameworks.openmetadata.enums.ElementStatus; +import org.odpi.openmetadata.frameworks.openmetadata.mapper.OpenMetadataValidValues; import org.odpi.openmetadata.frameworks.openmetadata.types.OpenMetadataProperty; import org.odpi.openmetadata.frameworks.openmetadata.types.OpenMetadataType; -import org.odpi.openmetadata.frameworks.openmetadata.mapper.OpenMetadataValidValues; -import org.odpi.openmetadata.frameworks.governanceaction.properties.*; import org.odpi.openmetadata.frameworkservices.gaf.converters.RelatedElementsConverter; import org.odpi.openmetadata.frameworkservices.gaf.ffdc.OpenMetadataStoreAuditCode; import org.odpi.openmetadata.frameworkservices.gaf.handlers.MetadataElementHandler; -import org.odpi.openmetadata.frameworkservices.gaf.rest.*; +import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataRelationshipList; +import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElementList; import org.odpi.openmetadata.frameworkservices.gaf.rest.ArchiveRequestBody; import org.odpi.openmetadata.frameworkservices.gaf.rest.TemplateRequestBody; import org.odpi.openmetadata.frameworkservices.gaf.rest.UpdateRequestBody; +import org.odpi.openmetadata.frameworkservices.gaf.rest.*; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.HistorySequencingOrder; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.MatchCriteria; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.SequencingOrder; @@ -58,7 +59,6 @@ public class OpenMetadataStoreRESTServices private final static RESTCallLogger restCallLogger = new RESTCallLogger(LoggerFactory.getLogger(OpenMetadataStoreRESTServices.class), instanceHandler.getServiceName()); - private final PropertyHelper propertyHelper = new PropertyHelper(); private final InvalidParameterHandler invalidParameterHandler = new InvalidParameterHandler(); private final String propertyNameParameter = "propertyName"; @@ -1134,42 +1134,52 @@ public RelatedMetadataElementListResponse getRelatedMetadataElements(String MetadataElementHandler handler = instanceHandler.getMetadataElementHandler(userId, serverName, methodName); + RelatedMetadataElementList relatedElementList = new RelatedMetadataElementList(); + if (requestBody != null) { - response.setElementList(handler.getRelatedMetadataElements(userId, - elementGUID, - startingAtEnd, - relationshipTypeName, - requestBody.getLimitResultsByStatus(), - requestBody.getAsOfTime(), - requestBody.getSequencingProperty(), - requestBody.getSequencingOrder(), - forLineage, - forDuplicateProcessing, - instanceHandler.getSupportedZones(userId, serverName, serviceURLMarker, methodName), - requestBody.getEffectiveTime(), - startFrom, - pageSize, - methodName)); + relatedElementList.setElementList(handler.getRelatedMetadataElements(userId, + elementGUID, + startingAtEnd, + relationshipTypeName, + requestBody.getLimitResultsByStatus(), + requestBody.getAsOfTime(), + requestBody.getSequencingProperty(), + requestBody.getSequencingOrder(), + forLineage, + forDuplicateProcessing, + instanceHandler.getSupportedZones(userId, serverName, serviceURLMarker, methodName), + requestBody.getEffectiveTime(), + startFrom, + pageSize, + methodName)); } else { - response.setElementList(handler.getRelatedMetadataElements(userId, - elementGUID, - startingAtEnd, - relationshipTypeName, - null, - null, - null, - null, - forLineage, - forDuplicateProcessing, - instanceHandler.getSupportedZones(userId, serverName, serviceURLMarker, methodName), - null, - startFrom, - pageSize, - methodName)); + relatedElementList.setElementList(handler.getRelatedMetadataElements(userId, + elementGUID, + startingAtEnd, + relationshipTypeName, + null, + null, + null, + null, + forLineage, + forDuplicateProcessing, + instanceHandler.getSupportedZones(userId, serverName, serviceURLMarker, methodName), + null, + startFrom, + pageSize, + methodName)); + } + + if (relatedElementList.getElementList() != null) + { + OpenMetadataMermaidGraphBuilder graphBuilder = new OpenMetadataMermaidGraphBuilder(elementGUID, relatedElementList.getElementList()); + relatedElementList.setMermaidGraph(graphBuilder.getMermaidGraph()); } + + response.setRelatedElementList(relatedElementList); } catch (Exception error) { @@ -1180,6 +1190,7 @@ public RelatedMetadataElementListResponse getRelatedMetadataElements(String return response; } + /** * Retrieve the relationships linking to the supplied elements. * @@ -1291,42 +1302,51 @@ public OpenMetadataRelationshipListResponse getMetadataElementRelationships(Stri MetadataElementHandler handler = instanceHandler.getMetadataElementHandler(userId, serverName, methodName); + OpenMetadataRelationshipList relationshipList = new OpenMetadataRelationshipList(); if (requestBody != null) { - response.setElementList(handler.getMetadataElementRelationships(userId, - metadataElementAtEnd1GUID, - relationshipTypeName, - metadataElementAtEnd2GUID, - requestBody.getLimitResultsByStatus(), - requestBody.getAsOfTime(), - requestBody.getSequencingProperty(), - requestBody.getSequencingOrder(), - forLineage, - forDuplicateProcessing, - instanceHandler.getSupportedZones(userId, serverName, serviceURLMarker, methodName), - requestBody.getEffectiveTime(), - startFrom, - pageSize, - methodName)); + relationshipList.setElementList(handler.getMetadataElementRelationships(userId, + metadataElementAtEnd1GUID, + relationshipTypeName, + metadataElementAtEnd2GUID, + requestBody.getLimitResultsByStatus(), + requestBody.getAsOfTime(), + requestBody.getSequencingProperty(), + requestBody.getSequencingOrder(), + forLineage, + forDuplicateProcessing, + instanceHandler.getSupportedZones(userId, serverName, serviceURLMarker, methodName), + requestBody.getEffectiveTime(), + startFrom, + pageSize, + methodName)); } else { - response.setElementList(handler.getMetadataElementRelationships(userId, - metadataElementAtEnd1GUID, - relationshipTypeName, - metadataElementAtEnd2GUID, - null, - null, - null, - null, - forLineage, - forDuplicateProcessing, - instanceHandler.getSupportedZones(userId, serverName, serviceURLMarker, methodName), - null, - startFrom, - pageSize, - methodName)); + relationshipList.setElementList(handler.getMetadataElementRelationships(userId, + metadataElementAtEnd1GUID, + relationshipTypeName, + metadataElementAtEnd2GUID, + null, + null, + null, + null, + forLineage, + forDuplicateProcessing, + instanceHandler.getSupportedZones(userId, serverName, serviceURLMarker, methodName), + null, + startFrom, + pageSize, + methodName)); } + + if (response.getRelationshipList() != null) + { + OpenMetadataMermaidGraphBuilder graphBuilder = new OpenMetadataMermaidGraphBuilder(metadataElementAtEnd1GUID, metadataElementAtEnd2GUID, relationshipList.getElementList()); + relationshipList.setMermaidGraph(graphBuilder.getMermaidGraph()); + } + + response.setRelationshipList(relationshipList); } catch (Exception error) { @@ -1448,14 +1468,14 @@ public OpenMetadataElementsResponse findMetadataElements(String serverN * PropertyServerException - there is a problem retrieving the connected asset properties from the property server or * UserNotAuthorizedException - the requesting user is not authorized to issue this request. */ - public OpenMetadataGraphResponse getAnchoredElementsGraph(String serverName, - String serviceURLMarker, - String userId, - String elementGUID, - boolean forLineage, - boolean forDuplicateProcessing, - int startFrom, - int pageSize, + public OpenMetadataGraphResponse getAnchoredElementsGraph(String serverName, + String serviceURLMarker, + String userId, + String elementGUID, + boolean forLineage, + boolean forDuplicateProcessing, + int startFrom, + int pageSize, AnyTimeRequestBody requestBody) { final String parameterName = "elementGUID"; @@ -1472,16 +1492,34 @@ public OpenMetadataGraphResponse getAnchoredElementsGraph(String serverName, auditLog = instanceHandler.getAuditLog(userId, serverName, methodName); - OpenMetadataElement anchorElement = handler.getBeanFromRepository(userId, - elementGUID, - parameterName, - OpenMetadataType.OPEN_METADATA_ROOT.typeName, - false, - false, - null, - null, - null, - methodName); + OpenMetadataElement anchorElement; + + if (requestBody != null) + { + anchorElement = handler.getBeanFromRepository(userId, + elementGUID, + parameterName, + OpenMetadataType.OPEN_METADATA_ROOT.typeName, + forLineage, + forDuplicateProcessing, + instanceHandler.getSupportedZones(userId, serverName, serviceURLMarker, methodName), + requestBody.getAsOfTime(), + requestBody.getEffectiveTime(), + methodName); + } + else + { + anchorElement = handler.getBeanFromRepository(userId, + elementGUID, + parameterName, + OpenMetadataType.OPEN_METADATA_ROOT.typeName, + forLineage, + forDuplicateProcessing, + instanceHandler.getSupportedZones(userId, serverName, serviceURLMarker, methodName), + null, + new Date(), + methodName); + } if (anchorElement != null) { @@ -1614,7 +1652,9 @@ public OpenMetadataGraphResponse getAnchoredElementsGraph(String serverName, elementGraph.setRelationships(metadataRelationships); } - elementGraph.setMermaidGraph(this.getElementGraphMermaidGraph(elementGraph)); + OpenMetadataMermaidGraphBuilder graphBuilder = new OpenMetadataMermaidGraphBuilder(elementGraph); + elementGraph.setMermaidGraph(graphBuilder.getMermaidGraph()); + response.setElementGraph(elementGraph); } } @@ -1628,200 +1668,6 @@ public OpenMetadataGraphResponse getAnchoredElementsGraph(String serverName, } - /** - * Constructing the mermaid graph for the retrieved element. - * - * @param elementGraph retrieved graph - * @return mermaid string - */ - private String getElementGraphMermaidGraph(OpenMetadataElementGraph elementGraph) - { - final String methodName = "getElementGraphMermaidGraph"; - - StringBuilder mermaidGraph = new StringBuilder(); - - mermaidGraph.append("---\n"); - mermaidGraph.append("title: Asset - "); - mermaidGraph.append(this.getDisplayName(elementGraph.getElementProperties(), elementGraph.getType().getTypeName())); - mermaidGraph.append(" ["); - mermaidGraph.append(elementGraph.getElementGUID()); - mermaidGraph.append("]\n---\nflowchart LR\n%%{init: {\"flowchart\": {\"htmlLabels\": false}} }%%\n\n"); - - List usedQualifiedNames = new ArrayList<>(); - - String currentQualifiedName = propertyHelper.getStringProperty(instanceHandler.getServiceName(), - OpenMetadataProperty.QUALIFIED_NAME.name, - elementGraph.getElementProperties(), - methodName); - String currentDisplayName = this.getDisplayName(elementGraph.getElementProperties(), elementGraph.getType().getTypeName()); - - appendMermaidNode(mermaidGraph, - currentQualifiedName, - currentDisplayName, - elementGraph.getType().getTypeName()); - - usedQualifiedNames.add(currentQualifiedName); - - if (elementGraph.getAnchoredElements() != null) - { - for (OpenMetadataElement node : elementGraph.getAnchoredElements()) - { - if (node != null) - { - currentQualifiedName = propertyHelper.getStringProperty(instanceHandler.getServiceName(), - OpenMetadataProperty.QUALIFIED_NAME.name, - node.getElementProperties(), - methodName);; - currentDisplayName = this.getDisplayName(node.getElementProperties(), node.getType().getTypeName()); - - - if (!usedQualifiedNames.contains(currentQualifiedName)) - { - appendMermaidNode(mermaidGraph, - currentQualifiedName, - currentDisplayName, - node.getType().getTypeName()); - - usedQualifiedNames.add(currentQualifiedName); - } - } - } - - for (OpenMetadataRelationship line : elementGraph.getRelationships()) - { - if (line != null) - { - mermaidGraph.append(this.removeSpaces(line.getElementAtEnd1().getUniqueName())); - mermaidGraph.append("-->|"); - mermaidGraph.append(line.getType().getTypeName()); - mermaidGraph.append("|"); - mermaidGraph.append(this.removeSpaces(line.getElementAtEnd2().getUniqueName())); - mermaidGraph.append("\n"); - } - } - } - - return mermaidGraph.toString(); - } - - - /** - * Extract a display name from a variety of properties. - * - * @param elementProperties properties from the element - * @param typeName type name as a last resource - * @return display name to use - */ - private String getDisplayName(ElementProperties elementProperties, - String typeName) - { - final String methodName = "getDisplayName"; - - String currentDisplayName = propertyHelper.getStringProperty(instanceHandler.getServiceName(), - OpenMetadataProperty.NAME.name, - elementProperties, - methodName); - if (currentDisplayName == null) - { - currentDisplayName = propertyHelper.getStringProperty(instanceHandler.getServiceName(), - OpenMetadataProperty.DISPLAY_NAME.name, - elementProperties, - methodName); - } - - if (currentDisplayName == null) - { - currentDisplayName = propertyHelper.getStringProperty(instanceHandler.getServiceName(), - OpenMetadataProperty.RESOURCE_NAME.name, - elementProperties, - methodName); - } - - if (currentDisplayName == null) - { - currentDisplayName = propertyHelper.getStringProperty(instanceHandler.getServiceName(), - OpenMetadataProperty.QUALIFIED_NAME.name, - elementProperties, - methodName); - } - - if (currentDisplayName == null) - { - currentDisplayName = typeName; - } - - return currentDisplayName; - } - - - /** - * Create a node in the mermaid graph. - * - * @param mermaidGraph current state of the graph - * @param currentNodeName unique name/identifier - * @param currentDisplayName display name - * @param currentType type of element - */ - private void appendMermaidNode(StringBuilder mermaidGraph, - String currentNodeName, - String currentDisplayName, - String currentType) - { - mermaidGraph.append(this.removeSpaces(currentNodeName)); - mermaidGraph.append("(\"`*"); - mermaidGraph.append(currentType); - mermaidGraph.append("*\n**"); - mermaidGraph.append(currentDisplayName); - mermaidGraph.append("**`\")\n"); - } - - - /** - * Remove all the spaces from the qualifiedName along with the curly braces - found in the templates. - * - * @param currentQualifiedName qualifiedName - * @return qualified name without spaces - */ - private String removeSpaces(String currentQualifiedName) - { - String noSpaces = currentQualifiedName.replaceAll("\\s+",""); - return noSpaces.replaceAll("[\\[\\](){}]", ""); - } - - - - /** - * Convert an array into a comma separated string. - * - * @param labelValues array of labels - * @return string value without square brackets (Mermaid does not allow them) - */ - private String getListLabel(List labelValues) - { - if (labelValues != null) - { - StringBuilder stringBuilder = new StringBuilder(); - boolean firstValue = true; - - for (String labelValue : labelValues) - { - if (! firstValue) - { - stringBuilder.append(","); - } - - firstValue = false; - stringBuilder.append(labelValue); - } - - return stringBuilder.toString(); - } - - return ""; - } - - - /** * Return a list of relationships that match the requested conditions. The results can be received as a series of pages. * @@ -1863,39 +1709,49 @@ public OpenMetadataRelationshipListResponse findRelationshipsBetweenMetadataElem { MetadataElementHandler handler = instanceHandler.getMetadataElementHandler(userId, serverName, methodName); + OpenMetadataRelationshipList relationshipList = new OpenMetadataRelationshipList(); + if (requestBody.getSearchProperties() != null) { - response.setElementList(handler.findRelationshipsBetweenMetadataElements(userId, - requestBody.getRelationshipTypeName(), - requestBody.getSearchProperties(), - requestBody.getLimitResultsByStatus(), - requestBody.getAsOfTime(), - requestBody.getSequencingProperty(), - requestBody.getSequencingOrder(), - forLineage, - forDuplicateProcessing, - instanceHandler.getSupportedZones(userId, serverName, serviceURLMarker, methodName), - requestBody.getEffectiveTime(), - startFrom, - pageSize, - methodName)); + relationshipList.setElementList(handler.findRelationshipsBetweenMetadataElements(userId, + requestBody.getRelationshipTypeName(), + requestBody.getSearchProperties(), + requestBody.getLimitResultsByStatus(), + requestBody.getAsOfTime(), + requestBody.getSequencingProperty(), + requestBody.getSequencingOrder(), + forLineage, + forDuplicateProcessing, + instanceHandler.getSupportedZones(userId, serverName, serviceURLMarker, methodName), + requestBody.getEffectiveTime(), + startFrom, + pageSize, + methodName)); } else { - response.setElementList(handler.getRelationshipsByType(userId, - requestBody.getRelationshipTypeName(), - forLineage, - forDuplicateProcessing, - requestBody.getLimitResultsByStatus(), - requestBody.getAsOfTime(), - requestBody.getSequencingProperty(), - requestBody.getSequencingOrder(), - instanceHandler.getSupportedZones(userId, serverName, serviceURLMarker, methodName), - null, - startFrom, - pageSize, - methodName)); + relationshipList.setElementList(handler.getRelationshipsByType(userId, + requestBody.getRelationshipTypeName(), + forLineage, + forDuplicateProcessing, + requestBody.getLimitResultsByStatus(), + requestBody.getAsOfTime(), + requestBody.getSequencingProperty(), + requestBody.getSequencingOrder(), + instanceHandler.getSupportedZones(userId, serverName, serviceURLMarker, methodName), + null, + startFrom, + pageSize, + methodName)); } + + if (relationshipList.getElementList() != null) + { + OpenMetadataMermaidGraphBuilder graphBuilder = new OpenMetadataMermaidGraphBuilder(relationshipList.getElementList()); + relationshipList.setMermaidGraph(graphBuilder.getMermaidGraph()); + } + + response.setRelationshipList(relationshipList); } else { @@ -2079,7 +1935,11 @@ public OpenMetadataRelationshipListResponse getRelationshipHistory(String methodName); } - response.setElementList(handler.convertOpenMetadataRelationships(relationships, methodName)); + OpenMetadataRelationshipList openMetadataRelationshipList = new OpenMetadataRelationshipList(); + openMetadataRelationshipList.setElementList(handler.convertOpenMetadataRelationships(relationships, methodName)); + + response.setRelationshipList(openMetadataRelationshipList); + // to do add mermaid graph } catch (Exception error) { diff --git a/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/OpenMetadataStore.java b/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/OpenMetadataStore.java index 353c37ed68..37b444b5ac 100644 --- a/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/OpenMetadataStore.java +++ b/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/OpenMetadataStore.java @@ -553,7 +553,7 @@ public List findMetadataElementsWithString(String searchSt * @throws UserNotAuthorizedException the governance action service is not able to access the elements * @throws PropertyServerException there is a problem accessing the metadata store */ - public List getRelatedMetadataElements(String elementGUID, + public RelatedMetadataElementList getRelatedMetadataElements(String elementGUID, int startingAtEnd, String relationshipTypeName, int startFrom, @@ -676,7 +676,7 @@ public List getMetadataElementHistory(String elementGUID, * @throws UserNotAuthorizedException the governance action service is not able to access the elements * @throws PropertyServerException there is a problem accessing the metadata store */ - public List getMetadataElementRelationships(String metadataElementAtEnd1GUID, + public OpenMetadataRelationshipList getMetadataElementRelationships(String metadataElementAtEnd1GUID, String metadataElementAtEnd2GUID, String relationshipTypeName, int startFrom, @@ -772,7 +772,7 @@ public List findMetadataElements(String meta * @throws UserNotAuthorizedException the governance action service is not able to access the elements * @throws PropertyServerException there is a problem accessing the metadata store */ - public List findRelationshipsBetweenMetadataElements(String relationshipTypeName, + public OpenMetadataRelationshipList findRelationshipsBetweenMetadataElements(String relationshipTypeName, SearchProperties searchProperties, List limitResultsByStatus, Date asOfTime, diff --git a/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/client/MetadataElementInterface.java b/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/client/MetadataElementInterface.java index ea11b6906b..7eaa11ed0c 100644 --- a/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/client/MetadataElementInterface.java +++ b/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/client/MetadataElementInterface.java @@ -5,11 +5,8 @@ import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException; -import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataElementGraph; +import org.odpi.openmetadata.frameworks.governanceaction.properties.*; import org.odpi.openmetadata.frameworks.openmetadata.enums.ElementStatus; -import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataElement; -import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElement; -import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataRelationship; import org.odpi.openmetadata.frameworks.governanceaction.search.ElementProperties; import org.odpi.openmetadata.frameworks.governanceaction.search.SearchClassifications; import org.odpi.openmetadata.frameworks.governanceaction.search.SearchProperties; @@ -225,21 +222,21 @@ List findMetadataElementsWithString(String use * @throws UserNotAuthorizedException the userId is not permitted to perform this operation * @throws PropertyServerException there is a problem accessing the metadata store */ - List getRelatedMetadataElements(String userId, - String elementGUID, - int startingAtEnd, - String relationshipTypeName, - List limitResultsByStatus, - Date asOfTime, - String sequencingProperty, - SequencingOrder sequencingOrder, - boolean forLineage, - boolean forDuplicateProcessing, - Date effectiveTime, - int startFrom, - int pageSize) throws InvalidParameterException, - UserNotAuthorizedException, - PropertyServerException; + RelatedMetadataElementList getRelatedMetadataElements(String userId, + String elementGUID, + int startingAtEnd, + String relationshipTypeName, + List limitResultsByStatus, + Date asOfTime, + String sequencingProperty, + SequencingOrder sequencingOrder, + boolean forLineage, + boolean forDuplicateProcessing, + Date effectiveTime, + int startFrom, + int pageSize) throws InvalidParameterException, + UserNotAuthorizedException, + PropertyServerException; /** @@ -320,18 +317,18 @@ RelatedMetadataElement getRelatedMetadataElement(String userId, * @throws UserNotAuthorizedException the userId is not permitted to perform this operation. * @throws PropertyServerException there is a problem accessing the metadata store */ - List getMetadataElementHistory(String userId, - String elementGUID, - Date fromTime, - Date toTime, - boolean oldestFirst, - boolean forLineage, - boolean forDuplicateProcessing, - Date effectiveTime, - int startFrom, - int pageSize) throws InvalidParameterException, - UserNotAuthorizedException, - PropertyServerException; + List getMetadataElementHistory(String userId, + String elementGUID, + Date fromTime, + Date toTime, + boolean oldestFirst, + boolean forLineage, + boolean forDuplicateProcessing, + Date effectiveTime, + int startFrom, + int pageSize) throws InvalidParameterException, + UserNotAuthorizedException, + PropertyServerException; /** @@ -358,21 +355,21 @@ List getMetadataElementHistory(String userId, * @throws UserNotAuthorizedException the userId is not permitted to perform this operation * @throws PropertyServerException there is a problem accessing the metadata store */ - List getMetadataElementRelationships(String userId, - String metadataElementAtEnd1GUID, - String metadataElementAtEnd2GUID, - String relationshipTypeName, - List limitResultsByStatus, - Date asOfTime, - String sequencingProperty, - SequencingOrder sequencingOrder, - boolean forLineage, - boolean forDuplicateProcessing, - Date effectiveTime, - int startFrom, - int pageSize) throws InvalidParameterException, - UserNotAuthorizedException, - PropertyServerException; + OpenMetadataRelationshipList getMetadataElementRelationships(String userId, + String metadataElementAtEnd1GUID, + String metadataElementAtEnd2GUID, + String relationshipTypeName, + List limitResultsByStatus, + Date asOfTime, + String sequencingProperty, + SequencingOrder sequencingOrder, + boolean forLineage, + boolean forDuplicateProcessing, + Date effectiveTime, + int startFrom, + int pageSize) throws InvalidParameterException, + UserNotAuthorizedException, + PropertyServerException; /** @@ -443,20 +440,20 @@ List findMetadataElements(String userId, * @throws UserNotAuthorizedException the userId is not permitted to perform this operation * @throws PropertyServerException there is a problem accessing the metadata store */ - List findRelationshipsBetweenMetadataElements(String userId, - String relationshipTypeName, - SearchProperties searchProperties, - List limitResultsByStatus, - Date asOfTime, - String sequencingProperty, - SequencingOrder sequencingOrder, - boolean forLineage, - boolean forDuplicateProcessing, - Date effectiveTime, - int startFrom, - int pageSize) throws InvalidParameterException, - UserNotAuthorizedException, - PropertyServerException; + OpenMetadataRelationshipList findRelationshipsBetweenMetadataElements(String userId, + String relationshipTypeName, + SearchProperties searchProperties, + List limitResultsByStatus, + Date asOfTime, + String sequencingProperty, + SequencingOrder sequencingOrder, + boolean forLineage, + boolean forDuplicateProcessing, + Date effectiveTime, + int startFrom, + int pageSize) throws InvalidParameterException, + UserNotAuthorizedException, + PropertyServerException; /** @@ -480,8 +477,8 @@ OpenMetadataRelationship getRelationshipByGUID(String userId, boolean forDuplicateProcessing, Date asOfTime, Date effectiveTime) throws InvalidParameterException, - UserNotAuthorizedException, - PropertyServerException; + UserNotAuthorizedException, + PropertyServerException; /** @@ -503,18 +500,18 @@ OpenMetadataRelationship getRelationshipByGUID(String userId, * @throws UserNotAuthorizedException the userId is not permitted to perform this operation. * @throws PropertyServerException there is a problem accessing the metadata store */ - List getRelationshipHistory(String userId, - String relationshipGUID, - Date fromTime, - Date toTime, - boolean oldestFirst, - boolean forLineage, - boolean forDuplicateProcessing, - Date effectiveTime, - int startFrom, - int pageSize) throws InvalidParameterException, - UserNotAuthorizedException, - PropertyServerException; + OpenMetadataRelationshipList getRelationshipHistory(String userId, + String relationshipGUID, + Date fromTime, + Date toTime, + boolean oldestFirst, + boolean forLineage, + boolean forDuplicateProcessing, + Date effectiveTime, + int startFrom, + int pageSize) throws InvalidParameterException, + UserNotAuthorizedException, + PropertyServerException; /** diff --git a/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/client/OpenMetadataClient.java b/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/client/OpenMetadataClient.java index 5181c19f00..e48e7a391a 100644 --- a/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/client/OpenMetadataClient.java +++ b/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/client/OpenMetadataClient.java @@ -457,7 +457,7 @@ public abstract List findMetadataElementsWithString(String * @throws PropertyServerException there is a problem accessing the metadata store */ @Override - public abstract List getRelatedMetadataElements(String userId, + public abstract RelatedMetadataElementList getRelatedMetadataElements(String userId, String elementGUID, int startingAtEnd, String relationshipTypeName, @@ -593,7 +593,7 @@ public abstract List getMetadataElementHistory(String use * @throws PropertyServerException there is a problem accessing the metadata store */ @Override - public abstract List getMetadataElementRelationships(String userId, + public abstract OpenMetadataRelationshipList getMetadataElementRelationships(String userId, String metadataElementAtEnd1GUID, String metadataElementAtEnd2GUID, String relationshipTypeName, @@ -680,7 +680,7 @@ public abstract List findMetadataElements(String * @throws PropertyServerException there is a problem accessing the metadata store */ @Override - public abstract List findRelationshipsBetweenMetadataElements(String userId, + public abstract OpenMetadataRelationshipList findRelationshipsBetweenMetadataElements(String userId, String relationshipTypeName, SearchProperties searchProperties, List limitResultsByStatus, @@ -741,7 +741,7 @@ public abstract OpenMetadataRelationship getRelationshipByGUID(String userId, * @throws PropertyServerException there is a problem accessing the metadata store */ @Override - public abstract List getRelationshipHistory(String userId, + public abstract OpenMetadataRelationshipList getRelationshipHistory(String userId, String relationshipGUID, Date fromTime, Date toTime, diff --git a/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/converters/MetadataRelationshipSummaryConverter.java b/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/converters/MetadataRelationshipSummaryConverter.java index 17d718c04a..053b8ceb8e 100644 --- a/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/converters/MetadataRelationshipSummaryConverter.java +++ b/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/converters/MetadataRelationshipSummaryConverter.java @@ -4,6 +4,7 @@ import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataRelationship; +import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataRelationshipList; import org.odpi.openmetadata.frameworks.governanceaction.search.PropertyHelper; import org.odpi.openmetadata.frameworks.openmetadata.metadataelements.ElementHeader; import org.odpi.openmetadata.frameworks.openmetadata.metadataelements.MetadataRelationshipSummary; @@ -92,9 +93,9 @@ public B getNewRelatedMetadataElementsBean(Class beanClass, * @return bean populated with properties from the instances supplied * @throws PropertyServerException there is a problem instantiating the bean */ - public List getNewBeans(Class beanClass, - List openMetadataRelationships, - String methodName) throws PropertyServerException + public List getNewBeans(Class beanClass, + OpenMetadataRelationshipList openMetadataRelationships, + String methodName) throws PropertyServerException { List results = null; @@ -102,7 +103,7 @@ public List getNewBeans(Class beanClass, { results = new ArrayList<>(); - for (OpenMetadataRelationship openMetadataElement : openMetadataRelationships) + for (OpenMetadataRelationship openMetadataElement : openMetadataRelationships.getElementList()) { if (openMetadataElement != null) { diff --git a/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/converters/OpenMetadataConverterBase.java b/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/converters/OpenMetadataConverterBase.java index 9894e7e017..5b90353fbf 100644 --- a/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/converters/OpenMetadataConverterBase.java +++ b/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/converters/OpenMetadataConverterBase.java @@ -3,16 +3,13 @@ package org.odpi.openmetadata.frameworks.governanceaction.converters; import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; +import org.odpi.openmetadata.frameworks.governanceaction.properties.*; import org.odpi.openmetadata.frameworks.openmetadata.enums.ToDoStatus; import org.odpi.openmetadata.frameworks.openmetadata.metadataelements.*; import org.odpi.openmetadata.frameworks.governanceaction.ffdc.GAFErrorCode; -import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataRelationship; import org.odpi.openmetadata.frameworks.openmetadata.properties.RelationshipProperties; import org.odpi.openmetadata.frameworks.openmetadata.types.OpenMetadataProperty; import org.odpi.openmetadata.frameworks.openmetadata.types.OpenMetadataType; -import org.odpi.openmetadata.frameworks.governanceaction.properties.AttachedClassification; -import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataElement; -import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElement; import org.odpi.openmetadata.frameworks.governanceaction.search.ElementProperties; import org.odpi.openmetadata.frameworks.governanceaction.search.PropertyHelper; @@ -119,10 +116,10 @@ public B getNewBean(Class beanClass, * @throws PropertyServerException there is a problem instantiating the bean */ @SuppressWarnings(value = "unused") - public B getNewBean(Class beanClass, - OpenMetadataElement element, + public B getNewBean(Class beanClass, + OpenMetadataElement element, OpenMetadataRelationship relationship, - String methodName) throws PropertyServerException + String methodName) throws PropertyServerException { final String thisMethodName = "getNewBean(element, relationship)"; @@ -132,6 +129,37 @@ public B getNewBean(Class beanClass, } + /** + * Using the supplied instances, return a new instance of the bean. It is used for beans such as + * an Annotation or To Do bean which combine knowledge from the element and its linked relationships. + * + * @param beanClass name of the class to create + * @param primaryElement element that is the root of the collection of entities that make up the + * content of the bean + * @param relationships relationships linking the entities + * @param methodName calling method + * @return bean populated with properties from the instances supplied + * @throws PropertyServerException there is a problem instantiating the bean + */ + @SuppressWarnings(value = "unused") + public B getNewComplexBean(Class beanClass, + OpenMetadataElement primaryElement, + RelatedMetadataElementList relationships, + String methodName) throws PropertyServerException + { + final String thisMethodName = "getNewComplexBean"; + + if (relationships != null) + { + return getNewComplexBean(beanClass, primaryElement, relationships.getElementList(), methodName); + } + else + { + return getNewComplexBean(beanClass, primaryElement, (List)null, methodName); + } + } + + /** * Using the supplied instances, return a new instance of the bean. It is used for beans such as * an Annotation or To Do bean which combine knowledge from the element and its linked relationships. @@ -222,12 +250,12 @@ public B getNewRelatedMetadataElementsBean(Class beanClass, * @return bean populated with properties from the instances supplied * @throws PropertyServerException there is a problem instantiating the bean */ - public B getNewSchemaAttributeBean(Class beanClass, - OpenMetadataElement schemaAttributeElement, - Class typeClass, - T schemaType, + public B getNewSchemaAttributeBean(Class beanClass, + OpenMetadataElement schemaAttributeElement, + Class typeClass, + T schemaType, List schemaAttributeOpenMetadataElements, - String methodName) throws PropertyServerException + String methodName) throws PropertyServerException { final String thisMethodName = "getNewSchemaAttributeBean"; diff --git a/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/converters/RelatedMetadataElementSummaryConverter.java b/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/converters/RelatedMetadataElementSummaryConverter.java index acb24e3e43..90e3de073f 100644 --- a/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/converters/RelatedMetadataElementSummaryConverter.java +++ b/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/converters/RelatedMetadataElementSummaryConverter.java @@ -3,8 +3,8 @@ package org.odpi.openmetadata.frameworks.governanceaction.converters; import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; -import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataElement; import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElement; +import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElementList; import org.odpi.openmetadata.frameworks.governanceaction.search.PropertyHelper; import org.odpi.openmetadata.frameworks.openmetadata.metadataelements.ElementHeader; import org.odpi.openmetadata.frameworks.openmetadata.metadataelements.MetadataElementSummary; @@ -104,7 +104,7 @@ public B getNewBean(Class beanClass, * @throws PropertyServerException there is a problem instantiating the bean */ public List getNewBeans(Class beanClass, - List relatedMetadataElements, + RelatedMetadataElementList relatedMetadataElements, String methodName) throws PropertyServerException { List results = null; @@ -113,7 +113,7 @@ public List getNewBeans(Class beanClass, { results = new ArrayList<>(); - for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements) + for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements.getElementList()) { if (relatedMetadataElement != null) { diff --git a/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/properties/OpenMetadataElementGraph.java b/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/properties/OpenMetadataElementGraph.java index 709e02f3a4..d1ccba2a11 100644 --- a/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/properties/OpenMetadataElementGraph.java +++ b/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/properties/OpenMetadataElementGraph.java @@ -53,7 +53,7 @@ public OpenMetadataElementGraph(OpenMetadataElementGraph template) { anchoredElements = template.getAnchoredElements(); relationships = template.getRelationships(); - mermaidGraph = getMermaidGraph(); + mermaidGraph = template.getMermaidGraph(); } } diff --git a/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/properties/OpenMetadataRelationshipList.java b/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/properties/OpenMetadataRelationshipList.java new file mode 100644 index 0000000000..866b053ad3 --- /dev/null +++ b/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/properties/OpenMetadataRelationshipList.java @@ -0,0 +1,156 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* Copyright Contributors to the ODPi Egeria project. */ + +package org.odpi.openmetadata.frameworks.governanceaction.properties; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; + +/** + * OpenMetadataRelationshipList is for passing back a list of GAF OpenMetadataRelationship + * or an exception if the request failed. + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public class OpenMetadataRelationshipList +{ + private List elementList = null; + private String mermaidGraph = null; + + + /** + * Default constructor + */ + public OpenMetadataRelationshipList() + { + } + + + /** + * Copy/clone constructor + * + * @param template object to copy + */ + public OpenMetadataRelationshipList(OpenMetadataRelationshipList template) + { + if (template != null) + { + elementList = template.getElementList(); + mermaidGraph = template.getMermaidGraph(); + } + } + + + /** + * Return the list of metadata elements. + * + * @return result object + */ + public List getElementList() + { + if (elementList == null) + { + return null; + } + else if (elementList.isEmpty()) + { + return null; + } + else + { + return new ArrayList<>(elementList); + } + } + + + /** + * Set up the metadata element to return. + * + * @param elementList result object + */ + public void setElementList(List elementList) + { + this.elementList = elementList; + } + + + /** + * Return the mermaid string used to render a graph. + * + * @return string in Mermaid markdown + */ + public String getMermaidGraph() + { + return mermaidGraph; + } + + + /** + * Set up mermaid string used to render a graph. + * + * @param mermaidGraph string in Mermaid markdown + */ + public void setMermaidGraph(String mermaidGraph) + { + this.mermaidGraph = mermaidGraph; + } + + + /** + * JSON-style toString + * + * @return return string containing the property names and values + */ + @Override + public String toString() + { + return "OpenMetadataRelationshipList{" + + "elementList=" + elementList + + ", mermaidGraph='" + mermaidGraph + '\'' + + '}'; + } + + + /** + * Return comparison result based on the content of the properties. + * + * @param objectToCompare test object + * @return result of comparison + */ + @Override + public boolean equals(Object objectToCompare) + { + if (this == objectToCompare) + { + return true; + } + if (objectToCompare == null || getClass() != objectToCompare.getClass()) + { + return false; + } + OpenMetadataRelationshipList that = (OpenMetadataRelationshipList) objectToCompare; + return Objects.equals(elementList, that.elementList) && + Objects.equals(mermaidGraph, that.mermaidGraph); + } + + + /** + * Return hash code for this object + * + * @return int hash code + */ + @Override + public int hashCode() + { + return Objects.hash(elementList, mermaidGraph); + } +} diff --git a/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/properties/RelatedMetadataElementList.java b/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/properties/RelatedMetadataElementList.java new file mode 100644 index 0000000000..98aac798f0 --- /dev/null +++ b/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/properties/RelatedMetadataElementList.java @@ -0,0 +1,156 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* Copyright Contributors to the ODPi Egeria project. */ + +package org.odpi.openmetadata.frameworks.governanceaction.properties; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; + +/** + * OpenMetadataRelationshipList is a response object for passing back a list of GAF OpenMetadataRelationship + * or an exception if the request failed. + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public class RelatedMetadataElementList +{ + private List elementList = null; + private String mermaidGraph = null; + + + /** + * Default constructor + */ + public RelatedMetadataElementList() + { + } + + + /** + * Copy/clone constructor + * + * @param template object to copy + */ + public RelatedMetadataElementList(RelatedMetadataElementList template) + { + if (template != null) + { + elementList = template.getElementList(); + mermaidGraph = template.getMermaidGraph(); + } + } + + + /** + * Return the list of metadata elements. + * + * @return result object + */ + public List getElementList() + { + if (elementList == null) + { + return null; + } + else if (elementList.isEmpty()) + { + return null; + } + else + { + return new ArrayList<>(elementList); + } + } + + + /** + * Set up the metadata element to return. + * + * @param elementList result object + */ + public void setElementList(List elementList) + { + this.elementList = elementList; + } + + + /** + * Return the mermaid string used to render a graph. + * + * @return string in Mermaid markdown + */ + public String getMermaidGraph() + { + return mermaidGraph; + } + + + /** + * Set up mermaid string used to render a graph. + * + * @param mermaidGraph string in Mermaid markdown + */ + public void setMermaidGraph(String mermaidGraph) + { + this.mermaidGraph = mermaidGraph; + } + + + /** + * JSON-style toString + * + * @return return string containing the property names and values + */ + @Override + public String toString() + { + return "RelatedMetadataElementList{" + + "elementList=" + elementList + + ", mermaidGraph='" + mermaidGraph + '\'' + + '}'; + } + + + /** + * Return comparison result based on the content of the properties. + * + * @param objectToCompare test object + * @return result of comparison + */ + @Override + public boolean equals(Object objectToCompare) + { + if (this == objectToCompare) + { + return true; + } + if (objectToCompare == null || getClass() != objectToCompare.getClass()) + { + return false; + } + RelatedMetadataElementList that = (RelatedMetadataElementList) objectToCompare; + return Objects.equals(elementList, that.elementList) && + Objects.equals(mermaidGraph, that.mermaidGraph); + } + + + /** + * Return hash code for this object + * + * @return int hash code + */ + @Override + public int hashCode() + { + return Objects.hash(elementList, mermaidGraph); + } +} diff --git a/open-metadata-implementation/frameworks/open-integration-framework/src/main/java/org/odpi/openmetadata/frameworks/integration/iterator/RelatedElementsIterator.java b/open-metadata-implementation/frameworks/open-integration-framework/src/main/java/org/odpi/openmetadata/frameworks/integration/iterator/RelatedElementsIterator.java index e919880412..b48f628617 100644 --- a/open-metadata-implementation/frameworks/open-integration-framework/src/main/java/org/odpi/openmetadata/frameworks/integration/iterator/RelatedElementsIterator.java +++ b/open-metadata-implementation/frameworks/open-integration-framework/src/main/java/org/odpi/openmetadata/frameworks/integration/iterator/RelatedElementsIterator.java @@ -9,6 +9,7 @@ import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException; import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataElement; import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElement; +import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElementList; import org.odpi.openmetadata.frameworks.integration.context.OpenMetadataAccess; import org.odpi.openmetadata.frameworks.openmetadata.enums.PermittedSynchronization; @@ -91,12 +92,19 @@ protected boolean fillCache() throws InvalidParameterException, { if ((elementCache == null) || (elementCache.isEmpty())) { - List relatedMetadataElementList = openMetadataAccess.getRelatedMetadataElements(parentGUID, - parentAtEnd, - parentRelationshipTypeName, - startFrom, - maxPageSize); - elementCache = this.getElementCache(relatedMetadataElementList); + RelatedMetadataElementList relatedMetadataElementList = openMetadataAccess.getRelatedMetadataElements(parentGUID, + parentAtEnd, + parentRelationshipTypeName, + startFrom, + maxPageSize); + if (relatedMetadataElementList != null) + { + elementCache = this.getElementCache(relatedMetadataElementList.getElementList()); + } + else + { + elementCache = null; + } startFrom = startFrom + maxPageSize; } diff --git a/open-metadata-implementation/frameworks/survey-action-framework/src/main/java/org/odpi/openmetadata/frameworks/surveyaction/AnnotationStore.java b/open-metadata-implementation/frameworks/survey-action-framework/src/main/java/org/odpi/openmetadata/frameworks/surveyaction/AnnotationStore.java index d9b1497c62..a806a6c06d 100644 --- a/open-metadata-implementation/frameworks/survey-action-framework/src/main/java/org/odpi/openmetadata/frameworks/surveyaction/AnnotationStore.java +++ b/open-metadata-implementation/frameworks/survey-action-framework/src/main/java/org/odpi/openmetadata/frameworks/surveyaction/AnnotationStore.java @@ -2,6 +2,7 @@ /* Copyright Contributors to the ODPi Egeria project. */ package org.odpi.openmetadata.frameworks.surveyaction; +import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElementList; import org.odpi.openmetadata.frameworks.openmetadata.enums.SequencingOrder; import org.odpi.openmetadata.frameworks.openmetadata.types.OpenMetadataProperty; import org.odpi.openmetadata.frameworks.openmetadata.types.OpenMetadataType; @@ -548,19 +549,19 @@ public List getAnnotationsForElement(String elementGUID, { final String methodName = "getAnnotationsForElement"; - List relatedMetadataElements = openMetadataStore.getRelatedMetadataElements(userId, - elementGUID, - 1, - OpenMetadataType.ASSOCIATED_ANNOTATION_RELATIONSHIP.typeName, - null, - null, - null, - SequencingOrder.CREATION_DATE_RECENT, - forLineage, - forDuplicateProcessing, - getEffectiveTime(), - startingFrom, - maximumResults); + RelatedMetadataElementList relatedMetadataElements = openMetadataStore.getRelatedMetadataElements(userId, + elementGUID, + 1, + OpenMetadataType.ASSOCIATED_ANNOTATION_RELATIONSHIP.typeName, + null, + null, + null, + SequencingOrder.CREATION_DATE_RECENT, + forLineage, + forDuplicateProcessing, + getEffectiveTime(), + startingFrom, + maximumResults); return this.getRelatedAnnotationBeans(relatedMetadataElements, methodName); } @@ -584,7 +585,7 @@ public List getNewAnnotations(int startingFrom, { final String methodName = "getNewAnnotations"; - List relatedMetadataElements = openMetadataStore.getRelatedMetadataElements(userId, + RelatedMetadataElementList relatedMetadataElements = openMetadataStore.getRelatedMetadataElements(userId, surveyReportGUID, 1, OpenMetadataType.REPORTED_ANNOTATION_RELATIONSHIP.typeName, @@ -623,7 +624,7 @@ public List getExtendedAnnotations(String annotationGUID, { final String methodName = "getExtendedAnnotations"; - List relatedMetadataElements = openMetadataStore.getRelatedMetadataElements(userId, + RelatedMetadataElementList relatedMetadataElements = openMetadataStore.getRelatedMetadataElements(userId, annotationGUID, 1, OpenMetadataType.ANNOTATION_EXTENSION_RELATIONSHIP.typeName, @@ -1031,8 +1032,8 @@ private List getAnnotationBeans(List openMetada * @throws UserNotAuthorizedException insufficient authorization * @throws PropertyServerException there is a problem instantiating the bean */ - private List getRelatedAnnotationBeans(List openMetadataElements, - String methodName) throws PropertyServerException, + private List getRelatedAnnotationBeans(RelatedMetadataElementList openMetadataElements, + String methodName) throws PropertyServerException, InvalidParameterException, UserNotAuthorizedException { @@ -1040,7 +1041,7 @@ private List getRelatedAnnotationBeans(List { List annotations = new ArrayList<>(); - for (RelatedMetadataElement openMetadataElement : openMetadataElements) + for (RelatedMetadataElement openMetadataElement : openMetadataElements.getElementList()) { annotations.add(this.getAnnotationBean(openMetadataElement.getElement(), methodName)); } @@ -1070,7 +1071,7 @@ private Annotation getAnnotationBean(OpenMetadataElement annotationElement, { if (annotationElement != null) { - List relationships = openMetadataStore.getRelatedMetadataElements(userId, + RelatedMetadataElementList relationships = openMetadataStore.getRelatedMetadataElements(userId, annotationElement.getElementGUID(), 0, null, @@ -1083,10 +1084,20 @@ private Annotation getAnnotationBean(OpenMetadataElement annotationElement, this.getEffectiveTime(), 0, 0); - return converter.getAnnotationBean(Annotation.class, - annotationElement, - relationships, - methodName); + if (relationships != null) + { + return converter.getAnnotationBean(Annotation.class, + annotationElement, + relationships.getElementList(), + methodName); + } + else + { + return converter.getAnnotationBean(Annotation.class, + annotationElement, + null, + methodName); + } } return null; diff --git a/open-metadata-implementation/frameworks/survey-action-framework/src/main/java/org/odpi/openmetadata/frameworks/surveyaction/converters/SurveyReportConverter.java b/open-metadata-implementation/frameworks/survey-action-framework/src/main/java/org/odpi/openmetadata/frameworks/surveyaction/converters/SurveyReportConverter.java index 2522741b2e..7ac3f1c207 100644 --- a/open-metadata-implementation/frameworks/survey-action-framework/src/main/java/org/odpi/openmetadata/frameworks/surveyaction/converters/SurveyReportConverter.java +++ b/open-metadata-implementation/frameworks/survey-action-framework/src/main/java/org/odpi/openmetadata/frameworks/surveyaction/converters/SurveyReportConverter.java @@ -4,6 +4,7 @@ import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; import org.odpi.openmetadata.frameworks.governanceaction.converters.OpenMetadataConverterBase; +import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElementList; import org.odpi.openmetadata.frameworks.openmetadata.types.OpenMetadataType; import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataElement; import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElement; @@ -11,8 +12,6 @@ import org.odpi.openmetadata.frameworks.governanceaction.search.PropertyHelper; import org.odpi.openmetadata.frameworks.surveyaction.properties.SurveyReport; -import java.util.List; - /** * SurveyReportConverter converts GAF elements into a survey report bean. @@ -47,7 +46,7 @@ public SurveyReportConverter(PropertyHelper propertyHelper, */ public SurveyReport getSurveyReport(Class beanClass, OpenMetadataElement primaryElement, - List relationships, + RelatedMetadataElementList relationships, String methodName) throws PropertyServerException { if (propertyHelper.isTypeOf(primaryElement, OpenMetadataType.SURVEY_REPORT.typeName)) @@ -79,7 +78,7 @@ public SurveyReport getSurveyReport(Class beanClass, if (relationships != null) { - for (RelatedMetadataElement relationship : relationships) + for (RelatedMetadataElement relationship : relationships.getElementList()) { if (relationship != null) { 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 d1a6591206..d8a5208fcc 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 @@ -9,12 +9,9 @@ import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException; +import org.odpi.openmetadata.frameworks.governanceaction.properties.*; import org.odpi.openmetadata.frameworks.governanceaction.search.PropertyComparisonOperator; import org.odpi.openmetadata.frameworks.openmetadata.enums.ElementStatus; -import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataElement; -import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataRelationship; -import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElement; -import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElementStub; import org.odpi.openmetadata.frameworks.governanceaction.search.ElementProperties; import org.odpi.openmetadata.frameworks.governanceaction.search.PropertyHelper; import org.odpi.openmetadata.frameworks.openmetadata.enums.SequencingOrder; @@ -170,25 +167,25 @@ private RelatedMetadataElement getFeedbackForUser(String userId, UserNotAuthorizedException { int startFrom = 0; - List attachedFeedbacks = client.getRelatedMetadataElements(userId, - elementGUID, - 1, - relationshipTypeName, - null, - null, - null, - SequencingOrder.CREATION_DATE_RECENT, - false, - false, - effectiveTime, - startFrom, - invalidParameterHandler.getMaxPagingSize()); + RelatedMetadataElementList attachedFeedbacks = client.getRelatedMetadataElements(userId, + elementGUID, + 1, + relationshipTypeName, + null, + null, + null, + SequencingOrder.CREATION_DATE_RECENT, + false, + false, + effectiveTime, + startFrom, + invalidParameterHandler.getMaxPagingSize()); RelatedMetadataElement existingFeedback = null; while ((existingFeedback == null) && (attachedFeedbacks != null)) { - for (RelatedMetadataElement attachedFeedback : attachedFeedbacks) + for (RelatedMetadataElement attachedFeedback : attachedFeedbacks.getElementList()) { if (attachedFeedback != null) { @@ -328,7 +325,7 @@ public List getAttachedRatings(String userId, { final String methodName = "getAttachedRatings"; - List relatedMetadataElements = client.getRelatedMetadataElements(userId, + RelatedMetadataElementList relatedMetadataElements = client.getRelatedMetadataElements(userId, elementGUID, 1, OpenMetadataType.ATTACHED_RATING_RELATIONSHIP.typeName, @@ -353,14 +350,14 @@ public List getAttachedRatings(String userId, * @return feedback beans * @throws PropertyServerException error formatting bean */ - private List getRatingsFromRelatedMetadataElement(List relatedMetadataElements, - String methodName) throws PropertyServerException + private List getRatingsFromRelatedMetadataElement(RelatedMetadataElementList relatedMetadataElements, + String methodName) throws PropertyServerException { if (relatedMetadataElements != null) { List results = new ArrayList<>(); - for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements) + for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements.getElementList()) { if (relatedMetadataElement != null) { @@ -461,7 +458,7 @@ public List getAttachedLikes(String userId, { final String methodName = "getAttachedLikes"; - List relatedMetadataElements = client.getRelatedMetadataElements(userId, + RelatedMetadataElementList relatedMetadataElements = client.getRelatedMetadataElements(userId, elementGUID, 1, OpenMetadataType.ATTACHED_LIKE_RELATIONSHIP.typeName, @@ -486,14 +483,14 @@ public List getAttachedLikes(String userId, * @return feedback beans * @throws PropertyServerException error formatting bean */ - private List getLikesFromRelatedMetadataElement(List relatedMetadataElements, - String methodName) throws PropertyServerException + private List getLikesFromRelatedMetadataElement(RelatedMetadataElementList relatedMetadataElements, + String methodName) throws PropertyServerException { if (relatedMetadataElements != null) { List results = new ArrayList<>(); - for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements) + for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements.getElementList()) { if (relatedMetadataElement != null) { @@ -706,7 +703,7 @@ public void updateCommentVisibility(String userId, OpenMetadataProperty.IS_PUBLIC.name, isPublic); - List relationships = client.getMetadataElementRelationships(userId, + OpenMetadataRelationshipList relationships = client.getMetadataElementRelationships(userId, parentGUID, commentGUID, OpenMetadataType.ATTACHED_COMMENT_RELATIONSHIP.typeName, @@ -722,7 +719,7 @@ public void updateCommentVisibility(String userId, if (relationships != null) { - for (OpenMetadataRelationship relationship : relationships) + for (OpenMetadataRelationship relationship : relationships.getElementList()) { if (relationship != null) { @@ -798,7 +795,7 @@ public void clearAcceptedAnswer(String userId, UserNotAuthorizedException, PropertyServerException { - List relationships = client.getMetadataElementRelationships(userId, + OpenMetadataRelationshipList relationships = client.getMetadataElementRelationships(userId, questionCommentGUID, answerCommentGUID, OpenMetadataType.ACCEPTED_ANSWER_RELATIONSHIP.typeName, @@ -814,7 +811,7 @@ public void clearAcceptedAnswer(String userId, if (relationships != null) { - for (OpenMetadataRelationship relationship : relationships) + for (OpenMetadataRelationship relationship : relationships.getElementList()) { if (relationship != null) { @@ -912,7 +909,7 @@ public List getAttachedComments(String userId, { final String methodName = "getAttachedComments"; - List relatedMetadataElements = client.getRelatedMetadataElements(userId, + RelatedMetadataElementList relatedMetadataElements = client.getRelatedMetadataElements(userId, elementGUID, 1, OpenMetadataType.ATTACHED_COMMENT_RELATIONSHIP.typeName, @@ -937,14 +934,14 @@ public List getAttachedComments(String userId, * @return feedback beans * @throws PropertyServerException error formatting bean */ - private List getCommentsFromRelatedMetadataElement(List relatedMetadataElements, - String methodName) throws PropertyServerException + private List getCommentsFromRelatedMetadataElement(RelatedMetadataElementList relatedMetadataElements, + String methodName) throws PropertyServerException { if (relatedMetadataElements != null) { List results = new ArrayList<>(); - for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements) + for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements.getElementList()) { if (relatedMetadataElement != null) { @@ -1403,7 +1400,7 @@ public void removeTagFromElement(String userId, PropertyServerException, UserNotAuthorizedException { - List relationships = client.getMetadataElementRelationships(userId, + OpenMetadataRelationshipList relationships = client.getMetadataElementRelationships(userId, elementGUID, tagGUID, OpenMetadataType.ATTACHED_TAG_RELATIONSHIP.typeName, @@ -1419,7 +1416,7 @@ public void removeTagFromElement(String userId, if (relationships != null) { - for (OpenMetadataRelationship relationship : relationships) + for (OpenMetadataRelationship relationship : relationships.getElementList()) { if (relationship != null) { @@ -1458,7 +1455,7 @@ public List getElementsByTag(String userId, PropertyServerException, UserNotAuthorizedException { - List relatedMetadataElements = client.getRelatedMetadataElements(userId, + RelatedMetadataElementList relatedMetadataElements = client.getRelatedMetadataElements(userId, tagGUID, 2, OpenMetadataType.ATTACHED_TAG_RELATIONSHIP.typeName, @@ -1476,7 +1473,7 @@ public List getElementsByTag(String userId, { List stubs = new ArrayList<>(); - for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements) + for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements.getElementList()) { if (relatedMetadataElement != null) { @@ -1517,7 +1514,7 @@ public List getAttachedTags(String userId, { final String methodName = "getAttachedTags"; - List relatedMetadataElements = client.getRelatedMetadataElements(userId, + RelatedMetadataElementList relatedMetadataElements = client.getRelatedMetadataElements(userId, elementGUID, 1, OpenMetadataType.ATTACHED_TAG_RELATIONSHIP.typeName, @@ -1542,14 +1539,14 @@ public List getAttachedTags(String userId, * @return feedback beans * @throws PropertyServerException error formatting bean */ - private List getTagsFromRelatedMetadataElement(List relatedMetadataElements, - String methodName) throws PropertyServerException + private List getTagsFromRelatedMetadataElement(RelatedMetadataElementList relatedMetadataElements, + String methodName) throws PropertyServerException { if (relatedMetadataElements != null) { List results = new ArrayList<>(); - for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements) + for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements.getElementList()) { if (relatedMetadataElement != null) { @@ -1792,14 +1789,14 @@ private List getNoteLogsFromOpenMetadataElement(List getNoteLogsFromRelatedMetadataElements(List relatedMetadataElements, + private List getNoteLogsFromRelatedMetadataElements(RelatedMetadataElementList relatedMetadataElements, String methodName) throws PropertyServerException { if (relatedMetadataElements != null) { List results = new ArrayList<>(); - for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements) + for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements.getElementList()) { if (relatedMetadataElement != null) { @@ -1897,7 +1894,7 @@ public List getNoteLogsForElement(String userId, { final String methodName = "getNoteLogsForElement"; - List relatedMetadataElements = client.getRelatedMetadataElements(userId, + RelatedMetadataElementList relatedMetadataElements = client.getRelatedMetadataElements(userId, elementGUID, 1, OpenMetadataType.ATTACHED_NOTE_LOG_RELATIONSHIP.typeName, @@ -2173,14 +2170,14 @@ private List getNotesFromOpenMetadataElement(List getNotesFromRelatedMetadataElements(List relatedMetadataElements, - String methodName) throws PropertyServerException + private List getNotesFromRelatedMetadataElements(RelatedMetadataElementList relatedMetadataElements, + String methodName) throws PropertyServerException { if (relatedMetadataElements != null) { List results = new ArrayList<>(); - for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements) + for (RelatedMetadataElement relatedMetadataElement : relatedMetadataElements.getElementList()) { if (relatedMetadataElement != null) { @@ -2220,7 +2217,7 @@ public List getNotesForNoteLog(String userId, { final String methodName = "getNotesForNoteLog"; - List relatedMetadataElements = client.getRelatedMetadataElements(userId, + RelatedMetadataElementList relatedMetadataElements = client.getRelatedMetadataElements(userId, noteLogGUID, 1, OpenMetadataType.ATTACHED_NOTE_LOG_ENTRY_RELATIONSHIP.typeName, diff --git a/open-metadata-implementation/view-server-generic-services/metadata-explorer/Egeria-metadata-explorer-omvs.http b/open-metadata-implementation/view-server-generic-services/metadata-explorer/Egeria-metadata-explorer-omvs.http index c20086a524..901b8aaf3f 100644 --- a/open-metadata-implementation/view-server-generic-services/metadata-explorer/Egeria-metadata-explorer-omvs.http +++ b/open-metadata-implementation/view-server-generic-services/metadata-explorer/Egeria-metadata-explorer-omvs.http @@ -43,7 +43,7 @@ Content-Type: application/json ### # @name get the GUID for active-metadata-store # Retrieve the metadata element using its unique identifier. -POST {{baseURL}}/servers/{{viewServer}}/api/open-metadata/metadata-explorer/metadata-elements/guid-by-unique-name +POST {{baseURL}}/servers/{{viewServer}}/api/open-metadata/runtime-manager/metadata-elements/guid-by-unique-name Authorization: Bearer {{token}} Content-Type: application/json @@ -82,7 +82,7 @@ content-packs/CloudInformationModel.omarchive ### -@elementGUID=e564900d-277f-425d-b008-885b1928eb2f +@elementGUID=6204f340-d7fd-4cc8-922a-8851fb889dc2 ### # @name getMetadataElementByGUID @@ -264,8 +264,8 @@ Content-Type: application/json ### -@metadataElementAtEnd1GUID=add guid here -@metadataElementAtEnd2GUID=add guid here +@metadataElementAtEnd1GUID=6204f340-d7fd-4cc8-922a-8851fb889dc2 +@metadataElementAtEnd2GUID=bd8de890-fa79-4c24-aab8-20b41b5893dd ### # @name getAllMetadataElementRelationships diff --git a/open-metadata-implementation/view-server-generic-services/metadata-explorer/metadata-explorer-server/src/main/java/org/odpi/openmetadata/viewservices/metadataexplorer/server/MetadataExplorerRESTServices.java b/open-metadata-implementation/view-server-generic-services/metadata-explorer/metadata-explorer-server/src/main/java/org/odpi/openmetadata/viewservices/metadataexplorer/server/MetadataExplorerRESTServices.java index dba620aa26..71d65028b9 100644 --- a/open-metadata-implementation/view-server-generic-services/metadata-explorer/metadata-explorer-server/src/main/java/org/odpi/openmetadata/viewservices/metadataexplorer/server/MetadataExplorerRESTServices.java +++ b/open-metadata-implementation/view-server-generic-services/metadata-explorer/metadata-explorer-server/src/main/java/org/odpi/openmetadata/viewservices/metadataexplorer/server/MetadataExplorerRESTServices.java @@ -435,35 +435,35 @@ public RelatedMetadataElementListResponse getRelatedMetadataElements(String if (requestBody != null) { - response.setElementList(handler.getRelatedMetadataElements(userId, - elementGUID, - startingAtEnd, - relationshipTypeName, - requestBody.getLimitResultsByStatus(), - requestBody.getAsOfTime(), - requestBody.getSequencingProperty(), - requestBody.getSequencingOrder(), - forLineage, - forDuplicateProcessing, - requestBody.getEffectiveTime(), - startFrom, - pageSize)); + response.setRelatedElementList(handler.getRelatedMetadataElements(userId, + elementGUID, + startingAtEnd, + relationshipTypeName, + requestBody.getLimitResultsByStatus(), + requestBody.getAsOfTime(), + requestBody.getSequencingProperty(), + requestBody.getSequencingOrder(), + forLineage, + forDuplicateProcessing, + requestBody.getEffectiveTime(), + startFrom, + pageSize)); } else { - response.setElementList(handler.getRelatedMetadataElements(userId, - elementGUID, - startingAtEnd, - relationshipTypeName, - null, - null, - null, - SequencingOrder.CREATION_DATE_RECENT, - forLineage, - forDuplicateProcessing, - null, - startFrom, - pageSize)); + response.setRelatedElementList(handler.getRelatedMetadataElements(userId, + elementGUID, + startingAtEnd, + relationshipTypeName, + null, + null, + null, + SequencingOrder.CREATION_DATE_RECENT, + forLineage, + forDuplicateProcessing, + null, + startFrom, + pageSize)); } } catch (Exception error) @@ -602,35 +602,35 @@ public OpenMetadataRelationshipListResponse getMetadataElementRelationships(Stri if (requestBody != null) { - response.setElementList(handler.getMetadataElementRelationships(userId, - metadataElementAtEnd1GUID, - metadataElementAtEnd2GUID, - relationshipTypeName, - requestBody.getLimitResultsByStatus(), - requestBody.getAsOfTime(), - requestBody.getSequencingProperty(), - requestBody.getSequencingOrder(), - forLineage, - forDuplicateProcessing, - requestBody.getEffectiveTime(), - startFrom, - pageSize)); + response.setRelationshipList(handler.getMetadataElementRelationships(userId, + metadataElementAtEnd1GUID, + metadataElementAtEnd2GUID, + relationshipTypeName, + requestBody.getLimitResultsByStatus(), + requestBody.getAsOfTime(), + requestBody.getSequencingProperty(), + requestBody.getSequencingOrder(), + forLineage, + forDuplicateProcessing, + requestBody.getEffectiveTime(), + startFrom, + pageSize)); } else { - response.setElementList(handler.getMetadataElementRelationships(userId, - metadataElementAtEnd1GUID, - metadataElementAtEnd2GUID, - relationshipTypeName, - null, - null, - null, - null, - forLineage, - forDuplicateProcessing, - null, - startFrom, - pageSize)); + response.setRelationshipList(handler.getMetadataElementRelationships(userId, + metadataElementAtEnd1GUID, + metadataElementAtEnd2GUID, + relationshipTypeName, + null, + null, + null, + null, + forLineage, + forDuplicateProcessing, + null, + startFrom, + pageSize)); } } catch (Exception error) @@ -759,18 +759,18 @@ public OpenMetadataRelationshipListResponse findRelationshipsBetweenMetadataElem { OpenMetadataHandler handler = instanceHandler.getOpenMetadataHandler(userId, serverName, viewServiceURLMarker, methodName); - response.setElementList(handler.findRelationshipsBetweenMetadataElements(userId, - requestBody.getRelationshipTypeName(), - requestBody.getSearchProperties(), - requestBody.getLimitResultsByStatus(), - requestBody.getAsOfTime(), - requestBody.getSequencingProperty(), - requestBody.getSequencingOrder(), - forLineage, - forDuplicateProcessing, - requestBody.getEffectiveTime(), - startFrom, - pageSize)); + response.setRelationshipList(handler.findRelationshipsBetweenMetadataElements(userId, + requestBody.getRelationshipTypeName(), + requestBody.getSearchProperties(), + requestBody.getLimitResultsByStatus(), + requestBody.getAsOfTime(), + requestBody.getSequencingProperty(), + requestBody.getSequencingOrder(), + forLineage, + forDuplicateProcessing, + requestBody.getEffectiveTime(), + startFrom, + pageSize)); } else { @@ -906,29 +906,29 @@ public OpenMetadataRelationshipListResponse getRelationshipHistory(String if (requestBody != null) { - response.setElementList(handler.getRelationshipHistory(userId, - relationshipGUID, - requestBody.getFromTime(), - requestBody.getToTime(), - oldestFirst, - forLineage, - forDuplicateProcessing, - requestBody.getEffectiveTime(), - startFrom, - pageSize)); + response.setRelationshipList(handler.getRelationshipHistory(userId, + relationshipGUID, + requestBody.getFromTime(), + requestBody.getToTime(), + oldestFirst, + forLineage, + forDuplicateProcessing, + requestBody.getEffectiveTime(), + startFrom, + pageSize)); } else { - response.setElementList(handler.getRelationshipHistory(userId, - relationshipGUID, - null, - null, - oldestFirst, - forLineage, - forDuplicateProcessing, - null, - startFrom, - pageSize)); + response.setRelationshipList(handler.getRelationshipHistory(userId, + relationshipGUID, + null, + null, + oldestFirst, + forLineage, + forDuplicateProcessing, + null, + startFrom, + pageSize)); } } catch (Exception error) diff --git a/open-metadata-resources/open-metadata-reports/survey-report/src/main/java/org/odpi/openmetadata/reports/surveyreport/SurveyReport.java b/open-metadata-resources/open-metadata-reports/survey-report/src/main/java/org/odpi/openmetadata/reports/surveyreport/SurveyReport.java index d17572858d..eb2cbad72c 100644 --- a/open-metadata-resources/open-metadata-reports/survey-report/src/main/java/org/odpi/openmetadata/reports/surveyreport/SurveyReport.java +++ b/open-metadata-resources/open-metadata-reports/survey-report/src/main/java/org/odpi/openmetadata/reports/surveyreport/SurveyReport.java @@ -5,6 +5,7 @@ import org.odpi.openmetadata.accessservices.assetowner.client.AssetOwner; import org.odpi.openmetadata.accessservices.assetowner.client.OpenMetadataStoreClient; +import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElementList; import org.odpi.openmetadata.frameworks.openmetadata.enums.SequencingOrder; import org.odpi.openmetadata.frameworks.openmetadata.metadataelements.AssetElement; import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; @@ -176,7 +177,7 @@ private void printReport(int reportIndentLevel, int startFrom = 0; int maxPageSize = 100; - List annotationElements = openMetadataStoreClient.getRelatedMetadataElements(clientUserId, + RelatedMetadataElementList annotationElements = openMetadataStoreClient.getRelatedMetadataElements(clientUserId, surveyReportLinkElement.getElement().getElementGUID(), 1, OpenMetadataType.REPORTED_ANNOTATION_RELATIONSHIP.typeName, @@ -194,7 +195,7 @@ private void printReport(int reportIndentLevel, { while (annotationElements != null) { - for (RelatedMetadataElement reportedAnnotationLink : annotationElements) + for (RelatedMetadataElement reportedAnnotationLink : annotationElements.getElementList()) { if ((reportedAnnotationLink != null) && (reportedAnnotationLink.getElement() != null)) { @@ -248,7 +249,7 @@ private void printReport(int reportIndentLevel, while (annotationElements != null) { - for (RelatedMetadataElement reportedAnnotationElement : annotationElements) + for (RelatedMetadataElement reportedAnnotationElement : annotationElements.getElementList()) { if ((reportedAnnotationElement != null) && (reportedAnnotationElement.getElement() != null)) { @@ -463,7 +464,7 @@ private void printAnnotation(int annotationIndentLevel, } } - List associatedElements = openMetadataStoreClient.getRelatedMetadataElements(clientUserId, + RelatedMetadataElementList associatedElements = openMetadataStoreClient.getRelatedMetadataElements(clientUserId, reportedAnnotationElement.getElement().getElementGUID(), 2, OpenMetadataType.ASSOCIATED_ANNOTATION_RELATIONSHIP.typeName, @@ -481,7 +482,7 @@ private void printAnnotation(int annotationIndentLevel, { int associatedElementIndentLevel = annotationIndentLevel + 1; - for (RelatedMetadataElement associatedElement : associatedElements) + for (RelatedMetadataElement associatedElement : associatedElements.getElementList()) { if (associatedElement != null) { @@ -562,19 +563,19 @@ private void run() outputReport.printReportSubheading(detailIndentLevel, "Survey report summaries"); - List surveyReportElements = openMetadataStoreClient.getRelatedMetadataElements(clientUserId, - assetGUID, - 1, - OpenMetadataType.ASSET_SURVEY_REPORT_RELATIONSHIP.typeName, - null, - null, - null, - SequencingOrder.CREATION_DATE_RECENT, - false, - false, - reportDate, - 0, - 0); + RelatedMetadataElementList surveyReportElements = openMetadataStoreClient.getRelatedMetadataElements(clientUserId, + assetGUID, + 1, + OpenMetadataType.ASSET_SURVEY_REPORT_RELATIONSHIP.typeName, + null, + null, + null, + SequencingOrder.CREATION_DATE_RECENT, + false, + false, + reportDate, + 0, + 0); if (surveyReportElements != null) { @@ -583,7 +584,7 @@ private void run() /* * First loop creates table of contents */ - for (RelatedMetadataElement surveyReportElement : surveyReportElements) + for (RelatedMetadataElement surveyReportElement : surveyReportElements.getElementList()) { if (surveyReportElement != null) { @@ -594,7 +595,7 @@ private void run() /* * Now print out the contents of each report */ - for (RelatedMetadataElement surveyReportElement : surveyReportElements) + for (RelatedMetadataElement surveyReportElement : surveyReportElements.getElementList()) { if (surveyReportElement != null) { diff --git a/open-metadata-resources/open-metadata-reports/valid-values-report/src/main/java/org/odpi/openmetadata/reports/validvalues/ValidValuesReport.java b/open-metadata-resources/open-metadata-reports/valid-values-report/src/main/java/org/odpi/openmetadata/reports/validvalues/ValidValuesReport.java index 445a5d21e7..df9a65f46e 100644 --- a/open-metadata-resources/open-metadata-reports/valid-values-report/src/main/java/org/odpi/openmetadata/reports/validvalues/ValidValuesReport.java +++ b/open-metadata-resources/open-metadata-reports/valid-values-report/src/main/java/org/odpi/openmetadata/reports/validvalues/ValidValuesReport.java @@ -8,6 +8,7 @@ import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException; +import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElementList; import org.odpi.openmetadata.frameworks.openmetadata.enums.SequencingOrder; import org.odpi.openmetadata.frameworks.openmetadata.metadataelements.ValidValueElement; import org.odpi.openmetadata.frameworks.openmetadata.types.OpenMetadataProperty; @@ -121,7 +122,7 @@ private void run() report.printReportLine(validValueInformation.indentLevel + 1, "Description", validValueInformation.element.getValidValueProperties().getDescription()); startFrom = 0; - List relatedElements = openMetadataStoreClient.getRelatedMetadataElements(clientUserId, + RelatedMetadataElementList relatedElements = openMetadataStoreClient.getRelatedMetadataElements(clientUserId, validValueInformation.element.getElementHeader().getGUID(), 0, null, @@ -137,7 +138,7 @@ private void run() while (relatedElements != null) { - for (RelatedMetadataElement relatedElement : relatedElements) + for (RelatedMetadataElement relatedElement : relatedElements.getElementList()) { if (! propertyHelper.isTypeOf(relatedElement, OpenMetadataType.VALID_VALUE_MEMBER_RELATIONSHIP.typeName)) { @@ -169,23 +170,23 @@ private void run() int refDataStartFrom = 0; - List relatedRefElements = openMetadataStoreClient.getRelatedMetadataElements(clientUserId, - relatedElement.getElement().getElementGUID(), - 0, - OpenMetadataType.SPECIFICATION_PROPERTY_ASSIGNMENT_RELATIONSHIP.typeName, - null, - null, - null, - SequencingOrder.CREATION_DATE_RECENT, - false, - false, - new Date(), - refDataStartFrom, - 500); + RelatedMetadataElementList relatedRefElements = openMetadataStoreClient.getRelatedMetadataElements(clientUserId, + relatedElement.getElement().getElementGUID(), + 0, + OpenMetadataType.SPECIFICATION_PROPERTY_ASSIGNMENT_RELATIONSHIP.typeName, + null, + null, + null, + SequencingOrder.CREATION_DATE_RECENT, + false, + false, + new Date(), + refDataStartFrom, + 500); while (relatedRefElements != null) { - for (RelatedMetadataElement relatedRefElement : relatedRefElements) + for (RelatedMetadataElement relatedRefElement : relatedRefElements.getElementList()) { if (relatedRefElement != null) { diff --git a/open-metadata-resources/open-metadata-samples/governance-action-samples/src/main/java/org/odpi/openmetadata/samples/governanceactions/clinicaltrials/CocoClinicalTrialBaseService.java b/open-metadata-resources/open-metadata-samples/governance-action-samples/src/main/java/org/odpi/openmetadata/samples/governanceactions/clinicaltrials/CocoClinicalTrialBaseService.java index 496b9a62ac..e3af4fd729 100644 --- a/open-metadata-resources/open-metadata-samples/governance-action-samples/src/main/java/org/odpi/openmetadata/samples/governanceactions/clinicaltrials/CocoClinicalTrialBaseService.java +++ b/open-metadata-resources/open-metadata-samples/governance-action-samples/src/main/java/org/odpi/openmetadata/samples/governanceactions/clinicaltrials/CocoClinicalTrialBaseService.java @@ -12,7 +12,6 @@ import org.odpi.openmetadata.frameworks.openmetadata.types.OpenMetadataType; import org.odpi.openmetadata.samples.governanceactions.ffdc.GovernanceActionSamplesErrorCode; -import java.util.List; /** * Provides shared functions for the clinical trial services. @@ -58,14 +57,14 @@ protected PersonContactDetails getContactDetailsForPersonGUID(String personGUID) person.getElementProperties(), methodName); - List contactDetails = governanceContext.getOpenMetadataStore().getRelatedMetadataElements(personGUID, - 1, - OpenMetadataType.CONTACT_THROUGH_RELATIONSHIP.typeName, - 0, - 0); + RelatedMetadataElementList contactDetails = governanceContext.getOpenMetadataStore().getRelatedMetadataElements(personGUID, + 1, + OpenMetadataType.CONTACT_THROUGH_RELATIONSHIP.typeName, + 0, + 0); if (contactDetails != null) { - for (RelatedMetadataElement contactDetail : contactDetails) + for (RelatedMetadataElement contactDetail : contactDetails.getElementList()) { if (contactDetail != null) { @@ -101,14 +100,14 @@ protected void checkCertificationValidForProject(String projectGUID, final String methodName = "checkCertificationValidForProject"; int projectStartFrom = 0; - List projects = governanceContext.getOpenMetadataStore().getRelatedMetadataElements(certificationTypeGUID, + RelatedMetadataElementList projects = governanceContext.getOpenMetadataStore().getRelatedMetadataElements(certificationTypeGUID, 1, OpenMetadataType.GOVERNED_BY_TYPE_NAME, projectStartFrom, governanceContext.getMaxPageSize()); while (projects != null) { - for (RelatedMetadataElement project : projects) + for (RelatedMetadataElement project : projects.getElementList()) { if (project != null) { diff --git a/open-metadata-resources/open-metadata-samples/governance-action-samples/src/main/java/org/odpi/openmetadata/samples/governanceactions/clinicaltrials/CocoClinicalTrialCertifyHospitalService.java b/open-metadata-resources/open-metadata-samples/governance-action-samples/src/main/java/org/odpi/openmetadata/samples/governanceactions/clinicaltrials/CocoClinicalTrialCertifyHospitalService.java index 51fc82e597..6848b46583 100644 --- a/open-metadata-resources/open-metadata-samples/governance-action-samples/src/main/java/org/odpi/openmetadata/samples/governanceactions/clinicaltrials/CocoClinicalTrialCertifyHospitalService.java +++ b/open-metadata-resources/open-metadata-samples/governance-action-samples/src/main/java/org/odpi/openmetadata/samples/governanceactions/clinicaltrials/CocoClinicalTrialCertifyHospitalService.java @@ -8,6 +8,7 @@ import org.odpi.openmetadata.frameworks.governanceaction.properties.ActionTargetElement; import org.odpi.openmetadata.frameworks.governanceaction.properties.CompletionStatus; import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataRelationship; +import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataRelationshipList; import org.odpi.openmetadata.frameworks.governanceaction.search.ElementProperties; import org.odpi.openmetadata.frameworks.openmetadata.types.OpenMetadataProperty; import org.odpi.openmetadata.frameworks.openmetadata.types.OpenMetadataType; @@ -188,11 +189,11 @@ private void updateCertificationToHospital(String projectGUID, final String methodName = "updateCertificationToHospital"; int startFrom = 0; - List existingCertifications = governanceContext.getOpenMetadataStore().getMetadataElementRelationships(hospitalGUID, - certificationTypeGUID, - OpenMetadataType.CERTIFICATION_OF_REFERENCEABLE_TYPE_NAME, - startFrom, - governanceContext.getMaxPageSize()); + OpenMetadataRelationshipList existingCertifications = governanceContext.getOpenMetadataStore().getMetadataElementRelationships(hospitalGUID, + certificationTypeGUID, + OpenMetadataType.CERTIFICATION_OF_REFERENCEABLE_TYPE_NAME, + startFrom, + governanceContext.getMaxPageSize()); if (existingCertifications == null) { @@ -231,7 +232,7 @@ private void updateCertificationToHospital(String projectGUID, OpenMetadataType.START_PROPERTY_NAME, new Date()); - for (OpenMetadataRelationship certification : existingCertifications) + for (OpenMetadataRelationship certification : existingCertifications.getElementList()) { if (certification != null) { diff --git a/open-metadata-resources/open-metadata-samples/governance-action-samples/src/main/java/org/odpi/openmetadata/samples/governanceactions/clinicaltrials/CocoClinicalTrialHospitalOnboardingService.java b/open-metadata-resources/open-metadata-samples/governance-action-samples/src/main/java/org/odpi/openmetadata/samples/governanceactions/clinicaltrials/CocoClinicalTrialHospitalOnboardingService.java index fc19b84377..5953c6ea7b 100644 --- a/open-metadata-resources/open-metadata-samples/governance-action-samples/src/main/java/org/odpi/openmetadata/samples/governanceactions/clinicaltrials/CocoClinicalTrialHospitalOnboardingService.java +++ b/open-metadata-resources/open-metadata-samples/governance-action-samples/src/main/java/org/odpi/openmetadata/samples/governanceactions/clinicaltrials/CocoClinicalTrialHospitalOnboardingService.java @@ -338,7 +338,7 @@ private PersonContactDetails checkHospitalCertification(String projectGUID, PersonContactDetails custodianContactDetails = null; int startFrom = 0; - List certifications = governanceContext.getOpenMetadataStore().getRelatedMetadataElements(hospitalGUID, + RelatedMetadataElementList certifications = governanceContext.getOpenMetadataStore().getRelatedMetadataElements(hospitalGUID, 1, OpenMetadataType.CERTIFICATION_OF_REFERENCEABLE_TYPE_NAME, startFrom, @@ -346,7 +346,7 @@ private PersonContactDetails checkHospitalCertification(String projectGUID, while (certifications != null) { - for (RelatedMetadataElement certification : certifications) + for (RelatedMetadataElement certification : certifications.getElementList()) { if (certification != null) { @@ -387,14 +387,14 @@ private PersonContactDetails checkHospitalCertification(String projectGUID, * Now check it is the certification for the right project. */ int projectStartFrom = 0; - List projects = governanceContext.getOpenMetadataStore().getRelatedMetadataElements(certification.getElement().getElementGUID(), + RelatedMetadataElementList projects = governanceContext.getOpenMetadataStore().getRelatedMetadataElements(certification.getElement().getElementGUID(), 1, OpenMetadataType.GOVERNED_BY_TYPE_NAME, projectStartFrom, governanceContext.getMaxPageSize()); while (projects != null) { - for (RelatedMetadataElement project : projects) + for (RelatedMetadataElement project : projects.getElementList()) { if (project != null) { diff --git a/open-metadata-resources/open-metadata-samples/governance-action-samples/src/main/java/org/odpi/openmetadata/samples/governanceactions/clinicaltrials/CocoClinicalTrialNominateHospitalService.java b/open-metadata-resources/open-metadata-samples/governance-action-samples/src/main/java/org/odpi/openmetadata/samples/governanceactions/clinicaltrials/CocoClinicalTrialNominateHospitalService.java index bad3b032b9..08a68bc115 100644 --- a/open-metadata-resources/open-metadata-samples/governance-action-samples/src/main/java/org/odpi/openmetadata/samples/governanceactions/clinicaltrials/CocoClinicalTrialNominateHospitalService.java +++ b/open-metadata-resources/open-metadata-samples/governance-action-samples/src/main/java/org/odpi/openmetadata/samples/governanceactions/clinicaltrials/CocoClinicalTrialNominateHospitalService.java @@ -8,6 +8,7 @@ import org.odpi.openmetadata.frameworks.governanceaction.properties.ActionTargetElement; import org.odpi.openmetadata.frameworks.governanceaction.properties.CompletionStatus; import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataRelationship; +import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataRelationshipList; import org.odpi.openmetadata.frameworks.governanceaction.search.ElementProperties; import org.odpi.openmetadata.frameworks.openmetadata.types.OpenMetadataProperty; import org.odpi.openmetadata.frameworks.openmetadata.types.OpenMetadataType; @@ -205,11 +206,11 @@ private void addNewCertificationToHospital(String hospitalGUID, UserNotAuthorizedException { int startFrom = 0; - List existingCertifications = governanceContext.getOpenMetadataStore().getMetadataElementRelationships(hospitalGUID, - certificationTypeGUID, - OpenMetadataType.CERTIFICATION_OF_REFERENCEABLE_TYPE_NAME, - startFrom, - governanceContext.getMaxPageSize()); + OpenMetadataRelationshipList existingCertifications = governanceContext.getOpenMetadataStore().getMetadataElementRelationships(hospitalGUID, + certificationTypeGUID, + OpenMetadataType.CERTIFICATION_OF_REFERENCEABLE_TYPE_NAME, + startFrom, + governanceContext.getMaxPageSize()); /* * All existing certifications are ended - assuming that the hospital contact people have changed - or @@ -221,7 +222,7 @@ private void addNewCertificationToHospital(String hospitalGUID, OpenMetadataType.END_PROPERTY_NAME, new Date()); - for (OpenMetadataRelationship certification : existingCertifications) + for (OpenMetadataRelationship certification : existingCertifications.getElementList()) { if (certification != null) { diff --git a/open-metadata-resources/open-metadata-samples/governance-action-samples/src/main/java/org/odpi/openmetadata/samples/governanceactions/clinicaltrials/CocoClinicalTrialSetUpService.java b/open-metadata-resources/open-metadata-samples/governance-action-samples/src/main/java/org/odpi/openmetadata/samples/governanceactions/clinicaltrials/CocoClinicalTrialSetUpService.java index 7c06c0555c..98f5f74dc0 100644 --- a/open-metadata-resources/open-metadata-samples/governance-action-samples/src/main/java/org/odpi/openmetadata/samples/governanceactions/clinicaltrials/CocoClinicalTrialSetUpService.java +++ b/open-metadata-resources/open-metadata-samples/governance-action-samples/src/main/java/org/odpi/openmetadata/samples/governanceactions/clinicaltrials/CocoClinicalTrialSetUpService.java @@ -5,11 +5,7 @@ import org.odpi.openmetadata.frameworks.auditlog.messagesets.AuditLogMessageDefinition; import org.odpi.openmetadata.frameworks.connectors.ffdc.*; -import org.odpi.openmetadata.frameworks.governanceaction.GeneralGovernanceActionService; -import org.odpi.openmetadata.frameworks.governanceaction.properties.ActionTargetElement; -import org.odpi.openmetadata.frameworks.governanceaction.properties.CompletionStatus; -import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataElement; -import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElement; +import org.odpi.openmetadata.frameworks.governanceaction.properties.*; import org.odpi.openmetadata.frameworks.governanceaction.search.ElementProperties; import org.odpi.openmetadata.frameworks.openmetadata.enums.ElementStatus; import org.odpi.openmetadata.frameworks.openmetadata.types.OpenMetadataProperty; @@ -439,15 +435,15 @@ private String createProcessFromGovernanceActionType(String process governanceActionExecutorRelationship.getRelationshipProperties()); - List actionTargets = governanceContext.getOpenMetadataStore().getRelatedMetadataElements(governanceActionTypeGUID, - 1, - OpenMetadataType.TARGET_FOR_ACTION_TYPE.typeName, - 0, - 0); + RelatedMetadataElementList actionTargets = governanceContext.getOpenMetadataStore().getRelatedMetadataElements(governanceActionTypeGUID, + 1, + OpenMetadataType.TARGET_FOR_ACTION_TYPE.typeName, + 0, + 0); if (actionTargets != null) { - for (RelatedMetadataElement actionTarget : actionTargets) + for (RelatedMetadataElement actionTarget : actionTargets.getElementList()) { if (actionTarget != null) { @@ -462,7 +458,7 @@ private String createProcessFromGovernanceActionType(String process } - List specifications = governanceContext.getOpenMetadataStore().getRelatedMetadataElements(governanceActionTypeGUID, + RelatedMetadataElementList specifications = governanceContext.getOpenMetadataStore().getRelatedMetadataElements(governanceActionTypeGUID, 1, OpenMetadataType.SPECIFICATION_PROPERTY_ASSIGNMENT_RELATIONSHIP.typeName, 0, @@ -470,7 +466,7 @@ private String createProcessFromGovernanceActionType(String process if (specifications != null) { - for (RelatedMetadataElement specification : specifications) + for (RelatedMetadataElement specification : specifications.getElementList()) { if (specification != null) { diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/governance-server-fvt/src/main/java/org/odpi/openmetadata/accessservices/governanceserver/fvt/duplicates/CreateDuplicatesTest.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/governance-server-fvt/src/main/java/org/odpi/openmetadata/accessservices/governanceserver/fvt/duplicates/CreateDuplicatesTest.java index 9b921dea1a..7662cbd425 100644 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/governance-server-fvt/src/main/java/org/odpi/openmetadata/accessservices/governanceserver/fvt/duplicates/CreateDuplicatesTest.java +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/governance-server-fvt/src/main/java/org/odpi/openmetadata/accessservices/governanceserver/fvt/duplicates/CreateDuplicatesTest.java @@ -12,6 +12,7 @@ import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException; import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataElement; import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElement; +import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElementList; import org.odpi.openmetadata.frameworks.governanceaction.search.ElementProperties; import org.odpi.openmetadata.frameworks.governanceaction.search.PropertyHelper; import org.odpi.openmetadata.frameworks.openmetadata.enums.ElementStatus; @@ -307,7 +308,7 @@ private static void runIt(String serverPlatformRootURL, String firstAssetMementoKeywordGUID = thisTest.createSearchKeyword(openMetadataStoreClient, userId, mementoPrefix, mementoPrefix + "Keyword for firstAsset" , null, null, mementoAssetGUID, activityName, testCaseName); String firstAssetIneffectiveKeywordGUID = thisTest.createSearchKeyword(openMetadataStoreClient, userId, ineffectivePrefix, ineffectivePrefix + "Keyword for firstAsset" , null, null, ineffectiveAssetGUID, activityName, testCaseName); - List relatedMetadataElements; + RelatedMetadataElementList relatedMetadataElements; activityName = "Keyword test - all returned"; relatedMetadataElements = openMetadataStoreClient.getRelatedMetadataElements(userId, firstAssetGUID, 1, keywordLinkTypeName, null, null, null, SequencingOrder.CREATION_DATE_RECENT, true, false, null, 0, 0); @@ -316,49 +317,49 @@ private static void runIt(String serverPlatformRootURL, { throw new FVTUnexpectedCondition(testCaseName, "No keywords returned by " + activityName); } - else if (relatedMetadataElements.size() != 4) + else if (relatedMetadataElements.getElementList().size() != 4) { - throw new FVTUnexpectedCondition(testCaseName, relatedMetadataElements.size() + " keywords: " + relatedMetadataElements + " returned by " + activityName); + throw new FVTUnexpectedCondition(testCaseName, relatedMetadataElements.getElementList().size() + " keywords: " + relatedMetadataElements + " returned by " + activityName); } activityName = "Keyword test - memento not returned"; relatedMetadataElements = openMetadataStoreClient.getRelatedMetadataElements(userId, firstAssetGUID, 1, keywordLinkTypeName, null, null, null, SequencingOrder.CREATION_DATE_RECENT, false, false, null, 0, 0); - if (relatedMetadataElements == null) + if ((relatedMetadataElements == null) || (relatedMetadataElements.getElementList() == null)) { throw new FVTUnexpectedCondition(testCaseName, "No keywords returned by " + activityName); } - else if (relatedMetadataElements.size() != 3) + else if (relatedMetadataElements.getElementList().size() != 3) { - throw new FVTUnexpectedCondition(testCaseName, relatedMetadataElements.size() + " keywords: " + relatedMetadataElements + " returned by " + activityName); + throw new FVTUnexpectedCondition(testCaseName, relatedMetadataElements.getElementList().size() + " keywords: " + relatedMetadataElements + " returned by " + activityName); } activityName = "Keyword test - none returned"; relatedMetadataElements = openMetadataStoreClient.getRelatedMetadataElements(userId, firstAssetGUID, 1, keywordLinkTypeName, null, null, null, SequencingOrder.CREATION_DATE_RECENT, false, true, new Date(), 0, 0); - if (relatedMetadataElements != null) + if ((relatedMetadataElements != null) && (relatedMetadataElements.getElementList() != null)) { - throw new FVTUnexpectedCondition(testCaseName, relatedMetadataElements.size() + " unexpected keywords returned by " + activityName); + throw new FVTUnexpectedCondition(testCaseName, relatedMetadataElements.getElementList().size() + " unexpected keywords returned by " + activityName); } activityName = "Keyword test - ineffective not returned"; relatedMetadataElements = openMetadataStoreClient.getRelatedMetadataElements(userId, firstAssetGUID, 1, keywordLinkTypeName, null, null, null, SequencingOrder.CREATION_DATE_RECENT, true, false, new Date(), 0, 0); - if (relatedMetadataElements == null) + if ((relatedMetadataElements == null) || (relatedMetadataElements.getElementList() == null)) { throw new FVTUnexpectedCondition(testCaseName, "No keywords returned by " + activityName); } - else if (relatedMetadataElements.size() != 2) + else if (relatedMetadataElements.getElementList().size() != 2) { - throw new FVTUnexpectedCondition(testCaseName, relatedMetadataElements.size() + " keywords returned by " + activityName); + throw new FVTUnexpectedCondition(testCaseName, relatedMetadataElements.getElementList().size() + " keywords returned by " + activityName); } activityName = "Keyword test - active returned"; relatedMetadataElements = openMetadataStoreClient.getRelatedMetadataElements(userId, firstAssetGUID, 1, keywordLinkTypeName, null, null, null, SequencingOrder.CREATION_DATE_RECENT, false, false, new Date(), 0, 0); - if (relatedMetadataElements == null) + if ((relatedMetadataElements == null) || (relatedMetadataElements.getElementList() == null)) { throw new FVTUnexpectedCondition(testCaseName, "No keywords returned by " + activityName); } - else if (relatedMetadataElements.size() != 1) + else if (relatedMetadataElements.getElementList().size() != 1) { - throw new FVTUnexpectedCondition(testCaseName, relatedMetadataElements.size() + " keywords returned by " + activityName); + throw new FVTUnexpectedCondition(testCaseName, relatedMetadataElements.getElementList().size() + " keywords returned by " + activityName); } } diff --git a/settings.gradle b/settings.gradle index e361adbef4..ef84eec7bb 100644 --- a/settings.gradle +++ b/settings.gradle @@ -85,6 +85,7 @@ include(':open-metadata-implementation:adapters:open-connectors:connector-config include(':open-metadata-implementation:adapters:authentication-plugins:http-helper') include(':open-metadata-implementation:common-services:ffdc-services') include(':open-metadata-implementation:common-services:generic-handlers') +include(':open-metadata-implementation:common-services:mermaid-services') include(':open-metadata-implementation:common-services:metadata-security:metadata-security-apis') include(':open-metadata-implementation:common-services:metadata-security:metadata-security-connectors') include(':open-metadata-implementation:common-services:metadata-security:metadata-security-server')