@Override
    public Collection<String> search(String key, String value) {
        Set<String> groupNames = new HashSet<>();
        Connection con = null;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        try {
            con = DbConnectionManager.getConnection();
            pstmt = con.prepareStatement(GROUPS_FOR_PROP);
            pstmt.setString(1, key);
            pstmt.setString(2, value);
            rs = pstmt.executeQuery();
            while (rs.next()) {
                groupNames.add(rs.getString(1));
            }
        }
        catch (SQLException sqle) {
            Log.error(sqle.getMessage(), sqle);
        }
        finally {
            DbConnectionManager.closeConnection(rs, pstmt, con);
        }
        return groupNames;
    }
Checks if any shared groups exists. No distinction is made between the type of shared group: any group that is
shared (with anything other than 'nobody') qualifies.

@return true if at least one shared group exists, otherwise false.
xmppserver/src/main/java/org/jivesoftware/openfire/group/AbstractGroupProvider.java