Author: doogie
Date: Sat Mar 21 23:25:08 2009 New Revision: 757078 URL: http://svn.apache.org/viewvc?rev=757078&view=rev Log: Fix purely empty whitespace lines, and remove trailing whitespace. Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/Captcha.java ofbiz/trunk/framework/common/src/org/ofbiz/common/CdyneServices.java ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonEvents.java ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonServices.java ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java ofbiz/trunk/framework/common/src/org/ofbiz/common/DataModelConstants.java ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java ofbiz/trunk/framework/common/src/org/ofbiz/common/FtpServices.java ofbiz/trunk/framework/common/src/org/ofbiz/common/KeywordSearchUtil.java ofbiz/trunk/framework/common/src/org/ofbiz/common/email/EmailServices.java ofbiz/trunk/framework/common/src/org/ofbiz/common/email/NotificationServices.java ofbiz/trunk/framework/common/src/org/ofbiz/common/geo/GeoWorker.java ofbiz/trunk/framework/common/src/org/ofbiz/common/image/ImageTransform.java ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LdapAuthenticationServices.java ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java ofbiz/trunk/framework/common/src/org/ofbiz/common/olap/CommonDimensionServices.java ofbiz/trunk/framework/common/src/org/ofbiz/common/period/PeriodServices.java ofbiz/trunk/framework/common/src/org/ofbiz/common/period/PeriodWorker.java ofbiz/trunk/framework/common/src/org/ofbiz/common/preferences/PreferenceServices.java ofbiz/trunk/framework/common/src/org/ofbiz/common/preferences/PreferenceWorker.java ofbiz/trunk/framework/common/src/org/ofbiz/common/status/StatusServices.java ofbiz/trunk/framework/common/src/org/ofbiz/common/status/StatusWorker.java ofbiz/trunk/framework/common/src/org/ofbiz/common/uom/UomWorker.java Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/Captcha.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/Captcha.java?rev=757078&r1=757077&r2=757078&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/Captcha.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/Captcha.java Sat Mar 21 23:25:08 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -61,7 +61,7 @@ } public static boolean createImageCaptcha (HttpServletRequest request,HttpServletResponse response) { - try { + try { //It is possible to pass the font size, image width and height with the request as well Color backgroundColor = Color.gray; Color borderColor = Color.DARK_GRAY; @@ -142,7 +142,7 @@ //Adding this because we called response.getOutputStream() above. This will prevent and illegal state exception being thrown return true; } - + public static void writeImage(BufferedImage image, HttpServletRequest request) { try { @@ -162,7 +162,7 @@ return; } } - + public static void deleteFile() { if (CAPTCHA_FILE_PATH != null) { File file = new File(CAPTCHA_FILE_PATH); Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/CdyneServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/CdyneServices.java?rev=757078&r1=757077&r2=757078&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/CdyneServices.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/CdyneServices.java Sat Mar 21 23:25:08 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -40,7 +40,7 @@ public class CdyneServices { public final static String module = CdyneServices.class.getName(); - + public final static String licenseKey = UtilProperties.getPropertyValue("cdyne", "LicenseKey", "0"); /** @@ -51,24 +51,24 @@ */ public static Map<String, Object> cdyneReturnCityState(DispatchContext dctx, Map<String, ?> context) { String zipcode = (String) context.get("zipcode"); - - String serviceUrl = "http://ws.cdyne.com/psaddress/addresslookup.asmx/ReturnCityState?zipcode=" + zipcode + "&LicenseKey=" + licenseKey; + + String serviceUrl = "http://ws.cdyne.com/psaddress/addresslookup.asmx/ReturnCityState?zipcode=" + zipcode + "&LicenseKey=" + licenseKey; try { String httpResponse = HttpClient.getUrlContent(serviceUrl); - + Document addressDocument = UtilXml.readXmlDocument(httpResponse); Element addressRootElement = addressDocument.getDocumentElement(); Map<String, Object> response = ServiceUtil.returnSuccess(); populateCdyneAddress(addressRootElement, response); - + if ("true".equals(response.get("ServiceError"))) { return ServiceUtil.returnError("Got ServiceError=true from CDyne ReturnCityState service; zipcode=" + zipcode); } if ("true".equals(response.get("AddressError"))) { return ServiceUtil.returnError("Got AddressError=true from CDyne ReturnCityState service; zipcode=" + zipcode); } - + return response; } catch (HttpClientException e) { String errMsg = "Error calling CDyne service at URL [" + serviceUrl + "]: " + e.toString(); @@ -88,7 +88,7 @@ return ServiceUtil.returnError(errMsg); } } - + public static void populateCdyneAddress(Element addressRootElement, Map<String, Object> targetContext) { targetContext.put("ServiceError", UtilXml.childElementValue(addressRootElement, "ServiceError")); targetContext.put("AddressError", UtilXml.childElementValue(addressRootElement, "AddressError")); @@ -128,19 +128,19 @@ targetContext.put("CensusBlockNum", UtilXml.childElementValue(addressRootElement, "CensusBlockNum")); targetContext.put("CensusTractNum", UtilXml.childElementValue(addressRootElement, "CensusTractNum")); - + /* Example URL: http://ws.cdyne.com/psaddress/addresslookup.asmx/ReturnCityState?zipcode=93940&LicenseKey=0 NOTE: 0 is a test LicenseKey - - Example Response: + + Example Response: <?xml version="1.0" encoding="utf-8"?> <Address xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://ws.cdyne.com/"> <ServiceError>false</ServiceError> <AddressError>false</AddressError> <AddressFoundBeMoreSpecific>false</AddressFoundBeMoreSpecific> <NeededCorrection>true</NeededCorrection> - + <DeliveryAddress>**UNKNOWN**</DeliveryAddress> <City>DEL REY OAKS</City> <StateAbbrev>CA</StateAbbrev> @@ -148,30 +148,30 @@ <County>MONTEREY</County> <CountyNum>0</CountyNum> <PreferredCityName>MONTEREY</PreferredCityName> - + <DeliveryPoint>99</DeliveryPoint> <CheckDigit>0</CheckDigit> - + <CSKey>Z20854</CSKey> <FIPS>06053</FIPS> - + <FromLongitude>-121.919965</FromLongitude> <FromLatitude>36.362864</FromLatitude> <ToLongitude>-121.647022</ToLongitude> <ToLatitude>36.652645</ToLatitude> <AvgLongitude>-121.7834935</AvgLongitude> <AvgLatitude>36.5077545</AvgLatitude> - + <CMSA>7120</CMSA> <PMSA /> <MSA>7120</MSA> <MA>712</MA> - + <TimeZone>PST</TimeZone> <hasDaylightSavings>true</hasDaylightSavings> <AreaCode>831</AreaCode> <LLCertainty>90</LLCertainty> - + <CensusBlockNum>9003</CensusBlockNum> <CensusTractNum>0134.00</CensusTractNum> </Address> Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonEvents.java?rev=757078&r1=757077&r2=757078&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonEvents.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonEvents.java Sat Mar 21 23:25:08 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -45,33 +45,33 @@ * Common Services */ public class CommonEvents { - + public static final String module = CommonEvents.class.getName(); - + public static UtilCache<String, Map<String, String>> appletSessions = new UtilCache<String, Map<String, String>>("AppletSessions", 0, 600000, true); - - public static String checkAppletRequest(HttpServletRequest request, HttpServletResponse response) { - GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator"); + + public static String checkAppletRequest(HttpServletRequest request, HttpServletResponse response) { + GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator"); String sessionId = request.getParameter("sessionId"); String visitId = request.getParameter("visitId"); sessionId = sessionId.trim(); visitId = visitId.trim(); - + String responseString = ""; - + GenericValue visit = null; try { - visit = delegator.findOne("Visit", false, "visitId", visitId); + visit = delegator.findOne("Visit", false, "visitId", visitId); } catch (GenericEntityException e) { Debug.logError(e, "Cannot Visit Object", module); } - - if (visit != null && visit.getString("sessionId").equals(sessionId) && appletSessions.containsKey(sessionId)) { + + if (visit != null && visit.getString("sessionId").equals(sessionId) && appletSessions.containsKey(sessionId)) { Map<String, String> sessionMap = appletSessions.get(sessionId); if (sessionMap != null && sessionMap.containsKey("followPage")) - responseString = sessionMap.remove("followPage"); - } - + responseString = sessionMap.remove("followPage"); + } + try { PrintWriter out = response.getWriter(); response.setContentType("text/plain"); @@ -80,29 +80,29 @@ } catch (IOException e) { Debug.logError(e, "Problems writing servlet output!", module); } - + return "success"; - } - + } + public static String receiveAppletRequest(HttpServletRequest request, HttpServletResponse response) { - GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator"); + GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator"); String sessionId = request.getParameter("sessionId"); String visitId = request.getParameter("visitId"); sessionId = sessionId.trim(); visitId = visitId.trim(); - + String responseString = "ERROR"; - + GenericValue visit = null; try { - visit = delegator.findOne("Visit", false, "visitId", visitId); + visit = delegator.findOne("Visit", false, "visitId", visitId); } catch (GenericEntityException e) { Debug.logError(e, "Cannot Visit Object", module); - } - - if (visit.getString("sessionId").equals(sessionId)) { + } + + if (visit.getString("sessionId").equals(sessionId)) { String currentPage = request.getParameter("currentPage"); - if (appletSessions.containsKey(sessionId)) { + if (appletSessions.containsKey(sessionId)) { Map<String, String> sessionMap = appletSessions.get(sessionId); String followers = sessionMap.get("followers"); List<String> folList = StringUtil.split(followers, ","); @@ -110,7 +110,7 @@ Map<String, String> folSesMap = UtilMisc.toMap("followPage", currentPage); appletSessions.put(follower, folSesMap); } - } + } responseString = "OK"; } @@ -122,16 +122,16 @@ } catch (IOException e) { Debug.logError(e, "Problems writing servlet output!", module); } - + return "success"; } - + public static String setAppletFollower(HttpServletRequest request, HttpServletResponse response) { Security security = (Security) request.getAttribute("security"); GenericValue userLogin = (GenericValue) request.getSession().getAttribute("userLogin"); String visitId = request.getParameter("visitId"); if (visitId != null) request.setAttribute("visitId", visitId); - if (security.hasPermission("SEND_CONTROL_APPLET", userLogin)) { + if (security.hasPermission("SEND_CONTROL_APPLET", userLogin)) { String followerSessionId = request.getParameter("followerSid"); String followSessionId = request.getParameter("followSid"); Map<String, String> follow = appletSessions.get(followSessionId); @@ -143,9 +143,9 @@ followerListStr = followerListStr + "," + followerSessionId; } appletSessions.put(followSessionId, follow); - appletSessions.put(followerSessionId, null); + appletSessions.put(followerSessionId, null); } - return "success"; + return "success"; } public static String setFollowerPage(HttpServletRequest request, HttpServletResponse response) { @@ -153,7 +153,7 @@ GenericValue userLogin = (GenericValue) request.getSession().getAttribute("userLogin"); String visitId = request.getParameter("visitId"); if (visitId != null) request.setAttribute("visitId", visitId); - if (security.hasPermission("SEND_CONTROL_APPLET", userLogin)) { + if (security.hasPermission("SEND_CONTROL_APPLET", userLogin)) { String followerSessionId = request.getParameter("followerSid"); String pageUrl = request.getParameter("pageUrl"); Map<String, String> follow = appletSessions.get(followerSessionId); @@ -161,7 +161,7 @@ follow.put("followPage", pageUrl); appletSessions.put(followerSessionId, follow); } - return "success"; + return "success"; } /** Simple event to set the users per-session locale setting. The user's locale Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonServices.java?rev=757078&r1=757077&r2=757078&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonServices.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonServices.java Sat Mar 21 23:25:08 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -177,7 +177,7 @@ Debug.set(Debug.INFO, "Y".equalsIgnoreCase((String) context.get("info"))); Debug.set(Debug.TIMING, "Y".equalsIgnoreCase((String) context.get("timing"))); Debug.set(Debug.VERBOSE, "Y".equalsIgnoreCase((String) context.get("verbose"))); - + return ServiceUtil.returnSuccess(); } @@ -185,7 +185,7 @@ String name = (String) context.get("name"); String level = (String) context.get("level"); boolean additivity = "Y".equalsIgnoreCase((String) context.get("additivity")); - + Logger logger = null; if ("root".equals(name)) { logger = Logger.getRootLogger(); @@ -194,7 +194,7 @@ } logger.setLevel(Level.toLevel(level)); logger.setAdditivity(additivity); - + return ServiceUtil.returnSuccess(); } @@ -458,8 +458,8 @@ try { while ((line = reader.readLine()) != null) { Debug.log("Read line: " + line, module); - writer.write(line); - } + writer.write(line); + } } catch (IOException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -469,7 +469,7 @@ } catch (Exception e) { Debug.logError(e, module); } - } + } Map<String, Object> result = ServiceUtil.returnSuccess(); result.put("contentType", "text/plain"); Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java?rev=757078&r1=757077&r2=757078&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java Sat Mar 21 23:25:08 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -38,20 +38,20 @@ * Common Workers */ public class CommonWorkers { - + public final static String module = CommonWorkers.class.getName(); public static List<GenericValue> getCountryList(GenericDelegator delegator) { List<GenericValue> geoList = FastList.newInstance(); String defaultCountry = UtilProperties.getPropertyValue("general.properties", "country.geo.id.default"); GenericValue defaultGeo = null; - if (defaultCountry != null && defaultCountry.length() > 0) { + if (defaultCountry != null && defaultCountry.length() > 0) { try { defaultGeo = delegator.findByPrimaryKeyCache("Geo", UtilMisc.toMap("geoId", defaultCountry)); } catch (GenericEntityException e) { Debug.logError(e, "Cannot lookup Geo", module); - } - } + } + } try { List<GenericValue> countryGeoList = delegator.findByAndCache("Geo", UtilMisc.toMap("geoTypeId", "COUNTRY"), UtilMisc.toList("geoName")); if (defaultGeo != null) { @@ -62,12 +62,12 @@ } } catch (GenericEntityException e) { Debug.logError(e, "Cannot lookup Geo", module); - } - return geoList; + } + return geoList; } - + public static List<GenericValue> getStateList(GenericDelegator delegator) { - List<GenericValue> geoList = FastList.newInstance(); + List<GenericValue> geoList = FastList.newInstance(); EntityCondition condition = EntityCondition.makeCondition(EntityOperator.OR, EntityCondition.makeCondition("geoTypeId", "STATE"), EntityCondition.makeCondition("geoTypeId", "PROVINCE"), EntityCondition.makeCondition("geoTypeId", "TERRITORY")); @@ -77,8 +77,8 @@ } catch (GenericEntityException e) { Debug.logError(e, "Cannot lookup State Geos: " + e.toString(), module); } - return geoList; - } + return geoList; + } /** * Returns a list of regional geo associations. @@ -101,8 +101,8 @@ geoList = delegator.findList("GeoAssocAndGeoTo", stateProvinceFindCond, null, sortList, null, true); } catch (GenericEntityException e) { Debug.logError(e, "Cannot lookup Geo", module); - } - - return geoList; - } + } + + return geoList; + } } Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/DataModelConstants.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/DataModelConstants.java?rev=757078&r1=757077&r2=757078&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/DataModelConstants.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/DataModelConstants.java Sat Mar 21 23:25:08 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java?rev=757078&r1=757077&r2=757078&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java Sat Mar 21 23:25:08 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -91,7 +91,7 @@ * * This is use to the generic method that expects entity data affixed with special suffixes * to indicate their purpose in formulating an SQL query statement. - * @param inputFields Input parameters run thru UtilHttp.getParameterMap + * @param inputFields Input parameters run thru UtilHttp.getParameterMap * @return a map with field name and operator */ public static HashMap<String, HashMap<String, HashMap<String, Object>>> prepareField(Map<String, ?> inputFields, Map<String, Object> queryStringMap, Map<String, List<Object[]>> origValueMap) { @@ -201,14 +201,14 @@ } return normalizedFields; } - + /** * createCondition, comparing the normalizedFields with the list of keys, . * * This is use to the generic method that expects entity data affixed with special suffixes * to indicate their purpose in formulating an SQL query statement. - * @param keys list of field for which it's possible to make the query - * @param normalizedFields list of field the user have populated + * @param keys list of field for which it's possible to make the query + * @param normalizedFields list of field the user have populated * @return a arrayList usable to create an entityCondition */ public static ArrayList<EntityCondition> createCondition(ModelEntity modelEntity, HashMap<String, HashMap<String, HashMap<String, Object>>> normalizedFields, Map<String, Object> queryStringMap, Map<String, List<Object[]>> origValueMap, GenericDelegator delegator, Map<String, ?> context) { @@ -293,7 +293,7 @@ } else { fieldObject = fieldValue; } - + if (ignoreCase != null && ignoreCase.equals("Y") && "java.lang.String".equals(fieldObject.getClass().getName())) { cond = EntityCondition.makeCondition(EntityFunction.UPPER_FIELD(fieldName), (EntityComparisonOperator) fieldOp, EntityFunction.UPPER(((String)fieldValue).toUpperCase())); } else { @@ -354,27 +354,27 @@ } return tmpList; } - + /** - * + * * same as performFind but now returning a list instead of an iterator * Extra parameters viewIndex: startPage of the partial list (0 = first page) * viewSize: the length of the page (number of records) * Extra output parameter: listSize: size of the totallist * list : the list itself. - * + * * @param dctx * @param context * @return Map */ public static Map<String, Object> performFindList(DispatchContext dctx, Map<String, ?> context) { Map<String, Object> result = performFind(dctx,context); - + Integer viewSize = (Integer) context.get("viewSize"); - if (viewSize == null) viewSize = Integer.valueOf(20); // default + if (viewSize == null) viewSize = Integer.valueOf(20); // default Integer viewIndex = (Integer) context.get("viewIndex"); if (viewIndex == null) viewIndex = Integer.valueOf(0); // default - + int start = viewIndex.intValue() * viewSize.intValue(); List<GenericValue> list = null; Integer listSize = null; @@ -387,13 +387,13 @@ } catch (Exception e) { Debug.logInfo("Problem getting partial list" + e,module); } - + result.put("listSize", listSize); result.put("list",list); result.remove("listIt"); return result; } - + /** * performFind * @@ -407,7 +407,7 @@ String noConditionFind = (String) context.get("noConditionFind"); String distinct = (String) context.get("distinct"); List fieldList = (List) context.get("fieldList"); - GenericValue userLogin = (GenericValue) context.get("userLogin"); + GenericValue userLogin = (GenericValue) context.get("userLogin"); if (UtilValidate.isEmpty(noConditionFind)) { // try finding in inputFields Map noConditionFind = (String) inputFields.get("noConditionFind"); @@ -433,7 +433,7 @@ } EntityConditionList exprList = (EntityConditionList)prepareResult.get("entityConditionList"); List<String> orderByList = checkList(prepareResult.get("orderByList"), String.class); - + Map<String, Object> executeResult = null; try { executeResult = dispatcher.runSync("executeFind", UtilMisc.toMap("entityName", entityName, "orderByList", orderByList, "fieldList", fieldList, "entityConditionList", exprList, "noConditionFind", noConditionFind, "distinct", distinct, "locale", context.get("locale"), "timeZone", context.get("timeZone"))); @@ -444,14 +444,14 @@ if (executeResult.get("listIt") == null) { if (Debug.verboseOn()) Debug.logVerbose("No list iterator found for query string + [" + prepareResult.get("queryString") + "]", module); } - + Map<String, Object> results = ServiceUtil.returnSuccess(); results.put("listIt", executeResult.get("listIt")); results.put("queryString", prepareResult.get("queryString")); results.put("queryStringMap", prepareResult.get("queryStringMap")); return results; } - + /** * prepareFind * @@ -493,7 +493,7 @@ ArrayList<EntityCondition> tmpList = createCondition(modelEntity, normalizedFields, queryStringMap, origValueMap, delegator, context); /* the filter by date condition should only be added when there are other conditions or when - * the user has specified a noConditionFind. Otherwise, specifying filterByDate will become + * the user has specified a noConditionFind. Otherwise, specifying filterByDate will become * its own condition. */ if ((tmpList.size() > 0) || ((noConditionFind != null) && (noConditionFind.equals("Y")))) { @@ -512,7 +512,7 @@ if (tmpList.size() > 0) { exprList = EntityCondition.makeCondition(tmpList); } - + List<String> orderByList = null; if (UtilValidate.isNotEmpty(orderBy)) { orderByList = StringUtil.split(orderBy,"|"); @@ -526,7 +526,7 @@ String queryString = UtilHttp.urlEncodeArgs(reducedQueryStringMap); results.put("queryString", queryString); results.put("queryStringMap", reducedQueryStringMap); - + results.put("orderByList", orderByList); results.put("entityConditionList", exprList); return results; @@ -544,7 +544,7 @@ boolean noConditionFind = "Y".equals((String) context.get("noConditionFind")); boolean distinct = "Y".equals((String) context.get("distinct")); List fieldList = (List) context.get("fieldList"); - Set fieldSet = null; + Set fieldSet = null; if (fieldList != null) { fieldSet = new HashSet(fieldList); } @@ -553,7 +553,7 @@ EntityListIterator listIt = null; try { if (noConditionFind || (entityConditionList != null && entityConditionList.getConditionListSize() > 0)) { - listIt = delegator.find(entityName, entityConditionList, null, fieldSet, orderByList, + listIt = delegator.find(entityName, entityConditionList, null, fieldSet, orderByList, new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, distinct)); } } catch (GenericEntityException e) { @@ -564,7 +564,7 @@ results.put("listIt", listIt); return results; } - + private static String dayStart(String timeStampString, int daysLater) { String retValue = null; Timestamp ts = null; @@ -650,14 +650,14 @@ /** * Returns the first generic item of the service 'performFind' * Same parameters as performFind service but returns a single GenericValue - * + * * @param dctx * @param context * @return */ public static Map<String, Object> performFindItem(DispatchContext dctx, Map<String, ?> context) { Map<String, Object> result = org.ofbiz.common.FindServices.performFind(dctx,context); - + List<GenericValue> list = null; GenericValue item= null; try { @@ -670,7 +670,7 @@ } catch (Exception e) { Debug.logInfo("Problem getting list Item" + e,module); } - + if (!UtilValidate.isEmpty(item)) { result.put("item",item); } Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/FtpServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/FtpServices.java?rev=757078&r1=757077&r2=757078&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/FtpServices.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/FtpServices.java Sat Mar 21 23:25:08 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/KeywordSearchUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/KeywordSearchUtil.java?rev=757078&r1=757077&r2=757078&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/KeywordSearchUtil.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/KeywordSearchUtil.java Sat Mar 21 23:25:08 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -62,14 +62,14 @@ String seps = UtilProperties.getPropertyValue("keywordsearch", "index.keyword.separators", ";: ,.!?\t\"\'\r\n\\/()[]{}*%<>-+_"); return seps; } - + public static String getStopWordBagOr() { return UtilProperties.getPropertyValue("keywordsearch", "stop.word.bag.or"); } public static String getStopWordBagAnd() { return UtilProperties.getPropertyValue("keywordsearch", "stop.word.bag.and"); } - + public static boolean getRemoveStems() { String removeStemsStr = UtilProperties.getPropertyValue("keywordsearch", "remove.stems"); return "true".equals(removeStemsStr); @@ -87,7 +87,7 @@ } return stemSet; } - + public static void processForKeywords(String str, Map<String, Long> keywords, boolean forSearch, boolean anyPrefix, boolean anySuffix, boolean isAnd) { String separators = getSeparators(); String stopWordBagOr = getStopWordBagOr(); @@ -95,10 +95,10 @@ boolean removeStems = getRemoveStems(); Set<String> stemSet = getStemSet(); - + processForKeywords(str, keywords, separators, stopWordBagAnd, stopWordBagOr, removeStems, stemSet, forSearch, anyPrefix, anySuffix, isAnd); } - + public static void processKeywordsForIndex(String str, Map<String, Long> keywords, String separators, String stopWordBagAnd, String stopWordBagOr, boolean removeStems, Set<String> stemSet) { processForKeywords(str, keywords, separators, stopWordBagAnd, stopWordBagOr, removeStems, stemSet, false, false, false, false); } @@ -107,16 +107,16 @@ Set<String> keywordSet = makeKeywordSet(str, separators, forSearch); fixupKeywordSet(keywordSet, keywords, stopWordBagAnd, stopWordBagOr, removeStems, stemSet, forSearch, anyPrefix, anySuffix, isAnd); } - + public static void fixupKeywordSet(Set<String> keywordSet, Map<String, Long> keywords, String stopWordBagAnd, String stopWordBagOr, boolean removeStems, Set<String> stemSet, boolean forSearch, boolean anyPrefix, boolean anySuffix, boolean isAnd) { if (keywordSet == null) { return; } - + for (String token: keywordSet) { - + // when cleaning up the tokens the ordering is inportant: check stop words, remove stems, then get rid of 1 character tokens (1 digit okay) - + // check stop words String colonToken = ":" + token + ":"; if (forSearch) { @@ -128,7 +128,7 @@ continue; } } - + // remove stems if (removeStems) { for (String stem: stemSet) { @@ -137,12 +137,12 @@ } } } - + // get rid of all length 0 tokens now if (token.length() == 0) { continue; } - + // get rid of all length 1 character only tokens, pretty much useless if (token.length() == 1 && Character.isLetter(token.charAt(0))) { continue; @@ -162,7 +162,7 @@ } token = strSb.toString(); } - + // group by word, add up weight Long curWeight = (Long) keywords.get(token); if (curWeight == null) { @@ -175,12 +175,12 @@ public static Set<String> makeKeywordSet(String str, String separators, boolean forSearch) { if (separators == null) separators = getSeparators(); - + Set<String> keywords = new TreeSet<String>(); if (str.length() > 0) { // strip off weird characters str = str.replaceAll("\\\302\\\240|\\\240", " "); - + if (forSearch) { // remove %_*? from separators if is for a search StringBuilder sb = new StringBuilder(separators); @@ -190,7 +190,7 @@ if (sb.indexOf("?") >= 0) sb.deleteCharAt(sb.indexOf("?")); separators = sb.toString(); } - + StringTokenizer tokener = new StringTokenizer(str, separators, false); while (tokener.hasMoreTokens()) { // make sure it is lower case before doing anything else @@ -201,7 +201,7 @@ token = token.replace('*', '%'); token = token.replace('?', '_'); } - + keywords.add(token); } } Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/email/EmailServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/email/EmailServices.java?rev=757078&r1=757077&r2=757078&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/email/EmailServices.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/email/EmailServices.java Sat Mar 21 23:25:08 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -165,10 +165,10 @@ } if (UtilValidate.isEmpty(socketFactoryClass)) { socketFactoryClass = UtilProperties.getPropertyValue("general.properties", "mail.smtp.socketFactory.class"); - } + } if (UtilValidate.isEmpty(socketFactoryFallback)) { socketFactoryFallback = UtilProperties.getPropertyValue("general.properties", "mail.smtp.socketFactory.fallback", "false"); - } + } } else if (sendVia == null) { return ServiceUtil.returnError("Parameter sendVia is required when sendType is not mail.smtp.host"); } @@ -176,7 +176,7 @@ if (contentType == null) { contentType = "text/html"; } - + if (UtilValidate.isNotEmpty(bodyParts)) { contentType = "multipart/mixed"; } @@ -189,8 +189,8 @@ props.put("mail.smtp.port", port); } if (UtilValidate.isNotEmpty(socketFactoryPort)) { - props.put("mail.smtp.socketFactory.port", socketFactoryPort); - } + props.put("mail.smtp.socketFactory.port", socketFactoryPort); + } if (UtilValidate.isNotEmpty(socketFactoryClass)) { props.put("mail.smtp.socketFactory.class", socketFactoryClass); Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); @@ -204,7 +204,7 @@ Session session = Session.getInstance(props); boolean debug = UtilProperties.propertyValueEqualsIgnoreCase("general.properties", "mail.debug.on", "Y"); - session.setDebug(debug); + session.setDebug(debug); MimeMessage mail = new MimeMessage(session); if (messageId != null) { @@ -383,9 +383,9 @@ return ServiceUtil.returnError(errMsg); } } - + boolean isMultiPart = false; - + // check if attachment screen location passed in if (UtilValidate.isNotEmpty(xslfoAttachScreenLocation)) { isMultiPart = true; @@ -398,7 +398,7 @@ screensAtt.populateContextForService(dctx, bodyParameters); screenContextAtt.putAll(bodyParameters); screensAtt.render(xslfoAttachScreenLocation); - + /* try { // save generated fo file for debugging String buf = writer.toString(); @@ -415,7 +415,7 @@ // create the output stream for the generation ByteArrayOutputStream baos = new ByteArrayOutputStream(); - + Fop fop = ApacheFopWorker.createFopInstance(baos, MimeConstants.MIME_PDF); ApacheFopWorker.transform(src, null, fop); @@ -472,7 +472,7 @@ serviceContext.put("contentType", "text/html"); } } - + // also expand the subject at this point, just in case it has the FlexibleStringExpander syntax in it... String subject = (String) serviceContext.remove("subject"); subject = FlexibleStringExpander.expandString(subject, screenContext, locale); @@ -492,16 +492,16 @@ String errMsg = "Error send email :" + e.toString(); Debug.logError(e, errMsg, module); return ServiceUtil.returnError(errMsg); - } + } result.put("body", bodyWriter.toString()); return result; } - + /** class to create a file in memory required for sending as an attachment */ public static class StringDataSource implements DataSource { private String contentType; private ByteArrayOutputStream contentArray; - + public StringDataSource(String content, String contentType) throws IOException { this.contentType = contentType; contentArray = new ByteArrayOutputStream(); @@ -509,7 +509,7 @@ contentArray.flush(); contentArray.close(); } - + public String getContentType() { return contentType == null ? "application/octet-stream" : contentType; } @@ -531,12 +531,12 @@ public static class ByteArrayDataSource implements DataSource { private String contentType; private byte[] contentArray; - + public ByteArrayDataSource(byte[] content, String contentType) throws IOException { this.contentType = contentType; this.contentArray = content; } - + public String getContentType() { return contentType == null ? "application/octet-stream" : contentType; } Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/email/NotificationServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/email/NotificationServices.java?rev=757078&r1=757077&r2=757078&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/email/NotificationServices.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/email/NotificationServices.java Sat Mar 21 23:25:08 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -49,9 +49,9 @@ * Provides generic services related to preparing and * delivering notifications via email. * <p> - * To use the NotificationService, a message specific service should be + * To use the NotificationService, a message specific service should be * defined for a particular <a href="http://freemarker.sourceforge.net/docs/dgui_quickstart_template.html"> - * Freemarker Template</a> mapping the required fields of the + * Freemarker Template</a> mapping the required fields of the * template to the required attributes of the service. * <p> * This service definition should extend the <code>sendNotificationInterface<code> @@ -70,19 +70,19 @@ * </blockquote> * <p> * An optional parameter available to all message templates is <code>baseUrl</code> - * which can either be specified when the service is invoked or let the - * <code>NotificationService</code> attempt to resolve it as best it can, + * which can either be specified when the service is invoked or let the + * <code>NotificationService</code> attempt to resolve it as best it can, * see {@link #setBaseUrl(GenericDelegator, String, Map) setBaseUrl(Map)} for details on how this is achieved. * <p> - * The following example shows what a simple notification message template, - * associated with the above service, might contain: + * The following example shows what a simple notification message template, + * associated with the above service, might contain: * <blockquote> * <pre> * Please use the following link to schedule a delivery date: * <p> * ${baseUrl}/ordermgr/control/schedulepo?orderId=${orderId}" * </pre> - * </blockquote> + * </blockquote> * <p> * The template file must be found on the classpath at runtime and * match the "templateName" field passed to the service when it @@ -92,15 +92,15 @@ * to implement a custom service that takes one or two parameters that can * be used to resolve the rest of the required fields and then pass them to * the {@link #prepareNotification(DispatchContext, Map) prepareNotification(DispatchContext, Map)} - * or {@link #sendNotification(DispatchContext, Map) sendNotification(DispatchContext, Map)} + * or {@link #sendNotification(DispatchContext, Map) sendNotification(DispatchContext, Map)} * methods directly to generate or generate and send the notification respectively. - * + * */ public class NotificationServices { public static final String module = NotificationServices.class.getName(); - /** + /** * This will use the {@link #prepareNotification(DispatchContext, Map) prepareNotification(DispatchContext, Map)} * method to generate the body of the notification message to send * and then deliver it via the "sendMail" service. @@ -110,26 +110,26 @@ * specified body instead. This can be used to combine both service * calls in a decoupled manner if other steps are required between * generating the message body and sending the notification. - * + * * @param ctx The dispatching context of the service * @param context The map containing all the fields associated with * the sevice * @return A Map with the service response messages in it */ public static Map<String, Object> sendNotification(DispatchContext ctx, Map<String, ? extends Object> context) { - LocalDispatcher dispatcher = ctx.getDispatcher(); + LocalDispatcher dispatcher = ctx.getDispatcher(); Map result = null; - + try { // see whether the optional 'body' attribute was specified or needs to be processed // nulls are handled the same as not specified - String body = (String) context.get("body"); - - if (body == null) { - // prepare the body of the notification email + String body = (String) context.get("body"); + + if (body == null) { + // prepare the body of the notification email Map bodyResult = prepareNotification(ctx, context); - - // ensure the body was generated successfully + + // ensure the body was generated successfully if (bodyResult.get(ModelService.RESPONSE_MESSAGE).equals(ModelService.RESPOND_SUCCESS)) { body = (String) bodyResult.get("body"); } else { @@ -138,7 +138,7 @@ body = null; } } - + // make sure we have a valid body before sending if (body != null) { // retain only the required attributes for the sendMail service @@ -152,9 +152,9 @@ emailContext.put("sendVia", context.get("sendVia")); emailContext.put("sendType", context.get("sendType")); emailContext.put("contentType", context.get("contentType")); - - // pass on to the sendMail service - result = dispatcher.runSync("sendMail", emailContext); + + // pass on to the sendMail service + result = dispatcher.runSync("sendMail", emailContext); } else { Debug.logError("Invalid email body; null is not allowed", module); result = ServiceUtil.returnError("Invalid email body; null is not allowed"); @@ -175,44 +175,44 @@ * The result returned will contain the appropriate response * messages indicating succes or failure and the OUT parameter, * "body" containing the generated message. - * + * * @param ctx The dispatching context of the service * @param context The map containing all the fields associated with * the sevice * @return A new Map indicating success or error containing the - * body generated from the template and the input parameters. + * body generated from the template and the input parameters. */ public static Map<String, Object> prepareNotification(DispatchContext ctx, Map<String, ? extends Object> context) { GenericDelegator delegator = ctx.getDelegator(); String templateName = (String) context.get("templateName"); Map templateData = (Map) context.get("templateData"); String webSiteId = (String) context.get("webSiteId"); - - Map result = null; + + Map result = null; if (templateData == null) { templateData = FastMap.newInstance(); } - + try { // ensure the baseURl is defined setBaseUrl(delegator, webSiteId, templateData); - + // initialize the template reader and processor URL templateUrl = UtilURL.fromResource(templateName); - + if (templateUrl == null) { Debug.logError("Problem getting the template URL: " + templateName + " not found", module); return ServiceUtil.returnError("Problem finding template; see logs"); } - + // process the template with the given data and write // the email body to the String buffer Writer writer = new StringWriter(); FreeMarkerWorker.renderTemplate(templateUrl.toExternalForm(), templateData, writer); // extract the newly created body for the notification email - String notificationBody = writer.toString(); - + String notificationBody = writer.toString(); + // generate the successfull reponse result = ServiceUtil.returnSuccess("Message body generated successfully"); result.put("body", notificationBody); @@ -234,17 +234,17 @@ * <code>baseUrl</code> field is set in the given context. * <p> * If it has been specified a default <code>baseUrl</code> will be - * set using a best effort approach. If it is specified in the + * set using a best effort approach. If it is specified in the * url.properties configuration files of the system, that will be - * used, otherwise it will attempt resolve the fully qualified + * used, otherwise it will attempt resolve the fully qualified * local host name. * <p> * <i>Note:</i> I thought it might be useful to have some dynamic way * of extending the default properties provided by the NotificationService, - * such as the <code>baseUrl</code>, perhaps using the standard + * such as the <code>baseUrl</code>, perhaps using the standard * <code>ResourceBundle</code> java approach so that both classes * and static files may be invoked. - * + * * @param context The context to check and, if necessary, set the * <code>baseUrl</code>. */ @@ -253,14 +253,14 @@ if (!context.containsKey("baseUrl")) { StringBuilder httpBase = null; StringBuilder httpsBase = null; - - String localServer = null; - + + String localServer = null; + String httpsPort = null; String httpsServer = null; String httpPort = null; String httpServer = null; - Boolean enableHttps = null; + Boolean enableHttps = null; try { // using just the IP address of localhost if we don't have a defined server @@ -271,7 +271,7 @@ localServer = "127.0.0.1"; } - // load the properties from the website entity + // load the properties from the website entity GenericValue webSite = null; if (webSiteId != null) { try { @@ -287,9 +287,9 @@ Debug.logWarning(e, "Problems with WebSite entity; using global defaults", module); } } - + // fill in any missing properties with fields from the global file - if (UtilValidate.isEmpty(httpsPort)) { + if (UtilValidate.isEmpty(httpsPort)) { httpsPort = UtilProperties.getPropertyValue("url.properties", "port.https", "443"); } if (UtilValidate.isEmpty(httpsServer)) { @@ -304,7 +304,7 @@ if (UtilValidate.isEmpty(enableHttps)) { enableHttps = (UtilProperties.propertyValueEqualsIgnoreCase("url.properties", "port.https.enabled", "Y")) ? Boolean.TRUE : Boolean.FALSE; } - + // prepare the (non-secure) URL httpBase = new StringBuilder("http://"); httpBase.append(httpServer); @@ -315,7 +315,7 @@ // set the base (non-secure) URL for any messages requiring it context.put("baseUrl", httpBase.toString()); - + if (enableHttps.booleanValue()) { // prepare the (secure) URL httpsBase = new StringBuilder("https://"); @@ -324,12 +324,12 @@ httpsBase.append(":"); httpsBase.append(httpsPort); } - + // set the base (secure) URL for any messages requiring it context.put("baseSecureUrl", httpsBase.toString()); } else { context.put("baseSecureUrl", httpBase.toString()); - } + } } } } Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/geo/GeoWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/geo/GeoWorker.java?rev=757078&r1=757077&r2=757078&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/geo/GeoWorker.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/geo/GeoWorker.java Sat Mar 21 23:25:08 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -84,7 +84,7 @@ return geoList; } - + public static Set<String> expandGeoRegionDeep(Set<String> geoIdSet, GenericDelegator delegator) throws GenericEntityException { if (geoIdSet == null || geoIdSet.size() == 0) { return geoIdSet; @@ -120,7 +120,7 @@ //Debug.log("Contains Geo : " + geoList.contains(geo)); return geoList.contains(geo); } - + public static GenericValue findLatestGeoPoint(GenericDelegator delegator, String Entity, String mainId, String mainValueId, String secondId, String secondValueId) { List<GenericValue> gptList = null; if (UtilValidate.isNotEmpty(secondId) && UtilValidate.isNotEmpty(secondValueId)) { @@ -141,5 +141,5 @@ return EntityUtil.getFirst(gptList); } return null; - } + } } Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/image/ImageTransform.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/image/ImageTransform.java?rev=757078&r1=757077&r2=757078&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/image/ImageTransform.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/image/ImageTransform.java Sat Mar 21 23:25:08 2009 @@ -1,240 +1,240 @@ -/******************************************************************************* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations - * under the License. - *******************************************************************************/ -package org.ofbiz.common.image; - -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; -import java.util.List; -import java.util.Locale; -import java.util.Map; - -import javax.imageio.ImageIO; - -import javolution.util.FastMap; - -import org.jdom.Document; -import org.jdom.Element; -import org.jdom.JDOMException; -import org.jdom.input.SAXBuilder; -import org.ofbiz.base.util.Debug; -import org.ofbiz.base.util.UtilProperties; + * under the License. + *******************************************************************************/ +package org.ofbiz.common.image; + +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +import javax.imageio.ImageIO; + +import javolution.util.FastMap; + +import org.jdom.Document; +import org.jdom.Element; +import org.jdom.JDOMException; +import org.jdom.input.SAXBuilder; +import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilProperties; -/** +/** * ImageTransform Class - * <p> + * <p> * Services to apply transformation to images - */ -public class ImageTransform { + */ +public class ImageTransform { - public static final String module = ImageTransform.class.getName(); - public static final String resource = "CommonErrorUiLabels"; + public static final String module = ImageTransform.class.getName(); + public static final String resource = "CommonErrorUiLabels"; - public ImageTransform() { - } + public ImageTransform() { + } - /** - * getBufferedImage - * <p> - * Set a buffered image - * - * @param context - * @param fileLocation Full file Path or URL + /** + * getBufferedImage + * <p> + * Set a buffered image + * + * @param context + * @param fileLocation Full file Path or URL * @return URL images for all different size types - * @throws IOException Error prevents the document from being fully parsed - * @throws JDOMException Errors occur in parsing - */ - public static Map<String, Object> getBufferedImage(String fileLocation, Locale locale) - throws IllegalArgumentException, IOException { - - /* VARIABLES */ - BufferedImage bufImg; - Map<String, Object> result = FastMap.newInstance(); - - /* BUFFERED IMAGE */ - try { - bufImg = ImageIO.read(new File(fileLocation)); - } catch (IllegalArgumentException e) { - String errMsg = UtilProperties.getMessage(resource, "ImageTransform.input_is_null", locale) + " : " + fileLocation + " ; " + e.toString(); - Debug.logError(errMsg, module); - result.put("errorMessage", errMsg); - return result; - } catch (IOException e) { - String errMsg = UtilProperties.getMessage(resource, "ImageTransform.error_occurs_during_reading", locale) + " : " + fileLocation + " ; " + e.toString(); - Debug.logError(errMsg, module); - result.put("errorMessage", errMsg); - return result; - } - - result.put("responseMessage", "success"); - result.put("bufferedImage", bufImg); - return result; - - } - - /** - * scaleImage - * <p> + * @throws IOException Error prevents the document from being fully parsed + * @throws JDOMException Errors occur in parsing + */ + public static Map<String, Object> getBufferedImage(String fileLocation, Locale locale) + throws IllegalArgumentException, IOException { + + /* VARIABLES */ + BufferedImage bufImg; + Map<String, Object> result = FastMap.newInstance(); + + /* BUFFERED IMAGE */ + try { + bufImg = ImageIO.read(new File(fileLocation)); + } catch (IllegalArgumentException e) { + String errMsg = UtilProperties.getMessage(resource, "ImageTransform.input_is_null", locale) + " : " + fileLocation + " ; " + e.toString(); + Debug.logError(errMsg, module); + result.put("errorMessage", errMsg); + return result; + } catch (IOException e) { + String errMsg = UtilProperties.getMessage(resource, "ImageTransform.error_occurs_during_reading", locale) + " : " + fileLocation + " ; " + e.toString(); + Debug.logError(errMsg, module); + result.put("errorMessage", errMsg); + return result; + } + + result.put("responseMessage", "success"); + result.put("bufferedImage", bufImg); + return result; + + } + + /** + * scaleImage + * <p> * scale original image related to the ImageProperties.xml dimensions - * - * @param bufImg Buffered image to scale - * @param imgHeight Original image height - * @param imgwidth Original image width - * @param dimensionMap Image dimensions by size type - * @param sizeType Size type to scale - * @return New scaled buffered image - */ - public static Map<String, Object> scaleImage(BufferedImage bufImg, double imgHeight, double imgWidth, Map<String, Map<String, String>> dimensionMap, String sizeType, Locale locale) { - - /* VARIABLES */ - BufferedImage bufNewImg; - double defaultHeight, defaultWidth, scaleFactor; - Map<String, Object> result = FastMap.newInstance(); - - /* DIMENSIONS from ImageProperties */ - defaultHeight = Double.parseDouble(dimensionMap.get(sizeType).get("height").toString()); - defaultWidth = Double.parseDouble(dimensionMap.get(sizeType).get("width").toString()); - if (defaultHeight == 0.0 || defaultWidth == 0.0) { - String errMsg = UtilProperties.getMessage(resource, "ImageTransform.one_default_dimension_is_null", locale) + " : defaultHeight = " + defaultHeight + " ; defaultWidth = " + defaultWidth; - Debug.logError(errMsg, module); - result.put("errorMessage", errMsg); - return result; - } + * + * @param bufImg Buffered image to scale + * @param imgHeight Original image height + * @param imgwidth Original image width + * @param dimensionMap Image dimensions by size type + * @param sizeType Size type to scale + * @return New scaled buffered image + */ + public static Map<String, Object> scaleImage(BufferedImage bufImg, double imgHeight, double imgWidth, Map<String, Map<String, String>> dimensionMap, String sizeType, Locale locale) { + + /* VARIABLES */ + BufferedImage bufNewImg; + double defaultHeight, defaultWidth, scaleFactor; + Map<String, Object> result = FastMap.newInstance(); + + /* DIMENSIONS from ImageProperties */ + defaultHeight = Double.parseDouble(dimensionMap.get(sizeType).get("height").toString()); + defaultWidth = Double.parseDouble(dimensionMap.get(sizeType).get("width").toString()); + if (defaultHeight == 0.0 || defaultWidth == 0.0) { + String errMsg = UtilProperties.getMessage(resource, "ImageTransform.one_default_dimension_is_null", locale) + " : defaultHeight = " + defaultHeight + " ; defaultWidth = " + defaultWidth; + Debug.logError(errMsg, module); + result.put("errorMessage", errMsg); + return result; + } - /* SCALE FACTOR */ + /* SCALE FACTOR */ // find the right Scale Factor related to the Image Dimensions - if (imgHeight > imgWidth) { - scaleFactor = defaultHeight / imgHeight; - if (scaleFactor == 0.0) { - String errMsg = UtilProperties.getMessage(resource, "ImageTransform.height_scale_factor_is_null", locale) + " (defaultHeight = " + defaultHeight + "; imgHeight = " + imgHeight; - Debug.logError(errMsg, module); - result.put("errorMessage", errMsg); - return result; - } - // get scaleFactor from the smallest width - if (defaultWidth < (imgWidth * scaleFactor)) { - scaleFactor = defaultWidth / imgWidth; - } - } else { - scaleFactor = defaultWidth / imgWidth; - if (scaleFactor == 0.0) { - String errMsg = UtilProperties.getMessage(resource, "ImageTransform.width_scale_factor_is_null", locale) + " (defaultWidth = " + defaultWidth + "; imgWidth = " + imgWidth; - Debug.logError(errMsg, module); - result.put("errorMessage", errMsg); - return result; - } - // get scaleFactor from the smallest height - if (defaultHeight < (imgHeight * scaleFactor)) { - scaleFactor = defaultHeight / imgHeight; - } - } - - if (scaleFactor == 0.0) { - String errMsg = UtilProperties.getMessage(resource, "ImageTransform.final_scale_factor_is_null", locale) + " = " + scaleFactor; - Debug.logError(errMsg, module); - result.put("errorMessage", errMsg); - return result; - } - int bufImgType; - if (BufferedImage.TYPE_CUSTOM == bufImg.getType()) { - String errMsg = UtilProperties.getMessage(resource, "ImageTransform.unknown_buffered_image_type", locale); - Debug.logWarning(errMsg, module); - // apply a type for image majority - bufImgType = BufferedImage.TYPE_INT_ARGB_PRE; - } else { - bufImgType = bufImg.getType(); - } - - bufNewImg = new BufferedImage( (int) (imgWidth * scaleFactor), (int) (imgHeight * scaleFactor), bufImgType); - - result.put("responseMessage", "success"); - result.put("bufferedImage", bufNewImg); - result.put("scaleFactor", scaleFactor); - return result; - - } - - /** - * getXMLValue - * <p> - * From a XML element, get a values map - * - * @param fileFullPath File path to parse - * @return Map contains asked attribute values by attribute name - */ - public static Map<String, Object> getXMLValue(String fileFullPath, Locale locale) - throws IllegalStateException, IOException, JDOMException { - - /* VARIABLES */ - Document document; - Element rootElt; - Map<String, Map<String, String>> valueMap = FastMap.newInstance(); - Map<String, Object> result = FastMap.newInstance(); - - /* PARSING */ - SAXBuilder sxb = new SAXBuilder(); - try { - // JDOM - document = sxb.build(new File(fileFullPath)); - } catch (JDOMException e) { - String errMsg = UtilProperties.getMessage(resource, "ImageTransform.errors_occured_during_parsing", locale) + " ImageProperties.xml " + e.toString(); - Debug.logError(errMsg, module); - result.put("errorMessage", "error"); - return result; - } catch (IOException e) { - String errMsg = UtilProperties.getMessage(resource, "ImageTransform.error_prevents_the document_from_being_fully_parsed", locale) + e.toString(); - Debug.logError(errMsg, module); - result.put("errorMessage", "error"); - return result; - } - // set Root Element - try { - rootElt = document.getRootElement(); - } catch (IllegalStateException e) { - String errMsg = UtilProperties.getMessage(resource, "ImageTransform.root_element_has_not_been_set", locale) + e.toString(); - Debug.logError(errMsg, module); - result.put("errorMessage", "error"); - return result; - } - - /* get NAME and VALUE */ - List<Element> children = rootElt.getChildren(); // FIXME : despite upgrading to jdom 1.1, it seems that getChildren is pre 1.5 java code (ie getChildren does not retun List<Element> but only List) - for (Element currentElt : children) { - Map<String, String> eltMap = FastMap.newInstance(); - if (currentElt.getContentSize() > 0) { - Map<String, String> childMap = FastMap.newInstance(); - // loop over Children 1st level - List<Element> children2 = currentElt.getChildren(); - for (Element currentChild : children2) { - childMap.put(currentChild.getAttributeValue("name"), currentChild.getAttributeValue("value")); - } - valueMap.put(currentElt.getAttributeValue("name"), childMap); - } else { - eltMap.put(currentElt.getAttributeValue("name"), currentElt.getAttributeValue("value")); - valueMap.put(currentElt.getName(), eltMap); - } - } - - result.put("responseMessage", "success"); - result.put("xml", valueMap); - return result; + if (imgHeight > imgWidth) { + scaleFactor = defaultHeight / imgHeight; + if (scaleFactor == 0.0) { + String errMsg = UtilProperties.getMessage(resource, "ImageTransform.height_scale_factor_is_null", locale) + " (defaultHeight = " + defaultHeight + "; imgHeight = " + imgHeight; + Debug.logError(errMsg, module); + result.put("errorMessage", errMsg); + return result; + } + // get scaleFactor from the smallest width + if (defaultWidth < (imgWidth * scaleFactor)) { + scaleFactor = defaultWidth / imgWidth; + } + } else { + scaleFactor = defaultWidth / imgWidth; + if (scaleFactor == 0.0) { + String errMsg = UtilProperties.getMessage(resource, "ImageTransform.width_scale_factor_is_null", locale) + " (defaultWidth = " + defaultWidth + "; imgWidth = " + imgWidth; + Debug.logError(errMsg, module); + result.put("errorMessage", errMsg); + return result; + } + // get scaleFactor from the smallest height + if (defaultHeight < (imgHeight * scaleFactor)) { + scaleFactor = defaultHeight / imgHeight; + } + } + + if (scaleFactor == 0.0) { + String errMsg = UtilProperties.getMessage(resource, "ImageTransform.final_scale_factor_is_null", locale) + " = " + scaleFactor; + Debug.logError(errMsg, module); + result.put("errorMessage", errMsg); + return result; + } + int bufImgType; + if (BufferedImage.TYPE_CUSTOM == bufImg.getType()) { + String errMsg = UtilProperties.getMessage(resource, "ImageTransform.unknown_buffered_image_type", locale); + Debug.logWarning(errMsg, module); + // apply a type for image majority + bufImgType = BufferedImage.TYPE_INT_ARGB_PRE; + } else { + bufImgType = bufImg.getType(); + } + + bufNewImg = new BufferedImage( (int) (imgWidth * scaleFactor), (int) (imgHeight * scaleFactor), bufImgType); + + result.put("responseMessage", "success"); + result.put("bufferedImage", bufNewImg); + result.put("scaleFactor", scaleFactor); + return result; + + } + + /** + * getXMLValue + * <p> + * From a XML element, get a values map + * + * @param fileFullPath File path to parse + * @return Map contains asked attribute values by attribute name + */ + public static Map<String, Object> getXMLValue(String fileFullPath, Locale locale) + throws IllegalStateException, IOException, JDOMException { + + /* VARIABLES */ + Document document; + Element rootElt; + Map<String, Map<String, String>> valueMap = FastMap.newInstance(); + Map<String, Object> result = FastMap.newInstance(); + + /* PARSING */ + SAXBuilder sxb = new SAXBuilder(); + try { + // JDOM + document = sxb.build(new File(fileFullPath)); + } catch (JDOMException e) { + String errMsg = UtilProperties.getMessage(resource, "ImageTransform.errors_occured_during_parsing", locale) + " ImageProperties.xml " + e.toString(); + Debug.logError(errMsg, module); + result.put("errorMessage", "error"); + return result; + } catch (IOException e) { + String errMsg = UtilProperties.getMessage(resource, "ImageTransform.error_prevents_the document_from_being_fully_parsed", locale) + e.toString(); + Debug.logError(errMsg, module); + result.put("errorMessage", "error"); + return result; + } + // set Root Element + try { + rootElt = document.getRootElement(); + } catch (IllegalStateException e) { + String errMsg = UtilProperties.getMessage(resource, "ImageTransform.root_element_has_not_been_set", locale) + e.toString(); + Debug.logError(errMsg, module); + result.put("errorMessage", "error"); + return result; + } + + /* get NAME and VALUE */ + List<Element> children = rootElt.getChildren(); // FIXME : despite upgrading to jdom 1.1, it seems that getChildren is pre 1.5 java code (ie getChildren does not retun List<Element> but only List) + for (Element currentElt : children) { + Map<String, String> eltMap = FastMap.newInstance(); + if (currentElt.getContentSize() > 0) { + Map<String, String> childMap = FastMap.newInstance(); + // loop over Children 1st level + List<Element> children2 = currentElt.getChildren(); + for (Element currentChild : children2) { + childMap.put(currentChild.getAttributeValue("name"), currentChild.getAttributeValue("value")); + } + valueMap.put(currentElt.getAttributeValue("name"), childMap); + } else { + eltMap.put(currentElt.getAttributeValue("name"), currentElt.getAttributeValue("value")); + valueMap.put(currentElt.getName(), eltMap); + } + } + + result.put("responseMessage", "success"); + result.put("xml", valueMap); + return result; - } -} + } +} Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LdapAuthenticationServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LdapAuthenticationServices.java?rev=757078&r1=757077&r2=757078&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LdapAuthenticationServices.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LdapAuthenticationServices.java Sat Mar 21 23:25:08 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -119,7 +119,7 @@ parentTx = TransactionUtil.suspend(); } catch (GenericTransactionException e) { Debug.logError(e, "Could not suspend transaction: " + e.getMessage(), module); - } + } try { beganTransaction = TransactionUtil.begin(); userLogin.store(); |
Free forum by Nabble | Edit this page |