@Test public void shouldGetOnlyResultSetWhenGettingChildren() throws Exception { final TabularResultSet resultSet = this.procedure.setResultSet( getTransaction(), TabularResultSet.class ); assertThat( this.procedure.getChildren( getTransaction() ).length, is( 1 ) ); assertThat( this.procedure.getChildren( getTransaction() )[0], is( ( KomodoObject )resultSet ) ); }
@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" ); ArgCheck.isNotNull( resultSetType, "resultSetType" ); 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 ); } else { throw new UnsupportedOperationException( Messages.getString( Relational.UNEXPECTED_RESULT_SET_TYPE, resultSetType.getName() ) ); } return result; }
StoredProcedureImpl extends AbstractProcedureImpl implements StoredProcedure { @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" ); ArgCheck.isNotNull( resultSetType, "resultSetType" ); 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 ); } else { throw new UnsupportedOperationException( Messages.getString( Relational.UNEXPECTED_RESULT_SET_TYPE, resultSetType.getName() ) ); } return result; } }
StoredProcedureImpl extends AbstractProcedureImpl implements StoredProcedure { @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" ); ArgCheck.isNotNull( resultSetType, "resultSetType" ); 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 ); } else { throw new UnsupportedOperationException( Messages.getString( Relational.UNEXPECTED_RESULT_SET_TYPE, resultSetType.getName() ) ); } return result; } StoredProcedureImpl( final UnitOfWork uow,
                                final Repository repository,
                                final String workspacePath ); }
StoredProcedureImpl extends AbstractProcedureImpl implements StoredProcedure { @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" ); ArgCheck.isNotNull( resultSetType, "resultSetType" ); 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 ); } else { throw new UnsupportedOperationException( Messages.getString( Relational.UNEXPECTED_RESULT_SET_TYPE, resultSetType.getName() ) ); } return result; } StoredProcedureImpl( final UnitOfWork uow,
                                final Repository repository,
                                final String workspacePath ); @Override KomodoType[] getChildTypes(); @Override String getNativeQuery( final UnitOfWork transaction ); @Override ProcedureResultSet getResultSet( final UnitOfWork transaction ); @Override Map< String, String > getStandardOptions(); @Override KomodoType getTypeIdentifier( final UnitOfWork transaction ); @Override Model getParent( final UnitOfWork transaction ); @Override boolean isNonPrepared( final UnitOfWork transaction ); @Override boolean isStandardOption( final String name ); @Override void removeResultSet( final UnitOfWork transaction ); @Override void setNativeQuery( final UnitOfWork transaction,
                                final String newNativeQuery ); @Override void setNonPrepared( final UnitOfWork transaction,
                                final boolean newNonPrepared ); @SuppressWarnings( "unchecked" ) @Override T setResultSet( final UnitOfWork transaction,
                                                            final Class< T > resultSetType ); }
StoredProcedureImpl extends AbstractProcedureImpl implements StoredProcedure { @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" ); ArgCheck.isNotNull( resultSetType, "resultSetType" ); 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 ); } else { throw new UnsupportedOperationException( Messages.getString( Relational.UNEXPECTED_RESULT_SET_TYPE, resultSetType.getName() ) ); } return result; } StoredProcedureImpl( final UnitOfWork uow,
                                final Repository repository,
                                final String workspacePath ); @Override KomodoType[] getChildTypes(); @Override String getNativeQuery( final UnitOfWork transaction ); @Override ProcedureResultSet getResultSet( final UnitOfWork transaction ); @Override Map< String, String > getStandardOptions(); @Override KomodoType getTypeIdentifier( final UnitOfWork transaction ); @Override Model getParent( final UnitOfWork transaction ); @Override boolean isNonPrepared( final UnitOfWork transaction ); @Override boolean isStandardOption( final String name ); @Override void removeResultSet( final UnitOfWork transaction ); @Override void setNativeQuery( final UnitOfWork transaction,
                                final String newNativeQuery ); @Override void setNonPrepared( final UnitOfWork transaction,
                                final boolean newNonPrepared ); @SuppressWarnings( "unchecked" ) @Override T setResultSet( final UnitOfWork transaction,
                                                            final Class< T > resultSetType );  }