class BusinessObjectFormatExternalInterfaceDaoHelper {

    public BusinessObjectFormatExternalInterfaceEntity getBusinessObjectFormatExternalInterfaceEntity(
        BusinessObjectFormatExternalInterfaceKey businessObjectFormatExternalInterfaceKey)
    {
        // Get a business object format entity. Since business object format to external interface
        // mapping is version-less, retrieve the latest version of the business object format.
        BusinessObjectFormatEntity businessObjectFormatEntity = businessObjectFormatDao.getBusinessObjectFormatByAltKey(
            new BusinessObjectFormatKey(businessObjectFormatExternalInterfaceKey.getNamespace(),
                businessObjectFormatExternalInterfaceKey.getBusinessObjectDefinitionName(),
                businessObjectFormatExternalInterfaceKey.getBusinessObjectFormatUsage(),
                businessObjectFormatExternalInterfaceKey.getBusinessObjectFormatFileType(), null));

        // If business object format exists, then try to retrieve specified external interface.
        ExternalInterfaceEntity externalInterfaceEntity = null;
        if (businessObjectFormatEntity != null)
        {
            externalInterfaceEntity = externalInterfaceDao.getExternalInterfaceByName(businessObjectFormatExternalInterfaceKey.getExternalInterfaceName());
        }

        // If business object format and external interface both exist, then try to retrieve business object format to external interface mapping.
        BusinessObjectFormatExternalInterfaceEntity businessObjectFormatExternalInterfaceEntity = null;
        if (externalInterfaceEntity != null)
        {
            businessObjectFormatExternalInterfaceEntity = businessObjectFormatExternalInterfaceDao
                .getBusinessObjectFormatExternalInterfaceByBusinessObjectFormatAndExternalInterface(businessObjectFormatEntity, externalInterfaceEntity);
        }

        // Throw an exception if specified business object format to external interface mapping does not exist.
        if (businessObjectFormatExternalInterfaceEntity == null)
        {
            throw new ObjectNotFoundException(String.format(
                "Business object format to external interface mapping with \"%s\" namespace, \"%s\" business object definition name, " +
                    "\"%s\" business object format usage, \"%s\" business object format file type, and \"%s\" external interface name doesn't exist.",
                businessObjectFormatExternalInterfaceKey.getNamespace(), businessObjectFormatExternalInterfaceKey.getBusinessObjectDefinitionName(),
                businessObjectFormatExternalInterfaceKey.getBusinessObjectFormatUsage(),
                businessObjectFormatExternalInterfaceKey.getBusinessObjectFormatFileType(),
                businessObjectFormatExternalInterfaceKey.getExternalInterfaceName()));
        }

        return businessObjectFormatExternalInterfaceEntity;
    }

}