1 24 package org.ofbiz.minilang.operation; 25 26 import java.util.*; 27 28 import org.w3c.dom.*; 29 import org.ofbiz.base.util.*; 30 31 38 public class MapProcessor { 39 40 String name; 41 List makeInStrings = new LinkedList(); 42 List simpleMapProcesses = new LinkedList(); 43 44 public MapProcessor(Element simpleMapProcessorElement) { 45 name = simpleMapProcessorElement.getAttribute("name"); 46 47 List makeInStringElements = UtilXml.childElementList(simpleMapProcessorElement, "make-in-string"); 48 Iterator misIter = makeInStringElements.iterator(); 49 50 while (misIter.hasNext()) { 51 Element makeInStringElement = (Element) misIter.next(); 52 MakeInString makeInString = new MakeInString(makeInStringElement); 53 54 makeInStrings.add(makeInString); 55 } 56 57 List simpleMapProcessElements = UtilXml.childElementList(simpleMapProcessorElement, "process"); 58 Iterator strProcIter = simpleMapProcessElements.iterator(); 59 60 while (strProcIter.hasNext()) { 61 Element simpleMapProcessElement = (Element) strProcIter.next(); 62 SimpleMapProcess strProc = new SimpleMapProcess(simpleMapProcessElement); 63 64 simpleMapProcesses.add(strProc); 65 } 66 } 67 68 public String getName() { 69 return name; 70 } 71 72 public void exec(Map inMap, Map results, List messages, Locale locale, ClassLoader loader) { 73 if (makeInStrings != null && makeInStrings.size() > 0) { 74 Iterator misIter = makeInStrings.iterator(); 75 76 while (misIter.hasNext()) { 77 MakeInString makeInString = (MakeInString) misIter.next(); 78 79 makeInString.exec(inMap, results, messages, locale, loader); 80 } 81 } 82 83 if (simpleMapProcesses != null && simpleMapProcesses.size() > 0) { 84 Iterator strPrsIter = simpleMapProcesses.iterator(); 85 86 while (strPrsIter.hasNext()) { 87 SimpleMapProcess simpleMapProcess = (SimpleMapProcess) strPrsIter.next(); 88 89 simpleMapProcess.exec(inMap, results, messages, locale, loader); 90 } 91 } 92 } 93 } 94 | Popular Tags |