Examples of Disjunction


Examples of org.hibernate.criterion.Disjunction

      /*
       * wenn die maximale Berechtigung nicht Admin ist, dann nur bestimmte
       */
      if (loginForm.getMaximaleBerechtigung() > 1) {
        Hibernate.initialize(aktuellerNutzer);
        Disjunction dis = Restrictions.disjunction();
        for (Projekt proj : aktuellerNutzer.getProjekteList()) {
          dis.add(Restrictions.eq("projekt", proj));
        }
        crit.add(dis);
      }
    }

View Full Code Here

Examples of org.hibernate.criterion.Disjunction

      if (this.hideInactiveUsers) {
        crit.add(Restrictions.eq("istAktiv", true));
      }

      if (this.filter != null || this.filter.length() != 0) {
        Disjunction ex = Restrictions.disjunction();
        ex.add(Restrictions.like("vorname", "%" + this.filter + "%"));
        ex.add(Restrictions.like("nachname", "%" + this.filter + "%"));
//        crit.createCriteria("projekte", "proj");
//        ex.add(Restrictions.like("proj.titel", "%" + this.filter + "%"));
       
//        crit.createCriteria("benutzergruppen", "group");
//        ex.add(Restrictions.like("group.titel", "%" + this.filter + "%"));
View Full Code Here

Examples of org.hibernate.criterion.Disjunction

    Set<Class<?>> indexedEntities = searchFactoryImplementor.getIndexedTypesPolymorphic( new Class<?>[] { entityType } );
    DocumentBuilderIndexedEntity<?> builder = searchFactoryImplementor.getDocumentBuilderIndexedEntity(
        indexedEntities.iterator().next()
    );
    String idName = builder.getIdentifierName();
    Disjunction disjunction = Restrictions.disjunction();

    int loop = maxResults / MAX_IN_CLAUSE;
    boolean exact = maxResults % MAX_IN_CLAUSE == 0;
    if ( !exact ) {
      loop++;
    }
    for ( int index = 0; index < loop; index++ ) {
      int max = index * MAX_IN_CLAUSE + MAX_IN_CLAUSE <= maxResults ?
          index * MAX_IN_CLAUSE + MAX_IN_CLAUSE :
          maxResults;
      List<Serializable> ids = new ArrayList<Serializable>( max - index * MAX_IN_CLAUSE );
      for ( int entityInfoIndex = index * MAX_IN_CLAUSE; entityInfoIndex < max; entityInfoIndex++ ) {
        ids.add( entityInfos[entityInfoIndex].getId() );
      }
      disjunction.add( Restrictions.in( idName, ids ) );
    }
    criteria.add( disjunction );
    //not best effort so fail fast
    if ( timeoutManager.getType() != TimeoutManager.Type.LIMIT ) {
      Long timeLeftInSecond = timeoutManager.getTimeoutLeftInSeconds();
View Full Code Here

Examples of org.hibernate.criterion.Disjunction

    Set<Class<?>> indexedEntities = searchFactoryImplementor.getIndexedTypesPolymorphic( new Class<?>[] { entityType } );
    DocumentBuilderIndexedEntity<?> builder = searchFactoryImplementor.getIndexBinding(
        indexedEntities.iterator().next()
    ).getDocumentBuilder();
    String idName = builder.getIdentifierName();
    Disjunction disjunction = Restrictions.disjunction();

    int loop = maxResults / MAX_IN_CLAUSE;
    boolean exact = maxResults % MAX_IN_CLAUSE == 0;
    if ( !exact ) {
      loop++;
    }
    for ( int index = 0; index < loop; index++ ) {
      int max = index * MAX_IN_CLAUSE + MAX_IN_CLAUSE <= maxResults ?
          index * MAX_IN_CLAUSE + MAX_IN_CLAUSE :
          maxResults;
      List<Serializable> ids = new ArrayList<Serializable>( max - index * MAX_IN_CLAUSE );
      for ( int entityInfoIndex = index * MAX_IN_CLAUSE; entityInfoIndex < max; entityInfoIndex++ ) {
        ids.add( entityInfos[entityInfoIndex].getId() );
      }
      disjunction.add( Restrictions.in( idName, ids ) );
    }
    criteria.add( disjunction );
    //not best effort so fail fast
    if ( timeoutManager.getType() != TimeoutManager.Type.LIMIT ) {
      Long timeLeftInSecond = timeoutManager.getTimeoutLeftInSeconds();
View Full Code Here

Examples of org.hibernate.criterion.Disjunction

            transaction = this.session.beginTransaction();
            Criteria crit = this.session.createCriteria(Annonce.class);
            crit.add(Restrictions.eq("statut", dao.getById(1)));
            crit.addOrder(Order.desc("id"));
           
            Disjunction disDeps = Restrictions.disjunction();
           
            for(Departement dept : depts){
                disDeps.add(Restrictions.eq("departement",dept));
            }
           
            crit.add(disDeps);
                     
            annonces = new HashSet<Annonce>(
View Full Code Here

Examples of org.hibernate.criterion.Disjunction

    }

    // Specific filter for status (using a disjunction between possible statuses)
    if (filter.getStatusFilter() != null) {
      List<Short> statuses = filter.convertFilterState();
      Disjunction disj = Restrictions.disjunction();
      for (short status : statuses) {
        disj.add(Restrictions.eq("state", status));
      }
      crit.add(disj);
    }

    // Specific filter for started and last active dates.
View Full Code Here

Examples of org.hibernate.criterion.Disjunction

        List ids = new ArrayList<SomeEntityId>(2);
        ids.add( new SomeEntityId(1,12) );
        ids.add( new SomeEntityId(10,23) );

        Criteria criteria = s.createCriteria( SomeEntity.class );
        Disjunction disjunction = Restrictions.disjunction();

        disjunction.add( Restrictions.in( "id", ids  ) );
        criteria.add( disjunction );

        List list = criteria.list();
        assertEquals( 2, list.size() );
    transaction.rollback();
View Full Code Here

Examples of org.hibernate.criterion.Disjunction

  public List<Artifact> fetchAll(Iterable<ArtifactIdentifier> fetchList) {
    if (!fetchList.iterator().hasNext()) {
      return new ArrayList<Artifact>();
    }
    Criteria query = HibernateUtil.getCurrentSession().createCriteria(HibernateArtifact.class).createCriteria("id");
    Disjunction terms = Restrictions.disjunction();
    Collection<Long> withId = new ArrayList<Long>();
    for (ArtifactIdentifier aid : fetchList) {
      if (aid.getPk() != 0) {
        withId.add(aid.getPk());
      } else {
        terms.add(Restrictions.conjunction()
            .add(Restrictions.eq("revision", aid.getRevision()))
            .add(Restrictions.eq("name", aid.getName()))
            .add(Restrictions.eq("branch", aid.getBranch())));
      }
    }
    terms.add(Restrictions.in("pk", withId));
    query.add(terms);
    List<Artifact> list = (List<Artifact>) query.list();
    try {
      for (Artifact artifact : list) {
        artifact.setRepository(this);
View Full Code Here

Examples of org.hibernate.criterion.Disjunction

                    break;
                }
            }
        }
        if (searchCriteria.isOperationsSet()) {
            Disjunction operations = disjunction();
            for (PosibleOperations operation : searchCriteria.getOperations()) {
                operations.add(eq("actionName", operation));
            }
            criteria.add(operations);
        }

        return session.createCriteria(SimpleAction.class).add(criteria).
View Full Code Here

Examples of org.hibernate.criterion.Disjunction

  }

  protected DisjunctionEvaluator<Criterion, Object> compileDisjunction(Collection<CommandEvaluator> childs) {
    return new AbstractDisjunction<Criterion, Object>(childs) {
      public Criterion evaluate(Object arg) {
        Disjunction conj = Restrictions.disjunction();
        for (CommandEvaluator eval : childs) {
          conj.add((Criterion) eval.evaluate(null));
        }
        return conj;
      };
    };
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.