]> source.dussan.org Git - jackcess.git/commitdiff
minor cleanups
authorJames Ahlborn <jtahlborn@yahoo.com>
Sun, 4 Sep 2016 13:48:15 +0000 (13:48 +0000)
committerJames Ahlborn <jtahlborn@yahoo.com>
Sun, 4 Sep 2016 13:48:15 +0000 (13:48 +0000)
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@1024 f203690c-595d-4dc9-a70b-905162fa7fd2

src/main/java/com/healthmarketscience/jackcess/PropertyMap.java
src/main/java/com/healthmarketscience/jackcess/impl/complex/MultiValueColumnPropertyMap.java
src/test/java/com/healthmarketscience/jackcess/ComplexColumnTest.java

index 89a98c1a098a56236a9184763f14d6accd63ec08..b216c6b63f1d5d8f753d02a5edb0ecd4dd80f1b8 100644 (file)
@@ -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();
index 08f472c9b1ae99216c64a729aea565f56e91f118..25c8e958ee6e7531b888f2f2ca1757a4bfe23880 100644 (file)
@@ -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);
+  } 
 }
index acecf57daa854b8b71d0874f619c305feaa11e9f..b4704bf1e2858ff2e24e694c8294e4cdad1179f5 100644 (file)
@@ -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();
     }