You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2014/11/03 07:54:24 UTC
svn commit: r1636282 [10/20] - in
/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23: ./
applications/content/config/ applications/content/data/
applications/humanres/src/org/ofbiz/humanres/
applications/humanres/webapp/humanres/WEB-INF/ applica...
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilHttp.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilHttp.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilHttp.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilHttp.java Mon Nov 3 06:54:16 2014
@@ -35,6 +35,7 @@ import java.util.Currency;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -47,9 +48,6 @@ import javax.servlet.http.HttpServletReq
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
-import javolution.util.FastList;
-import javolution.util.FastMap;
-
import org.apache.commons.lang.RandomStringUtils;
import org.apache.oro.text.regex.MalformedPatternException;
import org.apache.oro.text.regex.Pattern;
@@ -88,7 +86,7 @@ public class UtilHttp {
* @return The resulting Map
*/
public static Map<String, Object> getCombinedMap(HttpServletRequest request, Set<? extends String> namesToSkip) {
- FastMap<String, Object> combinedMap = FastMap.newInstance();
+ Map<String, Object> combinedMap = new HashMap<String, Object>();
combinedMap.putAll(getParameterMap(request)); // parameters override nothing
combinedMap.putAll(getServletContextMap(request, namesToSkip)); // bottom level application attributes
combinedMap.putAll(getSessionMap(request, namesToSkip)); // session overrides application
@@ -162,7 +160,7 @@ public class UtilHttp {
}
public static Map<String, Object> getQueryStringOnlyParameterMap(String queryString) {
- Map<String, Object> paramMap = FastMap.newInstance();
+ Map<String, Object> paramMap = new HashMap<String, Object>();
if (UtilValidate.isNotEmpty(queryString)) {
StringTokenizer queryTokens = new StringTokenizer(queryString, "&");
while (queryTokens.hasMoreTokens()) {
@@ -189,7 +187,7 @@ public class UtilHttp {
public static Map<String, Object> getPathInfoOnlyParameterMap(String pathInfoStr, Set<? extends String> nameSet, Boolean onlyIncludeOrSkip) {
boolean onlyIncludeOrSkipPrim = onlyIncludeOrSkip == null ? true : onlyIncludeOrSkip.booleanValue();
- Map<String, Object> paramMap = FastMap.newInstance();
+ Map<String, Object> paramMap = new HashMap<String, Object>();
// 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
@@ -218,7 +216,7 @@ public class UtilHttp {
paramList.add(value);
} else {
String paramString = (String) curValue;
- paramList = FastList.newInstance();
+ paramList = new LinkedList<String>();
paramList.add(paramString);
paramList.add(value);
}
@@ -249,7 +247,7 @@ public class UtilHttp {
if (paramEntry.getValue() instanceof String) {
paramEntry.setValue(canonicalizeParameter((String) paramEntry.getValue()));
} else if (paramEntry.getValue() instanceof Collection<?>) {
- List<String> newList = FastList.newInstance();
+ List<String> newList = new LinkedList<String>();
for (String listEntry: UtilGenerics.<String>checkCollection(paramEntry.getValue())) {
newList.add(canonicalizeParameter(listEntry));
}
@@ -275,7 +273,7 @@ public class UtilHttp {
* @return The resulting Map
*/
public static Map<String, Object> getJSONAttributeMap(HttpServletRequest request) {
- Map<String, Object> returnMap = FastMap.newInstance();
+ Map<String, Object> returnMap = new HashMap<String, Object>();
Map<String, Object> attrMap = getAttributeMap(request);
for (Map.Entry<String, Object> entry : attrMap.entrySet()) {
String key = entry.getKey();
@@ -305,7 +303,7 @@ public class UtilHttp {
* @return The resulting Map
*/
public static Map<String, Object> getAttributeMap(HttpServletRequest request, Set<? extends String> namesToSkip) {
- Map<String, Object> attributeMap = FastMap.newInstance();
+ Map<String, Object> attributeMap = new HashMap<String, Object>();
// look at all request attributes
Enumeration<String> requestAttrNames = UtilGenerics.cast(request.getAttributeNames());
@@ -339,7 +337,7 @@ public class UtilHttp {
* @return The resulting Map
*/
public static Map<String, Object> getSessionMap(HttpServletRequest request, Set<? extends String> namesToSkip) {
- Map<String, Object> sessionMap = FastMap.newInstance();
+ Map<String, Object> sessionMap = new HashMap<String, Object>();
HttpSession session = request.getSession();
// look at all the session attributes
@@ -374,7 +372,7 @@ public class UtilHttp {
* @return The resulting Map
*/
public static Map<String, Object> getServletContextMap(HttpServletRequest request, Set<? extends String> namesToSkip) {
- Map<String, Object> servletCtxMap = FastMap.newInstance();
+ Map<String, Object> servletCtxMap = new HashMap<String, Object>();
// look at all servlet context attributes
ServletContext servletContext = (ServletContext) request.getAttribute("servletContext");
@@ -1126,7 +1124,7 @@ public class UtilHttp {
* index of the row.
*/
public static Collection<Map<String, Object>> parseMultiFormData(Map<String, Object> parameters) {
- FastMap<Integer, Map<String, Object>> rows = FastMap.newInstance(); // stores the rows keyed by row number
+ Map<Integer, Map<String, Object>> rows = new HashMap<Integer, Map<String, Object>>(); // stores the rows keyed by row number
// first loop through all the keys and create a hashmap for each ${ROW_SUBMIT_PREFIX}${N} = Y
for (String key: parameters.keySet()) {
@@ -1138,7 +1136,7 @@ public class UtilHttp {
// decode the value of N and create a new map for it
Integer n = Integer.decode(key.substring(ROW_SUBMIT_PREFIX_LENGTH, key.length()));
- Map<String, Object> m = FastMap.newInstance();
+ Map<String, Object> m = new HashMap<String, Object>();
m.put("row", n); // special "row" = N tuple
rows.put(n, m); // key it to N
}
@@ -1170,7 +1168,7 @@ public class UtilHttp {
* multi form parameters (usually named according to the ${param}_o_N notation).
*/
public static <V> Map<String, V> removeMultiFormParameters(Map<String, V> parameters) {
- FastMap<String, V> filteredParameters = new FastMap<String, V>();
+ Map<String, V> filteredParameters = new HashMap<String, V>();
for (Map.Entry<String, V> entry : parameters.entrySet()) {
String key = entry.getKey();
if (key != null && (key.indexOf(MULTI_ROW_DELIMITER) != -1 || key.indexOf("_useRowSubmit") != -1 || key.indexOf("_rowCount") != -1)) {
@@ -1220,7 +1218,7 @@ public class UtilHttp {
if (UtilValidate.isEmpty(compositeType)) return null;
// collect the composite fields into a map
- Map<String, String> data = FastMap.newInstance();
+ Map<String, String> data = new HashMap<String, String>();
for (Enumeration<String> names = UtilGenerics.cast(request.getParameterNames()); names.hasMoreElements();) {
String name = names.nextElement();
if (!name.startsWith(prefix + COMPOSITE_DELIMITER)) continue;
@@ -1375,7 +1373,7 @@ public class UtilHttp {
HttpSession session = request.getSession();
Map<String, Map<String, Object>> paramMapStore = UtilGenerics.checkMap(session.getAttribute("_PARAM_MAP_STORE_"));
if (paramMapStore == null) {
- paramMapStore = FastMap.newInstance();
+ paramMapStore = new HashMap<String, Map<String, Object>>();
session.setAttribute("_PARAM_MAP_STORE_", paramMapStore);
}
Map<String, Object> parameters = getParameterMap(request);
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilIO.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilIO.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilIO.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilIO.java Mon Nov 3 06:54:16 2014
@@ -19,34 +19,20 @@
package org.ofbiz.base.util;
import java.io.BufferedInputStream;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
import java.io.File;
-import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
import java.io.Reader;
-import java.io.Serializable;
-import java.io.StringReader;
-import java.io.StringWriter;
import java.io.Writer;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang.StringUtils;
-import org.ofbiz.base.conversion.Converter;
-import org.ofbiz.base.conversion.Converters;
-import org.ofbiz.base.json.JSON;
-import org.ofbiz.base.json.JSONWriter;
public final class UtilIO {
public static final Charset UTF8 = Charset.forName("UTF-8");
@@ -329,141 +315,4 @@ public final class UtilIO {
writer.write(value.substring(r));
writer.close();
}
-
- public static Object readObject(File file) throws ClassNotFoundException, IOException {
- return readObject(new FileInputStream(file), false);
- }
-
- public static Object readObject(File file, boolean allowJsonResolve) throws ClassNotFoundException, IOException {
- return readObject(new FileInputStream(file), allowJsonResolve);
- }
-
- public static Object readObject(InputStream in) throws ClassNotFoundException, IOException {
- return readObject(in, false);
- }
-
- public static Object readObject(InputStream in, boolean allowJsonResolve) throws ClassNotFoundException, IOException {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- IOUtils.copy(in, baos);
- in.close();
- byte[] bytes = baos.toByteArray();
- try {
- char[] buffer = StringUtils.chomp(readString(bytes)).toCharArray();
- return parseObject(buffer, 0, buffer.length, allowJsonResolve);
- } catch (Exception e) {
- }
- ObjectInputStream oin = new ObjectInputStream(new ByteArrayInputStream(bytes));
- Serializable value = (Serializable) oin.readObject();
- oin.close();
- return value;
- }
-
- public static Object readObject(char[] buffer) throws ClassNotFoundException, IOException {
- return parseObject(buffer, 0, buffer.length, false);
- }
-
- public static Object readObject(char[] buffer, int offset, int length) throws ClassNotFoundException, IOException {
- return parseObject(buffer, offset, length, false);
- }
-
- private static <S, T> T convertObject(Class<S> sourceClass, S value, Class<T> targetClass) throws Exception {
- Converter<S, T> converter = Converters.getConverter(sourceClass, targetClass);
- return converter.convert(targetClass, value);
- }
-
- private static Object parseObject(char[] buffer, int offset, int length, boolean allowJsonResolve) throws ClassNotFoundException, IOException {
- try {
- int i;
- for (i = offset; i < length && buffer[i] != ':'; i++);
- if (i > offset && i < length) {
- String className = new String(buffer, offset, i);
- Class<?> type = Class.forName(className);
- if (buffer[length - 1] == '\n') {
- length--;
- }
- if (buffer[length - 1] == '\r') {
- length--;
- }
- return convertObject(String.class, new String(buffer, i + 1, length - i - 1), type);
- }
- } catch (Exception e) {
- }
- try {
- return new JSON(new StringReader(new String(buffer, offset, length))).allowResolve(allowJsonResolve).JSONValue();
- } catch (Error e) {
- } catch (Exception e) {
- }
- throw new IOException("Can't read (" + new String(buffer, offset, length) + ")");
- }
-
- public static void writeObject(File file, Object value) throws IOException {
- writeObject(new FileOutputStream(file), value, false);
- }
-
- public static void writeObject(File file, Object value, boolean allowJsonResolve) throws IOException {
- writeObject(new FileOutputStream(file), value, allowJsonResolve);
- }
-
- public static void writeObject(OutputStream out, Object value) throws IOException {
- writeObject(out, value, false);
- }
-
- public static void writeObject(OutputStream out, Object value, boolean allowJsonResolve) throws IOException {
- try {
- PrintWriter writer = new PrintWriter(new OutputStreamWriter(out, UTF8));
- if (encodeObject(writer, value, allowJsonResolve)) {
- writer.println();
- writer.close();
- return;
- }
- } catch (Exception e) {
- }
- ObjectOutputStream oout = new ObjectOutputStream(out);
- oout.writeObject(value);
- oout.close();
- out.close();
- }
-
- private static <T> boolean encodeObject(Writer writer, T value, boolean allowJsonResolve) throws Exception {
- Converter<T, String> converter = UtilGenerics.cast(Converters.getConverter(value.getClass(), String.class));
- if (converter != null) {
- Class<?> clz = converter.getSourceClass();
- String str = converter.convert(value);
- if (clz != null) {
- writer.write(clz.getName());
- } else {
- writer.write(value.getClass().getName());
- }
- writer.write(':');
- writer.write(str);
- return true;
- } else {
- StringWriter sw = new StringWriter();
- IndentingWriter indenting = new IndentingWriter(writer, true, false);
- JSONWriter jsonWriter;
- if (allowJsonResolve) {
- jsonWriter = new JSONWriter(indenting, JSONWriter.ResolvingFallbackHandler);
- } else {
- jsonWriter = new JSONWriter(indenting);
- }
- jsonWriter.write(value);
- writer.write(sw.toString());
- return true;
- }
- }
-
- public static void writeObject(StringBuilder sb, Object value) throws IOException {
- writeObject(sb, value, false);
- }
-
- public static void writeObject(StringBuilder sb, Object value, boolean allowJsonResolve) throws IOException {
- try {
- StringWriter writer = new StringWriter();
- if (encodeObject(writer, value, allowJsonResolve)) {
- sb.append(writer.toString());
- return;
- }
- } catch (Exception e) {} //Empty catch because writeObject() calls encodeObject(), which *always* returns true, unless an error occurs.
- throw new IOException("Can't write (" + value + ")");
- }
}
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilJavaParse.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilJavaParse.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilJavaParse.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilJavaParse.java Mon Nov 3 06:54:16 2014
@@ -20,10 +20,9 @@ package org.ofbiz.base.util;
import java.io.File;
import java.util.Collection;
+import java.util.HashSet;
import java.util.Set;
-import javolution.util.FastSet;
-
import org.ofbiz.base.component.ComponentConfig;
@@ -117,7 +116,8 @@ public class UtilJavaParse {
return nextClose;
}
- public static Set<String> serviceMethodNames = FastSet.newInstance();
+ // FIXME: Not thread safe
+ public static Set<String> serviceMethodNames = new HashSet<String>();
static {
serviceMethodNames.add("runSync");
serviceMethodNames.add("runSyncIgnore");
@@ -129,7 +129,7 @@ public class UtilJavaParse {
serviceMethodNames.add("addCommitService");
}
public static Set<String> findServiceCallsInBlock(int blockStart, int blockEnd, String javaFile) {
- Set<String> serviceNameSet = FastSet.newInstance();
+ Set<String> serviceNameSet = new HashSet<String>();
int dispatcherIndex = javaFile.indexOf("dispatcher.", blockStart+1);
while (dispatcherIndex > 0 && dispatcherIndex < blockEnd) {
@@ -154,7 +154,8 @@ public class UtilJavaParse {
return serviceNameSet;
}
- public static Set<String> entityMethodNames = FastSet.newInstance();
+ // FIXME: Not thread safe
+ public static Set<String> entityMethodNames = new HashSet<String>();
static {
entityMethodNames.add("getModelEntity");
entityMethodNames.add("getEntityGroupName");
@@ -197,7 +198,7 @@ public class UtilJavaParse {
entityMethodNames.add("findCountByCondition");
}
public static Set<String> findEntityUseInBlock(int blockStart, int blockEnd, String javaFile) {
- Set<String> entityNameSet = FastSet.newInstance();
+ Set<String> entityNameSet = new HashSet<String>();
int delegatorIndex = javaFile.indexOf("delegator.", blockStart+1);
while (delegatorIndex > 0 && delegatorIndex < blockEnd) {
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilProperties.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilProperties.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilProperties.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilProperties.java Mon Nov 3 06:54:16 2014
@@ -29,9 +29,12 @@ import java.math.BigDecimal;
import java.math.BigInteger;
import java.net.URL;
import java.text.MessageFormat;
+import java.util.ArrayList;
import java.util.Enumeration;
+import java.util.HashSet;
import java.util.InvalidPropertiesFormatException;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -40,9 +43,6 @@ import java.util.Properties;
import java.util.ResourceBundle;
import java.util.Set;
-import javolution.util.FastList;
-import javolution.util.FastSet;
-
import org.ofbiz.base.location.FlexibleLocation;
import org.ofbiz.base.util.cache.UtilCache;
import org.ofbiz.base.util.collections.ResourceBundleMapWrapper;
@@ -78,7 +78,7 @@ public class UtilProperties implements S
protected static Locale fallbackLocale = null;
protected static Set<Locale> defaultCandidateLocales = null;
- protected static Set<String> propertiesNotFound = FastSet.newInstance();
+ protected static Set<String> propertiesNotFound = new HashSet<String>();
/** 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'
@@ -658,7 +658,7 @@ public class UtilProperties implements S
return getMessage(resource, name, UtilGenerics.toMap(String.class, context), locale);
}
- protected static Set<String> resourceNotFoundMessagesShown = FastSet.newInstance();
+ protected static Set<String> resourceNotFoundMessagesShown = new HashSet<String>();
/** Returns the specified resource/properties file as a ResourceBundle
* @param resource The name of the resource - can be a file, class, or URL
* @param locale The locale that the given resource will correspond to
@@ -777,7 +777,7 @@ public class UtilProperties implements S
* @return A list of candidate locales.
*/
public static List<Locale> localeToCandidateList(Locale locale) {
- List<Locale> localeList = FastList.newInstance();
+ List<Locale> localeList = new LinkedList<Locale>();
localeList.add(locale);
String localeString = locale.toString();
int pos = localeString.lastIndexOf("_", localeString.length());
@@ -798,7 +798,7 @@ public class UtilProperties implements S
if (defaultCandidateLocales == null) {
synchronized (UtilProperties.class) {
if (defaultCandidateLocales == null) {
- defaultCandidateLocales = FastSet.newInstance();
+ defaultCandidateLocales = new HashSet<Locale>();
defaultCandidateLocales.addAll(localeToCandidateList(Locale.getDefault()));
defaultCandidateLocales.addAll(localeToCandidateList(getFallbackLocale()));
defaultCandidateLocales.add(Locale.ROOT);
@@ -822,11 +822,10 @@ public class UtilProperties implements S
if (Locale.ROOT.equals(locale)) {
return UtilMisc.toList(locale);
}
- Set<Locale> localeSet = FastSet.newInstance();
+ Set<Locale> localeSet = new HashSet<Locale>();
localeSet.addAll(localeToCandidateList(locale));
localeSet.addAll(getDefaultCandidateLocales());
- List<Locale> localeList = FastList.newInstance();
- localeList.addAll(localeSet);
+ List<Locale> localeList = new ArrayList<Locale>(localeSet);
return localeList;
}
@@ -1036,11 +1035,11 @@ public class UtilProperties implements S
if (bundle == null) {
synchronized (bundleCache) {
double startTime = System.currentTimeMillis();
- FastList<Locale> candidateLocales = (FastList<Locale>) getCandidateLocales(locale);
+ List<Locale> candidateLocales = (List<Locale>) getCandidateLocales(locale);
UtilResourceBundle parentBundle = null;
int numProperties = 0;
while (candidateLocales.size() > 0) {
- Locale candidateLocale = candidateLocales.removeLast();
+ Locale candidateLocale = candidateLocales.remove(candidateLocales.size() -1);
// ResourceBundles are connected together as a singly-linked list
String lookupName = createResourceName(resource, candidateLocale, true);
UtilResourceBundle lookupBundle = bundleCache.get(lookupName);
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilTimer.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilTimer.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilTimer.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilTimer.java Mon Nov 3 06:54:16 2014
@@ -18,7 +18,7 @@
*******************************************************************************/
package org.ofbiz.base.util;
-import javolution.util.FastMap;
+import java.util.concurrent.ConcurrentHashMap;
/**
* Timer handling utility
@@ -30,10 +30,7 @@ import javolution.util.FastMap;
public class UtilTimer {
public static final String module = UtilTimer.class.getName();
- protected static FastMap<String, UtilTimer> staticTimers = FastMap.newInstance();
- static {
- staticTimers.setShared(true);
- }
+ protected static ConcurrentHashMap<String, UtilTimer> staticTimers = new ConcurrentHashMap<String, UtilTimer>();
protected String timerName = null;
protected String lastMessage = null;
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilXml.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilXml.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilXml.java Mon Nov 3 06:54:16 2014
@@ -29,6 +29,7 @@ import java.io.OutputStream;
import java.io.Reader;
import java.io.Writer;
import java.net.URL;
+import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.regex.Matcher;
@@ -45,8 +46,6 @@ import javax.xml.transform.dom.DOMSource
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
-import javolution.util.FastList;
-
import org.apache.xerces.parsers.DOMParser;
import org.apache.xerces.xni.Augmentations;
import org.apache.xerces.xni.NamespaceContext;
@@ -666,7 +665,7 @@ public class UtilXml {
public static List<? extends Element> childElementList(Element element) {
if (element == null) return null;
- List<Element> elements = FastList.newInstance();
+ List<Element> elements = new LinkedList<Element>();
Node node = element.getFirstChild();
if (node != null) {
@@ -686,7 +685,7 @@ public class UtilXml {
public static List<? extends Element> childElementList(Element element, String childElementName) {
if (element == null) return null;
- List<Element> elements = FastList.newInstance();
+ List<Element> elements = new LinkedList<Element>();
Node node = element.getFirstChild();
if (node != null) {
@@ -708,7 +707,7 @@ public class UtilXml {
public static List<? extends Element> childElementList(Element element, Set<String> childElementNames) {
if (element == null) return null;
- List<Element> elements = FastList.newInstance();
+ List<Element> elements = new LinkedList<Element>();
if (childElementNames == null) return elements;
Node node = element.getFirstChild();
@@ -733,7 +732,7 @@ public class UtilXml {
/** Return a List of Element objects that are children of the given DocumentFragment */
public static List<? extends Element> childElementList(DocumentFragment fragment) {
if (fragment == null) return null;
- List<Element> elements = FastList.newInstance();
+ List<Element> elements = new LinkedList<Element>();
Node node = fragment.getFirstChild();
if (node != null) {
do {
@@ -751,7 +750,7 @@ public class UtilXml {
public static List<? extends Node> childNodeList(Node node) {
if (node == null) return null;
- List<Node> nodes = FastList.newInstance();
+ List<Node> nodes = new LinkedList<Node>();
do {
if (node.getNodeType() == Node.ELEMENT_NODE || node.getNodeType() == Node.COMMENT_NODE) {
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java Mon Nov 3 06:54:16 2014
@@ -23,8 +23,10 @@ import java.io.NotSerializableException;
import java.io.Serializable;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.MissingResourceException;
@@ -37,8 +39,6 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
-import javolution.util.FastList;
-import javolution.util.FastMap;
import jdbm.helper.FastIterator;
import jdbm.htree.HTree;
@@ -475,7 +475,7 @@ public class UtilCache<K, V> implements
public Collection<V> values() {
if (fileTable != null) {
- List<V> values = FastList.newInstance();
+ List<V> values = new LinkedList<V>();
try {
synchronized (this) {
FastIterator<V> iter = fileTable.values();
@@ -490,7 +490,7 @@ public class UtilCache<K, V> implements
}
return values;
} else {
- List<V> valuesList = FastList.newInstance();
+ List<V> valuesList = new LinkedList<V>();
for (CacheLine<V> line: memoryTable.values()) {
valuesList.add(line.getValue());
}
@@ -896,7 +896,7 @@ public class UtilCache<K, V> implements
}
private Map<String, Object> createLineInfo(int keyNum, K key, CacheLine<V> line) {
- Map<String, Object> lineInfo = FastMap.newInstance();
+ Map<String, Object> lineInfo = new HashMap<String, Object>();
lineInfo.put("elementKey", key);
if (line.getLoadTimeNanos() > 0) {
@@ -908,7 +908,7 @@ public class UtilCache<K, V> implements
}
private Map<String, Object> createLineInfo(int keyNum, K key, V value) {
- Map<String, Object> lineInfo = FastMap.newInstance();
+ Map<String, Object> lineInfo = new HashMap<String, Object>();
lineInfo.put("elementKey", key);
lineInfo.put("lineSize", findSizeInBytes(value));
lineInfo.put("keyNum", keyNum);
@@ -916,7 +916,7 @@ public class UtilCache<K, V> implements
}
public Collection<? extends Map<String, Object>> getLineInfos() {
- List<Map<String, Object>> lineInfos = FastList.newInstance();
+ List<Map<String, Object>> lineInfos = new LinkedList<Map<String, Object>>();
int keyIndex = 0;
for (K key: getCacheLineKeys()) {
Object nulledKey = fromKey(key);
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/collections/GenericMapCollection.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/collections/GenericMapCollection.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/collections/GenericMapCollection.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/collections/GenericMapCollection.java Mon Nov 3 06:54:16 2014
@@ -20,11 +20,10 @@ package org.ofbiz.base.util.collections;
import java.util.Collection;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import javolution.util.FastList;
-
public abstract class GenericMapCollection<K, V, M extends Map<K, V>, I> implements Collection<I> {
protected final M source;
@@ -87,7 +86,7 @@ public abstract class GenericMapCollecti
}
public Object[] toArray() {
- List<I> list = FastList.newInstance();
+ List<I> list = new LinkedList<I>();
Iterator<I> it = iterator(false);
while (it.hasNext()) {
list.add(it.next());
@@ -96,7 +95,7 @@ public abstract class GenericMapCollecti
}
public <T> T[] toArray(T[] array) {
- List<Object> list = FastList.newInstance();
+ List<Object> list = new LinkedList<Object>();
Iterator<I> it = iterator(false);
while (it.hasNext()) {
list.add(it.next());
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/collections/MapContext.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/collections/MapContext.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/collections/MapContext.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/collections/MapContext.java Mon Nov 3 06:54:16 2014
@@ -20,17 +20,14 @@ package org.ofbiz.base.util.collections;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
-import javolution.context.ObjectFactory;
-import javolution.lang.Reusable;
-import javolution.util.FastList;
-import javolution.util.FastMap;
-import javolution.util.FastSet;
-
import org.ofbiz.base.util.UtilGenerics;
@@ -38,19 +35,12 @@ import org.ofbiz.base.util.UtilGenerics;
* Map Stack
*
*/
-public class MapContext<K, V> implements Map<K, V>, Reusable, LocalizedMap<V> {
+public class MapContext<K, V> implements Map<K, V>, LocalizedMap<V> {
public static final String module = MapContext.class.getName();
- protected static final ObjectFactory<MapContext<?, ?>> mapStackFactory = new ObjectFactory<MapContext<?, ?>>() {
- @Override
- protected MapContext<?, ?> create() {
- return new MapContext<Object, Object>();
- }
- };
-
public static final <K, V> MapContext<K, V> getMapContext() {
- return (MapContext<K, V>) UtilGenerics.<K, V>checkMap(mapStackFactory.object());
+ return new MapContext<K, V>();
}
public static <K, V> MapContext<K, V> createMapContext() {
@@ -82,15 +72,15 @@ public class MapContext<K, V> implements
super();
}
- protected List<Map<K, V>> stackList = FastList.newInstance();
+ protected List<Map<K, V>> stackList = new LinkedList<Map<K, V>>();
public void reset() {
- stackList = FastList.newInstance();
+ stackList = new LinkedList<Map<K, V>>();
}
/** Puts a new Map on the top of the stack */
public void push() {
- Map<K, V> newMap = FastMap.newInstance();
+ Map<K, V> newMap = new HashMap<K, V>();
this.stackList.add(0,newMap);
}
@@ -184,7 +174,7 @@ public class MapContext<K, V> implements
*/
public boolean containsValue(Object value) {
// walk the stackList and the entries for each Map and if nothing is in for the current key, consider it an option, otherwise ignore
- Set<K> resultKeySet = FastSet.newInstance();
+ Set<K> resultKeySet = new HashSet<K>();
for (Map<K, V> curMap: this.stackList) {
for (Map.Entry<K, V> curEntry: curMap.entrySet()) {
if (!resultKeySet.contains(curEntry.getKey())) {
@@ -277,7 +267,7 @@ public class MapContext<K, V> implements
*/
public Set<K> keySet() {
// walk the stackList and aggregate all keys
- Set<K> resultSet = FastSet.newInstance();
+ Set<K> resultSet = new HashSet<K>();
for (Map<K, V> curMap: this.stackList) {
resultSet.addAll(curMap.keySet());
}
@@ -289,8 +279,8 @@ public class MapContext<K, V> implements
*/
public Collection<V> values() {
// walk the stackList and the entries for each Map and if nothing is in for the current key, put it in
- Set<K> resultKeySet = FastSet.newInstance();
- List<V> resultValues = FastList.newInstance();
+ Set<K> resultKeySet = new HashSet<K>();
+ List<V> resultValues = new LinkedList<V>();
for (Map<K, V> curMap: this.stackList) {
for (Map.Entry<K, V> curEntry: curMap.entrySet()) {
if (!resultKeySet.contains(curEntry.getKey())) {
@@ -307,8 +297,8 @@ public class MapContext<K, V> implements
*/
public Set<Map.Entry<K, V>> entrySet() {
// walk the stackList and the entries for each Map and if nothing is in for the current key, put it in
- Set<K> resultKeySet = FastSet.newInstance();
- Set<Map.Entry<K, V>> resultEntrySet = FastSet.newInstance();
+ Set<K> resultKeySet = new HashSet<K>();
+ Set<Map.Entry<K, V>> resultEntrySet = new HashSet<Map.Entry<K, V>>();
for (Map<K, V> curMap: this.stackList) {
for (Map.Entry<K, V> curEntry: curMap.entrySet()) {
if (!resultKeySet.contains(curEntry.getKey())) {
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/collections/MapStack.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/collections/MapStack.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/collections/MapStack.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/collections/MapStack.java Mon Nov 3 06:54:16 2014
@@ -21,11 +21,7 @@ package org.ofbiz.base.util.collections;
import java.util.Locale;
import java.util.Map;
-import javolution.context.ObjectFactory;
-
import org.ofbiz.base.util.Debug;
-import org.ofbiz.base.util.UtilGenerics;
-
/**
* Map Stack
@@ -35,19 +31,8 @@ public class MapStack<K> extends MapCont
public static final String module = MapStack.class.getName();
- protected static final ObjectFactory<MapStack<?>> mapStackFactory = new ObjectFactory<MapStack<?>>() {
- @Override
- protected MapStack<?> create() {
- return new MapStack<Object>();
- }
- };
-
- protected static final <K> MapStack<K> getMapStack() {
- return (MapStack<K>) UtilGenerics.<K, Object>checkMap(mapStackFactory.object());
- }
-
public static <K> MapStack<K> create() {
- MapStack<K> newValue = MapStack.getMapStack();
+ MapStack<K> newValue = new MapStack<K>();
// initialize with a single entry
newValue.push();
return newValue;
@@ -55,7 +40,7 @@ public class MapStack<K> extends MapCont
@SuppressWarnings("unchecked")
public static <K> MapStack<K> create(Map<K, Object> baseMap) {
- MapStack<K> newValue = MapStack.getMapStack();
+ MapStack<K> newValue = new MapStack<K>();
if (baseMap instanceof MapStack) {
newValue.stackList.addAll(((MapStack) baseMap).stackList);
} else {
@@ -66,7 +51,7 @@ public class MapStack<K> extends MapCont
/** Does a shallow copy of the internal stack of the passed MapStack; enables simultaneous stacks that share common parent Maps */
public static <K> MapStack<K> create(MapStack<K> source) {
- MapStack<K> newValue = MapStack.getMapStack();
+ MapStack<K> newValue = new MapStack<K>();
newValue.stackList.addAll(source.stackList);
return newValue;
}
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/string/NodeELResolver.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/string/NodeELResolver.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/string/NodeELResolver.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/string/NodeELResolver.java Mon Nov 3 06:54:16 2014
@@ -19,6 +19,7 @@
package org.ofbiz.base.util.string;
import java.beans.FeatureDescriptor;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -32,8 +33,6 @@ import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
-import javolution.util.FastList;
-
import org.apache.xerces.dom.NodeImpl;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.cache.UtilCache;
@@ -103,7 +102,7 @@ public class NodeELResolver extends ELRe
} else if (nodeList.getLength() == 1) {
result = nodeList.item(0);
} else {
- List<Node> newList = FastList.newInstance();
+ List<Node> newList = new ArrayList<Node>(nodeList.getLength());
for (int i = 0; i < nodeList.getLength(); i++) {
newList.add(nodeList.item(i));
}
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/string/UelFunctions.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/string/UelFunctions.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/string/UelFunctions.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/string/UelFunctions.java Mon Nov 3 06:54:16 2014
@@ -28,6 +28,7 @@ import java.net.URL;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.util.Collection;
+import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
@@ -36,8 +37,6 @@ import javax.el.FunctionMapper;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamSource;
-import javolution.util.FastMap;
-
import org.cyberneko.html.parsers.DOMParser;
import org.ofbiz.base.location.FlexibleLocation;
import org.ofbiz.base.util.Debug;
@@ -165,7 +164,7 @@ public class UelFunctions {
}
protected static class Functions extends FunctionMapper {
- protected final Map<String, Method> functionMap = FastMap.newInstance();
+ protected final Map<String, Method> functionMap = new HashMap<String, Method>();
public Functions() {
try {
this.functionMap.put("date:second", UtilDateTime.class.getMethod("getSecond", Timestamp.class, TimeZone.class, Locale.class));
@@ -305,7 +304,7 @@ public class UelFunctions {
return dateFormat.format(stamp);
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("rawtypes")
public static int getSize(Object obj) {
try {
Map map = (Map) obj;
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/string/UelUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/string/UelUtil.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/string/UelUtil.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/string/UelUtil.java Mon Nov 3 06:54:16 2014
@@ -19,6 +19,8 @@
package org.ofbiz.base.util.string;
import java.math.BigDecimal;
+import java.util.HashMap;
+import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -38,9 +40,6 @@ import javax.el.ResourceBundleELResolver
import javax.el.ValueExpression;
import javax.el.VariableMapper;
-import javolution.util.FastList;
-import javolution.util.FastMap;
-
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.StringUtil;
import org.ofbiz.base.util.UtilGenerics;
@@ -453,6 +452,7 @@ public class UelUtil {
* @param property Property <code>Object</code> to be evaluated
* @return New <code>List</code> or <code>Map</code>
*/
+ @SuppressWarnings("rawtypes")
public static Object autoVivifyListOrMap(Object property) {
String str = property.toString();
boolean isList = ("add".equals(str) || str.startsWith("insert@"));
@@ -461,9 +461,9 @@ public class UelUtil {
isList = (index != null);
}
if (isList) {
- return FastList.newInstance();
+ return new LinkedList();
} else {
- return FastMap.newInstance();
+ return new HashMap();
}
}
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java Mon Nov 3 06:54:16 2014
@@ -31,7 +31,9 @@ import java.net.URL;
import java.util.ArrayList;
import java.util.Date;
import java.util.Enumeration;
+import java.util.HashMap;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -42,9 +44,6 @@ import java.util.TimeZone;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
-import javolution.util.FastList;
-import javolution.util.FastMap;
-
import org.ofbiz.base.location.FlexibleLocation;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.StringUtil;
@@ -65,6 +64,7 @@ import freemarker.template.SimpleScalar;
import freemarker.template.Template;
import freemarker.template.TemplateException;
import freemarker.template.TemplateExceptionHandler;
+import freemarker.template.TemplateHashModel;
import freemarker.template.TemplateModel;
import freemarker.template.TemplateModelException;
import freemarker.template.Version;
@@ -91,7 +91,13 @@ public class FreeMarkerWorker {
Configuration newConfig = new Configuration(version);
newConfig.setObjectWrapper(wrapper);
- newConfig.setSharedVariable("Static", wrapper.getStaticModels());
+ TemplateHashModel staticModels = wrapper.getStaticModels();
+ newConfig.setSharedVariable("Static", staticModels);
+ try {
+ newConfig.setSharedVariable("EntityQuery", staticModels.get("org.ofbiz.entity.util.EntityQuery"));
+ } catch (TemplateModelException e) {
+ Debug.logError(e, module);
+ }
newConfig.setLocalizedLookup(false);
newConfig.setSharedVariable("StringUtil", new BeanModel(StringUtil.INSTANCE, wrapper));
newConfig.setTemplateLoader(new FlexibleTemplateLoader());
@@ -467,7 +473,7 @@ public class FreeMarkerWorker {
public static void checkForLoop(String path, Map<String, Object> ctx) throws IOException {
List<String> templateList = UtilGenerics.checkList(ctx.get("templateList"));
if (templateList == null) {
- templateList = FastList.newInstance();
+ templateList = new LinkedList<String>();
} else {
if (templateList.contains(path)) {
throw new IOException(path + " has already been visited.");
@@ -478,7 +484,7 @@ public class FreeMarkerWorker {
}
public static Map<String, Object> createEnvironmentMap(Environment env) {
- Map<String, Object> templateRoot = FastMap.newInstance();
+ Map<String, Object> templateRoot = new HashMap<String, Object>();
Set<String> varNames = null;
try {
varNames = UtilGenerics.checkSet(env.getKnownVariableNames());
@@ -510,7 +516,7 @@ public class FreeMarkerWorker {
}
public static Map<String, Object> saveValues(Map<String, Object> context, String [] saveKeyNames) {
- Map<String, Object> saveMap = FastMap.newInstance();
+ Map<String, Object> saveMap = new HashMap<String, Object>();
for (String key: saveKeyNames) {
Object o = context.get(key);
if (o instanceof Map<?, ?>) {
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/test/UtilIOTests.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/test/UtilIOTests.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/test/UtilIOTests.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/test/UtilIOTests.java Mon Nov 3 06:54:16 2014
@@ -129,53 +129,4 @@ public class UtilIOTests extends Generic
UtilIO.writeString(baos, UtilIO.UTF8, toWrite);
assertEquals("writeString UTF8:" + label, wanted, baos.toByteArray());
}
-
- protected void checkBasicReadObject(Object value, String text) throws Exception {
- byte[] bytes = text.getBytes("UTF-8");
- assertEquals("read bytes " + value.getClass().getName(), value, UtilIO.readObject(new ByteArrayInputStream(bytes)));
- assertEquals("read chars " + value.getClass().getName(), value, UtilIO.readObject(text.toCharArray()));
- assertEquals("read chars offset " + value.getClass().getName(), value, UtilIO.readObject(text.toCharArray(), 0, text.length()));
- }
-
- protected void checkBasicReadWriteObject(Object value, String text) throws Exception {
- String lineEnding = System.getProperty("line.separator");
- text = text.replaceAll("\n", lineEnding);
- byte[] bytes = text.getBytes("UTF-8");
- assertEquals("read bytes " + value.getClass().getName(), value, UtilIO.readObject(new ByteArrayInputStream(bytes)));
- assertEquals("read chars " + value.getClass().getName(), value, UtilIO.readObject(text.toCharArray()));
- assertEquals("read chars offset " + value.getClass().getName(), value, UtilIO.readObject(text.toCharArray(), 0, text.length()));
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- UtilIO.writeObject(baos, value);
- assertEquals("write stream " + value.getClass().getName(), text, new String(baos.toByteArray(), "UTF-8"));
- StringBuilder sb = new StringBuilder();
- UtilIO.writeObject(sb, value);
- sb.append(lineEnding);
- assertEquals("write builder " + value.getClass().getName(), text, sb.toString());
- }
-
- public void testReadWriteObject() throws Exception {
- checkBasicReadWriteObject(Boolean.TRUE, "java.lang.Boolean:true\n");
- checkBasicReadWriteObject(Byte.valueOf("1"), "java.lang.Byte:1\n");
- checkBasicReadWriteObject(Double.valueOf("1.0"), "java.lang.Double:1.0\n");
- checkBasicReadWriteObject(Float.valueOf("1.0"), "java.lang.Float:1.0\n");
- checkBasicReadWriteObject(Integer.valueOf("1"), "java.lang.Integer:1\n");
- checkBasicReadWriteObject(Long.valueOf("1"), "java.lang.Long:1\n");
- checkBasicReadWriteObject(Short.valueOf("1"), "java.lang.Short:1\n");
- checkBasicReadWriteObject(BigDecimal.valueOf(500.5), "java.math.BigDecimal:500.5\n");
- checkBasicReadWriteObject(BigInteger.valueOf(500), "java.math.BigInteger:500\n");
- checkBasicReadWriteObject("1", "java.lang.String:1\n");
- checkBasicReadObject(Arrays.asList(new Object[] {"a", UtilMisc.toMap("b", Long.valueOf(1))}), "[\n \"a\",\n {\n \"b\": 1\n }\n]\n");
- checkBasicReadWriteObject(MemoryType.HEAP, "java.lang.management.MemoryType:HEAP\n");
- checkBasicReadWriteObject(MemoryType.NON_HEAP, "java.lang.management.MemoryType:NON_HEAP\n");
- checkBasicReadWriteObject(UtilIO.UTF8, "java.nio.charset.Charset:UTF-8\n");
- checkBasicReadWriteObject(InetAddress.getByAddress("localhost", new byte[] {127, 0, 0, 1}), "java.net.InetAddress:localhost\n");
- //checkBasicReadWriteObject(Pattern.compile("^([a-z]{3}.*?):$"), "java.util.regex.Pattern:^([a-z]{3}.*?):$\n");
- checkBasicReadWriteObject(Time.valueOf("12:34:56"), "java.sql.Time:12:34:56\n");
- //checkBasicReadWriteObject(new Timestamp(1234567890), "java.sql.Timestamp:1234567890 00:00:00\n");
- //checkBasicReadWriteObject(new java.util.Date(1234567890), "java.util.Date:1234567890\n");
- checkBasicReadWriteObject(UUID.fromString("c3241927-9f77-43e1-be16-bd71d245ef64"), "java.util.UUID:c3241927-9f77-43e1-be16-bd71d245ef64\n");
- checkBasicReadWriteObject(TimeZone.getTimeZone("America/Chicago"), "java.util.TimeZone:America/Chicago\n");
- checkBasicReadWriteObject(new SimpleDateFormat("MM/dd/yyyy hh:mm a"), "java.text.SimpleDateFormat:MM/dd/yyyy hh:mm a\n");
- checkBasicReadWriteObject(new Locale("en", "us"), "java.util.Locale:en_US\n");
- }
}
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/testdef/basetests.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/testdef/basetests.xml?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/testdef/basetests.xml (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/testdef/basetests.xml Mon Nov 3 06:54:16 2014
@@ -32,7 +32,8 @@
<junit-test-suite class-name="org.ofbiz.base.util.cache.test.UtilCacheTests"/>
<junit-test-suite class-name="org.ofbiz.base.conversion.test.DateTimeTests"/>
<junit-test-suite class-name="org.ofbiz.base.conversion.test.MiscTests"/>
- <junit-test-suite class-name="org.ofbiz.base.json.test.JSONTests"/>
+ <junit-test-suite class-name="org.ofbiz.base.conversion.test.TestBooleanConverters"/>
+ <junit-test-suite class-name="org.ofbiz.base.conversion.test.TestJSONConverters"/>
<!--junit-test-suite class-name="org.ofbiz.base.util.test.UtilIOTests"/-->
<junit-test-suite class-name="org.ofbiz.base.test.BaseUnitTests"/>
<junit-test-suite class-name="org.ofbiz.base.util.test.UtilPropertiesTests"/>
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/data/GeoData.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/data/GeoData.xml?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/data/GeoData.xml (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/data/GeoData.xml Mon Nov 3 06:54:16 2014
@@ -354,7 +354,7 @@ under the License.
<CountryAddressFormat geoId="CHN" geoAssocTypeId="REGIONS" requireStateProvinceId="" requirePostalCode="" postalCodeRegex="" hasPostalCodeExt="" requirePostalCodeExt="" addressFormat=""/>
<CountryAddressFormat geoId="COL" geoAssocTypeId="REGIONS" requireStateProvinceId="" requirePostalCode="" postalCodeRegex="" hasPostalCodeExt="" requirePostalCodeExt="" addressFormat=""/>
<CountryAddressFormat geoId="MEX" geoAssocTypeId="REGIONS" requireStateProvinceId="" requirePostalCode="" postalCodeRegex="" hasPostalCodeExt="" requirePostalCodeExt="" addressFormat=""/>
- <CountryAddressFormat geoId="NLD" geoAssocTypeId="REGIONS" requireStateProvinceId="" requirePostalCode="" postalCodeRegex="" hasPostalCodeExt="" requirePostalCodeExt="" addressFormat=""/>
+ <CountryAddressFormat geoId="NLD" geoAssocTypeId="REGIONS" requireStateProvinceId="N" requirePostalCode="Y" postalCodeRegex="^[1-9][\d]{3}\s?(?!(sa|sd|ss|SA|SD|SS))([a-eghj-opr-tv-xzA-EGHJ-OPR-TV-XZ]{2})?$ " hasPostalCodeExt="N" requirePostalCodeExt="N" addressFormat=""/>
<CountryAddressFormat geoId="POL" geoAssocTypeId="REGIONS" requireStateProvinceId="" requirePostalCode="" postalCodeRegex="" hasPostalCodeExt="" requirePostalCodeExt="" addressFormat=""/>
<CountryAddressFormat geoId="IND" geoAssocTypeId="REGIONS" requireStateProvinceId="" requirePostalCode="" postalCodeRegex="" hasPostalCodeExt="" requirePostalCodeExt="" addressFormat=""/>
<CountryAddressFormat geoId="ITA" geoAssocTypeId="REGIONS" requireStateProvinceId="" requirePostalCode="" postalCodeRegex="" hasPostalCodeExt="" requirePostalCodeExt="" addressFormat=""/>
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/CommonEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/CommonEvents.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/CommonEvents.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/CommonEvents.java Mon Nov 3 06:54:16 2014
@@ -28,8 +28,9 @@ import java.io.IOException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
+import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -40,14 +41,10 @@ import javax.servlet.http.HttpServletReq
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
-import javolution.util.FastMap;
-import net.sf.json.JSON;
-import net.sf.json.JSONArray;
-import net.sf.json.JSONObject;
-import net.sf.json.JSONSerializer;
import org.apache.commons.lang.RandomStringUtils;
import org.apache.commons.lang.StringUtils;
+import org.ofbiz.base.lang.JSON;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.StringUtil;
import org.ofbiz.base.util.UtilGenerics;
@@ -59,6 +56,7 @@ import org.ofbiz.base.util.cache.UtilCac
import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.security.Security;
/**
@@ -95,7 +93,7 @@ public class CommonEvents {
GenericValue visit = null;
try {
- visit = delegator.findOne("Visit", false, "visitId", visitId);
+ visit = EntityQuery.use(delegator).from("Visit").where("visitId", visitId).queryOne();
} catch (GenericEntityException e) {
Debug.logError(e, "Cannot Visit Object", module);
}
@@ -129,7 +127,7 @@ public class CommonEvents {
GenericValue visit = null;
try {
- visit = delegator.findOne("Visit", false, "visitId", visitId);
+ visit = EntityQuery.use(delegator).from("Visit").where("visitId", visitId).queryOne();
} catch (GenericEntityException e) {
Debug.logError(e, "Cannot Visit Object", module);
}
@@ -169,7 +167,7 @@ public class CommonEvents {
String followerSessionId = request.getParameter("followerSid");
String followSessionId = request.getParameter("followSid");
Map<String, String> follow = appletSessions.get(followSessionId);
- if (follow == null) follow = FastMap.newInstance();
+ if (follow == null) follow = new LinkedHashMap<String, String>();
String followerListStr = follow.get("followers");
if (followerListStr == null) {
followerListStr = followerSessionId;
@@ -191,7 +189,7 @@ public class CommonEvents {
String followerSessionId = request.getParameter("followerSid");
String pageUrl = request.getParameter("pageUrl");
Map<String, String> follow = appletSessions.get(followerSessionId);
- if (follow == null) follow = FastMap.newInstance();
+ if (follow == null) follow = new LinkedHashMap<String, String>();
follow.put("followPage", pageUrl);
appletSessions.put(followerSessionId, follow);
}
@@ -288,15 +286,16 @@ public class CommonEvents {
attrMap.remove(ignoreAttr);
}
}
-
- // create a JSON Object for return
- JSONObject json = JSONObject.fromObject(attrMap);
- writeJSONtoResponse(json, request.getMethod(), response);
-
+ try {
+ JSON json = JSON.from(attrMap);
+ writeJSONtoResponse(json, request.getMethod(), response);
+ } catch (Exception e) {
+ return "error";
+ }
return "success";
}
- private static void writeJSONtoResponse(JSON json, String httpMethod, HttpServletResponse response) {
+ private static void writeJSONtoResponse(JSON json, String httpMethod, HttpServletResponse response) throws UnsupportedEncodingException {
String jsonStr = json.toString();
if (jsonStr == null) {
Debug.logError("JSON Object was empty; fatal error!", module);
@@ -306,21 +305,17 @@ public class CommonEvents {
// This was added for security reason (OFBIZ-5409), you might need to remove the "//" prefix when handling the JSON response
// Though normally you simply have to access the data you want, so should not be annoyed by the "//" prefix
if ("GET".equalsIgnoreCase(httpMethod)) {
- Debug.logWarning("for security reason (OFBIZ-5409) the the '//' prefix was added handling the JSON response. " +
- "Normally you simply have to access the data you want, so should not be annoyed by the '//' prefix." +
- "You might need to remove it if you use Ajax GET responses (not recommended)." +
- "In case, the util.js scrpt is there to help you", module);
+ Debug.logWarning("for security reason (OFBIZ-5409) the the '//' prefix was added handling the JSON response. "
+ + "Normally you simply have to access the data you want, so should not be annoyed by the '//' prefix."
+ + "You might need to remove it if you use Ajax GET responses (not recommended)."
+ + "In case, the util.js scrpt is there to help you", module);
jsonStr = "//" + jsonStr;
}
// set the X-JSON content type
response.setContentType("application/x-json");
// jsonStr.length is not reliable for unicode characters
- try {
- response.setContentLength(jsonStr.getBytes("UTF8").length);
- } catch (UnsupportedEncodingException e) {
- Debug.logError("Problems with Json encoding: " + e, module);
- }
+ response.setContentLength(jsonStr.getBytes("UTF8").length);
// return the JSON String
Writer out;
@@ -333,81 +328,65 @@ public class CommonEvents {
}
}
-
- public static String getJSONuiLabelArray(HttpServletRequest request, HttpServletResponse response) {
- String requiredLabels = request.getParameter("requiredLabels");
-
- JSONObject uiLabelObject = null;
- if (UtilValidate.isNotEmpty(requiredLabels)) {
- // Transform JSON String to Object
- uiLabelObject = (JSONObject) JSONSerializer.toJSON(requiredLabels);
+ public static String getJSONuiLabelArray(HttpServletRequest request, HttpServletResponse response)
+ throws UnsupportedEncodingException, IOException {
+ // Format - {resource1 : [key1, key2 ...], resource2 : [key1, key2, ...], ...}
+ String jsonString = request.getParameter("requiredLabels");
+ Map<String, List<String>> uiLabelObject = null;
+ if (UtilValidate.isNotEmpty(jsonString)) {
+ JSON json = JSON.from(jsonString);
+ uiLabelObject = UtilGenerics.<Map<String, List<String>>> cast(json.toObject(Map.class));
+ }
+ if (UtilValidate.isEmpty(uiLabelObject)) {
+ Debug.logError("No resource and labels found in JSON string: " + jsonString, module);
+ return "error";
}
-
- JSONObject jsonUiLabel = new JSONObject();
Locale locale = request.getLocale();
- if(!uiLabelObject.isEmpty()) {
- Set<String> resourceSet = UtilGenerics.checkSet(uiLabelObject.keySet());
- // Iterate over the resouce set
- for (String resource : resourceSet) {
- JSONArray labels = uiLabelObject.getJSONArray(resource);
- if (labels.isEmpty() || labels == null) {
- continue;
+ Map<String, List<String>> uiLabelMap = new HashMap<String, List<String>>();
+ Set<Map.Entry<String, List<String>>> entrySet = uiLabelObject.entrySet();
+ for (Map.Entry<String, List<String>> entry : entrySet) {
+ String resource = entry.getKey();
+ List<String> resourceKeys = entry.getValue();
+ if (resourceKeys != null) {
+ List<String> labels = new ArrayList<String>(resourceKeys.size());
+ for (String resourceKey : resourceKeys) {
+ String label = UtilProperties.getMessage(resource, resourceKey, locale);
+ labels.add(label);
}
-
- // Iterate over the uiLabel List
- Iterator<String> jsonLabelIterator = UtilGenerics.cast(labels.iterator());
- JSONArray resourceLabelList = new JSONArray();
- while(jsonLabelIterator.hasNext()) {
- String label = jsonLabelIterator.next();
- String receivedLabel = UtilProperties.getMessage(resource, label, locale);
- if (UtilValidate.isNotEmpty(receivedLabel)) {
- resourceLabelList.add(receivedLabel);
- }
- }
- jsonUiLabel.element(resource, resourceLabelList);
+ uiLabelMap.put(resource, labels);
}
}
-
- writeJSONtoResponse(jsonUiLabel, request.getMethod(), response);
+ writeJSONtoResponse(JSON.from(uiLabelMap), request.getMethod(), response);
return "success";
}
- public static String getJSONuiLabel(HttpServletRequest request, HttpServletResponse response) {
- String requiredLabels = request.getParameter("requiredLabel");
-
- JSONObject uiLabelObject = null;
- if (UtilValidate.isNotEmpty(requiredLabels)) {
- // Transform JSON String to Object
- uiLabelObject = (JSONObject) JSONSerializer.toJSON(requiredLabels);
+ public static String getJSONuiLabel(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException {
+ // Format - {resource : key}
+ String jsonString = request.getParameter("requiredLabel");
+ Map<String, String> uiLabelObject = null;
+ if (UtilValidate.isNotEmpty(jsonString)) {
+ JSON json = JSON.from(jsonString);
+ uiLabelObject = UtilGenerics.<Map<String, String>>cast(json.toObject(Map.class));
+ }
+ if (UtilValidate.isEmpty(uiLabelObject)) {
+ Debug.logError("No resource and labels found in JSON string: " + jsonString, module);
+ return "error";
+ } else if (uiLabelObject.size() > 1) {
+ Debug.logError("More than one resource found, please use the method: getJSONuiLabelArray", module);
+ return "error";
}
-
- JSONArray jsonUiLabel = new JSONArray();
Locale locale = request.getLocale();
- if(!uiLabelObject.isEmpty()) {
- Set<String> resourceSet = UtilGenerics.checkSet(uiLabelObject.keySet());
- // Iterate over the resource set
- // here we need a keySet because we don't now which label resource to load
- // the key set should have the size one, if greater or empty error should returned
- if (UtilValidate.isEmpty(resourceSet)) {
- Debug.logError("No resource and labels found", module);
- return "error";
- } else if (resourceSet.size() > 1) {
- Debug.logError("More than one resource found, please use the method: getJSONuiLabelArray", module);
- return "error";
- }
-
- for (String resource : resourceSet) {
- String label = uiLabelObject.getString(resource);
- if (UtilValidate.isEmail(label)) {
- continue;
- }
-
- String receivedLabel = UtilProperties.getMessage(resource, label, locale);
- jsonUiLabel.add(receivedLabel);
+ Map<String, String> uiLabelMap = new HashMap<String, String>();
+ Set<Map.Entry<String, String>> entrySet = uiLabelObject.entrySet();
+ for (Map.Entry<String, String> entry : entrySet) {
+ String resource = entry.getKey();
+ String resourceKey = entry.getValue();
+ if (resourceKey != null) {
+ String label = UtilProperties.getMessage(resource, resourceKey, locale);
+ uiLabelMap.put(resource, label);
}
}
-
- writeJSONtoResponse(jsonUiLabel, request.getMethod(), response);
+ writeJSONtoResponse(JSON.from(uiLabelMap), request.getMethod(), response);
return "success";
}
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/CommonServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/CommonServices.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/CommonServices.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/CommonServices.java Mon Nov 3 06:54:16 2014
@@ -33,6 +33,8 @@ import java.io.Writer;
import java.nio.ByteBuffer;
import java.sql.Timestamp;
import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -41,9 +43,6 @@ import java.util.TreeSet;
import javax.mail.internet.MimeMessage;
-import javolution.util.FastList;
-import javolution.util.FastMap;
-
import org.ofbiz.base.metrics.Metrics;
import org.ofbiz.base.metrics.MetricsFactory;
import org.ofbiz.base.util.Debug;
@@ -112,7 +111,7 @@ public class CommonServices {
Delegator delegator = dctx.getDelegator();
Map<String, Object> response = ServiceUtil.returnSuccess();
- List<GenericValue> testingNodes = FastList.newInstance();
+ List<GenericValue> testingNodes = new LinkedList<GenericValue>();
for (int i = 0; i < 3; i ++) {
GenericValue testingNode = delegator.makeValue("TestingNode");
testingNode.put("testingNodeId", "TESTING_NODE" + i);
@@ -227,7 +226,7 @@ public class CommonServices {
* This service does not have required parameters and does not validate
*/
public static Map<String, Object> echoService(DispatchContext dctx, Map<String, ?> context) {
- Map<String, Object> result = FastMap.newInstance();
+ Map<String, Object> result = new LinkedHashMap<String, Object>();
result.putAll(context);
result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS);
return result;
@@ -387,7 +386,7 @@ public class CommonServices {
String fileName = (String) context.get("_uploadFile_fileName");
String contentType = (String) context.get("_uploadFile_contentType");
- Map<String, Object> createCtx = FastMap.newInstance();
+ Map<String, Object> createCtx = new LinkedHashMap<String, Object>();
createCtx.put("binData", array);
createCtx.put("dataResourceTypeId", "OFBIZ_FILE");
createCtx.put("dataResourceName", fileName);
@@ -409,7 +408,7 @@ public class CommonServices {
GenericValue dataResource = (GenericValue) createResp.get("dataResource");
if (dataResource != null) {
- Map<String, Object> contentCtx = FastMap.newInstance();
+ Map<String, Object> contentCtx = new LinkedHashMap<String, Object>();
contentCtx.put("dataResourceId", dataResource.getString("dataResourceId"));
contentCtx.put("localeString", ((Locale) context.get("locale")).toString());
contentCtx.put("contentTypeId", "DOCUMENT");
@@ -523,10 +522,10 @@ public class CommonServices {
}
public static Map<String, Object> getAllMetrics(DispatchContext dctx, Map<String, ?> context) {
- List<Map<String, Object>> metricsMapList = FastList.newInstance();
+ List<Map<String, Object>> metricsMapList = new LinkedList<Map<String, Object>>();
Collection<Metrics> metricsList = MetricsFactory.getMetrics();
for (Metrics metrics : metricsList) {
- Map<String, Object> metricsMap = FastMap.newInstance();
+ Map<String, Object> metricsMap = new LinkedHashMap<String, Object>();
metricsMap.put("name", metrics.getName());
metricsMap.put("serviceRate", metrics.getServiceRate());
metricsMap.put("threshold", metrics.getThreshold());
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/CommonWorkers.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/CommonWorkers.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/CommonWorkers.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/CommonWorkers.java Mon Nov 3 06:54:16 2014
@@ -18,9 +18,9 @@
*******************************************************************************/
package org.ofbiz.common;
+import java.util.LinkedList;
import java.util.List;
-
-import javolution.util.FastList;
+import java.util.Map;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.StringUtil;
@@ -33,6 +33,7 @@ import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.condition.EntityCondition;
import org.ofbiz.entity.condition.EntityExpr;
import org.ofbiz.entity.condition.EntityOperator;
+import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityTypeUtil;
import org.ofbiz.entity.util.EntityUtilProperties;
@@ -44,12 +45,12 @@ public class CommonWorkers {
public final static String module = CommonWorkers.class.getName();
public static List<GenericValue> getCountryList(Delegator delegator) {
- List<GenericValue> geoList = FastList.newInstance();
+ List<GenericValue> geoList = new LinkedList<GenericValue>();
String defaultCountry = EntityUtilProperties.getPropertyValue("general.properties", "country.geo.id.default", delegator);
GenericValue defaultGeo = null;
if (UtilValidate.isNotEmpty(defaultCountry)) {
try {
- defaultGeo = delegator.findOne("Geo", UtilMisc.toMap("geoId", defaultCountry), true);
+ defaultGeo = EntityQuery.use(delegator).from("Geo").where("geoId", defaultCountry).cache().queryOne();
} catch (GenericEntityException e) {
Debug.logError(e, "Cannot lookup Geo", module);
}
@@ -62,7 +63,7 @@ public class CommonWorkers {
exprs.add(EntityCondition.makeCondition("geoId", EntityOperator.IN, countriesAvailable));
}
- List<GenericValue> countriesList = FastList.newInstance();
+ List<GenericValue> countriesList = new LinkedList<GenericValue>();
try {
countriesList = delegator.findList("Geo", EntityCondition.makeCondition(exprs), null, UtilMisc.toList("geoName"), null, true);
} catch (GenericEntityException e) {
@@ -89,7 +90,7 @@ public class CommonWorkers {
}
public static List<GenericValue> getStateList(Delegator delegator) {
- List<GenericValue> geoList = FastList.newInstance();
+ List<GenericValue> geoList = new LinkedList<GenericValue>();
EntityCondition condition = EntityCondition.makeCondition(EntityOperator.OR, EntityCondition.makeCondition("geoTypeId", "STATE"), EntityCondition.makeCondition("geoTypeId", "PROVINCE"), EntityCondition.makeCondition("geoTypeId", "TERRITORY"),
EntityCondition.makeCondition("geoTypeId", "MUNICIPALITY"));
List<String> sortList = UtilMisc.toList("geoName");
@@ -119,7 +120,7 @@ public class CommonWorkers {
}
List<String> sortList = UtilMisc.toList(listOrderBy);
- List<GenericValue> geoList = FastList.newInstance();
+ List<GenericValue> geoList = new LinkedList<GenericValue>();
try {
// Check if the country is a country group and get recursively the
// states
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/FindServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/FindServices.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/FindServices.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/FindServices.java Mon Nov 3 06:54:16 2014
@@ -23,15 +23,14 @@ import static org.ofbiz.base.util.UtilGe
import java.sql.Timestamp;
import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
-import javolution.util.FastList;
-import javolution.util.FastMap;
-import javolution.util.FastSet;
-
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.ObjectType;
import org.ofbiz.base.util.StringUtil;
@@ -70,7 +69,7 @@ public class FindServices {
public static Map<String, EntityComparisonOperator<?, ?>> entityOperators;
static {
- entityOperators = FastMap.newInstance();
+ entityOperators = new LinkedHashMap<String, EntityComparisonOperator<?, ?>>();
entityOperators.put("between", EntityOperator.BETWEEN);
entityOperators.put("equals", EntityOperator.EQUALS);
entityOperators.put("greaterThan", EntityOperator.GREATER_THAN);
@@ -110,7 +109,7 @@ public class FindServices {
// Note that "normalizedFields" will contain values other than those
// Contained in the associated entity.
// Those extra fields will be ignored in the second half of this method.
- Map<String, Map<String, Map<String, Object>>> normalizedFields = FastMap.newInstance();
+ Map<String, Map<String, Map<String, Object>>> normalizedFields = new LinkedHashMap<String, Map<String, Map<String, Object>>>();
//StringBuffer queryStringBuf = new StringBuffer();
for (String fieldNameRaw: inputFields.keySet()) { // The name as it appeas in the HTML form
String fieldNameRoot = null; // The entity field name. Everything to the left of the first "_" if
@@ -182,19 +181,19 @@ public class FindServices {
}
subMap = normalizedFields.get(fieldNameRoot);
if (subMap == null) {
- subMap = FastMap.newInstance();
+ subMap = new LinkedHashMap<String, Map<String, Object>>();
normalizedFields.put(fieldNameRoot, subMap);
}
subMap2 = subMap.get(fieldPair);
if (subMap2 == null) {
- subMap2 = FastMap.newInstance();
+ subMap2 = new LinkedHashMap<String, Object>();
subMap.put(fieldPair, subMap2);
}
subMap2.put(fieldMode, fieldValue);
List<Object[]> origList = origValueMap.get(fieldNameRoot);
if (origList == null) {
- origList = FastList.newInstance();
+ origList = new LinkedList<Object[]>();
origValueMap.put(fieldNameRoot, origList);
}
Object [] origValues = {fieldNameRaw, fieldValue};
@@ -214,13 +213,13 @@ public class FindServices {
* @return returns an EntityCondition list
*/
public static List<EntityCondition> createConditionList(Map<String, ? extends Object> parameters, List<ModelField> fieldList, Map<String, Object> queryStringMap, Delegator delegator, Map<String, ?> context) {
- Set<String> processed = FastSet.newInstance();
- Set<String> keys = FastSet.newInstance();
- Map<String, ModelField> fieldMap = FastMap.newInstance();
+ Set<String> processed = new LinkedHashSet<String>();
+ Set<String> keys = new LinkedHashSet<String>();
+ Map<String, ModelField> fieldMap = new LinkedHashMap<String, ModelField>();
for (ModelField modelField : fieldList) {
fieldMap.put(modelField.getName(), modelField);
}
- List<EntityCondition> result = FastList.newInstance();
+ List<EntityCondition> result = new LinkedList<EntityCondition>();
for (Map.Entry<String, ? extends Object> entry : parameters.entrySet()) {
String parameterName = entry.getKey();
if (processed.contains(parameterName)) {
@@ -365,7 +364,7 @@ public class FindServices {
Object fieldValue = null; // If it is a "value" field, it will be the value to be used in the query.
// If it is an "op" field, it will be "equals", "greaterThan", etc.
EntityCondition cond = null;
- List<EntityCondition> tmpList = FastList.newInstance();
+ List<EntityCondition> tmpList = new LinkedList<EntityCondition>();
String opString = null;
boolean ignoreCase = false;
List<ModelField> fields = modelEntity.getFieldsUnmodifiable();
@@ -548,7 +547,7 @@ public class FindServices {
}
Timestamp filterByDateValue = (Timestamp) context.get("filterByDateValue");
- Map<String, Object> queryStringMap = FastMap.newInstance();
+ Map<String, Object> queryStringMap = new LinkedHashMap<String, Object>();
Delegator delegator = dctx.getDelegator();
ModelEntity modelEntity = delegator.getModelEntity(entityName);
List<EntityCondition> tmpList = createConditionList(inputFields, modelEntity.getFieldsUnmodifiable(), queryStringMap, delegator, context);
@@ -665,7 +664,7 @@ public class FindServices {
// Contained in the associated entity.
// Those extra fields will be ignored in the second half of this method.
ModelEntity modelEntity = delegator.getModelEntity(entityName);
- Map<String, Object> normalizedFields = FastMap.newInstance();
+ Map<String, Object> normalizedFields = new LinkedHashMap<String, Object>();
//StringBuffer queryStringBuf = new StringBuffer();
for (String fieldNameRaw: inputFields.keySet()) { // The name as it appeas in the HTML form
String fieldNameRoot = null; // The entity field name. Everything to the left of the first "_" if
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/FtpServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/FtpServices.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/FtpServices.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/FtpServices.java Mon Nov 3 06:54:16 2014
@@ -25,12 +25,11 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
-import javolution.util.FastList;
-
import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPReply;
@@ -60,7 +59,7 @@ public class FtpServices {
Debug.logError(ioe, "[putFile] Problem opening local file", module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "CommonFtpFileCannotBeOpen", locale));
}
- List<String> errorList = FastList.newInstance();
+ List<String> errorList = new LinkedList<String>();
FTPClient ftp = new FTPClient();
try {
Integer defaultTimeout = (Integer) context.get("defaultTimeout");
@@ -145,7 +144,7 @@ public class FtpServices {
Debug.logError(ioe, "[getFile] Problem opening local file", module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "CommonFtpFileCannotBeOpen", locale));
}
- List<String> errorList = FastList.newInstance();
+ List<String> errorList = new LinkedList<String>();
FTPClient ftp = new FTPClient();
try {
Integer defaultTimeout = (Integer) context.get("defaultTimeout");