public abstract class TransferStateListener
extends java.lang.Object
Constructor and Description |
---|
TransferStateListener() |
Modifier and Type | Method and Description |
---|---|
abstract void |
stateChanged(TransferState ts,
TransferState.Event event)
Notifies that the TransferState has changed due to the given event event.
|
public abstract void stateChanged(TransferState ts, TransferState.Event event)
If there is a requirement to change any of the objects during transfer, this should be done on the "copied" objects after the prepare stage. For example:
public void stateChanged( TransferState ts, TransferState.Event event ) { if ( evt == TransferState.Event.PREPARE_COMPLETE ) { try { // if the source provider is a Database, we can use it with a QueryWrapper to access // the dictionary or user tables DBObjectProvider pro = ts.getDescriptor().getSourceProvider(); if ( pro instanceof Database ) { final Database db = (Database)pro; for ( SystemObject so: ts.getCopiedObjects() ) { final String query = "select ... "; final QueryWrapper wrap = new QueryWrapper( db, query, new Object[]{ ... }); final QueryWrapper.QueryRunnable r = new QueryWrapper.QueryRunnable() { public void processResultSet( ResultSet rs ) throws DBException { try { while( rs.next() ) { ... } } catch( SQLException sqe ) { wrap.throwDBException( sqe ); } } }; try { wrap.executeQuery( r ); } catch( DBException dbe ) { // process exception } so.setSomeProperty( ... ); } } } catch (Exception e) { // process exception } } }
TransferState.Event