@Test public void buildContextByType() throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException, RepositoryErrorException { String methodName = "buildContextByType"; mockMetadataCollection(); mockEntityDetails(FIRST_GUID); mockTypeDef(ASSET_TYPE, ASSET_TYPE_GUID); AssetElements assetElements = assetCatalogHandler.buildContextByType(USER, FIRST_GUID, ASSET_TYPE); assertEquals(FIRST_GUID, assetElements.getGuid()); assertEquals(ASSET_TYPE, assetElements.getType().getName()); verify(invalidParameterHandler, times(1)).validateUserId(USER, methodName); }
public AssetElements buildContextByType(String userId, String entityGUID, String entityTypeDefName) throws UserNotAuthorizedException, PropertyServerException, InvalidParameterException { String methodName = "buildContextByType"; invalidParameterHandler.validateUserId(userId, methodName); EntityDetail entityDetail = getEntity(userId, entityGUID, entityTypeDefName); if (entityDetail == null || entityDetail.getType() == null || entityDetail.getType().getTypeDefName() == null) { return null; } String typeDefName = entityDetail.getType().getTypeDefName(); Set<String> superTypes = commonHandler.collectSuperTypes(userId, entityDetail.getType().getTypeDefName()); AssetElement assetElement = new AssetElement(); if (typeDefName.equals(GLOSSARY_TERM)) { return getContextForGlossaryTerm(userId, entityDetail); } else { invalidParameterHandler.validateAssetInSupportedZone(entityDetail.getGUID(), GUID_PARAMETER, commonHandler.getAssetZoneMembership(entityDetail.getClassifications()), supportedZones, serverUserName, methodName); AssetElements assetElements = assetConverter.buildAssetElements(entityDetail); if (superTypes.contains(SCHEMA_ELEMENT)) { getContextForSchemaElement(userId, entityDetail, assetElement); } else if (superTypes.contains(DEPLOYED_API)) { getContextForDeployedAPI(userId, entityDetail, assetElement); } else if (superTypes.contains(IT_INFRASTRUCTURE)) { getContextForInfrastructure(userId, entityDetail, assetElement); } else if (superTypes.contains(PROCESS)) { getContextForProcess(userId, entityDetail, assetElement); } else if (superTypes.contains(DATA_STORE)) { getContextForDataStore(userId, entityDetail, assetElement); } else if (superTypes.contains(DATA_SET)) { getContextForDataSet(userId, entityDetail, assetElement); } assetElements.setElements(Collections.singletonList(assetElement)); return assetElements; } }
AssetCatalogHandler { public AssetElements buildContextByType(String userId, String entityGUID, String entityTypeDefName) throws UserNotAuthorizedException, PropertyServerException, InvalidParameterException { String methodName = "buildContextByType"; invalidParameterHandler.validateUserId(userId, methodName); EntityDetail entityDetail = getEntity(userId, entityGUID, entityTypeDefName); if (entityDetail == null || entityDetail.getType() == null || entityDetail.getType().getTypeDefName() == null) { return null; } String typeDefName = entityDetail.getType().getTypeDefName(); Set<String> superTypes = commonHandler.collectSuperTypes(userId, entityDetail.getType().getTypeDefName()); AssetElement assetElement = new AssetElement(); if (typeDefName.equals(GLOSSARY_TERM)) { return getContextForGlossaryTerm(userId, entityDetail); } else { invalidParameterHandler.validateAssetInSupportedZone(entityDetail.getGUID(), GUID_PARAMETER, commonHandler.getAssetZoneMembership(entityDetail.getClassifications()), supportedZones, serverUserName, methodName); AssetElements assetElements = assetConverter.buildAssetElements(entityDetail); if (superTypes.contains(SCHEMA_ELEMENT)) { getContextForSchemaElement(userId, entityDetail, assetElement); } else if (superTypes.contains(DEPLOYED_API)) { getContextForDeployedAPI(userId, entityDetail, assetElement); } else if (superTypes.contains(IT_INFRASTRUCTURE)) { getContextForInfrastructure(userId, entityDetail, assetElement); } else if (superTypes.contains(PROCESS)) { getContextForProcess(userId, entityDetail, assetElement); } else if (superTypes.contains(DATA_STORE)) { getContextForDataStore(userId, entityDetail, assetElement); } else if (superTypes.contains(DATA_SET)) { getContextForDataSet(userId, entityDetail, assetElement); } assetElements.setElements(Collections.singletonList(assetElement)); return assetElements; } } }
AssetCatalogHandler { public AssetElements buildContextByType(String userId, String entityGUID, String entityTypeDefName) throws UserNotAuthorizedException, PropertyServerException, InvalidParameterException { String methodName = "buildContextByType"; invalidParameterHandler.validateUserId(userId, methodName); EntityDetail entityDetail = getEntity(userId, entityGUID, entityTypeDefName); if (entityDetail == null || entityDetail.getType() == null || entityDetail.getType().getTypeDefName() == null) { return null; } String typeDefName = entityDetail.getType().getTypeDefName(); Set<String> superTypes = commonHandler.collectSuperTypes(userId, entityDetail.getType().getTypeDefName()); AssetElement assetElement = new AssetElement(); if (typeDefName.equals(GLOSSARY_TERM)) { return getContextForGlossaryTerm(userId, entityDetail); } else { invalidParameterHandler.validateAssetInSupportedZone(entityDetail.getGUID(), GUID_PARAMETER, commonHandler.getAssetZoneMembership(entityDetail.getClassifications()), supportedZones, serverUserName, methodName); AssetElements assetElements = assetConverter.buildAssetElements(entityDetail); if (superTypes.contains(SCHEMA_ELEMENT)) { getContextForSchemaElement(userId, entityDetail, assetElement); } else if (superTypes.contains(DEPLOYED_API)) { getContextForDeployedAPI(userId, entityDetail, assetElement); } else if (superTypes.contains(IT_INFRASTRUCTURE)) { getContextForInfrastructure(userId, entityDetail, assetElement); } else if (superTypes.contains(PROCESS)) { getContextForProcess(userId, entityDetail, assetElement); } else if (superTypes.contains(DATA_STORE)) { getContextForDataStore(userId, entityDetail, assetElement); } else if (superTypes.contains(DATA_SET)) { getContextForDataSet(userId, entityDetail, assetElement); } assetElements.setElements(Collections.singletonList(assetElement)); return assetElements; } } AssetCatalogHandler(String serverUserName, String sourceName, InvalidParameterHandler invalidParameterHandler,
                               RepositoryHandler repositoryHandler, OMRSRepositoryHelper repositoryHelper,
                               RepositoryErrorHandler errorHandler, List<String> supportedZones, List<String> supportedTypesForSearch); }
