private Object convert( Object obj, AccessInputField field, int index ) throws Exception { // Get column Column c = data.t.getColumn( field.getColumn() ); // Find out field type ValueMetaAndData sourceValueMetaAndData = AccessInputMeta.getValueMetaAndData( c, field.getName(), obj ); // DO CONVERSIONS... // ValueMetaInterface targetValueMeta = data.outputRowMeta.getValueMeta( data.totalpreviousfields + index ); return targetValueMeta.convertData( sourceValueMetaAndData.getValueMeta(), sourceValueMetaAndData .getValueData() ); } }
@Override public Column getColumn(String name) { return wrapped.getColumn(name); }
public IterableBuilder setMatchPattern(String columnNamePattern, Object valuePattern) { return setMatchPattern(_cursor.getTable().getColumn(columnNamePattern), valuePattern); }
@Override public boolean matches(Table table, String columnName, Object value1, Object value2) { if(!table.getColumn(columnName).getType().isTextual()) { // use simple equality return SimpleColumnMatcher.INSTANCE.matches(table, columnName, value1, value2); } // convert both values to Strings and compare case-insensitively try { CharSequence cs1 = ColumnImpl.toCharSequence(value1); CharSequence cs2 = ColumnImpl.toCharSequence(value2); return((cs1 == cs2) || ((cs1 != null) && (cs2 != null) && cs1.toString().equalsIgnoreCase(cs2.toString()))); } catch(IOException e) { throw new RuntimeIOException("Could not read column " + columnName + " value", e); } }
@Override public boolean matches(Table table, String columnName, Object value1, Object value2) { if(equals(value1, value2)) { return true; } if((value1 != null) && (value2 != null) && (value1.getClass() != value2.getClass())) { // the values aren't the same type, try coercing them to "internal" // values and try again DataType dataType = table.getColumn(columnName).getType(); try { DatabaseImpl db = (DatabaseImpl)table.getDatabase(); Object internalV1 = ColumnImpl.toInternalValue(dataType, value1, db); Object internalV2 = ColumnImpl.toInternalValue(dataType, value2, db); return equals(internalV1, internalV2); } catch(IOException e) { // ignored, just go with the original result } } return false; }
@Override public void postTableLoadInit() throws IOException { super.postTableLoadInit(); // link up with the actual versioned column. it should have the same name // as the "value" column in the type table. Column versionedCol = getColumn().getTable().getColumn( getValueColumn().getName()); ((ColumnImpl)versionedCol).setVersionHistoryColumn((ColumnImpl)getColumn()); }