@Test void addAnchorGUID_throwsInvalidParameterException() throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException { SchemaAttribute schemaAttribute = new SchemaAttribute(); schemaAttribute.setQualifiedName(ATTRIBUTE_QUALIFIED_NAME); when(schemaTypeHandler.getEmptyTabularColumn()).thenReturn(schemaAttribute); when(dataEngineCommonHandler.findEntity(USER, ATTRIBUTE_QUALIFIED_NAME, SchemaElementMapper.SCHEMA_ATTRIBUTE_TYPE_NAME)).thenReturn(Optional.empty()); dataEngineSchemaTypeHandler.addAnchorGUID(USER, attribute, PROCESS_GUID); verify(dataEngineCommonHandler, times(1)).throwInvalidParameterException(DataEngineErrorCode.SCHEMA_ATTRIBUTE_NOT_FOUND, "addAnchorGUID", "qualifiedName", ATTRIBUTE_QUALIFIED_NAME); }
public void addAnchorGUID(String userId, Attribute attribute, String processGUID) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "addAnchorGUID"; final String parameterName = "qualifiedName"; Optional<EntityDetail> schemaAttributeEntity = findSchemaAttributeEntity(userId, attribute.getQualifiedName()); if (!schemaAttributeEntity.isPresent()) { dataEngineCommonHandler.throwInvalidParameterException(DataEngineErrorCode.SCHEMA_ATTRIBUTE_NOT_FOUND, methodName, parameterName, attribute.getQualifiedName()); } else { SchemaAttribute schemaAttribute = createTabularColumn(attribute); schemaAttribute.setAnchorGUID(processGUID); schemaTypeHandler.updateSchemaAttribute(userId, schemaAttributeEntity.get().getGUID(), schemaAttribute); } }
DataEngineSchemaTypeHandler { public void addAnchorGUID(String userId, Attribute attribute, String processGUID) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "addAnchorGUID"; final String parameterName = "qualifiedName"; Optional<EntityDetail> schemaAttributeEntity = findSchemaAttributeEntity(userId, attribute.getQualifiedName()); if (!schemaAttributeEntity.isPresent()) { dataEngineCommonHandler.throwInvalidParameterException(DataEngineErrorCode.SCHEMA_ATTRIBUTE_NOT_FOUND, methodName, parameterName, attribute.getQualifiedName()); } else { SchemaAttribute schemaAttribute = createTabularColumn(attribute); schemaAttribute.setAnchorGUID(processGUID); schemaTypeHandler.updateSchemaAttribute(userId, schemaAttributeEntity.get().getGUID(), schemaAttribute); } } }
DataEngineSchemaTypeHandler { public void addAnchorGUID(String userId, Attribute attribute, String processGUID) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "addAnchorGUID"; final String parameterName = "qualifiedName"; Optional<EntityDetail> schemaAttributeEntity = findSchemaAttributeEntity(userId, attribute.getQualifiedName()); if (!schemaAttributeEntity.isPresent()) { dataEngineCommonHandler.throwInvalidParameterException(DataEngineErrorCode.SCHEMA_ATTRIBUTE_NOT_FOUND, methodName, parameterName, attribute.getQualifiedName()); } else { SchemaAttribute schemaAttribute = createTabularColumn(attribute); schemaAttribute.setAnchorGUID(processGUID); schemaTypeHandler.updateSchemaAttribute(userId, schemaAttributeEntity.get().getGUID(), schemaAttribute); } } DataEngineSchemaTypeHandler(String serviceName, String serverName, InvalidParameterHandler invalidParameterHandler,
                                       RepositoryHandler repositoryHandler, OMRSRepositoryHelper repositoryHelper,
                                       SchemaTypeHandler schemaTypeHandler, DataEngineRegistrationHandler dataEngineRegistrationHandler,
                                       DataEngineCommonHandler dataEngineCommonHandler); }
DataEngineSchemaTypeHandler { public void addAnchorGUID(String userId, Attribute attribute, String processGUID) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "addAnchorGUID"; final String parameterName = "qualifiedName"; Optional<EntityDetail> schemaAttributeEntity = findSchemaAttributeEntity(userId, attribute.getQualifiedName()); if (!schemaAttributeEntity.isPresent()) { dataEngineCommonHandler.throwInvalidParameterException(DataEngineErrorCode.SCHEMA_ATTRIBUTE_NOT_FOUND, methodName, parameterName, attribute.getQualifiedName()); } else { SchemaAttribute schemaAttribute = createTabularColumn(attribute); schemaAttribute.setAnchorGUID(processGUID); schemaTypeHandler.updateSchemaAttribute(userId, schemaAttributeEntity.get().getGUID(), schemaAttribute); } } 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 addAnchorGUID(String userId, Attribute attribute, String processGUID) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "addAnchorGUID"; final String parameterName = "qualifiedName"; Optional<EntityDetail> schemaAttributeEntity = findSchemaAttributeEntity(userId, attribute.getQualifiedName()); if (!schemaAttributeEntity.isPresent()) { dataEngineCommonHandler.throwInvalidParameterException(DataEngineErrorCode.SCHEMA_ATTRIBUTE_NOT_FOUND, methodName, parameterName, attribute.getQualifiedName()); } else { SchemaAttribute schemaAttribute = createTabularColumn(attribute); schemaAttribute.setAnchorGUID(processGUID); schemaTypeHandler.updateSchemaAttribute(userId, schemaAttributeEntity.get().getGUID(), schemaAttribute); } } 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);  }