Examples of IdentitySet


Examples of org.hibernate.util.IdentitySet

    else {
      queryParametersToUse = queryParameters;
    }

    List combinedResults = new ArrayList();
    IdentitySet distinction = new IdentitySet();
    int includedCount = -1;
    translator_loop: for ( int i = 0; i < translators.length; i++ ) {
      List tmp = translators[i].list( session, queryParametersToUse );
      if ( needsLimit ) {
        // NOTE : firstRow is zero-based
        int first = queryParameters.getRowSelection().getFirstRow() == null
                    ? 0
                      : queryParameters.getRowSelection().getFirstRow().intValue();
        int max = queryParameters.getRowSelection().getMaxRows() == null
                    ? -1
                      : queryParameters.getRowSelection().getMaxRows().intValue();
        final int size = tmp.size();
        for ( int x = 0; x < size; x++ ) {
          final Object result = tmp.get( x );
          if ( ! distinction.add( result ) ) {
            continue;
          }
          includedCount++;
          if ( includedCount < first ) {
            continue;
View Full Code Here

Examples of org.hibernate.util.IdentitySet

   * @param event The delete event to be handled.
   *
   * @throws HibernateException
   */
  public void onDelete(DeleteEvent event) throws HibernateException {
    onDelete( event, new IdentitySet() );
  }
View Full Code Here

Examples of org.hibernate.util.IdentitySet

      int max = !hasLimit || queryParameters.getRowSelection().getMaxRows() == null
            ? -1
            : queryParameters.getRowSelection().getMaxRows().intValue();
      int size = results.size();
      List tmp = new ArrayList();
      IdentitySet distinction = new IdentitySet();
      for ( int i = 0; i < size; i++ ) {
        final Object result = results.get( i );
        if ( !distinction.add( result ) ) {
          continue;
        }
        includedCount++;
        if ( includedCount < first ) {
          continue;
View Full Code Here

Examples of org.hibernate.util.IdentitySet

    // create the collection holding the Orphans
    Collection res = new ArrayList();

    // collect EntityIdentifier(s) of the *current* elements - add them into a HashSet for fast access
    java.util.Set currentIds = new HashSet();
    java.util.Set currentSaving = new IdentitySet();
    for ( Iterator it=currentElements.iterator(); it.hasNext(); ) {
      Object current = it.next();
      if ( current!=null && ForeignKeys.isNotTransient(entityName, current, null, session) ) {
        EntityEntry ee = session.getPersistenceContext().getEntry( current );
        if ( ee != null && ee.getStatus() == Status.SAVING ) {
          currentSaving.add( current );
        }
        else {
          Serializable currentId = ForeignKeys.getEntityIdentifierIfNotUnsaved(entityName, current, session);
          currentIds.add( new TypedValue( idType, currentId, session.getEntityMode() ) );
        }
      }
    }

    // iterate over the *old* list
    for ( Iterator it=oldElements.iterator(); it.hasNext(); ) {
      Object old = it.next();
      if ( ! currentSaving.contains( old ) ) {
        Serializable oldId = ForeignKeys.getEntityIdentifierIfNotUnsaved(entityName, old, session);
        if ( !currentIds.contains( new TypedValue( idType, oldId, session.getEntityMode() ) ) ) {
          res.add(old);
        }
      }
View Full Code Here

Examples of org.hibernate.util.IdentitySet

   * @param event The delete event to be handled.
   *
   * @throws HibernateException
   */
  public void onDelete(DeleteEvent event) throws HibernateException {
    onDelete( event, new IdentitySet() );
  }
View Full Code Here

Examples of org.hibernate.util.IdentitySet

      int max = !hasLimit || queryParameters.getRowSelection().getMaxRows() == null
            ? -1
            : queryParameters.getRowSelection().getMaxRows().intValue();
      int size = results.size();
      List tmp = new ArrayList();
      IdentitySet distinction = new IdentitySet();
      for ( int i = 0; i < size; i++ ) {
        final Object result = results.get( i );
        if ( !distinction.add( result ) ) {
          continue;
        }
        includedCount++;
        if ( includedCount < first ) {
          continue;
View Full Code Here

Examples of org.hibernate.util.IdentitySet

    else {
      queryParametersToUse = queryParameters;
    }

    List combinedResults = new ArrayList();
    IdentitySet distinction = new IdentitySet();
    int includedCount = -1;
    translator_loop: for ( int i = 0; i < translators.length; i++ ) {
      List tmp = translators[i].list( session, queryParametersToUse );
      if ( needsLimit ) {
        // NOTE : firstRow is zero-based
        int first = queryParameters.getRowSelection().getFirstRow() == null
                    ? 0
                      : queryParameters.getRowSelection().getFirstRow().intValue();
        int max = queryParameters.getRowSelection().getMaxRows() == null
                    ? -1
                      : queryParameters.getRowSelection().getMaxRows().intValue();
        final int size = tmp.size();
        for ( int x = 0; x < size; x++ ) {
          final Object result = tmp.get( x );
          if ( ! distinction.add( result ) ) {
            continue;
          }
          includedCount++;
          if ( includedCount < first ) {
            continue;
View Full Code Here

Examples of org.hibernate.validation.util.IdentitySet

    return false;
  }

  private boolean isAlreadyValidatedForCurrentGroup(Object value, Class<?> group) {
    final IdentitySet objectsProcessedInCurrentGroups = processedObjects.get( group );
    return objectsProcessedInCurrentGroups != null && objectsProcessedInCurrentGroups.contains( value );
  }
View Full Code Here

Examples of org.hibernate.validator.internal.util.IdentitySet

    }
    return true;
  }

  private boolean isAlreadyValidatedForCurrentGroup(Object value, Class<?> group) {
    final IdentitySet objectsProcessedInCurrentGroups = processedObjects.get( group );
    return objectsProcessedInCurrentGroups != null && objectsProcessedInCurrentGroups.contains( value );
  }
View Full Code Here

Examples of org.hibernate.validator.internal.util.IdentitySet

  private void markProcessedForCurrentGroup(Object value, Class<?> group) {
    if ( processedObjects.containsKey( group ) ) {
      processedObjects.get( group ).add( value );
    }
    else {
      IdentitySet set = new IdentitySet();
      set.add( value );
      processedObjects.put( group, set );
    }
  }
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.