@Test public void getRelationshipBetweenEntities_throwsUserNotAuthorizedException() throws PropertyServerException, UserNotAuthorizedException, RepositoryErrorException { String methodName = "getRelationshipBetweenEntities"; mockTypeDef(RELATIONSHIP_TYPE, RELATIONSHIP_TYPE_GUID); mockMetadataCollection(); UserNotAuthorizedException mockedException = new UserNotAuthorizedException(AssetCatalogErrorCode.SERVICE_NOT_INITIALIZED.getMessageDefinition(), this.getClass().getName(), "", ""); doThrow(mockedException).when(repositoryHandler).getRelationshipBetweenEntities(USER, FIRST_GUID, "", SECOND_GUID, RELATIONSHIP_TYPE_GUID, RELATIONSHIP_TYPE, methodName); assertThrows(UserNotAuthorizedException.class, () -> relationshipHandler.getRelationshipBetweenEntities(USER, FIRST_GUID, SECOND_GUID, RELATIONSHIP_TYPE)); }
public org.odpi.openmetadata.accessservices.assetcatalog.model.Relationship getRelationshipBetweenEntities(String userId, String entity1GUID, String entity2GUID, String relationshipType) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "getRelationshipBetweenEntities"; invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateGUID(entity1GUID, "entity1GUID", methodName); invalidParameterHandler.validateGUID(entity2GUID, "entity2GUID", methodName); String relationshipTypeGUID = null; if (relationshipType != null) { relationshipTypeGUID = commonHandler.getTypeDefGUID(userId, relationshipType); } Relationship relationshipBetweenEntities = repositoryHandler.getRelationshipBetweenEntities(userId, entity1GUID, "", entity2GUID, relationshipTypeGUID, relationshipType, methodName); if (relationshipBetweenEntities != null) { AssetConverter converter = new AssetConverter(sourceName, repositoryHelper); return converter.convertRelationship(relationshipBetweenEntities); } return null; }
RelationshipHandler { public org.odpi.openmetadata.accessservices.assetcatalog.model.Relationship getRelationshipBetweenEntities(String userId, String entity1GUID, String entity2GUID, String relationshipType) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "getRelationshipBetweenEntities"; invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateGUID(entity1GUID, "entity1GUID", methodName); invalidParameterHandler.validateGUID(entity2GUID, "entity2GUID", methodName); String relationshipTypeGUID = null; if (relationshipType != null) { relationshipTypeGUID = commonHandler.getTypeDefGUID(userId, relationshipType); } Relationship relationshipBetweenEntities = repositoryHandler.getRelationshipBetweenEntities(userId, entity1GUID, "", entity2GUID, relationshipTypeGUID, relationshipType, methodName); if (relationshipBetweenEntities != null) { AssetConverter converter = new AssetConverter(sourceName, repositoryHelper); return converter.convertRelationship(relationshipBetweenEntities); } return null; } }
RelationshipHandler { public org.odpi.openmetadata.accessservices.assetcatalog.model.Relationship getRelationshipBetweenEntities(String userId, String entity1GUID, String entity2GUID, String relationshipType) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "getRelationshipBetweenEntities"; invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateGUID(entity1GUID, "entity1GUID", methodName); invalidParameterHandler.validateGUID(entity2GUID, "entity2GUID", methodName); String relationshipTypeGUID = null; if (relationshipType != null) { relationshipTypeGUID = commonHandler.getTypeDefGUID(userId, relationshipType); } Relationship relationshipBetweenEntities = repositoryHandler.getRelationshipBetweenEntities(userId, entity1GUID, "", entity2GUID, relationshipTypeGUID, relationshipType, methodName); if (relationshipBetweenEntities != null) { AssetConverter converter = new AssetConverter(sourceName, repositoryHelper); return converter.convertRelationship(relationshipBetweenEntities); } return null; } RelationshipHandler(String sourceName, InvalidParameterHandler invalidParameterHandler, RepositoryHandler repositoryHandler,
                               OMRSRepositoryHelper repositoryHelper, RepositoryErrorHandler errorHandler); }
RelationshipHandler { public org.odpi.openmetadata.accessservices.assetcatalog.model.Relationship getRelationshipBetweenEntities(String userId, String entity1GUID, String entity2GUID, String relationshipType) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "getRelationshipBetweenEntities"; invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateGUID(entity1GUID, "entity1GUID", methodName); invalidParameterHandler.validateGUID(entity2GUID, "entity2GUID", methodName); String relationshipTypeGUID = null; if (relationshipType != null) { relationshipTypeGUID = commonHandler.getTypeDefGUID(userId, relationshipType); } Relationship relationshipBetweenEntities = repositoryHandler.getRelationshipBetweenEntities(userId, entity1GUID, "", entity2GUID, relationshipTypeGUID, relationshipType, methodName); if (relationshipBetweenEntities != null) { AssetConverter converter = new AssetConverter(sourceName, repositoryHelper); return converter.convertRelationship(relationshipBetweenEntities); } return null; } RelationshipHandler(String sourceName, InvalidParameterHandler invalidParameterHandler, RepositoryHandler repositoryHandler,
                               OMRSRepositoryHelper repositoryHelper, RepositoryErrorHandler errorHandler); org.odpi.openmetadata.accessservices.assetcatalog.model.Relationship getRelationshipBetweenEntities(String userId,
                                                                                                               String entity1GUID,
                                                                                                               String entity2GUID,
                                                                                                               String relationshipType); }
RelationshipHandler { public org.odpi.openmetadata.accessservices.assetcatalog.model.Relationship getRelationshipBetweenEntities(String userId, String entity1GUID, String entity2GUID, String relationshipType) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "getRelationshipBetweenEntities"; invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateGUID(entity1GUID, "entity1GUID", methodName); invalidParameterHandler.validateGUID(entity2GUID, "entity2GUID", methodName); String relationshipTypeGUID = null; if (relationshipType != null) { relationshipTypeGUID = commonHandler.getTypeDefGUID(userId, relationshipType); } Relationship relationshipBetweenEntities = repositoryHandler.getRelationshipBetweenEntities(userId, entity1GUID, "", entity2GUID, relationshipTypeGUID, relationshipType, methodName); if (relationshipBetweenEntities != null) { AssetConverter converter = new AssetConverter(sourceName, repositoryHelper); return converter.convertRelationship(relationshipBetweenEntities); } return null; } RelationshipHandler(String sourceName, InvalidParameterHandler invalidParameterHandler, RepositoryHandler repositoryHandler,
                               OMRSRepositoryHelper repositoryHelper, RepositoryErrorHandler errorHandler); org.odpi.openmetadata.accessservices.assetcatalog.model.Relationship getRelationshipBetweenEntities(String userId,
                                                                                                               String entity1GUID,
                                                                                                               String entity2GUID,
                                                                                                               String relationshipType);  }