if ((type & SecConst.CERTTYPE_SUBCA) > 0) { ctypes.append(SecConst.CERTTYPE_SUBCA);
if ((type & CertificateDataBean.CERTTYPE_SUBCA) > 0) { ctypes.append(CertificateDataBean.CERTTYPE_SUBCA);
    public Collection findCertificatesByType(Admin admin, int type, String issuerDN) {        debug(">findCertificatesByType()");        if (null == admin                || type <= 0                || type > SecConst.CERTTYPE_SUBCA + SecConst.CERTTYPE_ENDENTITY + SecConst.CERTTYPE_ROOTCA) {            throw new IllegalArgumentException();        }        StringBuffer ctypes = new StringBuffer();        if ((type & SecConst.CERTTYPE_SUBCA) > 0) {            ctypes.append(SecConst.CERTTYPE_SUBCA);        }        if ((type & SecConst.CERTTYPE_ENDENTITY) > 0) {            if (ctypes.length() > 0) {                ctypes.append(", ");            }            ctypes.append(SecConst.CERTTYPE_ENDENTITY);        }        if ((type & SecConst.CERTTYPE_ROOTCA) > 0) {            if (ctypes.length() > 0) {                ctypes.append(", ");            }            ctypes.append(SecConst.CERTTYPE_ROOTCA);        }        Connection con = null;        PreparedStatement ps = null;        ResultSet result = null;        try {            ArrayList vect;// Status 20 = CertificateData.CERT_ACTIVE            StringBuffer stmt = new StringBuffer("SELECT DISTINCT fingerprint FROM CertificateData WHERE status = 20 AND ");            stmt.append(" type IN (");            stmt.append(ctypes.toString());            stmt.append(')');            if (null != issuerDN && issuerDN.length() > 0) {                String dn = CertTools.stringToBCDNString(issuerDN);                dn = StringTools.strip(dn);                if (log.isDebugEnabled()) {                    debug("findCertificatesByType() : Looking for cert with (transformed)DN: " + dn);                }                stmt.append(" AND issuerDN = '");                stmt.append(dn);                stmt.append('\'');            }            if (log.isDebugEnabled()) {                debug("findCertificatesByType() : executing SQL statement\n"                        + stmt.toString());            }            con = getConnection();            ps = con.prepareStatement(stmt.toString());            result = ps.executeQuery();            vect = new ArrayList();            while (result.next()) {                Certificate cert = findCertificateByFingerprint(admin, result.getString(1));                if (cert != null) {                    vect.add(cert);                }            }            debug("<findCertificatesByType()");            return vect;        } catch (Exception e) {            throw new EJBException(e);        } finally {            JDBCUtil.close(con, ps, result);        }    } // findCertificatesByType