AssetCatalogHandler { public AssetElements buildContextByType(String userId, String entityGUID, String entityTypeDefName) throws UserNotAuthorizedException, PropertyServerException, InvalidParameterException { String methodName = "buildContextByType"; invalidParameterHandler.validateUserId(userId, methodName); EntityDetail entityDetail = getEntity(userId, entityGUID, entityTypeDefName); if (entityDetail == null || entityDetail.getType() == null || entityDetail.getType().getTypeDefName() == null) { return null; } String typeDefName = entityDetail.getType().getTypeDefName(); Set<String> superTypes = commonHandler.collectSuperTypes(userId, entityDetail.getType().getTypeDefName()); AssetElement assetElement = new AssetElement(); if (typeDefName.equals(GLOSSARY_TERM)) { return getContextForGlossaryTerm(userId, entityDetail); } else { invalidParameterHandler.validateAssetInSupportedZone(entityDetail.getGUID(), GUID_PARAMETER, commonHandler.getAssetZoneMembership(entityDetail.getClassifications()), supportedZones, serverUserName, methodName); AssetElements assetElements = assetConverter.buildAssetElements(entityDetail); if (superTypes.contains(SCHEMA_ELEMENT)) { getContextForSchemaElement(userId, entityDetail, assetElement); } else if (superTypes.contains(DEPLOYED_API)) { getContextForDeployedAPI(userId, entityDetail, assetElement); } else if (superTypes.contains(IT_INFRASTRUCTURE)) { getContextForInfrastructure(userId, entityDetail, assetElement); } else if (superTypes.contains(PROCESS)) { getContextForProcess(userId, entityDetail, assetElement); } else if (superTypes.contains(DATA_STORE)) { getContextForDataStore(userId, entityDetail, assetElement); } else if (superTypes.contains(DATA_SET)) { getContextForDataSet(userId, entityDetail, assetElement); } assetElements.setElements(Collections.singletonList(assetElement)); return assetElements; } } 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 AssetElements buildContextByType(String userId, String entityGUID, String entityTypeDefName) throws UserNotAuthorizedException, PropertyServerException, InvalidParameterException { String methodName = "buildContextByType"; invalidParameterHandler.validateUserId(userId, methodName); EntityDetail entityDetail = getEntity(userId, entityGUID, entityTypeDefName); if (entityDetail == null || entityDetail.getType() == null || entityDetail.getType().getTypeDefName() == null) { return null; } String typeDefName = entityDetail.getType().getTypeDefName(); Set<String> superTypes = commonHandler.collectSuperTypes(userId, entityDetail.getType().getTypeDefName()); AssetElement assetElement = new AssetElement(); if (typeDefName.equals(GLOSSARY_TERM)) { return getContextForGlossaryTerm(userId, entityDetail); } else { invalidParameterHandler.validateAssetInSupportedZone(entityDetail.getGUID(), GUID_PARAMETER, commonHandler.getAssetZoneMembership(entityDetail.getClassifications()), supportedZones, serverUserName, methodName); AssetElements assetElements = assetConverter.buildAssetElements(entityDetail); if (superTypes.contains(SCHEMA_ELEMENT)) { getContextForSchemaElement(userId, entityDetail, assetElement); } else if (superTypes.contains(DEPLOYED_API)) { getContextForDeployedAPI(userId, entityDetail, assetElement); } else if (superTypes.contains(IT_INFRASTRUCTURE)) { getContextForInfrastructure(userId, entityDetail, assetElement); } else if (superTypes.contains(PROCESS)) { getContextForProcess(userId, entityDetail, assetElement); } else if (superTypes.contains(DATA_STORE)) { getContextForDataStore(userId, entityDetail, assetElement); } else if (superTypes.contains(DATA_SET)) { getContextForDataSet(userId, entityDetail, assetElement); } assetElements.setElements(Collections.singletonList(assetElement)); return assetElements; } } 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);  }