@Test void removeSchemaType() throws UserNotAuthorizedException, PropertyServerException, InvalidParameterException { mockTypeDef(SchemaElementMapper.TYPE_TO_ATTRIBUTE_RELATIONSHIP_TYPE_NAME, SchemaElementMapper.TYPE_TO_ATTRIBUTE_RELATIONSHIP_TYPE_GUID); EntityDetail entityDetail = mock(EntityDetail.class); when(entityDetail.getGUID()).thenReturn(ATTRIBUTE_GUID); List<EntityDetail> entityDetails = Collections.singletonList(entityDetail); when(repositoryHandler.getEntitiesForRelationshipType(USER, GUID, SchemaElementMapper.SCHEMA_TYPE_TYPE_NAME, SchemaElementMapper.TYPE_TO_ATTRIBUTE_RELATIONSHIP_TYPE_GUID, SchemaElementMapper.TYPE_TO_ATTRIBUTE_RELATIONSHIP_TYPE_NAME, 0, 0, "getSchemaAttributesForSchemaType")).thenReturn(entityDetails); dataEngineSchemaTypeHandler.removeSchemaType(USER, GUID); verify(dataEngineCommonHandler, times(1)).removeEntity(USER, ATTRIBUTE_GUID, SchemaElementMapper.TABULAR_COLUMN_TYPE_NAME); verify(dataEngineCommonHandler, times(1)).removeEntity(USER, GUID, SchemaElementMapper.TABULAR_SCHEMA_TYPE_TYPE_NAME); }
public void removeSchemaType(String userId, String schemaTypeGUID) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException { final String methodName = "removeSchemaType"; invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateGUID(schemaTypeGUID, SchemaTypePropertiesMapper.GUID_PROPERTY_NAME, methodName); Set<String> schemaAttributeGUIDs = getSchemaAttributesForSchemaType(userId, schemaTypeGUID); for (String schemaAttributeGUID : schemaAttributeGUIDs) { removeTabularColumn(userId, schemaAttributeGUID); } removeTabularSchemaType(userId, schemaTypeGUID); }
DataEngineSchemaTypeHandler { public void removeSchemaType(String userId, String schemaTypeGUID) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException { final String methodName = "removeSchemaType"; invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateGUID(schemaTypeGUID, SchemaTypePropertiesMapper.GUID_PROPERTY_NAME, methodName); Set<String> schemaAttributeGUIDs = getSchemaAttributesForSchemaType(userId, schemaTypeGUID); for (String schemaAttributeGUID : schemaAttributeGUIDs) { removeTabularColumn(userId, schemaAttributeGUID); } removeTabularSchemaType(userId, schemaTypeGUID); } }
DataEngineSchemaTypeHandler { public void removeSchemaType(String userId, String schemaTypeGUID) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException { final String methodName = "removeSchemaType"; invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateGUID(schemaTypeGUID, SchemaTypePropertiesMapper.GUID_PROPERTY_NAME, methodName); Set<String> schemaAttributeGUIDs = getSchemaAttributesForSchemaType(userId, schemaTypeGUID); for (String schemaAttributeGUID : schemaAttributeGUIDs) { removeTabularColumn(userId, schemaAttributeGUID); } removeTabularSchemaType(userId, schemaTypeGUID); } DataEngineSchemaTypeHandler(String serviceName, String serverName, InvalidParameterHandler invalidParameterHandler,
                                       RepositoryHandler repositoryHandler, OMRSRepositoryHelper repositoryHelper,
                                       SchemaTypeHandler schemaTypeHandler, DataEngineRegistrationHandler dataEngineRegistrationHandler,
                                       DataEngineCommonHandler dataEngineCommonHandler); }
DataEngineSchemaTypeHandler { public void removeSchemaType(String userId, String schemaTypeGUID) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException { final String methodName = "removeSchemaType"; invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateGUID(schemaTypeGUID, SchemaTypePropertiesMapper.GUID_PROPERTY_NAME, methodName); Set<String> schemaAttributeGUIDs = getSchemaAttributesForSchemaType(userId, schemaTypeGUID); for (String schemaAttributeGUID : schemaAttributeGUIDs) { removeTabularColumn(userId, schemaAttributeGUID); } removeTabularSchemaType(userId, schemaTypeGUID); } DataEngineSchemaTypeHandler(String serviceName, String serverName, InvalidParameterHandler invalidParameterHandler,
                                       RepositoryHandler repositoryHandler, OMRSRepositoryHelper repositoryHelper,
                                       SchemaTypeHandler schemaTypeHandler, DataEngineRegistrationHandler dataEngineRegistrationHandler,
                                       DataEngineCommonHandler dataEngineCommonHandler); String createOrUpdateSchemaType(String userId, org.odpi.openmetadata.accessservices.dataengine.model.SchemaType schemaType,
                                           String externalSourceName); Optional<EntityDetail> findSchemaTypeEntity(String userId, String qualifiedName); Optional<EntityDetail> findSchemaAttributeEntity(String userId, String qualifiedName); void addLineageMappingRelationship(String userId, String sourceSchemaAttributeQualifiedName, String targetSchemaAttributeQualifiedName,
                                              String externalSourceName); void removeSchemaType(String userId, String schemaTypeGUID); void addAnchorGUID(String userId, Attribute attribute, String processGUID); }
DataEngineSchemaTypeHandler { public void removeSchemaType(String userId, String schemaTypeGUID) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException { final String methodName = "removeSchemaType"; invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateGUID(schemaTypeGUID, SchemaTypePropertiesMapper.GUID_PROPERTY_NAME, methodName); Set<String> schemaAttributeGUIDs = getSchemaAttributesForSchemaType(userId, schemaTypeGUID); for (String schemaAttributeGUID : schemaAttributeGUIDs) { removeTabularColumn(userId, schemaAttributeGUID); } removeTabularSchemaType(userId, schemaTypeGUID); } DataEngineSchemaTypeHandler(String serviceName, String serverName, InvalidParameterHandler invalidParameterHandler,
                                       RepositoryHandler repositoryHandler, OMRSRepositoryHelper repositoryHelper,
                                       SchemaTypeHandler schemaTypeHandler, DataEngineRegistrationHandler dataEngineRegistrationHandler,
                                       DataEngineCommonHandler dataEngineCommonHandler); String createOrUpdateSchemaType(String userId, org.odpi.openmetadata.accessservices.dataengine.model.SchemaType schemaType,
                                           String externalSourceName); Optional<EntityDetail> findSchemaTypeEntity(String userId, String qualifiedName); Optional<EntityDetail> findSchemaAttributeEntity(String userId, String qualifiedName); void addLineageMappingRelationship(String userId, String sourceSchemaAttributeQualifiedName, String targetSchemaAttributeQualifiedName,
                                              String externalSourceName); void removeSchemaType(String userId, String schemaTypeGUID); void addAnchorGUID(String userId, Attribute attribute, String processGUID);  }