@Test public void getEntitiesFromNeighborhood() throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException, org.odpi.openmetadata.repositoryservices.ffdc.exception.UserNotAuthorizedException, EntityNotKnownException, FunctionNotSupportedException, org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException, RepositoryErrorException, PropertyErrorException, AssetCatalogException, TypeErrorException { OMRSMetadataCollection metadataCollection = mockMetadataCollection(); when(metadataCollection.getEntityNeighborhood(USER, FIRST_GUID, Collections.singletonList(ASSET_TYPE_GUID), Collections.singletonList(RELATIONSHIP_TYPE_GUID), Collections.singletonList(InstanceStatus.ACTIVE), null, null, 1)) .thenReturn(mockInstanceGraph()); SearchParameters searchParams = mockSearchParams(); mockTypeDef(ASSET_TYPE, ASSET_TYPE_GUID); List<AssetDescription> result = assetCatalogHandler.getEntitiesFromNeighborhood("server", USER, FIRST_GUID, searchParams); assertEquals(FIRST_GUID, result.get(0).getGuid()); String methodName = "getEntitiesFromNeighborhood"; verify(invalidParameterHandler, times(1)).validateUserId(USER, methodName); verify(invalidParameterHandler, times(1)).validateGUID(FIRST_GUID, GUID_PARAMETER, methodName); verify(invalidParameterHandler, times(1)).validateObject(searchParams, "searchParameter", methodName); }
public List<AssetDescription> getEntitiesFromNeighborhood(String serverName, String userId, String assetGUID, SearchParameters searchParameters) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException, AssetCatalogException { String methodName = "getEntitiesFromNeighborhood"; invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateGUID(assetGUID, GUID_PARAMETER, methodName); invalidParameterHandler.validateObject(searchParameters, SEARCH_PARAMETER, methodName); invalidParameterHandler.validatePaging(searchParameters.getFrom(), searchParameters.getPageSize(), methodName); InstanceGraph entityNeighborhood = getAssetNeighborhood(serverName, userId, assetGUID, searchParameters); List<EntityDetail> entities = entityNeighborhood.getEntities(); if (CollectionUtils.isEmpty(entities)) { throw new AssetCatalogException(AssetCatalogErrorCode.NO_ASSET_FROM_NEIGHBORHOOD_NOT_FOUND.getMessageDefinition(methodName), this.getClass().getName(), methodName); } return getAssetDescriptionsAfterValidation(methodName, entities); }
AssetCatalogHandler { public List<AssetDescription> getEntitiesFromNeighborhood(String serverName, String userId, String assetGUID, SearchParameters searchParameters) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException, AssetCatalogException { String methodName = "getEntitiesFromNeighborhood"; invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateGUID(assetGUID, GUID_PARAMETER, methodName); invalidParameterHandler.validateObject(searchParameters, SEARCH_PARAMETER, methodName); invalidParameterHandler.validatePaging(searchParameters.getFrom(), searchParameters.getPageSize(), methodName); InstanceGraph entityNeighborhood = getAssetNeighborhood(serverName, userId, assetGUID, searchParameters); List<EntityDetail> entities = entityNeighborhood.getEntities(); if (CollectionUtils.isEmpty(entities)) { throw new AssetCatalogException(AssetCatalogErrorCode.NO_ASSET_FROM_NEIGHBORHOOD_NOT_FOUND.getMessageDefinition(methodName), this.getClass().getName(), methodName); } return getAssetDescriptionsAfterValidation(methodName, entities); } }
AssetCatalogHandler { public List<AssetDescription> getEntitiesFromNeighborhood(String serverName, String userId, String assetGUID, SearchParameters searchParameters) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException, AssetCatalogException { String methodName = "getEntitiesFromNeighborhood"; invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateGUID(assetGUID, GUID_PARAMETER, methodName); invalidParameterHandler.validateObject(searchParameters, SEARCH_PARAMETER, methodName); invalidParameterHandler.validatePaging(searchParameters.getFrom(), searchParameters.getPageSize(), methodName); InstanceGraph entityNeighborhood = getAssetNeighborhood(serverName, userId, assetGUID, searchParameters); List<EntityDetail> entities = entityNeighborhood.getEntities(); if (CollectionUtils.isEmpty(entities)) { throw new AssetCatalogException(AssetCatalogErrorCode.NO_ASSET_FROM_NEIGHBORHOOD_NOT_FOUND.getMessageDefinition(methodName), this.getClass().getName(), methodName); } return getAssetDescriptionsAfterValidation(methodName, entities); } AssetCatalogHandler(String serverUserName, String sourceName, InvalidParameterHandler invalidParameterHandler,
                               RepositoryHandler repositoryHandler, OMRSRepositoryHelper repositoryHelper,
                               RepositoryErrorHandler errorHandler, List<String> supportedZones, List<String> supportedTypesForSearch); }
AssetCatalogHandler { public List<AssetDescription> getEntitiesFromNeighborhood(String serverName, String userId, String assetGUID, SearchParameters searchParameters) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException, AssetCatalogException { String methodName = "getEntitiesFromNeighborhood"; invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateGUID(assetGUID, GUID_PARAMETER, methodName); invalidParameterHandler.validateObject(searchParameters, SEARCH_PARAMETER, methodName); invalidParameterHandler.validatePaging(searchParameters.getFrom(), searchParameters.getPageSize(), methodName); InstanceGraph entityNeighborhood = getAssetNeighborhood(serverName, userId, assetGUID, searchParameters); List<EntityDetail> entities = entityNeighborhood.getEntities(); if (CollectionUtils.isEmpty(entities)) { throw new AssetCatalogException(AssetCatalogErrorCode.NO_ASSET_FROM_NEIGHBORHOOD_NOT_FOUND.getMessageDefinition(methodName), this.getClass().getName(), methodName); } return getAssetDescriptionsAfterValidation(methodName, entities); } 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<AssetDescription> getEntitiesFromNeighborhood(String serverName, String userId, String assetGUID, SearchParameters searchParameters) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException, AssetCatalogException { String methodName = "getEntitiesFromNeighborhood"; invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateGUID(assetGUID, GUID_PARAMETER, methodName); invalidParameterHandler.validateObject(searchParameters, SEARCH_PARAMETER, methodName); invalidParameterHandler.validatePaging(searchParameters.getFrom(), searchParameters.getPageSize(), methodName); InstanceGraph entityNeighborhood = getAssetNeighborhood(serverName, userId, assetGUID, searchParameters); List<EntityDetail> entities = entityNeighborhood.getEntities(); if (CollectionUtils.isEmpty(entities)) { throw new AssetCatalogException(AssetCatalogErrorCode.NO_ASSET_FROM_NEIGHBORHOOD_NOT_FOUND.getMessageDefinition(methodName), this.getClass().getName(), methodName); } return getAssetDescriptionsAfterValidation(methodName, entities); } 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);  }