model.setReasonCodeField( rcField );
}
model.getCharacteristics().clear();
for ( final DirtyableFlexTable flexTable : characteristicsTables ) {
final Characteristic characteristic = new Characteristic();
characteristic.setName( ( (TextBox) flexTable.getWidget( 0,
1 ) ).getValue() );
//Characteristic Fact Type
enumDropDown = (ListBox) flexTable.getWidget( 2,
0 );
if ( enumDropDown.getSelectedIndex() > -1 ) {
final String simpleFactName = enumDropDown.getValue( enumDropDown.getSelectedIndex() );
characteristic.setFact( simpleFactName );
oracle.getFieldCompletions( simpleFactName,
new Callback<ModelField[]>() {
@Override
public void callback( final ModelField[] fields ) {
if ( fields != null ) {
for ( ModelField mf : fields ) {
if ( mf.getType().equals( simpleFactName ) ) {
characteristic.setFact( mf.getClassName() );
break;
}
}
}
}
} );
//Characteristic Field (cannot be set if no Fact Type has been set)
enumDropDown = (ListBox) flexTable.getWidget( 2,
1 );
if ( enumDropDown.getSelectedIndex() > -1 ) {
String fieldName = enumDropDown.getValue( enumDropDown.getSelectedIndex() );
fieldName = fieldName.substring( 0, fieldName.indexOf( ":" ) ).trim();
characteristic.setField( fieldName );
} else {
characteristic.setField( "" );
}
getDataTypeForField( simpleFactName,
characteristic.getField(),
new Callback<String>() {
@Override
public void callback( final String result ) {
characteristic.setDataType( result );
}
} );
}
//Characteristic Reason Code
characteristic.setReasonCode( ( (TextBox) flexTable.getWidget( 2,
3 ) ).getValue() );
//Characteristic Base Line Score
final String baselineScore = ( (TextBox) flexTable.getWidget( 2,
2 ) ).getValue();
try {
characteristic.setBaselineScore( Double.parseDouble( baselineScore ) );
} catch ( Exception e ) {
characteristic.setBaselineScore( 0.0d );
}
//Characteristic Attributes
characteristic.getAttributes().clear();
characteristic.getAttributes().addAll( characteristicsAttrMap.get( flexTable ).getList() );
model.getCharacteristics().add( characteristic );
}
return model;