@Test void addPortDelegationRelationship() throws UserNotAuthorizedException, PropertyServerException, InvalidParameterException { mockDelegatedPortEntity(PortType.INPUT_PORT); portHandler.addPortDelegationRelationship(USER, GUID, PortType.INPUT_PORT, DELEGATED_QUALIFIED_NAME, EXTERNAL_SOURCE_DE_QUALIFIED_NAME); verify(dataEngineCommonHandler, times(1)).createOrUpdateExternalRelationship(USER, GUID, PORT_GUID, PortPropertiesMapper.PORT_DELEGATION_TYPE_NAME, PortPropertiesMapper.PORT_TYPE_NAME, EXTERNAL_SOURCE_DE_QUALIFIED_NAME, null); }
public void addPortDelegationRelationship(String userId, String portGUID, PortType portType, String delegatesToQualifiedName, String externalSourceName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "addPortDelegationRelationship"; invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateName(delegatesToQualifiedName, PortPropertiesMapper.QUALIFIED_NAME_PROPERTY_NAME, methodName); Optional<EntityDetail> delegatedPortEntity = findPortEntity(userId, delegatesToQualifiedName); final String parameterName = "qualifiedName"; if (delegatedPortEntity.isPresent()) { String delegatedPortType = getPortType(delegatedPortEntity.get()); if (portType.getName().equalsIgnoreCase(delegatedPortType)) { dataEngineCommonHandler.createOrUpdateExternalRelationship(userId, portGUID, delegatedPortEntity.get().getGUID(), PortPropertiesMapper.PORT_DELEGATION_TYPE_NAME, PortPropertiesMapper.PORT_TYPE_NAME, externalSourceName, null); } else { dataEngineCommonHandler.throwInvalidParameterException(DataEngineErrorCode.INVALID_PORT_TYPE, methodName, parameterName, delegatesToQualifiedName, portType.getName()); } } else { dataEngineCommonHandler.throwInvalidParameterException(DataEngineErrorCode.PORT_NOT_FOUND, methodName, parameterName, delegatesToQualifiedName); } }
PortHandler { public void addPortDelegationRelationship(String userId, String portGUID, PortType portType, String delegatesToQualifiedName, String externalSourceName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "addPortDelegationRelationship"; invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateName(delegatesToQualifiedName, PortPropertiesMapper.QUALIFIED_NAME_PROPERTY_NAME, methodName); Optional<EntityDetail> delegatedPortEntity = findPortEntity(userId, delegatesToQualifiedName); final String parameterName = "qualifiedName"; if (delegatedPortEntity.isPresent()) { String delegatedPortType = getPortType(delegatedPortEntity.get()); if (portType.getName().equalsIgnoreCase(delegatedPortType)) { dataEngineCommonHandler.createOrUpdateExternalRelationship(userId, portGUID, delegatedPortEntity.get().getGUID(), PortPropertiesMapper.PORT_DELEGATION_TYPE_NAME, PortPropertiesMapper.PORT_TYPE_NAME, externalSourceName, null); } else { dataEngineCommonHandler.throwInvalidParameterException(DataEngineErrorCode.INVALID_PORT_TYPE, methodName, parameterName, delegatesToQualifiedName, portType.getName()); } } else { dataEngineCommonHandler.throwInvalidParameterException(DataEngineErrorCode.PORT_NOT_FOUND, methodName, parameterName, delegatesToQualifiedName); } } }
PortHandler { public void addPortDelegationRelationship(String userId, String portGUID, PortType portType, String delegatesToQualifiedName, String externalSourceName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "addPortDelegationRelationship"; invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateName(delegatesToQualifiedName, PortPropertiesMapper.QUALIFIED_NAME_PROPERTY_NAME, methodName); Optional<EntityDetail> delegatedPortEntity = findPortEntity(userId, delegatesToQualifiedName); final String parameterName = "qualifiedName"; if (delegatedPortEntity.isPresent()) { String delegatedPortType = getPortType(delegatedPortEntity.get()); if (portType.getName().equalsIgnoreCase(delegatedPortType)) { dataEngineCommonHandler.createOrUpdateExternalRelationship(userId, portGUID, delegatedPortEntity.get().getGUID(), PortPropertiesMapper.PORT_DELEGATION_TYPE_NAME, PortPropertiesMapper.PORT_TYPE_NAME, externalSourceName, null); } else { dataEngineCommonHandler.throwInvalidParameterException(DataEngineErrorCode.INVALID_PORT_TYPE, methodName, parameterName, delegatesToQualifiedName, portType.getName()); } } else { dataEngineCommonHandler.throwInvalidParameterException(DataEngineErrorCode.PORT_NOT_FOUND, methodName, parameterName, delegatesToQualifiedName); } } PortHandler(String serviceName, String serverName, InvalidParameterHandler invalidParameterHandler, RepositoryHandler repositoryHandler,
                       OMRSRepositoryHelper repositoryHelper, DataEngineCommonHandler dataEngineCommonHandler); }
