@Test public void shouldHaveReferencesTableAfterConstruction() throws Exception { assertThat( this.foreignKey.getReferencesTable( getTransaction() ), is( this.refTable ) ); }
@Override public Table getReferencesTable( final UnitOfWork transaction ) throws KException { ArgCheck.isNotNull( transaction, "transaction" ); ArgCheck.isTrue( ( transaction.getState() == State.NOT_STARTED ), "transaction state is not NOT_STARTED" ); Table result = null; final Property property = getProperty( transaction, Constraint.TABLE_REFERENCE ); if ( property != null ) { final String tableId = property.getStringValue( transaction ); final KomodoObject kobject = getRepository().getUsingId( transaction, tableId ); if ( kobject == null ) { throw new KException( Messages.getString( Relational.REFERENCED_TABLE_NOT_FOUND, tableId ) ); } result = new TableImpl( transaction, getRepository(), kobject.getAbsolutePath() ); } return result; }
ForeignKeyImpl extends TableConstraintImpl implements ForeignKey { @Override public Table getReferencesTable( final UnitOfWork transaction ) throws KException { ArgCheck.isNotNull( transaction, "transaction" ); ArgCheck.isTrue( ( transaction.getState() == State.NOT_STARTED ), "transaction state is not NOT_STARTED" ); Table result = null; final Property property = getProperty( transaction, Constraint.TABLE_REFERENCE ); if ( property != null ) { final String tableId = property.getStringValue( transaction ); final KomodoObject kobject = getRepository().getUsingId( transaction, tableId ); if ( kobject == null ) { throw new KException( Messages.getString( Relational.REFERENCED_TABLE_NOT_FOUND, tableId ) ); } result = new TableImpl( transaction, getRepository(), kobject.getAbsolutePath() ); } return result; } }
ForeignKeyImpl extends TableConstraintImpl implements ForeignKey { @Override public Table getReferencesTable( final UnitOfWork transaction ) throws KException { ArgCheck.isNotNull( transaction, "transaction" ); ArgCheck.isTrue( ( transaction.getState() == State.NOT_STARTED ), "transaction state is not NOT_STARTED" ); Table result = null; final Property property = getProperty( transaction, Constraint.TABLE_REFERENCE ); if ( property != null ) { final String tableId = property.getStringValue( transaction ); final KomodoObject kobject = getRepository().getUsingId( transaction, tableId ); if ( kobject == null ) { throw new KException( Messages.getString( Relational.REFERENCED_TABLE_NOT_FOUND, tableId ) ); } result = new TableImpl( transaction, getRepository(), kobject.getAbsolutePath() ); } return result; } ForeignKeyImpl( final UnitOfWork uow,
                           final Repository repository,
                           final String workspacePath ); }
ForeignKeyImpl extends TableConstraintImpl implements ForeignKey { @Override public Table getReferencesTable( final UnitOfWork transaction ) throws KException { ArgCheck.isNotNull( transaction, "transaction" ); ArgCheck.isTrue( ( transaction.getState() == State.NOT_STARTED ), "transaction state is not NOT_STARTED" ); Table result = null; final Property property = getProperty( transaction, Constraint.TABLE_REFERENCE ); if ( property != null ) { final String tableId = property.getStringValue( transaction ); final KomodoObject kobject = getRepository().getUsingId( transaction, tableId ); if ( kobject == null ) { throw new KException( Messages.getString( Relational.REFERENCED_TABLE_NOT_FOUND, tableId ) ); } result = new TableImpl( transaction, getRepository(), kobject.getAbsolutePath() ); } return result; } ForeignKeyImpl( final UnitOfWork uow,
                           final Repository repository,
                           final String workspacePath ); @Override KomodoType getTypeIdentifier(UnitOfWork uow); @Override void addReferencesColumn( final UnitOfWork transaction,
                                     final Column newReferencesColumn ); @Override ConstraintType getConstraintType(); @Override Column[] getReferencesColumns( final UnitOfWork transaction ); @Override Table getReferencesTable( final UnitOfWork transaction ); @Override int getTypeId(); @Override Table getParent( final UnitOfWork transaction ); @Override void removeReferencesColumn( final UnitOfWork transaction,
                                        final Column removeReferencesColumn ); @Override void setReferencesTable( final UnitOfWork transaction,
                                    final Table newReferencesTable ); }
ForeignKeyImpl extends TableConstraintImpl implements ForeignKey { @Override public Table getReferencesTable( final UnitOfWork transaction ) throws KException { ArgCheck.isNotNull( transaction, "transaction" ); ArgCheck.isTrue( ( transaction.getState() == State.NOT_STARTED ), "transaction state is not NOT_STARTED" ); Table result = null; final Property property = getProperty( transaction, Constraint.TABLE_REFERENCE ); if ( property != null ) { final String tableId = property.getStringValue( transaction ); final KomodoObject kobject = getRepository().getUsingId( transaction, tableId ); if ( kobject == null ) { throw new KException( Messages.getString( Relational.REFERENCED_TABLE_NOT_FOUND, tableId ) ); } result = new TableImpl( transaction, getRepository(), kobject.getAbsolutePath() ); } return result; } ForeignKeyImpl( final UnitOfWork uow,
                           final Repository repository,
                           final String workspacePath ); @Override KomodoType getTypeIdentifier(UnitOfWork uow); @Override void addReferencesColumn( final UnitOfWork transaction,
                                     final Column newReferencesColumn ); @Override ConstraintType getConstraintType(); @Override Column[] getReferencesColumns( final UnitOfWork transaction ); @Override Table getReferencesTable( final UnitOfWork transaction ); @Override int getTypeId(); @Override Table getParent( final UnitOfWork transaction ); @Override void removeReferencesColumn( final UnitOfWork transaction,
                                        final Column removeReferencesColumn ); @Override void setReferencesTable( final UnitOfWork transaction,
                                    final Table newReferencesTable );  }