public CaseDefinitionEntity findLatestCaseDefinitionByKey(String caseDefinitionKey) {
    @SuppressWarnings("unchecked")
    List<CaseDefinitionEntity> caseDefinitions = getDbEntityManager().selectList("selectLatestCaseDefinitionByKey", configureParameterizedQuery(caseDefinitionKey));

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

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

    } else {
      throw LOG.multipleTenantsForCaseDefinitionKeyException(caseDefinitionKey);
    }
  }
public CaseDefinitionEntity findLatestCaseDefinitionByKey ( String caseDefinitionKey ) { @ SuppressWarnings ( "unchecked" ) List < CaseDefinitionEntity > caseDefinitions = getDbEntityManager ( ) . selectList ( "selectLatestCaseDefinitionByKey" , configureParameterizedQuery ( caseDefinitionKey ) ) ; if ( caseDefinitions . isEmpty ( ) ) { return null ; } else if ( caseDefinitions . size ( ) == 1 ) { return caseDefinitions . iterator ( ) . next ( ) ; } else { throw LOG . multipleTenantsForCaseDefinitionKeyException ( caseDefinitionKey ) ; } }
@return the latest version of the case definition with the given key (from any tenant)

@throws ProcessEngineException if more than one tenant has a case definition with the given key

@see #findLatestCaseDefinitionByKeyAndTenantId(String, String)