Author: adrianc
Date: Thu Apr 19 15:09:03 2012 New Revision: 1327981 URL: http://svn.apache.org/viewvc?rev=1327981&view=rev Log: Mini-language code format cleanup. No functional change. Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMapProcessor.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethodBsfEngine.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleServiceEngine.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ContextAccessor.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/FieldObject.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/FieldString.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/MethodContext.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/MethodObject.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/MethodOperation.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/MethodString.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/StringObject.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/StringString.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/AddError.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallBsh.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallClassMethod.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallObjectMethod.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallScript.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallService.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallServiceAsynch.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallSimpleMapProcessor.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallSimpleMethod.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CheckErrors.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CreateObject.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/FlexibleMessage.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/Return.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/SetServiceFields.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/Assert.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/CombinedCondition.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/CompareCondition.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/CompareFieldCondition.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/Conditional.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ConditionalFactory.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ElseIf.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/EmptyCondition.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/HasPermissionCondition.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/MasterIf.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/RegexpCondition.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ValidateMethodCondition.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/While.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/ClearCacheLine.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/ClearEntityCaches.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/CloneValue.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/CreateValue.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityAnd.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCondition.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCount.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityData.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityOne.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FilterListByAnd.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FilterListByDate.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByAnd.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByPrimaryKey.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/GetRelated.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/GetRelatedOne.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/MakeNextSeqId.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/MakeValue.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/NowDateToEnv.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/NowTimestampToEnv.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/OrderValueList.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/RefreshValue.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveByAnd.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveList.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveRelated.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveValue.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/SequencedIdToEnv.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/SetCurrentUserLogin.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/SetNonpkFields.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/SetPkFields.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/StoreList.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/StoreValue.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/TransactionBegin.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/TransactionCommit.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/TransactionRollback.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/ClearField.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/EnvToEnv.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/EnvToField.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/FieldToEnv.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/FieldToField.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/FieldToList.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/FirstFromList.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Iterate.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/IterateMap.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/ListToList.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/MapToMap.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/OrderMapList.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetCalendar.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetOperation.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringAppend.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringToField.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringToList.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/ToString.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/FieldToRequest.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/FieldToSession.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/RequestParametersToList.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/RequestToField.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/SessionToField.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/WebappPropertyToField.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/CheckId.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/CheckPermission.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompare.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompareField.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfEmpty.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfHasPermission.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfInstanceOf.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfNotEmpty.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfRegexp.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfValidateMethod.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/Calculate.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/Log.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/PropertyToField.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/serviceops/FieldToResult.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/BaseCompare.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Compare.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/CompareField.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/ConstantOper.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Convert.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Copy.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/InFieldOper.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/MakeInString.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/MakeInStringOperation.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/MapProcessor.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/NotEmpty.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/PropertyOper.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Regexp.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/SimpleMapOperation.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/SimpleMapProcess.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/ValidateMethod.java Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMapProcessor.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMapProcessor.java?rev=1327981&r1=1327980&r2=1327981&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMapProcessor.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMapProcessor.java Thu Apr 19 15:09:03 2012 @@ -41,46 +41,32 @@ public class SimpleMapProcessor { protected static UtilCache<String, Map<String, MapProcessor>> simpleMapProcessorsResourceCache = UtilCache.createUtilCache("minilang.SimpleMapProcessorsResource", 0, 0); protected static UtilCache<URL, Map<String, MapProcessor>> simpleMapProcessorsURLCache = UtilCache.createUtilCache("minilang.SimpleMapProcessorsURL", 0, 0); - public static void runSimpleMapProcessor(String xmlResource, String name, Map<String, Object> inMap, Map<String, Object> results, List<Object> messages, Locale locale) throws MiniLangException { - runSimpleMapProcessor(xmlResource, name, inMap, results, messages, locale, null); - } - - public static void runSimpleMapProcessor(String xmlResource, String name, Map<String, Object> inMap, Map<String, Object> results, List<Object> messages, Locale locale, ClassLoader loader) throws MiniLangException { - if (loader == null) { - loader = Thread.currentThread().getContextClassLoader(); - } - - Map<String, MapProcessor> mapProcessors = getProcessors(xmlResource, name, loader); - MapProcessor processor = mapProcessors.get(name); - - if (processor == null) { - throw new MiniLangException("Could not find SimpleMapProcessor named " + name + " in XML document resource: " + xmlResource); - } - - if (processor != null) { - processor.exec(inMap, results, messages, locale, loader); + protected static Map<String, MapProcessor> getAllProcessors(URL xmlURL) throws MiniLangException { + Map<String, MapProcessor> mapProcessors = FastMap.newInstance(); + // read in the file + Document document = null; + try { + document = UtilXml.readXmlDocument(xmlURL, true); + } catch (java.io.IOException e) { + throw new MiniLangException("Could not read XML file", e); + } catch (org.xml.sax.SAXException e) { + throw new MiniLangException("Could not parse XML file", e); + } catch (javax.xml.parsers.ParserConfigurationException e) { + throw new MiniLangException("XML parser not setup correctly", e); } - } - - public static void runSimpleMapProcessor(URL xmlURL, String name, Map<String, Object> inMap, Map<String, Object> results, List<Object> messages, Locale locale, ClassLoader loader) throws MiniLangException { - if (loader == null) - loader = Thread.currentThread().getContextClassLoader(); - - Map<String, MapProcessor> mapProcessors = getProcessors(xmlURL, name); - MapProcessor processor = mapProcessors.get(name); - - if (processor == null) { - throw new MiniLangException("Could not find SimpleMapProcessor named " + name + " in XML document: " + xmlURL.toString()); + if (document == null) { + throw new MiniLangException("Could not find SimpleMapProcessor XML document: " + xmlURL.toString()); } - - if (processor != null) { - processor.exec(inMap, results, messages, locale, loader); + Element rootElement = document.getDocumentElement(); + for (Element simpleMapProcessorElement : UtilXml.childElementList(rootElement, "simple-map-processor")) { + MapProcessor processor = new MapProcessor(simpleMapProcessorElement); + mapProcessors.put(simpleMapProcessorElement.getAttribute("name"), processor); } + return mapProcessors; } protected static Map<String, MapProcessor> getProcessors(String xmlResource, String name, ClassLoader loader) throws MiniLangException { Map<String, MapProcessor> simpleMapProcessors = simpleMapProcessorsResourceCache.get(xmlResource); - if (simpleMapProcessors == null) { synchronized (SimpleMapProcessor.class) { simpleMapProcessors = simpleMapProcessorsResourceCache.get(xmlResource); @@ -91,65 +77,59 @@ public class SimpleMapProcessor { } catch (MalformedURLException e) { throw new MiniLangException("Could not find SimpleMapProcessor XML document in resource: " + xmlResource + "; error was: " + e.toString(), e); } - if (xmlURL == null) { throw new MiniLangException("Could not find SimpleMapProcessor XML document in resource: " + xmlResource); } simpleMapProcessors = getAllProcessors(xmlURL); - - // put it in the cache simpleMapProcessorsResourceCache.put(xmlResource, simpleMapProcessors); } } } - return simpleMapProcessors; } protected static Map<String, MapProcessor> getProcessors(URL xmlURL, String name) throws MiniLangException { Map<String, MapProcessor> simpleMapProcessors = simpleMapProcessorsURLCache.get(xmlURL); - if (simpleMapProcessors == null) { synchronized (SimpleMapProcessor.class) { simpleMapProcessors = simpleMapProcessorsURLCache.get(xmlURL); if (simpleMapProcessors == null) { simpleMapProcessors = getAllProcessors(xmlURL); - - // put it in the cache simpleMapProcessorsURLCache.put(xmlURL, simpleMapProcessors); } } } - return simpleMapProcessors; } - protected static Map<String, MapProcessor> getAllProcessors(URL xmlURL) throws MiniLangException { - Map<String, MapProcessor> mapProcessors = FastMap.newInstance(); - - // read in the file - Document document = null; + public static void runSimpleMapProcessor(String xmlResource, String name, Map<String, Object> inMap, Map<String, Object> results, List<Object> messages, Locale locale) throws MiniLangException { + runSimpleMapProcessor(xmlResource, name, inMap, results, messages, locale, null); + } - try { - document = UtilXml.readXmlDocument(xmlURL, true); - } catch (java.io.IOException e) { - throw new MiniLangException("Could not read XML file", e); - } catch (org.xml.sax.SAXException e) { - throw new MiniLangException("Could not parse XML file", e); - } catch (javax.xml.parsers.ParserConfigurationException e) { - throw new MiniLangException("XML parser not setup correctly", e); + public static void runSimpleMapProcessor(String xmlResource, String name, Map<String, Object> inMap, Map<String, Object> results, List<Object> messages, Locale locale, ClassLoader loader) throws MiniLangException { + if (loader == null) { + loader = Thread.currentThread().getContextClassLoader(); } - - if (document == null) { - throw new MiniLangException("Could not find SimpleMapProcessor XML document: " + xmlURL.toString()); + Map<String, MapProcessor> mapProcessors = getProcessors(xmlResource, name, loader); + MapProcessor processor = mapProcessors.get(name); + if (processor == null) { + throw new MiniLangException("Could not find SimpleMapProcessor named " + name + " in XML document resource: " + xmlResource); } - - Element rootElement = document.getDocumentElement(); - for (Element simpleMapProcessorElement: UtilXml.childElementList(rootElement, "simple-map-processor")) { - MapProcessor processor = new MapProcessor(simpleMapProcessorElement); - mapProcessors.put(simpleMapProcessorElement.getAttribute("name"), processor); + if (processor != null) { + processor.exec(inMap, results, messages, locale, loader); } + } - return mapProcessors; + public static void runSimpleMapProcessor(URL xmlURL, String name, Map<String, Object> inMap, Map<String, Object> results, List<Object> messages, Locale locale, ClassLoader loader) throws MiniLangException { + if (loader == null) + loader = Thread.currentThread().getContextClassLoader(); + Map<String, MapProcessor> mapProcessors = getProcessors(xmlURL, name); + MapProcessor processor = mapProcessors.get(name); + if (processor == null) { + throw new MiniLangException("Could not find SimpleMapProcessor named " + name + " in XML document: " + xmlURL.toString()); + } + if (processor != null) { + processor.exec(inMap, results, messages, locale, loader); + } } } |
Free forum by Nabble | Edit this page |