Examples of Cascade


Examples of cascading.cascade.Cascade

    // connect up both sinks using the same exportPipe assembly
    Flow exportFromUrl = flowConnector.connect( "export url", sinkUrl, localSinkUrl, exportPipe );
    Flow exportFromWord = flowConnector.connect( "export word", sinkWord, localSinkWord, exportPipe );

    // connect up all the flows, order is not significant
    Cascade cascade = new CascadeConnector().connect( importPagesFlow, count, exportFromUrl, exportFromWord );

    // run the cascade to completion
    cascade.complete();
    }
View Full Code Here

Examples of com.googlecode.objectify.persister.annotation.Cascade

    this.factory = factory;
  }

  private Cascade getCascade(FieldMetadata metadata, Object object) {

    Cascade result = metadata.field.getAnnotation(Cascade.class);

    if (result == null) {
      result = object.getClass().getAnnotation(Cascade.class);
    }
View Full Code Here

Examples of gnu.javax.crypto.assembly.Cascade

    IBlockCipher desEDE = new TripleDES();

    HashMap map1 = new HashMap();
    HashMap map2 = new HashMap();
    HashMap map3 = new HashMap();
    Cascade new3DES = new Cascade();
    Object des1 = new3DES.append(Stage.getInstance(
        ModeFactory.getInstance(
            Registry.ECB_MODE, new DES(), 8),
            Direction.FORWARD));
    Object des2 = new3DES.append(Stage.getInstance(
        ModeFactory.getInstance(
            Registry.ECB_MODE, new DES(), 8),
            Direction.REVERSED));
    Object des3 = new3DES.append(Stage.getInstance(
        ModeFactory.getInstance(
            Registry.ECB_MODE, new DES(), 8),
            Direction.FORWARD));

    map.put(des1, map1);
    map.put(des2, map2);
    map.put(des3, map3);

    for (int i = 0; i < E_TV.length; i++)
      {
        map1.put(IBlockCipher.KEY_MATERIAL, Util.toBytesFromString(E_TV[i][0]));
        map2.put(IBlockCipher.KEY_MATERIAL, Util.toBytesFromString(E_TV[i][1]));
        map3.put(IBlockCipher.KEY_MATERIAL, Util.toBytesFromString(E_TV[i][2]));
        map.put(IBlockCipher.KEY_MATERIAL,
                Util.toBytesFromString(E_TV[i][0] + E_TV[i][1] + E_TV[i][2]));
        map.put(Cascade.DIRECTION, Direction.FORWARD);
        pt = Util.toBytesFromString(E_TV[i][3]);
        ct = Util.toBytesFromString(E_TV[i][4]);

        try
          {
            desEDE.reset();
            new3DES.reset();

            desEDE.init(map);
            new3DES.init(map);

            desEDE.encryptBlock(pt, 0, ct1, 0);
            new3DES.update(pt, 0, ct2, 0);
            harness.check(Arrays.equals(ct1, ct2));

            for (int j = 0; j < 9999; j++)
              {
                desEDE.encryptBlock(ct1, 0, ct1, 0);
                new3DES.update(ct2, 0, ct2, 0);
              }
            harness.check(Arrays.equals(ct, ct1));
            harness.check(Arrays.equals(ct, ct2));
          }
        catch (InvalidKeyException x)
          {
            harness.fail("init (encryption)");
            harness.debug(x);
          }
      }

    for (int i = 0; i < D_TV.length; i++)
      {
        map1.put(IBlockCipher.KEY_MATERIAL, Util.toBytesFromString(D_TV[i][0]));
        map2.put(IBlockCipher.KEY_MATERIAL, Util.toBytesFromString(D_TV[i][1]));
        map3.put(IBlockCipher.KEY_MATERIAL, Util.toBytesFromString(D_TV[i][2]));
        map.put(IBlockCipher.KEY_MATERIAL,
                Util.toBytesFromString(D_TV[i][0] + D_TV[i][1] + D_TV[i][2]));
        map.put(Cascade.DIRECTION, Direction.REVERSED);
        pt = Util.toBytesFromString(D_TV[i][3]);
        ct = Util.toBytesFromString(D_TV[i][4]);

        try
          {
            desEDE.reset();
            new3DES.reset();

            desEDE.init(map);
            new3DES.init(map);

            desEDE.decryptBlock(pt, 0, ct1, 0);
            new3DES.update(pt, 0, ct2, 0);
            harness.check(Arrays.equals(ct1, ct2));

            for (int j = 0; j < 9999; j++)
              {
                desEDE.decryptBlock(ct1, 0, ct1, 0);
                new3DES.update(ct2, 0, ct2, 0);
              }
            harness.check(Arrays.equals(ct, ct1));
            harness.check(Arrays.equals(ct, ct2));
          }
        catch (InvalidKeyException x)
View Full Code Here

Examples of org.hibernate.annotations.Cascade

              "@Column(s) not allowed on a @ManyToOne property: "
                  + BinderHelper.getPath( propertyHolder, inferredData )
          );
        }

        Cascade hibernateCascade = property.getAnnotation( Cascade.class );
        NotFound notFound = property.getAnnotation( NotFound.class );
        boolean ignoreNotFound = notFound != null && notFound.action().equals( NotFoundAction.IGNORE );
        OnDelete onDeleteAnn = property.getAnnotation( OnDelete.class );
        boolean onDeleteCascade = onDeleteAnn != null && OnDeleteAction.CASCADE.equals( onDeleteAnn.action() );
        JoinTable assocTable = propertyHolder.getJoinTable( property );
        if ( assocTable != null ) {
          Join join = propertyHolder.addJoin( assocTable, false );
          for ( Ejb3JoinColumn joinColumn : joinColumns ) {
            joinColumn.setExplicitTableName( join.getTable().getName() );
          }
        }
        final boolean mandatory = !ann.optional() || forcePersist;
        bindManyToOne(
            getCascadeStrategy( ann.cascade(), hibernateCascade, false, forcePersist ),
            joinColumns,
            !mandatory,
            ignoreNotFound, onDeleteCascade,
            ToOneBinder.getTargetEntity( inferredData, mappings ),
            propertyHolder,
            inferredData, false, isIdentifierMapper,
            inSecondPass, propertyBinder, mappings
        );
      }
      else if ( property.isAnnotationPresent( OneToOne.class ) ) {
        OneToOne ann = property.getAnnotation( OneToOne.class );

        //check validity
        if ( property.isAnnotationPresent( Column.class )
            || property.isAnnotationPresent( Columns.class ) ) {
          throw new AnnotationException(
              "@Column(s) not allowed on a @OneToOne property: "
                  + BinderHelper.getPath( propertyHolder, inferredData )
          );
        }

        //FIXME support a proper PKJCs
        boolean trueOneToOne = property.isAnnotationPresent( PrimaryKeyJoinColumn.class )
            || property.isAnnotationPresent( PrimaryKeyJoinColumns.class );
        Cascade hibernateCascade = property.getAnnotation( Cascade.class );
        NotFound notFound = property.getAnnotation( NotFound.class );
        boolean ignoreNotFound = notFound != null && notFound.action().equals( NotFoundAction.IGNORE );
        OnDelete onDeleteAnn = property.getAnnotation( OnDelete.class );
        boolean onDeleteCascade = onDeleteAnn != null && OnDeleteAction.CASCADE.equals( onDeleteAnn.action() );
        JoinTable assocTable = propertyHolder.getJoinTable( property );
        if ( assocTable != null ) {
          Join join = propertyHolder.addJoin( assocTable, false );
          for ( Ejb3JoinColumn joinColumn : joinColumns ) {
            joinColumn.setExplicitTableName( join.getTable().getName() );
          }
        }
        //MapsId means the columns belong to the pk => not null
        //@OneToOne with @PKJC can still be optional
        final boolean mandatory = !ann.optional() || forcePersist;
        bindOneToOne(
            getCascadeStrategy( ann.cascade(), hibernateCascade, ann.orphanRemoval(), forcePersist ),
            joinColumns,
            !mandatory,
            getFetchMode( ann.fetch() ),
            ignoreNotFound, onDeleteCascade,
            ToOneBinder.getTargetEntity( inferredData, mappings ),
            propertyHolder,
            inferredData,
            ann.mappedBy(),
            trueOneToOne,
            isIdentifierMapper,
            inSecondPass,
            propertyBinder,
            mappings
        );
      }
      else if ( property.isAnnotationPresent( org.hibernate.annotations.Any.class ) ) {

        //check validity
        if ( property.isAnnotationPresent( Column.class )
            || property.isAnnotationPresent( Columns.class ) ) {
          throw new AnnotationException(
              "@Column(s) not allowed on a @Any property: "
                  + BinderHelper.getPath( propertyHolder, inferredData )
          );
        }

        Cascade hibernateCascade = property.getAnnotation( Cascade.class );
        OnDelete onDeleteAnn = property.getAnnotation( OnDelete.class );
        boolean onDeleteCascade = onDeleteAnn != null && OnDeleteAction.CASCADE.equals( onDeleteAnn.action() );
        JoinTable assocTable = propertyHolder.getJoinTable( property );
        if ( assocTable != null ) {
          Join join = propertyHolder.addJoin( assocTable, false );
          for ( Ejb3JoinColumn joinColumn : joinColumns ) {
            joinColumn.setExplicitTableName( join.getTable().getName() );
          }
        }
        bindAny(
            getCascadeStrategy( null, hibernateCascade, false, forcePersist ),
            //@Any has not cascade attribute
            joinColumns,
            onDeleteCascade,
            nullability,
            propertyHolder,
            inferredData,
            entityBinder,
            isIdentifierMapper,
            mappings
        );
      }
      else if ( property.isAnnotationPresent( OneToMany.class )
          || property.isAnnotationPresent( ManyToMany.class )
          || property.isAnnotationPresent( ElementCollection.class )
          || property.isAnnotationPresent( ManyToAny.class ) ) {
        OneToMany oneToManyAnn = property.getAnnotation( OneToMany.class );
        ManyToMany manyToManyAnn = property.getAnnotation( ManyToMany.class );
        ElementCollection elementCollectionAnn = property.getAnnotation( ElementCollection.class );

        final IndexColumn indexColumn;

        if ( property.isAnnotationPresent( OrderColumn.class ) ) {
          indexColumn = IndexColumn.buildColumnFromAnnotation(
              property.getAnnotation( OrderColumn.class ),
              propertyHolder,
              inferredData,
              entityBinder.getSecondaryTables(),
              mappings
          );
          if ( property.isAnnotationPresent( ListIndexBase.class ) ) {
            indexColumn.setBase( ( property.getAnnotation( ListIndexBase.class ) ).value() );
          }
        }
        else {
          //if @IndexColumn is not there, the generated IndexColumn is an implicit column and not used.
          //so we can leave the legacy processing as the default
          indexColumn = IndexColumn.buildColumnFromAnnotation(
              property.getAnnotation( org.hibernate.annotations.IndexColumn.class ),
              propertyHolder,
              inferredData,
              mappings
          );
        }
        CollectionBinder collectionBinder = CollectionBinder.getCollectionBinder(
            propertyHolder.getEntityName(),
            property,
            !indexColumn.isImplicit(),
            property.isAnnotationPresent( MapKeyType.class ),
            mappings
        );
        collectionBinder.setIndexColumn( indexColumn );
        collectionBinder.setMapKey( property.getAnnotation( MapKey.class ) );
        collectionBinder.setPropertyName( inferredData.getPropertyName() );

        collectionBinder.setBatchSize( property.getAnnotation( BatchSize.class ) );

        collectionBinder.setJpaOrderBy( property.getAnnotation( javax.persistence.OrderBy.class ) );
        collectionBinder.setSqlOrderBy( property.getAnnotation( OrderBy.class ) );

        collectionBinder.setSort( property.getAnnotation( Sort.class ) );
        collectionBinder.setNaturalSort( property.getAnnotation( SortNatural.class ) );
        collectionBinder.setComparatorSort( property.getAnnotation( SortComparator.class ) );

        Cache cachAnn = property.getAnnotation( Cache.class );
        collectionBinder.setCache( cachAnn );
        collectionBinder.setPropertyHolder( propertyHolder );
        Cascade hibernateCascade = property.getAnnotation( Cascade.class );
        NotFound notFound = property.getAnnotation( NotFound.class );
        boolean ignoreNotFound = notFound != null && notFound.action().equals( NotFoundAction.IGNORE );
        collectionBinder.setIgnoreNotFound( ignoreNotFound );
        collectionBinder.setCollectionType( inferredData.getProperty().getElementClass() );
        collectionBinder.setMappings( mappings );
View Full Code Here

Examples of org.hibernate.annotations.Cascade

          || property.isAnnotationPresent( Columns.class ) ) {
        throw new AnnotationException( "@Column(s) not allowed on a @ManyToOne property: "
            + StringHelper.qualify( propertyHolder.getPath(), inferredData.getPropertyName() ) );
      }

      Cascade hibernateCascade = property.getAnnotation( Cascade.class );
      NotFound notFound = property.getAnnotation( NotFound.class );
      boolean ignoreNotFound = notFound != null && notFound.action().equals( NotFoundAction.IGNORE );
      OnDelete onDeleteAnn = property.getAnnotation( OnDelete.class );
      boolean onDeleteCascade = onDeleteAnn != null && OnDeleteAction.CASCADE.equals( onDeleteAnn.action() );
      JoinTable assocTable = property.getAnnotation( JoinTable.class );
      if ( assocTable != null ) {
        Join join = propertyHolder.addJoin( assocTable, false );
        for (Ejb3JoinColumn joinColumn : joinColumns) {
          joinColumn.setSecondaryTableName( join.getTable().getName() );
        }
      }
      bindManyToOne(
          getCascadeStrategy( ann.cascade(), hibernateCascade ),
          joinColumns,
          ann.optional(),
          ignoreNotFound, onDeleteCascade,
          mappings.getReflectionManager().toXClass( ann.targetEntity() ),
          propertyHolder,
          inferredData, false, isIdentifierMapper, inSecondPass, mappings
      );
    }
    else if ( property.isAnnotationPresent( OneToOne.class ) ) {
      OneToOne ann = property.getAnnotation( OneToOne.class );

      //check validity
      if ( property.isAnnotationPresent( Column.class )
          || property.isAnnotationPresent( Columns.class ) ) {
        throw new AnnotationException( "@Column(s) not allowed on a @OneToOne property: "
            + StringHelper.qualify( propertyHolder.getPath(), inferredData.getPropertyName() ) );
      }

      //FIXME support a proper PKJCs
      boolean trueOneToOne = property.isAnnotationPresent( PrimaryKeyJoinColumn.class )
          || property.isAnnotationPresent( PrimaryKeyJoinColumns.class );
      Cascade hibernateCascade = property.getAnnotation( Cascade.class );
      NotFound notFound = property.getAnnotation( NotFound.class );
      boolean ignoreNotFound = notFound != null && notFound.action().equals( NotFoundAction.IGNORE );
      OnDelete onDeleteAnn = property.getAnnotation( OnDelete.class );
      boolean onDeleteCascade = onDeleteAnn != null && OnDeleteAction.CASCADE.equals( onDeleteAnn.action() );
      JoinTable assocTable = property.getAnnotation( JoinTable.class );
      if ( assocTable != null ) {
        Join join = propertyHolder.addJoin( assocTable, false );
        for (Ejb3JoinColumn joinColumn : joinColumns) {
          joinColumn.setSecondaryTableName( join.getTable().getName() );
        }
      }
      bindOneToOne(
          getCascadeStrategy( ann.cascade(), hibernateCascade ),
          joinColumns,
          ann.optional(),
          getFetchMode( ann.fetch() ),
          ignoreNotFound, onDeleteCascade,
          mappings.getReflectionManager().toXClass( ann.targetEntity() ),
          propertyHolder,
          inferredData, ann.mappedBy(), trueOneToOne, isIdentifierMapper, inSecondPass, mappings
      );
    }
    else if ( property.isAnnotationPresent( org.hibernate.annotations.Any.class ) ) {

      //check validity
      if ( property.isAnnotationPresent( Column.class )
          || property.isAnnotationPresent( Columns.class ) ) {
        throw new AnnotationException( "@Column(s) not allowed on a @Any property: "
            + StringHelper.qualify( propertyHolder.getPath(), inferredData.getPropertyName() ) );
      }

      Cascade hibernateCascade = property.getAnnotation( Cascade.class );
      NotFound notFound = property.getAnnotation( NotFound.class );
      boolean ignoreNotFound = notFound != null && notFound.action().equals( NotFoundAction.IGNORE );
      OnDelete onDeleteAnn = property.getAnnotation( OnDelete.class );
      boolean onDeleteCascade = onDeleteAnn != null && OnDeleteAction.CASCADE.equals( onDeleteAnn.action() );
      JoinTable assocTable = property.getAnnotation( JoinTable.class );
      if ( assocTable != null ) {
        Join join = propertyHolder.addJoin( assocTable, false );
        for (Ejb3JoinColumn joinColumn : joinColumns) {
          joinColumn.setSecondaryTableName( join.getTable().getName() );
        }
      }
      bindAny( getCascadeStrategy( null, hibernateCascade ), //@Any has not cascade attribute
          joinColumns, onDeleteCascade, nullability,
          propertyHolder, inferredData, entityBinder,
          isIdentifierMapper, mappings );
    }
    else if ( property.isAnnotationPresent( OneToMany.class )
        || property.isAnnotationPresent( ManyToMany.class )
        || property.isAnnotationPresent( CollectionOfElements.class )
        || property.isAnnotationPresent( ManyToAny.class ) ) {
      OneToMany oneToManyAnn = property.getAnnotation( OneToMany.class );
      ManyToMany manyToManyAnn = property.getAnnotation( ManyToMany.class );
      CollectionOfElements collectionOfElementsAnn = property.getAnnotation( CollectionOfElements.class );
      org.hibernate.annotations.IndexColumn indexAnn = property.getAnnotation(
          org.hibernate.annotations.IndexColumn.class
      );
      JoinTable assocTable = property.getAnnotation( JoinTable.class );

      IndexColumn indexColumn = IndexColumn.buildColumnFromAnnotation(
          indexAnn, propertyHolder, inferredData, mappings
      );
      CollectionBinder collectionBinder = CollectionBinder.getCollectionBinder(
          propertyHolder.getEntityName(),
          property,
          !indexColumn.isImplicit()
      );
      collectionBinder.setIndexColumn( indexColumn );
      MapKey mapKeyAnn = property.getAnnotation( MapKey.class );
      collectionBinder.setMapKey( mapKeyAnn );
      collectionBinder.setPropertyName( inferredData.getPropertyName() );
      BatchSize batchAnn = property.getAnnotation( BatchSize.class );
      collectionBinder.setBatchSize( batchAnn );
      javax.persistence.OrderBy ejb3OrderByAnn = property.getAnnotation( javax.persistence.OrderBy.class );
      OrderBy orderByAnn = property.getAnnotation( OrderBy.class );
      collectionBinder.setEjb3OrderBy( ejb3OrderByAnn );
      collectionBinder.setSqlOrderBy( orderByAnn );
      Sort sortAnn = property.getAnnotation( Sort.class );
      collectionBinder.setSort( sortAnn );
      Cache cachAnn = property.getAnnotation( Cache.class );
      collectionBinder.setCache( cachAnn );
      collectionBinder.setPropertyHolder( propertyHolder );
      Cascade hibernateCascade = property.getAnnotation( Cascade.class );
      NotFound notFound = property.getAnnotation( NotFound.class );
      boolean ignoreNotFound = notFound != null && notFound.action().equals( NotFoundAction.IGNORE );
      collectionBinder.setIgnoreNotFound( ignoreNotFound );
      collectionBinder.setCollectionType( inferredData.getProperty().getElementClass() );
      collectionBinder.setMappings( mappings );
View Full Code Here

Examples of org.hibernate.engine.Cascade

      id = e.getId();
    }

    // cascade the refresh prior to refreshing this entity
    refreshedAlready.put(object, object);
    new Cascade(CascadingAction.REFRESH, Cascade.BEFORE_REFRESH, source)
        .cascade( persister, object, refreshedAlready );

    if ( e != null ) {
      EntityKey key = new EntityKey( id, persister, source.getEntityMode() );
      source.getPersistenceContext().removeEntity(key);
View Full Code Here

Examples of org.hibernate.engine.Cascade

    final Object entity,
    final Map copyCache
  ) {
    source.getPersistenceContext().incrementCascadeLevel();
    try {
      new Cascade( getCascadeAction(), Cascade.BEFORE_MERGE, source )
          .cascade(persister, entity, copyCache);
    }
    finally {
      source.getPersistenceContext().decrementCascadeLevel();
    }
View Full Code Here

Examples of org.hibernate.engine.Cascade

 
  private void cascadeOnFlush(EventSource session, EntityPersister persister, Object object, Object anything)
  throws HibernateException {
    session.getPersistenceContext().incrementCascadeLevel();
    try {
      new Cascade( getCascadingAction(), Cascade.BEFORE_FLUSH, session )
      .cascade( persister, object, anything );
    }
    finally {
      session.getPersistenceContext().decrementCascadeLevel();
    }
View Full Code Here

Examples of org.hibernate.engine.Cascade

    // rather because it might now be stale, and there is no longer any
    // EntityEntry to take precedence
    // This is now handled by removeEntity()
    //session.getPersistenceContext().removeDatabaseSnapshot(key);

    new Cascade( CascadingAction.EVICT, Cascade.AFTER_EVICT, session )
        .cascade( persister, object );
  }
View Full Code Here

Examples of org.hibernate.engine.Cascade

   */
  private void cascadeOnUpdate(SaveOrUpdateEvent event, EntityPersister persister, Object entity) {
    EventSource source = event.getSession();
    source.getPersistenceContext().incrementCascadeLevel();
    try {
      new Cascade( CascadingAction.SAVE_UPDATE, Cascade.AFTER_UPDATE, source )
          .cascade( persister, entity );
    }
    finally {
      source.getPersistenceContext().decrementCascadeLevel();
    }
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.