break;
    public List readAllContractsByCriteria(String orderBy, Boolean justActiveContracts,            Boolean justDesactiveContracts, Date dateBeginContract, Date dateEndContract,            Integer spanNumber, Integer numberOfElementsInSpan, Integer grantTypeId) {        List<GrantContract> grantContracts = (List<GrantContract>) readAll(GrantContract.class);        ComparatorChain comparatorChain = new ComparatorChain(new BeanComparator(orderBy), true);        Collections.sort(grantContracts, comparatorChain);        List<GrantContract> result = null;        Integer desiredContractRegimeState = new Integer(1);        long now = System.currentTimeMillis();        for (GrantContract grantContract : grantContracts) {            boolean verifiesConditions = true;            for (GrantContractRegime grantContractRegime : grantContract                    .getContractRegimes()) {                if (!grantContractRegime.getState().equals(desiredContractRegimeState)) {                    verifiesConditions = false;                }                if (justActiveContracts != null                        && justActiveContracts.booleanValue()                        && (grantContractRegime.getDateEndContract().getTime() < now || !grantContract                                .getEndContractMotive().equals(""))) {                    verifiesConditions = false;                }                if (justDesactiveContracts != null                        && justDesactiveContracts.booleanValue()                        && (grantContractRegime.getDateEndContract().getTime() > now || grantContract                                .getEndContractMotive().equals(""))) {                    verifiesConditions = false;                }                if (dateBeginContract != null                        && grantContractRegime.getDateBeginContract().getTime() < dateBeginContract                                .getTime()) {                    verifiesConditions = false;                }                if (dateEndContract != null                        && grantContractRegime.getDateEndContract().getTime() > dateEndContract                                .getTime()) {                    verifiesConditions = false;                }                if (grantTypeId != null                        && !grantContract.getGrantType().getIdInternal().equals(grantTypeId)) {                    verifiesConditions = false;                }                if (verifiesConditions) {                    break;                }                verifiesConditions = true;            }            if (verifiesConditions) {                result.add(grantContract);                break;            }        }        int begin = (spanNumber - 1) * numberOfElementsInSpan;        int end = begin + numberOfElementsInSpan;        return result.subList(begin, end);    }