tvaultapi/src/main/java/com/tmobile/cso/vault/api/service/SSLCertificateService.java
private boolean isPolicyOfCertType(String policy, String certType) {
	    String certTypeName = SSLCertificateConstants.INTERNAL_POLICY_NAME;
	    if (certType.equals(SSLCertificateConstants.EXTERNAL)) {
            certTypeName = SSLCertificateConstants.EXTERNAL_POLICY_NAME;
        }
        String ownerPolicyPrefix = new StringBuilder().append(SSLCertificateConstants.SUDO_CERT_POLICY_PREFIX)
                .append(certTypeName).append("_").toString();
        String readPolicyPrefix = new StringBuilder().append(SSLCertificateConstants.READ_CERT_POLICY_PREFIX)
                .append(certTypeName).append("_").toString();
        String writePolicyPrefix = new StringBuilder().append(SSLCertificateConstants.WRITE_CERT_POLICY_PREFIX)
                .append(certTypeName).append("_").toString();
        String denyPolicyPrefix = new StringBuilder().append(SSLCertificateConstants.DENY_CERT_POLICY_PREFIX)
                .append(certTypeName).append("_").toString();

        if (policy.startsWith(ownerPolicyPrefix) || policy.startsWith(readPolicyPrefix)
                || policy.startsWith(writePolicyPrefix) || policy.startsWith(denyPolicyPrefix)) {
            return true;
        }
        return false;
    }
/**
     * To check of the policy is of internal or external certificate type.
     * @param policy
     * @param certType
     * @return
     */
To check of the policy is of internal or external certificate type.
@param policy
@param certType
@return
To check of the policy is of internal or external certificate type . @param policy @param certType @return
private boolean isPolicyOfCertType(String policy, String certType) {
	    String certTypeName = SSLCertificateConstants.INTERNAL_POLICY_NAME;
	    if (certType.equals(SSLCertificateConstants.EXTERNAL)) {
            certTypeName = SSLCertificateConstants.EXTERNAL_POLICY_NAME;
        }
        String ownerPolicyPrefix = new StringBuilder().append(SSLCertificateConstants.SUDO_CERT_POLICY_PREFIX)
                .append(certTypeName).append("_").toString();
        String readPolicyPrefix = new StringBuilder().append(SSLCertificateConstants.READ_CERT_POLICY_PREFIX)
                .append(certTypeName).append("_").toString();
        String writePolicyPrefix = new StringBuilder().append(SSLCertificateConstants.WRITE_CERT_POLICY_PREFIX)
                .append(certTypeName).append("_").toString();
        String denyPolicyPrefix = new StringBuilder().append(SSLCertificateConstants.DENY_CERT_POLICY_PREFIX)
                .append(certTypeName).append("_").toString();
        if (policy.startsWith(ownerPolicyPrefix) || policy.startsWith(readPolicyPrefix)
                || policy.startsWith(writePolicyPrefix) || policy.startsWith(denyPolicyPrefix)) {
            return true;
        }
        return false;
    }
private boolean isPolicyOfCertType ( String policy , String certType ) { String certTypeName = SSLCertificateConstants . INTERNAL_POLICY_NAME ; if ( certType . equals ( SSLCertificateConstants . EXTERNAL ) ) { certTypeName = SSLCertificateConstants . EXTERNAL_POLICY_NAME ; } String ownerPolicyPrefix = new StringBuilder ( ) . append ( SSLCertificateConstants . SUDO_CERT_POLICY_PREFIX ) . append ( certTypeName ) . append ( "_" ) . toString ( ) ; String readPolicyPrefix = new StringBuilder ( ) . append ( SSLCertificateConstants . READ_CERT_POLICY_PREFIX ) . append ( certTypeName ) . append ( "_" ) . toString ( ) ; String writePolicyPrefix = new StringBuilder ( ) . append ( SSLCertificateConstants . WRITE_CERT_POLICY_PREFIX ) . append ( certTypeName ) . append ( "_" ) . toString ( ) ; String denyPolicyPrefix = new StringBuilder ( ) . append ( SSLCertificateConstants . DENY_CERT_POLICY_PREFIX ) . append ( certTypeName ) . append ( "_" ) . toString ( ) ; if ( policy . startsWith ( ownerPolicyPrefix ) || policy . startsWith ( readPolicyPrefix ) || policy . startsWith ( writePolicyPrefix ) || policy . startsWith ( denyPolicyPrefix ) ) { return true ; } return false ; }
To check of the policy is of internal or external certificate type.
To check of the policy is of internal or external certificate type .