PortHandler { public void addPortDelegationRelationship(String userId, String portGUID, PortType portType, String delegatesToQualifiedName, String externalSourceName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "addPortDelegationRelationship"; invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateName(delegatesToQualifiedName, PortPropertiesMapper.QUALIFIED_NAME_PROPERTY_NAME, methodName); Optional<EntityDetail> delegatedPortEntity = findPortEntity(userId, delegatesToQualifiedName); final String parameterName = "qualifiedName"; if (delegatedPortEntity.isPresent()) { String delegatedPortType = getPortType(delegatedPortEntity.get()); if (portType.getName().equalsIgnoreCase(delegatedPortType)) { dataEngineCommonHandler.createOrUpdateExternalRelationship(userId, portGUID, delegatedPortEntity.get().getGUID(), PortPropertiesMapper.PORT_DELEGATION_TYPE_NAME, PortPropertiesMapper.PORT_TYPE_NAME, externalSourceName, null); } else { dataEngineCommonHandler.throwInvalidParameterException(DataEngineErrorCode.INVALID_PORT_TYPE, methodName, parameterName, delegatesToQualifiedName, portType.getName()); } } else { dataEngineCommonHandler.throwInvalidParameterException(DataEngineErrorCode.PORT_NOT_FOUND, methodName, parameterName, delegatesToQualifiedName); } } PortHandler(String serviceName, String serverName, InvalidParameterHandler invalidParameterHandler, RepositoryHandler repositoryHandler,
                       OMRSRepositoryHelper repositoryHelper, DataEngineCommonHandler dataEngineCommonHandler); String createPortImplementation(String userId, PortImplementation portImplementation, String externalSourceName); String createPortAlias(String userId, PortAlias portAlias, String externalSourceName); void updatePortImplementation(String userId, EntityDetail originalPortEntity, PortImplementation portImplementation); void updatePortAlias(String userId, EntityDetail originalPortEntity, PortAlias portAlias); void addPortSchemaRelationship(String userId, String portGUID, String schemaTypeGUID, String externalSourceName); String findSchemaTypeForPort(String userId, String portGUID); void addPortDelegationRelationship(String userId, String portGUID, PortType portType, String delegatesToQualifiedName,
                                              String externalSourceName); void removePort(String userId, String portGUID, String entityTypeName); Optional<EntityDetail> findPortImplementationEntity(String userId, String qualifiedName); Optional<EntityDetail> findPortAliasEntity(String userId, String qualifiedName); Optional<EntityDetail> findPortEntity(String userId, String qualifiedName); }
PortHandler { public void addPortDelegationRelationship(String userId, String portGUID, PortType portType, String delegatesToQualifiedName, String externalSourceName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "addPortDelegationRelationship"; invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateName(delegatesToQualifiedName, PortPropertiesMapper.QUALIFIED_NAME_PROPERTY_NAME, methodName); Optional<EntityDetail> delegatedPortEntity = findPortEntity(userId, delegatesToQualifiedName); final String parameterName = "qualifiedName"; if (delegatedPortEntity.isPresent()) { String delegatedPortType = getPortType(delegatedPortEntity.get()); if (portType.getName().equalsIgnoreCase(delegatedPortType)) { dataEngineCommonHandler.createOrUpdateExternalRelationship(userId, portGUID, delegatedPortEntity.get().getGUID(), PortPropertiesMapper.PORT_DELEGATION_TYPE_NAME, PortPropertiesMapper.PORT_TYPE_NAME, externalSourceName, null); } else { dataEngineCommonHandler.throwInvalidParameterException(DataEngineErrorCode.INVALID_PORT_TYPE, methodName, parameterName, delegatesToQualifiedName, portType.getName()); } } else { dataEngineCommonHandler.throwInvalidParameterException(DataEngineErrorCode.PORT_NOT_FOUND, methodName, parameterName, delegatesToQualifiedName); } } PortHandler(String serviceName, String serverName, InvalidParameterHandler invalidParameterHandler, RepositoryHandler repositoryHandler,
                       OMRSRepositoryHelper repositoryHelper, DataEngineCommonHandler dataEngineCommonHandler); String createPortImplementation(String userId, PortImplementation portImplementation, String externalSourceName); String createPortAlias(String userId, PortAlias portAlias, String externalSourceName); void updatePortImplementation(String userId, EntityDetail originalPortEntity, PortImplementation portImplementation); void updatePortAlias(String userId, EntityDetail originalPortEntity, PortAlias portAlias); void addPortSchemaRelationship(String userId, String portGUID, String schemaTypeGUID, String externalSourceName); String findSchemaTypeForPort(String userId, String portGUID); void addPortDelegationRelationship(String userId, String portGUID, PortType portType, String delegatesToQualifiedName,
                                              String externalSourceName); void removePort(String userId, String portGUID, String entityTypeName); Optional<EntityDetail> findPortImplementationEntity(String userId, String qualifiedName); Optional<EntityDetail> findPortAliasEntity(String userId, String qualifiedName); Optional<EntityDetail> findPortEntity(String userId, String qualifiedName);  }