class UriUtils {

    static boolean isValidDocumentId(String suffix, String factoryLink) {
        // Skip validation for core services
        if (suffix.startsWith(ServiceUriPaths.CORE + UriUtils.URI_PATH_CHAR)) {
            return true;
        }

        int index = 0;
        if (UriUtils.isChildPath(suffix, factoryLink)) {
            index = factoryLink.length() + 1;
        }

        final int len = suffix.length();
        if (index < len && suffix.charAt(index) == UriUtils.URI_PATH_CHAR.charAt(0)) {
            index = index + 1;
        }

        if (index >= len) {
            return false;
        }

        for (int i = index; i < len; i++) {
            char ch = suffix.charAt(i);
            if (ch >= '0' && ch <= '9') {
                continue;
            }
            if (ch >= 'a' && ch <= 'z') {
                continue;
            }
            if (ch >= 'A' && ch <= 'Z') {
                continue;
            }
            if (URI_LEGAL_CHARS.indexOf(ch) >= 0) {
                continue;
            }
            return false;
        }

        return true;
    }

    private  UriUtils();

}