camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1164433 - in /camel/branches/camel-2.8.x: ./ components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/ components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/ components/camel-bindy/src/test/java/org/apach...
Date Fri, 02 Sep 2011 09:32:39 GMT
Author: davsclaus
Date: Fri Sep  2 09:32:38 2011
New Revision: 1164433

URL: http://svn.apache.org/viewvc?rev=1164433&view=rev
Log:
Merged revisions 1154684 via svnmerge from 
https://svn.apache.org/repos/asf/camel/trunk


Modified:
    camel/branches/camel-2.8.x/   (props changed)
    camel/branches/camel-2.8.x/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java
    camel/branches/camel-2.8.x/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java
    camel/branches/camel-2.8.x/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexOneToManyKeyValuePairUnMarshallTest.java

Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Sep  2 09:32:38 2011
@@ -1 +1 @@
-/camel/trunk:1150651,1151054,1152170,1155230,1156108,1156260,1156277,1156479,1156524,1157348,1157798,1157831,1157878,1158153,1159171,1159174,1159326,1159457,1159460,1159606,1159682-1159683,1159867,1160547,1160637,1161010,1161082,1161524,1162309,1162395
+/camel/trunk:1150651,1151054,1152170,1154684,1155230,1156108,1156260,1156277,1156479,1156524,1157348,1157798,1157831,1157878,1158153,1159171,1159174,1159326,1159457,1159460,1159606,1159682-1159683,1159867,1160547,1160637,1161010,1161082,1161524,1162309,1162395

Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.8.x/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java?rev=1164433&r1=1164432&r2=1164433&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java
(original)
+++ camel/branches/camel-2.8.x/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java
Fri Sep  2 09:32:38 2011
@@ -51,9 +51,7 @@ public class BindyKeyValuePairFactory ex
     private Map<Integer, KeyValuePairField> keyValuePairFields = new LinkedHashMap<Integer,
KeyValuePairField>();
     private Map<Integer, Field> annotedFields = new LinkedHashMap<Integer, Field>();
     private Map<String, Integer> sections = new HashMap<String, Integer>();
-
     private Map<String, List> lists = new HashMap<String, List>();
-
     private String keyValuePairSeparator;
     private String pairSeparator;
     private boolean messageOrdered;
@@ -117,12 +115,18 @@ public class BindyKeyValuePairFactory ex
         }
     }
 
-    /**
-     * 
-     */
+    @Override
     public void bind(List<String> data, Map<String, Object> model, int line)
throws Exception {
 
-        Map<Integer, List> results = new HashMap<Integer, List>();
+        // Map to hold the model @OneToMany classes while binding
+        Map<String, List<Object>> lists = new HashMap<String, List<Object>>();
+
+        bind(data, model, line, lists);
+    }
+
+    public void bind(List<String> data, Map<String, Object> model, int line,
Map<String, List<Object>> lists) throws Exception {
+
+        Map<Integer, List<String>> results = new HashMap<Integer, List<String>>();
 
         LOG.debug("Key value pairs data : {}", data);
 
@@ -169,21 +173,14 @@ public class BindyKeyValuePairFactory ex
             if (obj != null) {
 
                 // Generate model from key value map
-                generateModelFromKeyValueMap(clazz, obj, results, line);
+                generateModelFromKeyValueMap(clazz, obj, results, line, lists);
 
             }
         }
 
     }
 
-    /**
-     * @param clazz
-     * @param obj
-     * @param results
-     * @param line
-     * @throws Exception
-     */
-    private void generateModelFromKeyValueMap(Class clazz, Object obj, Map<Integer, List>
results, int line) throws Exception {
+    private void generateModelFromKeyValueMap(Class clazz, Object obj, Map<Integer, List<String>>
results, int line, Map<String, List<Object>> lists) throws Exception {
 
         for (Field field : clazz.getDeclaredFields()) {
 
@@ -395,7 +392,7 @@ public class BindyKeyValuePairFactory ex
                         lists.put(cl.getName(), new ArrayList());
                     }
 
-                    generateModelFromKeyValueMap(cl, null, results, line);
+                    generateModelFromKeyValueMap(cl, null, results, line, lists);
 
                     // Add list of objects
                     field.set(obj, lists.get(cl.getName()));
@@ -637,4 +634,5 @@ public class BindyKeyValuePairFactory ex
             }
         }
     }
+
 }

Modified: camel/branches/camel-2.8.x/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java?rev=1164433&r1=1164432&r2=1164433&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java
(original)
+++ camel/branches/camel-2.8.x/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java
Fri Sep  2 09:32:38 2011
@@ -21,6 +21,7 @@ import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Scanner;
@@ -79,6 +80,9 @@ public class BindyKeyValuePairDataFormat
 
         // Pojos of the model
         Map<String, Object> model;
+        
+        // Map to hold the model @OneToMany classes while binding
+        Map<String, List<Object>> lists = new HashMap<String, List<Object>>();
 
         InputStreamReader in = new InputStreamReader(inputStream);
 
@@ -117,7 +121,7 @@ public class BindyKeyValuePairDataFormat
                 if (result.size() > 0) {
                     // Bind data from message with model classes
                     // Counter is used to detect line where error occurs
-                    factory.bind(result, model, count);
+                    factory.bind(result, model, count, lists);
 
                     // Link objects together
                     factory.link(model);

Modified: camel/branches/camel-2.8.x/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexOneToManyKeyValuePairUnMarshallTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexOneToManyKeyValuePairUnMarshallTest.java?rev=1164433&r1=1164432&r2=1164433&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexOneToManyKeyValuePairUnMarshallTest.java
(original)
+++ camel/branches/camel-2.8.x/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexOneToManyKeyValuePairUnMarshallTest.java
Fri Sep  2 09:32:38 2011
@@ -33,9 +33,11 @@ public class BindyComplexOneToManyKeyVal
 
         String message = "8=FIX 4.19=2034=135=049=INVMGR56=BRKR" + "1=BE.CHM.00111=CHM0001-0158=this
is a camel - bindy test" + "22=448=BE000124567854=1"
                          + "22=548=BE000987654354=2" + "22=648=BE000999999954=3" +
"10=220";
+        String message2 = "8=FIX 4.19=2034=135=049=INVMGR56=BRKR" + "1=BE.CHM.00111=CHM0001-0158=this
is a camel - bindy test10=220";
 
-        result.expectedMessageCount(1);
+        result.expectedMessageCount(2);
         template.sendBody(message);
+        template.sendBody(message2);
 
         result.assertIsSatisfied();
 



Mime
View raw message