PushdownFunctionImpl extends FunctionImpl implements PushdownFunction { @SuppressWarnings( "unchecked" ) @Override public < T extends ProcedureResultSet > T setResultSet( final UnitOfWork transaction, final Class< T > resultSetType ) throws KException { ArgCheck.isNotNull( transaction, "transaction" ); ArgCheck.isTrue( ( transaction.getState() == State.NOT_STARTED ), "transaction state is not NOT_STARTED" ); final ProcedureResultSet resultSet = getResultSet( transaction ); if ( resultSet != null ) { resultSet.remove( transaction ); } T result = null; if ( resultSetType == TabularResultSet.class ) { result = ( T )RelationalModelFactory.createTabularResultSet( transaction, getRepository(), this ); } else if ( resultSetType == DataTypeResultSet.class ) { result = ( T )RelationalModelFactory.createDataTypeResultSet( transaction, getRepository(), this ); } return result; } PushdownFunctionImpl( final UnitOfWork uow,
                                 final Repository repository,
                                 final String workspacePath ); @Override KomodoType[] getChildTypes(); @Override ProcedureResultSet getResultSet( final UnitOfWork transaction ); @Override int getTypeId(); @Override KomodoType getTypeIdentifier( final UnitOfWork uow ); @Override Model getParent( final UnitOfWork transaction ); @Override void removeResultSet( final UnitOfWork transaction ); @SuppressWarnings( "unchecked" ) @Override T setResultSet( final UnitOfWork transaction,
                                                            final Class< T > resultSetType );  }
@Test public void shouldGetOnlyResultSetWhenGettingChildren() throws Exception { final TabularResultSet resultSet = this.function.setResultSet( getTransaction(), TabularResultSet.class ); assertThat( this.function.getChildren( getTransaction() ).length, is( 1 ) ); assertThat( this.function.getChildren( getTransaction() )[0], is( ( KomodoObject )resultSet ) ); }
@Test public void shouldGetChildren() throws Exception { this.function.addParameter( getTransaction(), "param" ); this.function.setResultSet( getTransaction(), DataTypeResultSet.class ); assertThat( this.function.getChildren( getTransaction() ).length, is( 2 ) ); }