code: public String createPolicyRuleForExternalId(ComponentService componentService, ExternalId externalId, String policyName) throws IntegrationException {
          Optional<ComponentVersionView> componentVersionView = componentService.getComponentVersion(externalId);
          if (!componentVersionView.isPresent()) {
              throw new BlackDuckIntegrationException(String.format("The external id (%s) provided could not be found, so no policy can be created for it.", externalId.createExternalId()));
          }
  
          PolicyRuleExpressionSetBuilder builder = new PolicyRuleExpressionSetBuilder();
          builder.addComponentVersionCondition(PolicyRuleConditionOperatorType.EQ, componentVersionView.get());
          PolicyRuleExpressionSetView expressionSet = builder.createPolicyRuleExpressionSetView();
  
          PolicyRuleView policyRuleView = new PolicyRuleView();
          policyRuleView.setName(policyName);
          policyRuleView.setEnabled(true);
          policyRuleView.setOverridable(true);
          policyRuleView.setExpression(expressionSet);
  
          return createPolicyRule(policyRuleView);
      }
docs: This will create a policy rule that will be violated by the existence of a matching external id in the project's BOM.