@Test public void getLinkingRelationshipsBetweenAssets() throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException, org.odpi.openmetadata.repositoryservices.ffdc.exception.UserNotAuthorizedException, EntityNotKnownException, FunctionNotSupportedException, org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException, RepositoryErrorException, PropertyErrorException, AssetCatalogException { String methodName = "getLinkingRelationshipsBetweenAssets"; OMRSMetadataCollection metadataCollection = mockMetadataCollection(); when(metadataCollection.getLinkingEntities(USER, FIRST_GUID, SECOND_GUID, Collections.singletonList(InstanceStatus.ACTIVE), null)) .thenReturn(mockInstanceGraph()); List<org.odpi.openmetadata.accessservices.assetcatalog.model.Relationship> result = assetCatalogHandler .getLinkingRelationshipsBetweenAssets("server", USER, FIRST_GUID, SECOND_GUID); assertEquals(RELATIONSHIP_GUID, result.get(0).getGuid()); verify(invalidParameterHandler, times(1)).validateUserId(USER, methodName); verify(invalidParameterHandler, times(1)).validateGUID(FIRST_GUID, "startAssetGUID", methodName); verify(invalidParameterHandler, times(1)).validateGUID(SECOND_GUID, "endAssetGUID", methodName); }
public List<org.odpi.openmetadata.accessservices.assetcatalog.model.Relationship> getLinkingRelationshipsBetweenAssets(String serverName, String userId, String startAssetGUID, String endAssetGUID) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException, AssetCatalogException { String methodName = "getLinkingRelationshipsBetweenAssets"; initialValidationStartEndAssetGUID(userId, startAssetGUID, endAssetGUID, methodName); OMRSMetadataCollection metadataCollection = commonHandler.getOMRSMetadataCollection(); InstanceGraph linkingEntities = null; try { linkingEntities = metadataCollection.getLinkingEntities(userId, startAssetGUID, endAssetGUID, Collections.singletonList(InstanceStatus.ACTIVE), null); } catch (org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException | FunctionNotSupportedException | RepositoryErrorException | PropertyErrorException e) { errorHandler.handleRepositoryError(e, methodName); } catch (EntityNotKnownException e) { errorHandler.handleUnknownEntity(e, startAssetGUID, "", methodName, GUID_PARAMETER); } catch (org.odpi.openmetadata.repositoryservices.ffdc.exception.UserNotAuthorizedException e) { errorHandler.handleUnauthorizedUser(userId, methodName); } if (linkingEntities == null || CollectionUtils.isEmpty(linkingEntities.getRelationships())) { throw new AssetCatalogException(AssetCatalogErrorCode.LINKING_RELATIONSHIPS_NOT_FOUND.getMessageDefinition(methodName), this.getClass().getName(), methodName); } return assetConverter.convertRelationships(linkingEntities.getRelationships()); }
AssetCatalogHandler { public List<org.odpi.openmetadata.accessservices.assetcatalog.model.Relationship> getLinkingRelationshipsBetweenAssets(String serverName, String userId, String startAssetGUID, String endAssetGUID) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException, AssetCatalogException { String methodName = "getLinkingRelationshipsBetweenAssets"; initialValidationStartEndAssetGUID(userId, startAssetGUID, endAssetGUID, methodName); OMRSMetadataCollection metadataCollection = commonHandler.getOMRSMetadataCollection(); InstanceGraph linkingEntities = null; try { linkingEntities = metadataCollection.getLinkingEntities(userId, startAssetGUID, endAssetGUID, Collections.singletonList(InstanceStatus.ACTIVE), null); } catch (org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException | FunctionNotSupportedException | RepositoryErrorException | PropertyErrorException e) { errorHandler.handleRepositoryError(e, methodName); } catch (EntityNotKnownException e) { errorHandler.handleUnknownEntity(e, startAssetGUID, "", methodName, GUID_PARAMETER); } catch (org.odpi.openmetadata.repositoryservices.ffdc.exception.UserNotAuthorizedException e) { errorHandler.handleUnauthorizedUser(userId, methodName); } if (linkingEntities == null || CollectionUtils.isEmpty(linkingEntities.getRelationships())) { throw new AssetCatalogException(AssetCatalogErrorCode.LINKING_RELATIONSHIPS_NOT_FOUND.getMessageDefinition(methodName), this.getClass().getName(), methodName); } return assetConverter.convertRelationships(linkingEntities.getRelationships()); } }
AssetCatalogHandler { public List<org.odpi.openmetadata.accessservices.assetcatalog.model.Relationship> getLinkingRelationshipsBetweenAssets(String serverName, String userId, String startAssetGUID, String endAssetGUID) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException, AssetCatalogException { String methodName = "getLinkingRelationshipsBetweenAssets"; initialValidationStartEndAssetGUID(userId, startAssetGUID, endAssetGUID, methodName); OMRSMetadataCollection metadataCollection = commonHandler.getOMRSMetadataCollection(); InstanceGraph linkingEntities = null; try { linkingEntities = metadataCollection.getLinkingEntities(userId, startAssetGUID, endAssetGUID, Collections.singletonList(InstanceStatus.ACTIVE), null); } catch (org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException | FunctionNotSupportedException | RepositoryErrorException | PropertyErrorException e) { errorHandler.handleRepositoryError(e, methodName); } catch (EntityNotKnownException e) { errorHandler.handleUnknownEntity(e, startAssetGUID, "", methodName, GUID_PARAMETER); } catch (org.odpi.openmetadata.repositoryservices.ffdc.exception.UserNotAuthorizedException e) { errorHandler.handleUnauthorizedUser(userId, methodName); } if (linkingEntities == null || CollectionUtils.isEmpty(linkingEntities.getRelationships())) { throw new AssetCatalogException(AssetCatalogErrorCode.LINKING_RELATIONSHIPS_NOT_FOUND.getMessageDefinition(methodName), this.getClass().getName(), methodName); } return assetConverter.convertRelationships(linkingEntities.getRelationships()); } AssetCatalogHandler(String serverUserName, String sourceName, InvalidParameterHandler invalidParameterHandler,
                               RepositoryHandler repositoryHandler, OMRSRepositoryHelper repositoryHelper,
                               RepositoryErrorHandler errorHandler, List<String> supportedZones, List<String> supportedTypesForSearch); }
