Package org.hibernate.criterion

Examples of org.hibernate.criterion.Disjunction


        List<AbstractFamixEntity> entities = new ArrayList<AbstractFamixEntity>();

        try {
            Criteria query = getHibernateSession().createCriteria(AbstractFamixEntity.class);
            query.createAlias("sourceAnchor", "sa");
            Disjunction orClausel = Restrictions.disjunction();

            int countOPs = 0;
            for (String reducedUniqueName : sourceReferences.keySet()) {
                if (reducedUniqueName != "") {
                    orClausel.add(Restrictions.and(
                            Restrictions.like("uniqueName", reducedUniqueName + "(%)"),
                            Restrictions.eq("sa.start", sourceReferences.get(reducedUniqueName))
                    )
                    );
View Full Code Here


    conj.add(Restrictions.eq("pianoDeiConti.codiceGruppo", pianoDeiConti.getCodiceGruppo()));
    conj.add(Restrictions.eq("pianoDeiConti.codiceMastro", pianoDeiConti.getCodiceMastro()));
    conj.add(Restrictions.eq("pianoDeiConti.codiceConto", pianoDeiConti.getCodiceConto()));
    conj.add(Restrictions.le("dataInizioValidita", dataRegistrazione));

    Disjunction disj = Restrictions.disjunction();
    disj.add(Restrictions.isNull("dataFineValidita"));
    disj.add(Restrictions.ge("dataFineValidita", dataRegistrazione));
    conj.add(disj);

    criteria.add(conj);
    try {
      return (List<Conto>) getHibernateTemplate().findByCriteria(criteria);
View Full Code Here

    DetachedCriteria criteria = DetachedCriteria.forClass(VariazioneParametroFinanziario.class);
    criteria.add(Restrictions.eq("codiceParametroFinanziario", codiceParametroFinanziario));
    criteria.add(Restrictions.le("dataInizioValidita", allaData));
    criteria.add(Restrictions.eq("legalEntity", legalEntity).ignoreCase());
    criteria.add(Restrictions.eq("organizationUnit", organizationUnit).ignoreCase());
    Disjunction or = Restrictions.disjunction();
    or.add(Restrictions.isNull("dataFineValidita"));
    or.add(Restrictions.gt("dataFineValidita", allaData));
    criteria.add(or);
    List<VariazioneParametroFinanziario> result = getHibernateTemplate().findByCriteria(criteria);
    return result != null && result.size() > 0 ? result.get(0).getValoreParametroFinanziario() : null;
  }
View Full Code Here

    conj.add(Restrictions.eq("codiceTipoTasso", tipoTasso));
    conj.add(Restrictions.lt("importoMin", importoRiferimento));
    conj.add(Restrictions.ge("importoMax", importoRiferimento));
    conj.add(Restrictions.le("dataInizioValidita", dataRiferimento));

    Disjunction orDataFineValidita = Restrictions.disjunction();
    orDataFineValidita = Restrictions.disjunction();
    orDataFineValidita.add(Restrictions.ge("dataFineValidita", dataRiferimento));
    orDataFineValidita.add(Restrictions.isNull("dataFineValidita"));
    conj.add(orDataFineValidita);

    criteria.add(conj);

    return (List<TassiRiferimento>) getHibernateTemplate().findByCriteria(criteria);
View Full Code Here

  private DetachedCriteria getTabellaFinanziariaCriteria(List<SearchCriteriaLogicProduct> andCriteriaList) {
    DetachedCriteria criteria = DetachedCriteria.forClass(TestataTabellaFinanziaria.class);
    criteria.add(Restrictions.eq("legalEntity", legalEntity).ignoreCase());
    criteria.add(Restrictions.eq("organizationUnit", organizationUnit).ignoreCase());

    Disjunction ors = Restrictions.disjunction();

    for (SearchCriteriaLogicProduct sclp : andCriteriaList) {
      DetachedCriteria agenteCriteria = null;
     
      Conjunction andsTestata = Restrictions.conjunction();

      for (SearchCriteria sc : sclp.getSearchCriteriaList()) {
        Conjunction andsAgente = null;
       
        SimpleExpression simpleExpression = sc.getSimpleExpression();
        if (sc.getValore() instanceof String)
          simpleExpression.ignoreCase();
        if (((SearchCriteriaWithEntity) sc).getEntity() == AgenteTabellaFinanziaria.class) {
          // Aggiungo condizioni di and alla subquery della testata
          if (agenteCriteria == null) {
            agenteCriteria = DetachedCriteria.forClass(AgenteTabellaFinanziaria.class);
            agenteCriteria.setProjection(Projections.property("testataTabellaFinanziaria.numeroTabellaFinanziaria"));
          }
          if (andsAgente == null) {
            andsAgente = Restrictions.conjunction();
          }
          andsAgente.add(simpleExpression);

        } else if (((SearchCriteriaWithEntity) sc).getEntity() == TestataTabellaFinanziaria.class) {
          // Aggiungo condizioni di and su testata tabella finanziaria
          if(sc.getCampo().equals("dataFineValidita")){
            Disjunction orsDataFine = Restrictions.disjunction();
            orsDataFine.add(simpleExpression);
            orsDataFine.add(Restrictions.isNull("dataFineValidita"));
            andsTestata.add(orsDataFine);
          }else{
            andsTestata.add(simpleExpression);
          }
         
View Full Code Here

    DetachedCriteria criteria = DetachedCriteria.forClass(VariazioneParametroFinanziario.class);
    criteria.add(Restrictions.eq("codiceParametroFinanziario", codiceParametroFinanziario));
    criteria.add(Restrictions.eq("legalEntity", legalEntity).ignoreCase());
    criteria.add(Restrictions.eq("organizationUnit", organizationUnit).ignoreCase());
   
    Disjunction or = Restrictions.disjunction();
    or.add(Restrictions.between("dataInizioValidita", dallaData, allaData));
   
    Conjunction and = Restrictions.conjunction();
    and.add(Restrictions.le("dataInizioValidita", dallaData));
    Disjunction orDt = Restrictions.disjunction();
    orDt.add(Restrictions.isNull("dataFineValidita"));
    orDt.add(Restrictions.gt("dataFineValidita", allaData));
    and.add(orDt);
    or.add(and);
    and = Restrictions.conjunction();
    and.add(Restrictions.le("dataInizioValidita", dallaData));
    and.add(Restrictions.ge("dataFineValidita", dallaData));
View Full Code Here

      conj.add(Restrictions.eq("anniIntestatario", anni));
    }

    conj.add(Restrictions.le("durataMinimaContratto", durata));

    Disjunction orDett = Restrictions.disjunction();
    orDett = Restrictions.disjunction();
    orDett.add(Restrictions.isNull("durataMassimaContratto"));
    orDett.add(Restrictions.ge("durataMassimaContratto", durata));
    conj.add(orDett);

    criteria.add(conj);
    List<Assicurazione> result = getHibernateTemplate().findByCriteria(criteria);
    if (result != null && result.size() > 0)
View Full Code Here

    conj.add(Restrictions.eq("tipoAssicurazione", tipoAssicurazione));
    conj.add(Restrictions.in("sessoIntestatario", sessi));
    conj.add(Restrictions.eq("anniIntestatario", anni));
    conj.add(Restrictions.le("durataMinimaContratto", durata));

    Disjunction orDett = Restrictions.disjunction();
    orDett = Restrictions.disjunction();
    orDett.add(Restrictions.isNull("durataMassimaContratto"));
    orDett.add(Restrictions.ge("durataMassimaContratto", durata));
    conj.add(orDett);

    criteria.add(conj);
    List<Assicurazione> result = getHibernateTemplate().findByCriteria(criteria);
    if (result != null && result.size() > 0)
View Full Code Here

      Long numeroTabellaFinanziaria) {
    DetachedCriteria criteriaDettaglio = DetachedCriteria.forClass(DettaglioTabellaFinanziaria.class);
    DetachedCriteria criteriaTestata = DetachedCriteria.forClass(TestataTabellaFinanziaria.class);

    Conjunction andDett = Restrictions.conjunction();
    Disjunction orDett = Restrictions.disjunction();
    orDett.add(Restrictions.isNull("massimoDurataContr"));
    orDett.add(Restrictions.ge("massimoDurataContr", durata));
    andDett.add(orDett);
    andDett.add(Restrictions.le("minimoDurataContr", durata));

    Conjunction andTestata = Restrictions.conjunction();
    Disjunction orTestata = Restrictions.disjunction();
    orTestata.add(Restrictions.isNull("dataFineValidita"));
    orTestata.add(Restrictions.gt("dataFineValidita", dataRichiesta));
    andTestata.add(orTestata);
    andTestata.add(Restrictions.eq("numeroTabellaFinanziaria", numeroTabellaFinanziaria));
    andTestata.add(Restrictions.eq("legalEntity", legalEntity).ignoreCase());
    andTestata.add(Restrictions.eq("organizationUnit", organizationUnit).ignoreCase());
View Full Code Here

    criteria.add(Restrictions.eq("legalEntity", legalEntity).ignoreCase());
    criteria.add(Restrictions.eq("organizationUnit", organizationUnit).ignoreCase());

    // DetachedCriteria criteria =
    // DetachedCriteria.forClass(GruppoDatiFinanziari.class);
    Disjunction ors = Restrictions.disjunction();

    for (SearchCriteriaLogicProduct sclp : andCriteriaList) {

      DetachedCriteria datifinCriteria = null;
      // DetachedCriteria mutuoCriteria = null;
      // Conjunction andsDatifin = Restrictions.conjunction();
      // Conjunction andsMutuo = null;
      Conjunction andsDatifin = null;
      Conjunction andsMutuo = Restrictions.conjunction();

      for (SearchCriteria sc : sclp.getSearchCriteriaList()) {

        SimpleExpression simpleExpression = sc.getSimpleExpression();
        if (sc.getValore() instanceof String)
          simpleExpression.ignoreCase();
        if (((SearchCriteriaWithEntity) sc).getEntity() == GruppoDatiFinanziari.class) {
          // Aggiungo condizioni di and alla subquery dei mutui
          if (datifinCriteria == null) {
            datifinCriteria = DetachedCriteria.forClass(GruppoDatiFinanziari.class);
            datifinCriteria.setProjection(Projections.property("mutuo"));
          }
          if (andsDatifin == null) {
            andsDatifin = Restrictions.conjunction();
          }
          andsDatifin.add(simpleExpression);

        } else if (((SearchCriteriaWithEntity) sc).getEntity() == Mutuo.class) {
          // Aggiungo condizioni di and sui Datifin
          andsMutuo.add(simpleExpression);
        }

        if (andsDatifin != null) {
          andsDatifin.add(Restrictions.isNull("dataFineValidita"));
          datifinCriteria.add(andsDatifin);
          andsMutuo.add(Subqueries.propertyIn("numeroMutuo", datifinCriteria));
        }

        ors.add(andsMutuo);
      }

      criteria.add(ors);

    }
View Full Code Here

TOP

Related Classes of org.hibernate.criterion.Disjunction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.