Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/TimeDuration.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/TimeDuration.java?rev=759228&r1=759227&r2=759228&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/TimeDuration.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/TimeDuration.java Fri Mar 27 16:55:57 2009 @@ -148,16 +148,16 @@ calStart = (Calendar) cal2.clone(); calEnd = (Calendar) cal1.clone(); } - + // this will be used to speed up time comparisons long targetMillis = calEnd.getTimeInMillis(); long deltaMillis = targetMillis - calStart.getTimeInMillis(); - + // shortcut for equal dates if (deltaMillis == 0) { return; } - + // compute elapsed years long yearMillis = 86400000 * calStart.getMinimum(Calendar.DAY_OF_YEAR); float units = deltaMillis / yearMillis; @@ -189,13 +189,13 @@ units = deltaMillis / 1000; this.seconds = advanceCalendar(calStart, calEnd, (int) units, Calendar.SECOND); deltaMillis = targetMillis - calStart.getTimeInMillis(); - + this.millis = (int) deltaMillis; if (isNegative) { makeNegative(); } } - + protected int advanceCalendar(Calendar start, Calendar end, int units, int type) { if (units >= 1) { start.add(type, units); Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/URLConnector.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/URLConnector.java?rev=759228&r1=759227&r2=759228&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/URLConnector.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/URLConnector.java Fri Mar 27 16:55:57 2009 @@ -34,7 +34,7 @@ * */ public class URLConnector { - + public static final String module = URLConnector.class.getName(); private URLConnection connection = null; @@ -51,11 +51,11 @@ this.trustAnyCert = trustAnyCert; this.hostCertLevel = hostCertLevel; } - + protected synchronized URLConnection openConnection(int timeout) throws IOException { Thread t = new Thread(new URLConnectorThread()); t.start(); - + try { this.wait(timeout); } catch (InterruptedException e) { @@ -79,15 +79,15 @@ public static URLConnection openConnection(URL url) throws IOException { return openConnection(url, 30000); } - + public static URLConnection openConnection(URL url, int timeout) throws IOException { return openConnection(url, timeout, null, SSLUtil.HOSTCERT_NORMAL_CHECK); } - + public static URLConnection openConnection(URL url, String clientCertAlias) throws IOException { return openConnection(url, 30000, clientCertAlias, SSLUtil.HOSTCERT_NORMAL_CHECK); } - + public static URLConnection openConnection(URL url, int timeout, String clientCertAlias, int hostCertLevel) throws IOException { URLConnector uc = new URLConnector(url, clientCertAlias, hostCertLevel, false); return uc.openConnection(timeout); @@ -117,7 +117,7 @@ URLConnection con = null; try { con = url.openConnection(); - + if ("HTTPS".equalsIgnoreCase(url.getProtocol())) { HttpsURLConnection scon = (HttpsURLConnection) con; try { @@ -146,7 +146,7 @@ } } } - + // closes the HttpURLConnection does nothing to others private static void close(URLConnection con) { if (con instanceof HttpURLConnection) { Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java?rev=759228&r1=759227&r2=759228&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java Fri Mar 27 16:55:57 2009 @@ -297,7 +297,7 @@ public static java.sql.Timestamp getWeekEnd(java.sql.Timestamp stamp) { return getWeekEnd(stamp, TimeZone.getDefault(), Locale.getDefault()); } - + public static java.util.Calendar toCalendar(java.sql.Timestamp stamp) { Calendar cal = Calendar.getInstance(); if (stamp != null) { @@ -619,7 +619,7 @@ calendar.setTime(date); return dateFormat.format(date); } - + /** * Makes a date String in the format MM/DD/YYYY from a Date * @@ -703,7 +703,7 @@ return df.format(timestamp); } - + /** * Makes a Timestamp for the beginning of the month * @@ -741,23 +741,23 @@ Calendar tempCal = toCalendar(stamp, TimeZone.getDefault(), Locale.getDefault()); return tempCal.get(Calendar.DAY_OF_WEEK); } - + public static int weekNumber(Timestamp input, int startOfWeek) { Calendar calendar = Calendar.getInstance(); calendar.setFirstDayOfWeek(startOfWeek); - + if (startOfWeek == Calendar.MONDAY) { calendar.setMinimalDaysInFirstWeek(4); } else if (startOfWeek == Calendar.SUNDAY) { calendar.setMinimalDaysInFirstWeek(3); } - + calendar.setTime(new java.util.Date(input.getTime())); return calendar.get(Calendar.WEEK_OF_YEAR); } - + // ----- New methods that take a timezone and locale -- // - + /** * Returns a Calendar object initialized to the specified date/time, time zone, * and locale. @@ -855,7 +855,7 @@ retStamp.setNanos(999999999); return retStamp; } - + public static Timestamp getMonthStart(Timestamp stamp, TimeZone timeZone, Locale locale) { return getMonthStart(stamp, 0, 0, timeZone, locale); } @@ -953,7 +953,7 @@ } return resultList; } - + /** * Returns an initialized DateFormat object. * @@ -1077,7 +1077,7 @@ public static TimeZone getDefaultTimeZone() { return TimeZone.getDefault(); } - + /** Returns a TimeZone object based upon a time zone ID. Method defaults to * server's time zone if tzID is null or empty. * @see java.util.TimeZone Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilFormatOut.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilFormatOut.java?rev=759228&r1=759227&r2=759228&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilFormatOut.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilFormatOut.java Fri Mar 27 16:55:57 2009 @@ -30,7 +30,7 @@ public class UtilFormatOut { public static final String module = UtilFormatOut.class.getName(); - + public static String safeToString(Object obj) { if (obj != null) { return obj.toString(); @@ -38,7 +38,7 @@ return ""; } } - + // ------------------- price format handlers ------------------- static DecimalFormat priceDecimalFormat = new DecimalFormat("#,##0.00"); static DecimalFormat priceNumberFormat = new DecimalFormat("##0.00"); @@ -270,7 +270,7 @@ public static String formatQuantity(double quantity) { return quantityDecimalFormat.format(quantity); } - + public static String formatPaddedNumber(long number, int numericPadding) { StringBuilder outStrBfr = new StringBuilder(Long.toString(number)); while (numericPadding > outStrBfr.length()) { @@ -278,7 +278,7 @@ } return outStrBfr.toString(); } - + public static String formatPaddingRemove(String original) { if (original == null) return null; StringBuilder orgBuf = new StringBuilder(original); @@ -287,8 +287,8 @@ } return orgBuf.toString(); } - - + + // ------------------- date handlers ------------------- /** Formats a String timestamp into a nice string * @param timestamp String timestamp to be formatted @@ -517,11 +517,11 @@ public static String makeSqlSafe(String unsafeString) { return unsafeString.replaceAll("'","''"); } - + public static String formatPrintableCreditCard(String original) { if (original == null) return null; if (original.length() <= 4) return original; - + StringBuffer buffer = new StringBuffer(); for(int i=0; i < original.length()-4 ; i++) { buffer.append('*'); Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java?rev=759228&r1=759227&r2=759228&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java Fri Mar 27 16:55:57 2009 @@ -60,14 +60,14 @@ public class UtilHttp { public static final String module = UtilHttp.class.getName(); - + public static final String MULTI_ROW_DELIMITER = "_o_"; public static final String ROW_SUBMIT_PREFIX = "_rowSubmit_o_"; public static final String COMPOSITE_DELIMITER = "_c_"; public static final int MULTI_ROW_DELIMITER_LENGTH = MULTI_ROW_DELIMITER.length(); public static final int ROW_SUBMIT_PREFIX_LENGTH = ROW_SUBMIT_PREFIX.length(); public static final int COMPOSITE_DELIMITER_LENGTH = COMPOSITE_DELIMITER.length(); - + /** * Create a combined map from servlet context, session, attributes and parameters * @return The resulting Map @@ -87,7 +87,7 @@ combinedMap.putAll(getSessionMap(request, namesToSkip)); // session overrides application combinedMap.putAll(getParameterMap(request)); // parameters override session combinedMap.putAll(getAttributeMap(request)); // attributes trump them all - + return combinedMap; } @@ -132,7 +132,7 @@ } paramMap.put(name, value); } - + paramMap.putAll(getPathInfoOnlyParameterMap(request, nameSet, onlyIncludeOrSkip)); if (paramMap.size() == 0) { @@ -147,10 +147,10 @@ Debug.logVerbose("Made Request Parameter Map with [" + paramMap.size() + "] Entries", module); Debug.logVerbose("Request Parameter Map Entries: " + System.getProperty("line.separator") + UtilMisc.printMap(paramMap), module); } - + return canonicalizeParameterMap(paramMap); } - + public static Map<String, Object> getQueryStringOnlyParameterMap(HttpServletRequest request) { Map<String, Object> paramMap = FastMap.newInstance(); String queryString = request.getQueryString(); @@ -173,11 +173,11 @@ } return canonicalizeParameterMap(paramMap); } - + public static Map<String, Object> getPathInfoOnlyParameterMap(HttpServletRequest request, Set<? extends String> nameSet, Boolean onlyIncludeOrSkip) { boolean onlyIncludeOrSkipPrim = onlyIncludeOrSkip == null ? true : onlyIncludeOrSkip.booleanValue(); Map<String, Object> paramMap = FastMap.newInstance(); - + // now add in all path info parameters /~name1=value1/~name2=value2/ // note that if a parameter with a given name already exists it will be put into a list with all values String pathInfoStr = request.getPathInfo(); @@ -217,17 +217,17 @@ } } } - + return canonicalizeParameterMap(paramMap); } - + public static Map<String, Object> getUrlOnlyParameterMap(HttpServletRequest request) { // NOTE: these have already been through canonicalizeParameterMap, so not doing it again here Map<String, Object> paramMap = getQueryStringOnlyParameterMap(request); paramMap.putAll(getPathInfoOnlyParameterMap(request, null, null)); return paramMap; } - + public static Map<String, Object> canonicalizeParameterMap(Map<String, Object> paramMap) { for (Map.Entry<String, Object> paramEntry: paramMap.entrySet()) { if (paramEntry.getValue() instanceof String) { @@ -242,7 +242,7 @@ } return paramMap; } - + public static String canonicalizeParameter(String paramValue) { try { String cannedStr = StringUtil.defaultWebEncoder.canonicalize(paramValue, StringUtil.esapiCanonicalizeStrict); @@ -253,7 +253,7 @@ return paramValue; } } - + /** * Create a map from a HttpRequest (attributes) object used in JSON requests * @return The resulting Map @@ -274,7 +274,7 @@ return returnMap; } - + /** * Create a map from a HttpRequest (attributes) object * @return The resulting Map @@ -518,14 +518,14 @@ } return appName; } - + public static void setInitialRequestInfo(HttpServletRequest request) { HttpSession session = request.getSession(); if (UtilValidate.isNotEmpty((String) session.getAttribute("_WEBAPP_NAME_"))) { // oops, info already in place... return; } - + StringBuffer fullRequestUrl = UtilHttp.getFullRequestUrl(request); session.setAttribute("_WEBAPP_NAME_", UtilHttp.getApplicationName(request)); @@ -533,7 +533,7 @@ session.setAttribute("_CLIENT_REQUEST_", fullRequestUrl.toString()); session.setAttribute("_CLIENT_USER_AGENT_", request.getHeader("User-Agent") != null ? request.getHeader("User-Agent") : ""); session.setAttribute("_CLIENT_REFERER_", request.getHeader("Referer") != null ? request.getHeader("Referer") : ""); - + session.setAttribute("_CLIENT_FORWARDED_FOR_", request.getHeader("X-Forwarded-For")); session.setAttribute("_CLIENT_REMOTE_ADDR_", request.getRemoteAddr()); session.setAttribute("_CLIENT_REMOTE_HOST_", request.getRemoteHost()); @@ -585,7 +585,7 @@ localeObject = userLogin.get("lastLocale"); } } - + // no user locale? before global default try appDefaultLocale if specified if (localeObject == null && !UtilValidate.isEmpty(appDefaultLocale)) { localeObject = appDefaultLocale; @@ -641,7 +641,7 @@ public static void setTimeZone(HttpSession session, TimeZone timeZone) { session.setAttribute("timeZone", timeZone); } - + public static TimeZone getTimeZone(HttpServletRequest request) { HttpSession session = request.getSession(); TimeZone timeZone = (TimeZone) session.getAttribute("timeZone"); @@ -777,7 +777,7 @@ } return buf.toString(); } - + public static String getRequestUriFromTarget(String target) { if (target == null || target.length() == 0) return null; int endOfRequestUri = target.length(); @@ -1027,7 +1027,7 @@ public static String stripViewParamsFromQueryString(String queryString) { return stripViewParamsFromQueryString(queryString, null); } - + public static String stripViewParamsFromQueryString(String queryString, String paginatorNumber) { Set<String> paramNames = new HashSet<String>(); if (UtilValidate.isNotEmpty(paginatorNumber)) { @@ -1039,7 +1039,7 @@ paramNames.add("viewSize" + paginatorNumber); return stripNamedParamsFromQueryString(queryString, paramNames); } - + public static String stripNamedParamsFromQueryString(String queryString, Collection<String> paramNames) { String retStr = null; if (UtilValidate.isNotEmpty(queryString)) { @@ -1066,7 +1066,7 @@ } return retStr; } - + /** * Given multi form data with the ${param}_o_N notation, creates a Collection * of Maps for the submitted rows. Each Map contains the key/value pairs @@ -1231,7 +1231,7 @@ */ public static boolean checkURLforSpiders(HttpServletRequest request) { boolean result = false; - + String spiderRequest = (String) request.getAttribute("_REQUEST_FROM_SPIDER_"); if (UtilValidate.isNotEmpty(spiderRequest)) { if ("Y".equals(spiderRequest)) { @@ -1254,10 +1254,10 @@ } } } - + if (!result) request.setAttribute("_REQUEST_FROM_SPIDER_", "N"); - + return result; } Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilJ2eeCompat.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilJ2eeCompat.java?rev=759228&r1=759227&r2=759228&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilJ2eeCompat.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilJ2eeCompat.java Fri Mar 27 16:55:57 2009 @@ -25,7 +25,7 @@ * */ public class UtilJ2eeCompat { - + public static final String module = UtilJ2eeCompat.class.getName(); public static final String TOMCAT = "apache tomcat"; Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilJavaParse.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilJavaParse.java?rev=759228&r1=759227&r2=759228&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilJavaParse.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilJavaParse.java Fri Mar 27 16:55:57 2009 @@ -39,29 +39,29 @@ public static String findRealPathAndFileForClass(String fullyQualifiedClassName) { // search through the component directories, in the src directory for each, using the class path as the path within it - + String sourceSubPath = fullyQualifiedClassName.substring(0, fullyQualifiedClassName.lastIndexOf(".")).replace('.', File.separatorChar); String classFileName = fullyQualifiedClassName.substring(fullyQualifiedClassName.lastIndexOf(".")+1) + ".java"; - + Collection<ComponentConfig> allComponentConfigs = ComponentConfig.getAllComponents(); for (ComponentConfig cc: allComponentConfigs) { String rootDirectory = cc.getRootLocation(); if (!rootDirectory.endsWith(File.separatorChar + "")) rootDirectory += File.separatorChar; rootDirectory += "src" + File.separatorChar; - + File rootDirFile = new File(rootDirectory); if (!rootDirFile.exists()) { // no src directory, move along continue; } - + String classDir = rootDirectory + sourceSubPath; File classDirFile = new File(classDir); if (!classDirFile.exists()) { // no src class sub-directory, move along continue; } - + String fullPathAndFile = classDir + File.separatorChar + classFileName; File classFile = new File(fullPathAndFile); if (classFile.exists()) { @@ -69,15 +69,15 @@ return fullPathAndFile; } } - + return null; } - + public static int findServiceMethodBlockStart(String methodName, String javaFile) { if (Debug.verboseOn()) Debug.logVerbose("In findServiceMethodBlockStart for " + methodName, module); - + // starts with something like this: public static Map exportServiceEoModelBundle(DispatchContext dctx, Map context) { - + // start with the main pattern int methodNameIndex = javaFile.indexOf("public static Map " + methodName + "(DispatchContext dctx, Map context) {"); // try a little less... and some nice messy variations... @@ -86,17 +86,17 @@ if (methodNameIndex < 0) methodNameIndex = javaFile.indexOf(" Map " + methodName + " (DispatchContext "); if (methodNameIndex < 0) methodNameIndex = javaFile.indexOf(" Map " + methodName + "( DispatchContext "); if (methodNameIndex < 0) methodNameIndex = javaFile.indexOf(" Map " + methodName + " ( DispatchContext "); - + // not found! if (methodNameIndex < 0) return -1; - + // find the open brace and return its position return javaFile.indexOf("{", methodNameIndex); } - + public static int findEndOfBlock(int blockStart, String javaFile) { //Debug.logInfo("In findEndOfBlock for blockStart " + blockStart, module); - + int nextOpen = javaFile.indexOf("{", blockStart+1); int nextClose = javaFile.indexOf("}", blockStart+1); if (nextOpen > 0 && nextClose > 0 && nextClose > nextOpen) { @@ -112,7 +112,7 @@ nextClose = javaFile.indexOf("}", endOfSubBlock+1); //Debug.logInfo("In loop in findEndOfBlock for nextOpen=" + nextOpen + ", nextClose=" + nextClose + ", endOfSubBlock=" + endOfSubBlock, module); } - + // at this point there should be no nextOpen or nextOpen is after the nextClose, meaning we're at the end of the block return nextClose; } @@ -130,7 +130,7 @@ } public static Set<String> findServiceCallsInBlock(int blockStart, int blockEnd, String javaFile) { Set<String> serviceNameSet = FastSet.newInstance(); - + int dispatcherIndex = javaFile.indexOf("dispatcher.", blockStart+1); while (dispatcherIndex > 0 && dispatcherIndex < blockEnd) { // verify it is a call we're looking for @@ -150,7 +150,7 @@ dispatcherIndex = javaFile.indexOf("dispatcher.", openParenIndex); } - + return serviceNameSet; } @@ -162,7 +162,7 @@ entityMethodNames.add("getGroupHelperName"); entityMethodNames.add("getEntityHelperName"); entityMethodNames.add("getEntityHelper"); - + entityMethodNames.add("makeValue"); entityMethodNames.add("makeValueSingle"); entityMethodNames.add("makeValidValue"); @@ -173,7 +173,7 @@ entityMethodNames.add("createSingle"); entityMethodNames.add("removeByAnd"); entityMethodNames.add("removeByCondition"); - + entityMethodNames.add("create"); entityMethodNames.add("createSingle"); entityMethodNames.add("removeByAnd"); @@ -218,10 +218,10 @@ entityNameSet.add(entityName); } } - + delegatorIndex = javaFile.indexOf("delegator.", openParenIndex); } - + return entityNameSet; } Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilMisc.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilMisc.java?rev=759228&r1=759227&r2=759228&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilMisc.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilMisc.java Fri Mar 27 16:55:57 2009 @@ -43,7 +43,7 @@ public class UtilMisc { public static final String module = UtilMisc.class.getName(); - + public static final BigDecimal ZERO_BD = BigDecimal.ZERO; /** @@ -176,7 +176,7 @@ } return theBuf.toString(); } - + public static <T> List<T> makeListWritable(Collection<? extends T> col) { List<T> result = FastList.newInstance(); if (col != null) result.addAll(col); @@ -194,7 +194,7 @@ if (col != null) result.addAll(col); return result; } - + /** * This change a Map to be Serializable by removing all entries with values that are not Serializable. * @@ -216,7 +216,7 @@ //if (!(map instanceof Serializable)) { // Debug.logInfo("Parameter Map is not Serializable!", module); //} - + //for (Map.Entry<String, V> mapEntry: map.entrySet()) { // Debug.logInfo("Entry in Map made serializable: " + mapEntry.getKey() + "=" + mapEntry.getValue(), module); //} @@ -242,7 +242,7 @@ } return toSort; } - + /** * Assuming outerMap not null; if null will throw a NullPointerException */ @@ -266,7 +266,7 @@ } return innerList; } - + /** * Assuming theMap not null; if null will throw a NullPointerException */ @@ -284,7 +284,7 @@ } else { throw new IllegalArgumentException("In addToBigDecimalInMap found a Map value of a type not supported: " + currentNumberObj.getClass().getName()); } - + if (addNumber == null || ZERO_BD.equals(addNumber)) { return currentNumber; } @@ -296,7 +296,7 @@ public static <T> T removeFirst(List<T> lst) { return lst.remove(0); } - + public static <T> Set<T> collectionToSet(Collection<T> c) { if (c == null) return null; Set<T> theSet = null; @@ -309,7 +309,7 @@ } return theSet; } - + /** * Create a Set from passed objX parameters * @return The resulting Set @@ -509,7 +509,7 @@ } return list; } - + public static <K, V> void addToListInMap(V element, Map<K, Object> theMap, K listKey) { List<V> theList = UtilGenerics.checkList(theMap.get(listKey)); if (theList == null) { @@ -518,7 +518,7 @@ } theList.add(element); } - + public static <K, V> void addToSetInMap(V element, Map<K, Set<V>> theMap, K setKey) { Set<V> theSet = UtilGenerics.checkSet(theMap.get(setKey)); if (theSet == null) { @@ -527,7 +527,7 @@ } theSet.add(element); } - + public static <K, V> void addToSortedSetInMap(V element, Map<K, Set<V>> theMap, K setKey) { Set<V> theSet = UtilGenerics.checkSet(theMap.get(setKey)); if (theSet == null) { @@ -536,7 +536,7 @@ } theSet.add(element); } - + /** Converts an <code>Object</code> to a <code>double</code>. Returns * zero if conversion is not possible. * @param obj Object to convert @@ -647,7 +647,7 @@ theMap.put(key, value); } } - + /** * Parse a locale string Locale object * @param localeString The locale string (en_US) @@ -966,7 +966,7 @@ } } } - + public static void staticWait(long timeout) throws InterruptedException { new UtilMiscWaiter().safeWait(timeout); } Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilName.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilName.java?rev=759228&r1=759227&r2=759228&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilName.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilName.java Fri Mar 27 16:55:57 2009 @@ -69,7 +69,7 @@ public String getRawString() { return this.raw; } - + public String getPrefix() { return this.getField(PREFIX); } Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilNumber.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilNumber.java?rev=759228&r1=759227&r2=759228&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilNumber.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilNumber.java Fri Mar 27 16:55:57 2009 @@ -60,7 +60,7 @@ } return scale; } - + /** * As above, but use the default properties file */ @@ -158,7 +158,7 @@ rbnfRuleSets = new HashMap<Locale, String>(); rbnfRuleSets.put(Locale.US, ruleSet_en_US); } - + /** * Method to format an amount using a custom rule set. * Current rule sets available: Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilObject.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilObject.java?rev=759228&r1=759227&r2=759228&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilObject.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilObject.java Fri Mar 27 16:55:57 2009 @@ -38,7 +38,7 @@ byte[] data = null; try { bos = new ByteArrayOutputStream(); - + int numBytesRead; while ((numBytesRead = is.read(buffer)) != -1) { bos.write(buffer, 0, numBytesRead); Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilPlist.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilPlist.java?rev=759228&r1=759227&r2=759228&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilPlist.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilPlist.java Fri Mar 27 16:55:57 2009 @@ -75,7 +75,7 @@ public static void writePlistPropertyValueList(List<Object> propertyValueList, int indentLevel, PrintWriter writer) { for (int i = 0; i < indentLevel; i++) writer.print(indentFourString); writer.print("("); - + Iterator<Object> propertyValueIter = propertyValueList.iterator(); while (propertyValueIter.hasNext()) { Object propertyValue = propertyValueIter.next(); @@ -87,7 +87,7 @@ if (propertyValueIter.hasNext()) writer.print(", "); } } - + for (int i = 0; i < indentLevel; i++) writer.print(indentFourString); writer.println(");"); } @@ -122,7 +122,7 @@ public static void writePlistPropertyValueListXml(List<Object> propertyValueList, int indentLevel, PrintWriter writer) { for (int i = 0; i < indentLevel; i++) writer.print(indentFourString); writer.println("<array>"); - + indentLevel++; Iterator<Object> propertyValueIter = propertyValueList.iterator(); while (propertyValueIter.hasNext()) { @@ -138,11 +138,11 @@ } } indentLevel--; - + for (int i = 0; i < indentLevel; i++) writer.print(indentFourString); writer.println("</array>"); } - + /** * Writes model information in the Apple EOModelBundle format. * Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java?rev=759228&r1=759227&r2=759228&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java Fri Mar 27 16:55:57 2009 @@ -77,7 +77,7 @@ protected static Locale fallbackLocale = null; protected static Set<Locale> defaultCandidateLocales = null; protected static Set<String> propertiesNotFound = FastSet.newInstance(); - + /** Compares the specified property to the compareString, returns true if they are the same, false otherwise * @param resource The name of the resource - if the properties file is 'webevent.properties', the resource name is 'webevent' * @param name The name of the property in the properties file @@ -323,7 +323,7 @@ } return value == null ? "" : value.trim(); } - + /** Sets the specified value of the specified property name to the specified resource/properties file * @param resource The name of the resource - must be a file * @param name The name of the property in the properties file @@ -361,7 +361,7 @@ +"###############################################################################\n" +"# \n" +"#Dynamically modified by OFBiz Framework (org.ofbiz.base.util : UtilProperties.setPropertyValue)"); - + propFile.close(); } catch (FileNotFoundException e) { Debug.log(e, "Unable to located the resource file.", module); @@ -659,7 +659,7 @@ } return resourceName; } - + public static boolean isPropertiesResourceNotFound(String resource, Locale locale, boolean removeExtension) { return propertiesNotFound.contains(UtilProperties.createResourceName(resource, locale, removeExtension)); } @@ -817,7 +817,7 @@ protected int hashCode = hashCode(); protected UtilResourceBundle() {} - + public UtilResourceBundle(Properties properties, Locale locale, UtilResourceBundle parent) { this.properties = properties; this.locale = locale; @@ -873,11 +873,11 @@ } return bundle; } - + public int hashCode() { return this.hashCode; } - + public boolean equals(Object obj) { return obj == null ? false : obj.hashCode() == this.hashCode; } @@ -885,11 +885,11 @@ public Locale getLocale() { return this.locale; } - + protected Object handleGetObject(String key) { return properties.get(key); } - + public Enumeration<String> getKeys() { return new Enumeration<String>() { Iterator i = properties.keySet().iterator(); Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilTimer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilTimer.java?rev=759228&r1=759227&r2=759228&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilTimer.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilTimer.java Fri Mar 27 16:55:57 2009 @@ -30,7 +30,7 @@ * */ public class UtilTimer { - + public static final String module = UtilTimer.class.getName(); protected static Map<String, UtilTimer> staticTimers = FastMap.newInstance(); @@ -42,7 +42,7 @@ protected long lastMessageTime; protected boolean running = false; protected boolean log = false; - + public static UtilTimer makeTimer() { return new UtilTimer(); } Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilURL.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilURL.java?rev=759228&r1=759227&r2=759228&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilURL.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilURL.java Fri Mar 27 16:55:57 2009 @@ -98,14 +98,14 @@ } return url; } - + public static URL fromUrlString(String urlString) { URL url = null; try { url = new URL(urlString); } catch (MalformedURLException e) { } - + return url; } @@ -122,7 +122,7 @@ newFilename = newFilename + filename; return fromFilename(newFilename); } - + public static String getOfbizHomeRelativeLocation(URL fileUrl) { String ofbizHome = System.getProperty("ofbiz.home"); String path = fileUrl.getPath(); @@ -132,10 +132,10 @@ } return path; } - + public static String readUrlText(URL url) throws IOException { InputStream stream = url.openStream(); - + StringBuilder buf = new StringBuilder(); BufferedReader in = null; try { @@ -158,7 +158,7 @@ } } } - + return buf.toString(); } } Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilValidate.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilValidate.java?rev=759228&r1=759227&r2=759228&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilValidate.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilValidate.java Fri Mar 27 16:55:57 2009 @@ -895,7 +895,7 @@ return false; } } - + /** isTime returns true if string arguments hour, minute, and second form a valid time. */ public static boolean isTime(String hour, String minute, String second) { // catch invalid years(not 2- or 4-digit) and invalid months and days. @@ -1170,7 +1170,7 @@ return false; } - + /** Checks to see if the cc number is a valid number for any accepted credit card * @param ccPassed - a string representing a credit card number * @return true, if the credit card number is any valid credit card number for any of the accepted card types, false otherwise @@ -1301,7 +1301,7 @@ if (check >= 10) check = 0; return Character.forDigit(check, 10); } - + public static String checkValidDatabaseId(String fieldStr) { if (fieldStr.indexOf(' ') >= 0) { return "[space found at position " + (fieldStr.indexOf(' ') + 1) + "]"; Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=759228&r1=759227&r2=759228&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java Fri Mar 27 16:55:57 2009 @@ -57,7 +57,7 @@ public class UtilXml { public static final String module = UtilXml.class.getName(); - + public static String writeXmlDocument(Document document) throws java.io.IOException { if (document == null) { Debug.logWarning("[UtilXml.writeXmlDocument] Document was null, doing nothing", module); @@ -154,7 +154,7 @@ serializer.asDOMSerializer(); serializer.serialize(element); } - + public static Document readXmlDocument(String content) throws SAXException, ParserConfigurationException, java.io.IOException { return readXmlDocument(content, true); @@ -205,10 +205,10 @@ } long startTime = System.currentTimeMillis(); - + // DON'T do this: seems to be causing problems with Catalina/Tomcat, maybe it is expecting a different parser? //System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"); - + Document document = null; /* Xerces DOMParser direct interaction; the other seems to be working better than this, so we'll stay with the standard JAXP stuff @@ -222,7 +222,7 @@ parser.parse(new InputSource(is)); document = parser.getDocument(); */ - + /* Standard JAXP (mostly), but doesn't seem to be doing XML Schema validation, so making sure that is on... */ DocumentBuilderFactory factory = new org.apache.xerces.jaxp.DocumentBuilderFactoryImpl(); factory.setValidating(validate); @@ -230,7 +230,7 @@ factory.setAttribute("http://xml.org/sax/features/validation", validate); factory.setAttribute("http://apache.org/xml/features/validation/schema", validate); - + // with a SchemaUrl, a URL object //factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema"); //factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", SchemaUrl); @@ -243,7 +243,7 @@ builder.setErrorHandler(eh); } document = builder.parse(is); - + double totalSeconds = (System.currentTimeMillis() - startTime)/1000.0; if (Debug.verboseOn()) Debug.logVerbose("XML Read " + totalSeconds + "s: " + docDescription, module); return document; @@ -268,7 +268,7 @@ } if (document == null) return null; - + if (rootElementName != null) { Element rootElement = document.createElement(rootElementName); document.appendChild(rootElement); @@ -395,9 +395,9 @@ * if name is null, all child elements will be included. */ public static List<? extends Node> childNodeList(Node node) { if (node == null) return null; - + List<Node> nodes = FastList.newInstance(); - + if (node != null) { do { if (node.getNodeType() == Node.ELEMENT_NODE || node.getNodeType() == Node.COMMENT_NODE) { @@ -535,11 +535,11 @@ } while ((textNode = textNode.getNextSibling()) != null); return valueBuffer.toString(); } - + /** Return the text (node value) of the first node under this */ public static String nodeValue(Node node) { if (node == null) return null; - + StringBuilder valueBuffer = new StringBuilder(); do { if (node.getNodeType() == Node.CDATA_SECTION_NODE || node.getNodeType() == Node.TEXT_NODE || node.getNodeType() == Node.COMMENT_NODE) { @@ -644,13 +644,13 @@ } else { filename = systemId.substring(lastSlash + 1); } - + URL resourceUrl = UtilURL.fromResource(filename); - + if (resourceUrl != null) { InputStream resStream = resourceUrl.openStream(); InputSource inputSource = new InputSource(resStream); - + if (UtilValidate.isNotEmpty(publicId)) { inputSource.setPublicId(publicId); } Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java?rev=759228&r1=759227&r2=759228&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java Fri Mar 27 16:55:57 2009 @@ -49,7 +49,7 @@ public class UtilCache<K, V> implements Serializable { public static final String module = UtilCache.class.getName(); - + /** A static Map to keep track of all of the UtilCache instances. */ public static Map<String, UtilCache<?, ?>> utilCacheTable = new WeakHashMap<String, UtilCache<?, ?>>(); @@ -76,7 +76,7 @@ protected long removeHitCount = 0; /** A count of the number of cache misses on removes */ protected long removeMissCount = 0; - + /** The maximum number of elements in the cache. * If set to 0, there will be no limit on the number of elements in the cache. */ @@ -97,7 +97,7 @@ /** The set of listeners to receive notifcations when items are modidfied(either delibrately or because they were expired). */ protected Set<CacheListener<K, V>> listeners = FastSet.newInstance(); - + /** Constructor which specifies the cacheName as well as the maxSize, expireTime and useSoftReference. * The passed maxSize, expireTime and useSoftReference will be overridden by values from cache.properties if found. * @param maxSize The maxSize member is set to this value @@ -322,7 +322,7 @@ CacheLine<V> line = cacheLineTable.get(key); return line; } - + protected CacheLine<V> getInternal(Object key, boolean countGet) { CacheLine<V> line = getInternalNoCheck(key); if (line == null) { @@ -347,7 +347,7 @@ if (cacheLineTable == null) { return null; } - + List<V> valuesList = FastList.newInstance(); for (K key: cacheLineTable.keySet()) { valuesList.add(this.get(key)); @@ -371,7 +371,7 @@ public V remove(Object key) { return this.removeInternal(key, true); } - + /** This is used for internal remove calls because we only want to count external calls */ @SuppressWarnings("unchecked") protected synchronized V removeInternal(Object key, boolean countRemove) { @@ -445,11 +445,11 @@ public long getMissCountTotal() { return this.missCountSoftRef + this.missCountNotFound + this.missCountExpired; } - + public long getRemoveHitCount() { return this.removeHitCount; } - + public long getRemoveMissCount() { return this.removeMissCount; } @@ -527,7 +527,7 @@ public boolean getUseSoftReference() { return this.useSoftReference; } - + public boolean getUseFileSystemStore() { return this.useFileSystemStore; } @@ -552,7 +552,7 @@ return false; } } - + /** * NOTE: this returns an unmodifiable copy of the keySet, so removing from here won't have an effect, * and calling a remove while iterating through the set will not cause a concurrent modification exception. @@ -622,14 +622,14 @@ listeners.add(listener); } } - + /** Removes an event listener for key removals */ public void removeListener(CacheListener<K, V> listener) { synchronized (listeners) { listeners.remove(listener); } } - + /** Clears all expired cache entries from all caches */ public static void clearExpiredFromAllCaches() { for (Map.Entry<String, UtilCache<?, ?>> entry: utilCacheTable.entrySet()) { @@ -637,7 +637,7 @@ utilCache.clearExpired(); } } - + /** Checks for a non-expired key in a specific cache */ public static boolean validKey(String cacheName, Object key) { UtilCache<?, ?> cache = findCache(cacheName); @@ -647,7 +647,7 @@ } return false; } - + public static void clearCachesThatStartWith(String startsWith) { synchronized (utilCacheTable) { for (Map.Entry<String, UtilCache<?, ?>> entry: utilCacheTable.entrySet()) { Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/FlexibleMapAccessor.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/FlexibleMapAccessor.java?rev=759228&r1=759227&r2=759228&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/FlexibleMapAccessor.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/FlexibleMapAccessor.java Fri Mar 27 16:55:57 2009 @@ -70,7 +70,7 @@ Debug.logVerbose("FlexibleMapAccessor created, original = " + this.original, module); } } - + /** Returns a FlexibleMapAccessor instance. * @param original The original String expression * @return A FlexibleMapAccessor instance @@ -164,7 +164,7 @@ Debug.logInfo("UEL exception while setting value: " + e + ", original = " + this.original, module); } } - + /** Given the name based information in this accessor, remove the value from the passed in Map. * @param base the Map to remove from * @return the object removed @@ -185,7 +185,7 @@ } return object; } - + protected String getExpression(Map<String, ? extends Object> base) { String expression = null; if (this.fse != null) { @@ -202,7 +202,7 @@ } return this.original; } - + @SuppressWarnings("unchecked") public boolean equals(Object obj) { if (this == obj) { @@ -217,7 +217,7 @@ } catch (Exception e) {} return false; } - + public int hashCode() { return this.original == null ? super.hashCode() : this.original.hashCode(); } Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/FlexibleProperties.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/FlexibleProperties.java?rev=759228&r1=759227&r2=759228&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/FlexibleProperties.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/FlexibleProperties.java Fri Mar 27 16:55:57 2009 @@ -37,7 +37,7 @@ public class FlexibleProperties extends Properties implements Serializable { public static final String module = FlexibleProperties.class.getName(); - + private static final boolean truncateIfMissingDefault = false; private static final boolean doPropertyExpansionDefault = true; Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/FlexibleServletAccessor.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/FlexibleServletAccessor.java?rev=759228&r1=759227&r2=759228&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/FlexibleServletAccessor.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/FlexibleServletAccessor.java Fri Mar 27 16:55:57 2009 @@ -45,7 +45,7 @@ public FlexibleServletAccessor(String name) { init(name); } - + public FlexibleServletAccessor(String name, String defaultName) { if (name == null || name.length() == 0) { init(defaultName); @@ -53,7 +53,7 @@ init(name); } } - + protected void init(String name) { this.name = name; if (name == null || name.length() == 0) { @@ -77,12 +77,12 @@ attributeName = name; fma = null; } - + needsExpand = false; } } } - + public boolean isEmpty() { return this.empty; } @@ -120,7 +120,7 @@ AttributeAccessor<T> aa = new AttributeAccessor<T>(name, expandContext, this.attributeName, this.fma, this.needsExpand); aa.put(request, value); } - + /** Based on name put in HttpSession or from List in HttpSession; * If the brackets for a list are empty the value will be appended to the list, * otherwise the value will be set in the position of the number in the brackets. @@ -134,7 +134,7 @@ AttributeAccessor<T> aa = new AttributeAccessor<T>(name, expandContext, this.attributeName, this.fma, this.needsExpand); aa.put(session, value); } - + /** Based on name remove from ServletRequest or from List in ServletRequest * @param request * @param expandContext @@ -144,7 +144,7 @@ AttributeAccessor<T> aa = new AttributeAccessor<T>(name, expandContext, this.attributeName, this.fma, this.needsExpand); return aa.remove(request); } - + /** Based on name remove from HttpSession or from List in HttpSession * @param session * @param expandContext @@ -154,7 +154,7 @@ AttributeAccessor<T> aa = new AttributeAccessor<T>(name, expandContext, this.attributeName, this.fma, this.needsExpand); return aa.remove(session); } - + /** The equals and hashCode methods are imnplemented just case this object is ever accidently used as a Map key * * @return the hashcode */ @@ -188,7 +188,7 @@ public String toString() { return this.name; } - + protected static class AttributeAccessor<T> implements Serializable { protected Map<String, Object> expandContext; protected String attributeName; @@ -199,11 +199,11 @@ protected int listIndex; protected int openBrace; protected int closeBrace; - + public AttributeAccessor(String origName, Map<String, Object> expandContext, String defAttributeName, FlexibleMapAccessor<T> defFma, boolean needsExpand) { attributeName = defAttributeName; fma = defFma; - + if (needsExpand) { String name = FlexibleStringExpander.expandString(origName, expandContext); int dotIndex = name.indexOf('.'); @@ -239,7 +239,7 @@ attributeName = attributeName.substring(0, openBrace); isListReference = true; } - + } public T get(ServletRequest request) { @@ -286,7 +286,7 @@ } } } - + public void put(ServletRequest request, T value) { if (fma == null) { if (isListReference) { @@ -305,7 +305,7 @@ } } } - + public void put(HttpSession session, T value) { if (fma == null) { if (isListReference) { Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/MapComparator.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/MapComparator.java?rev=759228&r1=759227&r2=759228&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/MapComparator.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/MapComparator.java Fri Mar 27 16:55:57 2009 @@ -31,9 +31,9 @@ * */ public class MapComparator implements Comparator<Map<Object, Object>> { - + public static final String module = MapComparator.class.getName(); - + private List<? extends Object> keys; /** @@ -70,9 +70,9 @@ if (key instanceof FlexibleMapAccessor) { FlexibleMapAccessor<Object> fmaKey = UtilGenerics.cast(key); ascending = fmaKey.getIsAscending(); - + //Debug.logInfo("Doing compare with a FlexibleMapAccessor [" + fmaKey.getOriginalName() + "] ascending [" + ascending + "]", module); - + o1 = fmaKey.get(UtilGenerics.<String, Object>checkMap(map1)); o2 = fmaKey.get(UtilGenerics.<String, Object>checkMap(map2)); } else { @@ -86,7 +86,7 @@ key = keyStr.substring(1); } } - + o1 = map1.get(key); o2 = map2.get(key); } @@ -94,7 +94,7 @@ if (o1 == null && o2 == null) { continue; } - + int compareResult = 0; if (o1 != null && o2 == null) { compareResult = -1; @@ -102,7 +102,7 @@ if (o1 == null && o2 != null) { compareResult = 1; } - + if (compareResult == 0) { try { // the map values in question MUST implement the Comparable interface, if not we'll throw an exception @@ -124,7 +124,7 @@ } } } - + // none of them were different, so they are equal return 0; } Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/MapStack.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/MapStack.java?rev=759228&r1=759227&r2=759228&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/MapStack.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/MapStack.java Fri Mar 27 16:55:57 2009 @@ -81,19 +81,19 @@ protected MapStack() { super(); } - + protected List<Map<K, Object>> stackList = FastList.newInstance(); - + public void reset() { stackList = FastList.newInstance(); } - + /** Puts a new Map on the top of the stack */ public void push() { Map<K, Object> newMap = FastMap.newInstance(); this.stackList.add(0,newMap); } - + /** Puts an existing Map on the top of the stack (top meaning will override lower layers on the stack) */ public void push(Map<K, Object> existingMap) { if (existingMap == null) { @@ -101,7 +101,7 @@ } this.stackList.add(0, existingMap); } - + /** Puts an existing Map on the BOTTOM of the stack (bottom meaning will be overriden by lower layers on the stack, ie everything else already there) */ public void addToBottom(Map<K, Object> existingMap) { if (existingMap == null) { @@ -109,7 +109,7 @@ } this.stackList.add(existingMap); } - + /** Remove and returns the Map from the top of the stack; if there is only one Map on the stack it returns null and does not remove it */ public Map<K, Object> pop() { // always leave at least one Map in the List, ie never pop off the last Map @@ -119,7 +119,7 @@ return null; } } - + /** * Creates a MapStack object that has the same Map objects on its stack; * meant to be used to enable a @@ -211,7 +211,7 @@ if ("context".equals(key)) { return this; } - + // walk the stackList and for the first place it is found return true; otherwise refurn false for (Map<K, Object> curMap: this.stackList) { // only return if the curMap contains the key, rather than checking for null; this allows a null at a lower level to override a value at a higher level @@ -229,7 +229,7 @@ if ("context".equals(name)) { return this; } - + // walk the stackList and for the first place it is found return true; otherwise refurn false for (Map<K, Object> curMap: this.stackList) { // only return if the curMap contains the key, rather than checking for null; this allows a null at a lower level to override a value at a higher level @@ -254,7 +254,7 @@ Debug.logWarning("WARNING: Putting a value in a MapStack with key [context] that is not this MapStack, will be hidden by the current MapStack self-reference: " + value, module); } } - + // all write operations are local: only put in the Map on the top of the stack Map<K, Object> currentMap = this.stackList.get(0); return currentMap.put(key, value); @@ -334,14 +334,14 @@ } return Collections.unmodifiableSet(resultEntrySet); } - + public String toString() { StringBuilder fullMapString = new StringBuilder(); int curLevel = 0; for (Map<K, Object> curMap: this.stackList) { fullMapString.append("============================== Start stack level " + curLevel + "\n"); for (Map.Entry<K, Object> curEntry: curMap.entrySet()) { - + fullMapString.append("==>["); fullMapString.append(curEntry.getKey()); fullMapString.append("]:"); Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/OrderedMap.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/OrderedMap.java?rev=759228&r1=759227&r2=759228&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/OrderedMap.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/OrderedMap.java Fri Mar 27 16:55:57 2009 @@ -68,7 +68,7 @@ super.clear(); orderedKeys.clear(); } - + /** * @see java.util.Map#remove(java.lang.Object) */ @@ -77,7 +77,7 @@ orderedKeys.remove(key); return super.remove(key); } - + /** * @see java.util.Map#values() */ @@ -85,7 +85,7 @@ if (orderedKeys.isEmpty()) { return null; } - + List<V> values = FastList.newInstance(); for (K key: orderedKeys) { values.add(this.get(key)); Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/ResourceBundleMapWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/ResourceBundleMapWrapper.java?rev=759228&r1=759227&r2=759228&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/ResourceBundleMapWrapper.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/ResourceBundleMapWrapper.java Fri Mar 27 16:55:57 2009 @@ -35,7 +35,7 @@ * */ public class ResourceBundleMapWrapper implements Map<String, Object>, Serializable { - + protected MapStack<String> rbmwStack; protected ResourceBundle initialResourceBundle; protected Map<String, Object> context; @@ -51,7 +51,7 @@ this.initialResourceBundle = initialInternalRbmWrapper.getResourceBundle(); this.rbmwStack = MapStack.create(initialInternalRbmWrapper); } - + /** When creating new from a ResourceBundle the one passed to the constructor should be the most specific or local ResourceBundle, with more common ones pushed onto the stack progressively. */ public ResourceBundleMapWrapper(ResourceBundle initialResourceBundle) { @@ -61,7 +61,7 @@ this.initialResourceBundle = initialResourceBundle; this.rbmwStack = MapStack.create(new InternalRbmWrapper(initialResourceBundle)); } - + /** When creating new from a ResourceBundle the one passed to the constructor should be the most specific or local ResourceBundle, with more common ones pushed onto the stack progressively. */ public ResourceBundleMapWrapper(ResourceBundle initialResourceBundle, Map<String, Object> context) { @@ -72,7 +72,7 @@ this.rbmwStack = MapStack.create(new InternalRbmWrapper(initialResourceBundle)); this.context = context; } - + /** Puts ResourceBundle on the BOTTOM of the stack (bottom meaning will be overriden by higher layers on the stack, ie everything else already there) */ public void addBottomResourceBundle(ResourceBundle topResourceBundle) { this.rbmwStack.addToBottom(new InternalRbmWrapper(topResourceBundle)); @@ -149,11 +149,11 @@ public Collection<Object> values() { return this.rbmwStack.values(); } - + public static class InternalRbmWrapper implements Map<String, Object>, Serializable { protected ResourceBundle resourceBundle; protected Map<String, Object> topLevelMap; - + public InternalRbmWrapper(ResourceBundle resourceBundle) { if (resourceBundle == null) { throw new IllegalArgumentException("Cannot create InternalRbmWrapper with a null ResourceBundle."); @@ -172,7 +172,7 @@ } topLevelMap.put("_RESOURCE_BUNDLE_", resourceBundle); } - + /* (non-Javadoc) * @see java.util.Map#size() */ @@ -180,14 +180,14 @@ // this is an approximate size, won't include elements from parent bundles return topLevelMap.size() - 1; } - + /* (non-Javadoc) * @see java.util.Map#isEmpty() */ public boolean isEmpty() { return topLevelMap.isEmpty(); } - + /* (non-Javadoc) * @see java.util.Map#containsKey(java.lang.Object) */ @@ -207,14 +207,14 @@ } return false; } - + /* (non-Javadoc) * @see java.util.Map#containsValue(java.lang.Object) */ public boolean containsValue(Object arg0) { throw new RuntimeException("Not implemented for ResourceBundleMapWrapper"); } - + /* (non-Javadoc) * @see java.util.Map#get(java.lang.Object) */ @@ -243,60 +243,60 @@ */ return value; } - + /* (non-Javadoc) * @see java.util.Map#put(java.lang.Object, java.lang.Object) */ public Object put(String arg0, Object arg1) { throw new RuntimeException("Not implemented/allowed for ResourceBundleMapWrapper"); } - + /* (non-Javadoc) * @see java.util.Map#remove(java.lang.Object) */ public Object remove(Object arg0) { throw new RuntimeException("Not implemented for ResourceBundleMapWrapper"); } - + /* (non-Javadoc) * @see java.util.Map#putAll(java.util.Map) */ public void putAll(Map arg0) { throw new RuntimeException("Not implemented for ResourceBundleMapWrapper"); } - + /* (non-Javadoc) * @see java.util.Map#clear() */ public void clear() { throw new RuntimeException("Not implemented for ResourceBundleMapWrapper"); } - + /* (non-Javadoc) * @see java.util.Map#keySet() */ public Set<String> keySet() { return this.topLevelMap.keySet(); } - + /* (non-Javadoc) * @see java.util.Map#values() */ public Collection<Object> values() { return this.topLevelMap.values(); } - + /* (non-Javadoc) * @see java.util.Map#entrySet() */ public Set<Map.Entry<String, Object>> entrySet() { return this.topLevelMap.entrySet(); } - + public ResourceBundle getResourceBundle() { return this.resourceBundle; } - + /*public String toString() { return this.topLevelMap.toString(); }*/ Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java?rev=759228&r1=759227&r2=759228&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java Fri Mar 27 16:55:57 2009 @@ -45,7 +45,7 @@ */ @SuppressWarnings("serial") public class FlexibleStringExpander implements Serializable { - + public static final String module = FlexibleStringExpander.class.getName(); public static final String openBracket = "${"; public static final String closeBracket = "}"; @@ -71,11 +71,11 @@ this.strElems = null; } } - + public boolean isEmpty() { return this.orig == null || this.orig.length() == 0; } - + public String getOriginal() { return this.orig; } @@ -88,7 +88,7 @@ public String expandString(Map<String, ? extends Object> context) { return this.expandString(context, null, null); } - + /** This expands the pre-parsed String given the context passed in. A * null context argument will return the original String. * @param context A context Map containing the variable values @@ -98,7 +98,7 @@ public String expandString(Map<String, ? extends Object> context, Locale locale) { return this.expandString(context, null, locale); } - + /** This expands the pre-parsed String given the context passed in. A * null context argument will return the original String. * @param context A context Map containing the variable values @@ -139,7 +139,7 @@ } return buffer.toString(); } - + /** Returns a FlexibleStringExpander instance. * @param original The original String expression * @return A FlexibleStringExpander instance @@ -164,7 +164,7 @@ } return fse; } - + /** Does on-the-fly parsing and expansion of the original String using * variable values from the passed context. A null context argument will * return the original String. @@ -175,7 +175,7 @@ public static String expandString(String original, Map<String, ? extends Object> context) { return expandString(original, context, null, null); } - + /** Does on-the-fly parsing and expansion of the original String using * variable values from the passed context. A null context argument will * return the original String. @@ -186,7 +186,7 @@ public static String expandString(String original, Map<String, ? extends Object> context, Locale locale) { return expandString(original, context, null, locale); } - + /** Does on-the-fly parsing and expansion of the original String using * variable values from the passed context. A null context argument will * return the original String. @@ -201,7 +201,7 @@ FlexibleStringExpander fse = FlexibleStringExpander.getInstance(original); return fse.expandString(context, timeZone, locale); } - + /** Protected helper method. * @param original * @return a list of parsed string elements @@ -270,7 +270,7 @@ protected static interface StrElem extends Serializable { public void append(StringBuilder buffer, Map<String, ? extends Object> context, TimeZone timeZone, Locale locale); } - + protected static class ConstElem implements StrElem { protected final String str; protected ConstElem(String value) { @@ -280,7 +280,7 @@ buffer.append(this.str); } } - + protected static class BshElem implements StrElem { protected final String str; protected BshElem(String scriptlet) { @@ -327,7 +327,7 @@ } } } - + protected static class NestedVarElem implements StrElem { protected final List<StrElem> strElems; protected int hint = 20; Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/JuelConnector.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/JuelConnector.java?rev=759228&r1=759227&r2=759228&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/JuelConnector.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/JuelConnector.java Fri Mar 27 16:55:57 2009 @@ -37,7 +37,7 @@ */ public class JuelConnector { protected static final String module = JuelConnector.class.getName(); - + /** Returns an <code>ExpressionFactory</code> instance. * @return A customized <code>ExpressionFactory</code> instance */ @@ -110,7 +110,7 @@ } } } - + /** Custom <code>Parser</code> class needed to implement auto-vivify. */ protected static class ExtendedParser extends Parser { public ExtendedParser(Builder context, String input) { Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/UelUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/UelUtil.java?rev=759228&r1=759227&r2=759228&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/UelUtil.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/UelUtil.java Fri Mar 27 16:55:57 2009 @@ -117,7 +117,7 @@ return this.variableMapper; } } - + protected static class BasicVariableMapper extends VariableMapper { protected final ELContext elContext; protected final Map<String, Object> variables; Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java?rev=759228&r1=759227&r2=759228&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java Fri Mar 27 16:55:57 2009 @@ -68,9 +68,9 @@ * */ public class FreeMarkerWorker { - + public static final String module = FreeMarkerWorker.class.getName(); - + // use soft references for this so that things from Content records don't kill all of our memory, or maybe not for performance reasons... hmmm, leave to config file... public static UtilCache<String, Template> cachedTemplates = new UtilCache<String, Template>("template.ftl.general", 0, 0, false); protected static BeansWrapper defaultOfbizWrapper = BeansWrapper.getDefaultInstance(); @@ -78,7 +78,7 @@ public static Configuration makeConfiguration(BeansWrapper wrapper) { Configuration newConfig = new Configuration(); - + newConfig.setObjectWrapper(wrapper); newConfig.setSharedVariable("Static", wrapper.getStaticModels()); newConfig.setLocalizedLookup(false); @@ -109,10 +109,10 @@ loadTransforms(loader, props, newConfig); } } - + return newConfig; } - + /** * Protected helper method. */ @@ -140,7 +140,7 @@ public static void renderTemplateAtLocation(String templateLocation, Map<String, Object> context, Appendable outWriter) throws MalformedURLException, TemplateException, IOException { renderTemplate(templateLocation, context, outWriter); } - + /** * Renders a template contained in a String. * @param templateLocation A unique ID for this template - used for caching @@ -155,7 +155,7 @@ renderTemplateFromString(templateString, templateLocation, context, outWriter); } } - + /** * Renders a template from a Reader. * @param templateLocation A unique ID for this template - used for caching @@ -166,7 +166,7 @@ Template template = getTemplate(templateLocation); renderTemplate(template, context, outWriter); } - + public static Environment renderTemplateFromString(String templateString, String templateLocation, Map<String, Object> context, Appendable outWriter) throws TemplateException, IOException { Template template = cachedTemplates.get(templateLocation); if (template == null) { @@ -180,10 +180,10 @@ } } } - + return renderTemplate(template, context, outWriter); } - + /** * Renders a Template instance. * @param template A Template instance @@ -205,7 +205,7 @@ env.process(); return env; } - + /** * Apply user settings to an Environment instance. * @param env An Environment instance @@ -228,13 +228,13 @@ public static Configuration getDefaultOfbizConfig() { return defaultOfbizConfig; } - + /** Make sure to close the reader when you're done! That's why this method is private, BTW. */ private static Reader makeReader(String templateLocation) throws IOException { if (UtilValidate.isEmpty(templateLocation)) { throw new IllegalArgumentException("FreeMarker template location null or empty"); } - + URL locationUrl = null; try { locationUrl = FlexibleLocation.resolveLocation(templateLocation); @@ -244,10 +244,10 @@ if (locationUrl == null) { throw new IllegalArgumentException("FreeMarker file not found at location: " + templateLocation); } - + InputStream locationIs = locationUrl.openStream(); Reader templateReader = new InputStreamReader(locationIs); - + String locationProtocol = locationUrl.getProtocol(); if ("file".equals(locationProtocol) && Debug.verboseOn()) { String locationFile = locationUrl.getFile(); @@ -256,7 +256,7 @@ String filename = locationFile.substring(lastSlash + 1); Debug.logVerbose("FreeMarker render: filename=" + filename + ", locationDir=" + locationDir, module); } - + return templateReader; } @@ -268,7 +268,7 @@ public static Template getTemplate(String templateLocation) throws TemplateException, IOException { return getTemplate(templateLocation, cachedTemplates, defaultOfbizConfig); } - + public static Template getTemplate(String templateLocation, UtilCache<String, Template> cache, Configuration config) throws TemplateException, IOException { Template template = (Template) cache.get(templateLocation); if (template == null) { @@ -285,7 +285,7 @@ } return template; } - + public static String getArg(Map<String, ? extends Object> args, String key, Environment env) { Map<String, ? extends Object> templateContext = UtilGenerics.checkMap(FreeMarkerWorker.getWrappedObject("context", env)); return getArg(args, key, templateContext); @@ -417,7 +417,7 @@ } else if (o instanceof BeanModel) { returnObj = ((BeanModel)o).getWrappedObject(); } - + return returnObj; } @@ -452,7 +452,7 @@ } return templateRoot; } - + public static void saveContextValues(Map<String, Object> context, String [] saveKeyNames, Map<String, Object> saveMap ) { //Map saveMap = new HashMap(); for (String key: saveKeyNames) { @@ -571,7 +571,7 @@ } return templateModelObj; } - + /** * OFBiz Template Source. This class is used by FlexibleTemplateLoader. */ @@ -583,7 +583,7 @@ public FlexibleTemplateSource(String templateLocation) { this.templateLocation = templateLocation; } - + public int hashCode() { return templateLocation.hashCode(); } @@ -597,7 +597,7 @@ return createdDate.getTime(); } } - + /** * OFBiz Template Loader. This template loader uses the FlexibleLocation * class to locate and load Freemarker templates. Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/XslTransform.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/XslTransform.java?rev=759228&r1=759227&r2=759228&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/XslTransform.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/XslTransform.java Fri Mar 27 16:55:57 2009 @@ -88,14 +88,14 @@ transformer.setParameter(key, val); } } - + DOMResult outputResult = new DOMResult(UtilXml.makeEmptyXmlDocument()); - + String inputUrl = (String)context.get("inputUrl"); String inputString = (String)context.get("inputString"); Document inputDocument = (Document)context.get("inputDocument"); Source inputSource = getSource(inputDocument, inputUrl, inputString); - + transformer.transform(inputSource, outputResult); Node nd = outputResult.getNode(); outputDocument = (Document)nd; @@ -103,7 +103,7 @@ return outputDocument; } - + private static Source getSource(Document inputDocument, String inputUrl, String inputString) throws GeneralException, IOException { Source source = null; if (inputDocument != null) { |
Free forum by Nabble | Edit this page |