aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2016-09-04 13:48:15 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2016-09-04 13:48:15 +0000
commit70eb4cc43cfc18a65aa50506dfeaf1d8a2e3a3f4 (patch)
treeeb273b92001a984e7557821a1e92f8b0ecda475c /src
parente9dcad296a38ee5886817a4039af5f6e877c2f13 (diff)
downloadjackcess-70eb4cc43cfc18a65aa50506dfeaf1d8a2e3a3f4.tar.gz
jackcess-70eb4cc43cfc18a65aa50506dfeaf1d8a2e3a3f4.zip
minor cleanups
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@1024 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/healthmarketscience/jackcess/PropertyMap.java2
-rw-r--r--src/main/java/com/healthmarketscience/jackcess/impl/complex/MultiValueColumnPropertyMap.java11
-rw-r--r--src/test/java/com/healthmarketscience/jackcess/ComplexColumnTest.java4
3 files changed, 12 insertions, 5 deletions
diff --git a/src/main/java/com/healthmarketscience/jackcess/PropertyMap.java b/src/main/java/com/healthmarketscience/jackcess/PropertyMap.java
index 89a98c1..b216c6b 100644
--- a/src/main/java/com/healthmarketscience/jackcess/PropertyMap.java
+++ b/src/main/java/com/healthmarketscience/jackcess/PropertyMap.java
@@ -45,6 +45,8 @@ public interface PropertyMap extends Iterable<PropertyMap.Property>
public static final String RESULT_TYPE_PROP = "ResultType";
public static final String EXPRESSION_PROP = "Expression";
public static final String ALLOW_MULTI_VALUE_PROP = "AllowMultipleValues";
+ public static final String ROW_SOURCE_TYPE_PROP = "RowSourceType";
+ public static final String ROW_SOURCE_PROP = "RowSource";
public String getName();
diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/complex/MultiValueColumnPropertyMap.java b/src/main/java/com/healthmarketscience/jackcess/impl/complex/MultiValueColumnPropertyMap.java
index 08f472c..25c8e95 100644
--- a/src/main/java/com/healthmarketscience/jackcess/impl/complex/MultiValueColumnPropertyMap.java
+++ b/src/main/java/com/healthmarketscience/jackcess/impl/complex/MultiValueColumnPropertyMap.java
@@ -85,7 +85,7 @@ public class MultiValueColumnPropertyMap implements PropertyMap
public Property put(String name, DataType type, Object value) {
// the only property which seems to go in the "primary" is the "multi
// value" property
- if(ALLOW_MULTI_VALUE_PROP.equals(name)) {
+ if(isPrimaryKey(name)) {
return _primary.put(name, DataType.BOOLEAN, value);
}
return _complex.put(name, value);
@@ -97,7 +97,7 @@ public class MultiValueColumnPropertyMap implements PropertyMap
}
for(Property prop : props) {
- if(ALLOW_MULTI_VALUE_PROP.equals(prop.getName())) {
+ if(isPrimaryKey(prop.getName())) {
((PropertyMapImpl)_primary).put(prop);
} else {
((PropertyMapImpl)_complex).put(prop);
@@ -106,7 +106,7 @@ public class MultiValueColumnPropertyMap implements PropertyMap
}
public Property remove(String name) {
- if(ALLOW_MULTI_VALUE_PROP.equals(name)) {
+ if(isPrimaryKey(name)) {
return _primary.remove(name);
}
return _complex.remove(name);
@@ -164,4 +164,9 @@ public class MultiValueColumnPropertyMap implements PropertyMap
public String toString() {
return PropertyMapImpl.toString(this);
}
+
+ private static boolean isPrimaryKey(String name) {
+ // the multi-value key seems to be the only one on the primary column
+ return ALLOW_MULTI_VALUE_PROP.equals(name);
+ }
}
diff --git a/src/test/java/com/healthmarketscience/jackcess/ComplexColumnTest.java b/src/test/java/com/healthmarketscience/jackcess/ComplexColumnTest.java
index acecf57..b4704bf 100644
--- a/src/test/java/com/healthmarketscience/jackcess/ComplexColumnTest.java
+++ b/src/test/java/com/healthmarketscience/jackcess/ComplexColumnTest.java
@@ -306,9 +306,9 @@ public class ComplexColumnTest extends TestCase
// test multi-value col props
PropertyMap props = col.getProperties();
assertEquals(Boolean.TRUE, props.getValue(PropertyMap.ALLOW_MULTI_VALUE_PROP));
- assertEquals("Value List", props.getValue("RowSourceType"));
+ assertEquals("Value List", props.getValue(PropertyMap.ROW_SOURCE_TYPE_PROP));
assertEquals("\"value1\";\"value2\";\"value3\";\"value4\"",
- props.getValue("RowSource"));
+ props.getValue(PropertyMap.ROW_SOURCE_PROP));
db.close();
}