[lsc-changes] r449 - lsc/branches/v1.1/src/main/java/org/lsc/service

jclarke at lsc-project.org jclarke at lsc-project.org
Wed Nov 18 18:48:01 CET 2009


Author: jclarke
Date: 2009-11-18 18:48:00 +0100 (Wed, 18 Nov 2009)
New Revision: 449

Modified:
   lsc/branches/v1.1/src/main/java/org/lsc/service/AbstractJdbcService.java
Log:
Fixes #145. When reading from database, use all pivot attributes to form a unique identifier

Modified: lsc/branches/v1.1/src/main/java/org/lsc/service/AbstractJdbcService.java
===================================================================
--- lsc/branches/v1.1/src/main/java/org/lsc/service/AbstractJdbcService.java	2009-11-13 11:28:09 UTC (rev 448)
+++ lsc/branches/v1.1/src/main/java/org/lsc/service/AbstractJdbcService.java	2009-11-18 17:48:00 UTC (rev 449)
@@ -56,6 +56,7 @@
 import javax.naming.NamingException;
 
 import org.apache.commons.collections.map.ListOrderedMap;
+import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
 import org.lsc.LscAttributes;
 import org.lsc.LscObject;
@@ -118,8 +119,13 @@
             Iterator<HashMap<String,Object>> idsIter = ids.iterator();
             while(idsIter.hasNext()) {
             	HashMap<String,Object> idMap = idsIter.next();
+            	
+            	// the key of the result Map is usally the DN
+            	// since we don't have a DN from a database, we use a concatenation of all pivot attributes
+            	// this is backwards compatible with the key being the pivot attribute (when there's only one)
+            	String key = StringUtils.join(idMap.values().iterator(), ", ");
             	LscAttributes la = new LscAttributes(idMap);
-            	ret.put(idMap.get(idMap.keySet().iterator().next()).toString(), la);
+            	ret.put(key, la);
             }
         } catch (SQLException e) {
             LOGGER.warn("Error while looking for the entries list: " + e, e);



More information about the lsc-changes mailing list