/**
   * @return the latest version of the decision definition with the given key (from any tenant)
   * @throws ProcessEngineException if more than one tenant has a decision definition with the given
   *     key
   * @see #findLatestDecisionDefinitionByKeyAndTenantId(String, String)
   */
  public DecisionDefinitionEntity findLatestDecisionDefinitionByKey(String decisionDefinitionKey) {
    @SuppressWarnings("unchecked")
    List<DecisionDefinitionEntity> decisionDefinitions =
        getDbEntityManager()
            .selectList("selectLatestDecisionDefinitionByKey", decisionDefinitionKey);

    if (decisionDefinitions.isEmpty()) {
      return null;

    } else if (decisionDefinitions.size() == 1) {
      return decisionDefinitions.iterator().next();

    } else {
      throw LOG.multipleTenantsForDecisionDefinitionKeyException(decisionDefinitionKey);
    }
  }