public String identifierToSuppressionId ( Identifier id ) { if ( id instanceof PurlIdentifier ) { final PurlIdentifier purl = ( PurlIdentifier ) id ; return purl . toGav ( ) ; } else if ( id instanceof CpeIdentifier ) { try { final CpeIdentifier cpeId = ( CpeIdentifier ) id ; final Cpe cpe = cpeId . getCpe ( ) ; return String . format ( "cpe:/%s:%s:%s" , Convert . wellFormedToCpeUri ( cpe . getPart ( ) ) , Convert . wellFormedToCpeUri ( cpe . getWellFormedVendor ( ) ) , Convert . wellFormedToCpeUri ( cpe . getWellFormedProduct ( ) ) ) ; } catch ( CpeEncodingException ex ) { LOGGER . debug ( "Unable to convert to cpe URI" , ex ) ; } } else if ( id instanceof GenericIdentifier ) { return id . getValue ( ) ; } return null ; }
Converts an identifier into the Suppression string when possible .