/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.finra.datagenerator.samples.consumer;

import java.util.HashMap;
import java.util.Map.Entry;
import java.util.Random;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.log4j.Logger;
import org.finra.datagenerator.consumer.DataConsumer;

public class SampleMachineConsumer implements DataConsumer {

    protected static final Logger log = Logger.getLogger(SampleMachineConsumer.class);

    private final int myTemplateHashCode = "#{customplaceholder}".hashCode();
    private final Random rand = new Random(System.currentTimeMillis());

    @Override
    public void consume(HashMap<String, String> originalRow, AtomicBoolean exitFlag) {
        // Go through our templates and fill them with values
        HashMap<String, String> outputValues = new HashMap<>();

        for (Entry<String, String> entry : originalRow.entrySet()) {
            String value = entry.getValue();
            int hashCode = value.hashCode();

            if (hashCode == myTemplateHashCode && value.equals("#{customplaceholder}")) {
                // Generate a random number
                int ran = rand.nextInt();
                value = "" + ran;
            }

            outputValues.put(entry.getKey(), value);
        }

        // Using the values, compile our output. In our case, we will just write it to the console
        System.out.println("Row=" + outputValues.toString());
    }
}

@@ -633,16 +633,38 @@
 ashMap;%0A
+import java.util.Map;%0A
 import j
@@ -712,58 +712,8 @@
 om;%0A
-import java.util.concurrent.atomic.AtomicBoolean;%0A
 impo
@@ -793,16 +793,81 @@
 onsumer;
+%0Aimport org.finra.datagenerator.consumer.defaults.ConsumerResult;
 %0A%0Apublic
@@ -1203,67 +1203,25 @@
 ume(
-HashMap%3CString, String%3E originalRow, AtomicBoolean exitFlag
+ConsumerResult cr
 ) %7B%0A
@@ -1282,16 +1282,75 @@
  values%0A
+        Map%3CString, String%3E originalRow = cr.getDataMap();%0A
         
@@ -2022,10 +2022,11 @@
 ;%0A    %7D%0A
+%0A
 %7D%0A

Fix the sample