public static boolean isMessageExcluded ( Message message , RecipientType recipientType , String recipientValue ) { Recipient [ ] recipients = ( Recipient [ ] ) message . getMetadata ( "cwf.pub.recipients" ) ; if ( recipients == null || recipients . length == 0 ) { return false ; } boolean excluded = false ; for ( Recipient recipient : recipients ) { if ( recipient . getType ( ) == recipientType ) { excluded = true ; if ( recipient . getValue ( ) . equals ( recipientValue ) ) { return false ; } } } return excluded ; }
Returns true if the message should be excluded based on the given recipient values . A message is considered excluded if it has any constraint on the recipient type and does not have a matching recipient for that type .