AssetCatalogHandler { public List<org.odpi.openmetadata.accessservices.assetcatalog.model.Relationship> getLinkingRelationshipsBetweenAssets(String serverName, String userId, String startAssetGUID, String endAssetGUID) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException, AssetCatalogException { String methodName = "getLinkingRelationshipsBetweenAssets"; initialValidationStartEndAssetGUID(userId, startAssetGUID, endAssetGUID, methodName); OMRSMetadataCollection metadataCollection = commonHandler.getOMRSMetadataCollection(); InstanceGraph linkingEntities = null; try { linkingEntities = metadataCollection.getLinkingEntities(userId, startAssetGUID, endAssetGUID, Collections.singletonList(InstanceStatus.ACTIVE), null); } catch (org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException | FunctionNotSupportedException | RepositoryErrorException | PropertyErrorException e) { errorHandler.handleRepositoryError(e, methodName); } catch (EntityNotKnownException e) { errorHandler.handleUnknownEntity(e, startAssetGUID, "", methodName, GUID_PARAMETER); } catch (org.odpi.openmetadata.repositoryservices.ffdc.exception.UserNotAuthorizedException e) { errorHandler.handleUnauthorizedUser(userId, methodName); } if (linkingEntities == null || CollectionUtils.isEmpty(linkingEntities.getRelationships())) { throw new AssetCatalogException(AssetCatalogErrorCode.LINKING_RELATIONSHIPS_NOT_FOUND.getMessageDefinition(methodName), this.getClass().getName(), methodName); } return assetConverter.convertRelationships(linkingEntities.getRelationships()); } AssetCatalogHandler(String serverUserName, String sourceName, InvalidParameterHandler invalidParameterHandler,
                               RepositoryHandler repositoryHandler, OMRSRepositoryHelper repositoryHelper,
                               RepositoryErrorHandler errorHandler, List<String> supportedZones, List<String> supportedTypesForSearch); AssetDescription getEntityDetails(String userId, String assetGUID, String assetTypeName); List<org.odpi.openmetadata.accessservices.assetcatalog.model.Relationship> getRelationshipsByEntityGUID(String userId,
                                                                                                                   String assetGUID,
                                                                                                                   String assetTypeName); List<org.odpi.openmetadata.accessservices.assetcatalog.model.Classification> getEntityClassificationByName(String userId,
                                                                                                                      String assetGUID,
                                                                                                                      String assetTypeName,
                                                                                                                      String classificationName); List<org.odpi.openmetadata.accessservices.assetcatalog.model.Relationship> getLinkingRelationshipsBetweenAssets(String serverName,
                                                                                                                           String userId,
                                                                                                                           String startAssetGUID,
                                                                                                                           String endAssetGUID); List<org.odpi.openmetadata.accessservices.assetcatalog.model.Relationship> getRelationships(String userId,
                                                                                                       String assetGUID,
                                                                                                       String assetTypeName,
                                                                                                       String relationshipTypeName,
                                                                                                       Integer from, Integer pageSize); List<AssetDescription> getIntermediateAssets(String userId, String startAssetGUID, String endAssetGUID); List<AssetDescription> getEntitiesFromNeighborhood(String serverName, String userId, String assetGUID, SearchParameters searchParameters); List<AssetElements> searchByType(String userId, String searchCriteria, SearchParameters searchParameters); AssetElements buildContextByType(String userId,
                                            String entityGUID,
                                            String entityTypeDefName); List<Type> getSupportedTypes(String userId, String typeName); }
