From aafaa8f12793373085d10ffb58664f868fa397d4 Mon Sep 17 00:00:00 2001 From: James Ahlborn Date: Sat, 12 Nov 2011 02:56:39 +0000 Subject: some tweaks, fixes, and tests for unsupported values git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@592 f203690c-595d-4dc9-a70b-905162fa7fd2 --- .../jackcess/complex/ComplexValueForeignKey.java | 13 ++++++++++++- .../jackcess/complex/UnsupportedColumnInfo.java | 14 +++++++++----- 2 files changed, 21 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/java/com/healthmarketscience/jackcess/complex/ComplexValueForeignKey.java b/src/java/com/healthmarketscience/jackcess/complex/ComplexValueForeignKey.java index d236afe..ba31a3b 100644 --- a/src/java/com/healthmarketscience/jackcess/complex/ComplexValueForeignKey.java +++ b/src/java/com/healthmarketscience/jackcess/complex/ComplexValueForeignKey.java @@ -167,6 +167,16 @@ public class ComplexValueForeignKey extends Number return (List)getValues(); } + @SuppressWarnings("unchecked") + public List getUnsupportedValues() + throws IOException + { + if(getComplexType() != ComplexDataType.UNSUPPORTED) { + throw new UnsupportedOperationException(); + } + return (List)getValues(); + } + public void reset() { // discard any cached values _values = null; @@ -246,7 +256,8 @@ public class ComplexValueForeignKey extends Number return value; } - public UnsupportedValue addUnsupportedValue(Map values) + public UnsupportedValue addUnsupportedValue( + Map values) throws IOException { reset(); diff --git a/src/java/com/healthmarketscience/jackcess/complex/UnsupportedColumnInfo.java b/src/java/com/healthmarketscience/jackcess/complex/UnsupportedColumnInfo.java index 7275511..27ee434 100644 --- a/src/java/com/healthmarketscience/jackcess/complex/UnsupportedColumnInfo.java +++ b/src/java/com/healthmarketscience/jackcess/complex/UnsupportedColumnInfo.java @@ -59,8 +59,10 @@ public class UnsupportedColumnInfo extends ComplexColumnInfo { int id = (Integer)getPrimaryKeyColumn().getRowValue(rawValue); - Map values = new LinkedHashMap(rawValue); - values.remove(getPrimaryKeyColumn().getName()); + Map values = new LinkedHashMap(); + for(Column col : getValueColumns()) { + col.setRowValue(values, col.getRowValue(rawValue)); + } return new UnsupportedValueImpl(id, complexValueFk, values); } @@ -77,13 +79,15 @@ public class UnsupportedColumnInfo extends ComplexColumnInfo return row; } - public static UnsupportedValue newValue(Map values) { + public static UnsupportedValue newValue(Map values) { return newValue(INVALID_COMPLEX_VALUE_ID, values); } public static UnsupportedValue newValue( - ComplexValueForeignKey complexValueFk, Map values) { - return new UnsupportedValueImpl(INVALID_ID, complexValueFk, values); + ComplexValueForeignKey complexValueFk, + Map values) { + return new UnsupportedValueImpl(INVALID_ID, complexValueFk, + new LinkedHashMap(values)); } private static class UnsupportedValueImpl extends ComplexValueImpl -- cgit v1.2.3