AssetCatalogHandler { public List<org.odpi.openmetadata.accessservices.assetcatalog.model.Relationship> getLinkingRelationshipsBetweenAssets(String serverName, String userId, String startAssetGUID, String endAssetGUID) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException, AssetCatalogException { String methodName = "getLinkingRelationshipsBetweenAssets"; initialValidationStartEndAssetGUID(userId, startAssetGUID, endAssetGUID, methodName); OMRSMetadataCollection metadataCollection = commonHandler.getOMRSMetadataCollection(); InstanceGraph linkingEntities = null; try { linkingEntities = metadataCollection.getLinkingEntities(userId, startAssetGUID, endAssetGUID, Collections.singletonList(InstanceStatus.ACTIVE), null); } catch (org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException | FunctionNotSupportedException | RepositoryErrorException | PropertyErrorException e) { errorHandler.handleRepositoryError(e, methodName); } catch (EntityNotKnownException e) { errorHandler.handleUnknownEntity(e, startAssetGUID, "", methodName, GUID_PARAMETER); } catch (org.odpi.openmetadata.repositoryservices.ffdc.exception.UserNotAuthorizedException e) { errorHandler.handleUnauthorizedUser(userId, methodName); } if (linkingEntities == null || CollectionUtils.isEmpty(linkingEntities.getRelationships())) { throw new AssetCatalogException(AssetCatalogErrorCode.LINKING_RELATIONSHIPS_NOT_FOUND.getMessageDefinition(methodName), this.getClass().getName(), methodName); } return assetConverter.convertRelationships(linkingEntities.getRelationships()); } AssetCatalogHandler(String serverUserName, String sourceName, InvalidParameterHandler invalidParameterHandler,
                               RepositoryHandler repositoryHandler, OMRSRepositoryHelper repositoryHelper,
                               RepositoryErrorHandler errorHandler, List<String> supportedZones, List<String> supportedTypesForSearch); AssetDescription getEntityDetails(String userId, String assetGUID, String assetTypeName); List<org.odpi.openmetadata.accessservices.assetcatalog.model.Relationship> getRelationshipsByEntityGUID(String userId,
                                                                                                                   String assetGUID,
                                                                                                                   String assetTypeName); List<org.odpi.openmetadata.accessservices.assetcatalog.model.Classification> getEntityClassificationByName(String userId,
                                                                                                                      String assetGUID,
                                                                                                                      String assetTypeName,
                                                                                                                      String classificationName); List<org.odpi.openmetadata.accessservices.assetcatalog.model.Relationship> getLinkingRelationshipsBetweenAssets(String serverName,
                                                                                                                           String userId,
                                                                                                                           String startAssetGUID,
                                                                                                                           String endAssetGUID); List<org.odpi.openmetadata.accessservices.assetcatalog.model.Relationship> getRelationships(String userId,
                                                                                                       String assetGUID,
                                                                                                       String assetTypeName,
                                                                                                       String relationshipTypeName,
                                                                                                       Integer from, Integer pageSize); List<AssetDescription> getIntermediateAssets(String userId, String startAssetGUID, String endAssetGUID); List<AssetDescription> getEntitiesFromNeighborhood(String serverName, String userId, String assetGUID, SearchParameters searchParameters); List<AssetElements> searchByType(String userId, String searchCriteria, SearchParameters searchParameters); AssetElements buildContextByType(String userId,
                                            String entityGUID,
                                            String entityTypeDefName); List<Type> getSupportedTypes(String userId, String typeName);  }