You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by do...@apache.org on 2009/03/27 17:56:18 UTC
svn commit: r759231 - in /ofbiz/trunk/framework/common/src/org/ofbiz/common:
./ email/ geo/ login/ olap/ period/ status/
Author: doogie
Date: Fri Mar 27 16:56:17 2009
New Revision: 759231
URL: http://svn.apache.org/viewvc?rev=759231&view=rev
Log:
Fix lines that *only* have 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/FindServices.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/login/LoginServices.java
ofbiz/trunk/framework/common/src/org/ofbiz/common/olap/CommonDimensionServices.java
ofbiz/trunk/framework/common/src/org/ofbiz/common/period/PeriodWorker.java
ofbiz/trunk/framework/common/src/org/ofbiz/common/status/StatusServices.java
ofbiz/trunk/framework/common/src/org/ofbiz/common/status/StatusWorker.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=759231&r1=759230&r2=759231&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/Captcha.java (original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/Captcha.java Fri Mar 27 16:56:17 2009
@@ -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=759231&r1=759230&r2=759231&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/CdyneServices.java (original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/CdyneServices.java Fri Mar 27 16:56:17 2009
@@ -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;
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,11 +128,11 @@
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:
<?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/">
@@ -140,7 +140,7 @@
<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=759231&r1=759230&r2=759231&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonEvents.java (original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonEvents.java Fri Mar 27 16:56:17 2009
@@ -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");
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);
} catch (GenericEntityException e) {
Debug.logError(e, "Cannot Visit Object", module);
}
-
+
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");
}
-
+
try {
PrintWriter out = response.getWriter();
response.setContentType("text/plain");
@@ -80,26 +80,26 @@
} 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");
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);
} catch (GenericEntityException e) {
Debug.logError(e, "Cannot Visit Object", module);
}
-
+
if (visit.getString("sessionId").equals(sessionId)) {
String currentPage = request.getParameter("currentPage");
if (appletSessions.containsKey(sessionId)) {
@@ -122,10 +122,10 @@
} 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");
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=759231&r1=759230&r2=759231&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonServices.java (original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonServices.java Fri Mar 27 16:56:17 2009
@@ -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();
}
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=759231&r1=759230&r2=759231&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java (original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java Fri Mar 27 16:56:17 2009
@@ -38,7 +38,7 @@
* Common Workers
*/
public class CommonWorkers {
-
+
public final static String module = CommonWorkers.class.getName();
public static List<GenericValue> getCountryList(GenericDelegator delegator) {
@@ -65,7 +65,7 @@
}
return geoList;
}
-
+
public static List<GenericValue> getStateList(GenericDelegator delegator) {
List<GenericValue> geoList = FastList.newInstance();
EntityCondition condition = EntityCondition.makeCondition(EntityOperator.OR,
@@ -102,7 +102,7 @@
} catch (GenericEntityException e) {
Debug.logError(e, "Cannot lookup Geo", module);
}
-
+
return geoList;
}
}
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=759231&r1=759230&r2=759231&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java (original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java Fri Mar 27 16:56:17 2009
@@ -201,7 +201,7 @@
}
return normalizedFields;
}
-
+
/**
* createCondition, comparing the normalizedFields with the list of keys, .
*
@@ -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,7 +354,7 @@
}
return tmpList;
}
-
+
/**
*
* same as performFind but now returning a list instead of an iterator
@@ -369,12 +369,12 @@
*/
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
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
*
@@ -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
*
@@ -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;
@@ -564,7 +564,7 @@
results.put("listIt", listIt);
return results;
}
-
+
private static String dayStart(String timeStampString, int daysLater) {
String retValue = null;
Timestamp ts = null;
@@ -657,7 +657,7 @@
*/
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/KeywordSearchUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/KeywordSearchUtil.java?rev=759231&r1=759230&r2=759231&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/KeywordSearchUtil.java (original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/KeywordSearchUtil.java Fri Mar 27 16:56:17 2009
@@ -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=759231&r1=759230&r2=759231&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 Fri Mar 27 16:56:17 2009
@@ -176,7 +176,7 @@
if (contentType == null) {
contentType = "text/html";
}
-
+
if (UtilValidate.isNotEmpty(bodyParts)) {
contentType = "multipart/mixed";
}
@@ -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);
@@ -496,12 +496,12 @@
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,19 +509,19 @@
contentArray.flush();
contentArray.close();
}
-
+
public String getContentType() {
return contentType == null ? "application/octet-stream" : contentType;
}
-
+
public InputStream getInputStream() throws IOException {
return new ByteArrayInputStream(contentArray.toByteArray());
}
-
+
public String getName() {
return "stringDatasource";
}
-
+
public OutputStream getOutputStream() throws IOException {
throw new IOException("Cannot write to this read-only resource");
}
@@ -531,24 +531,24 @@
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;
}
-
+
public InputStream getInputStream() throws IOException {
return new ByteArrayInputStream(contentArray);
}
-
+
public String getName() {
return "ByteArrayDataSource";
}
-
+
public OutputStream getOutputStream() throws IOException {
throw new IOException("Cannot write to this read-only resource");
}
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=759231&r1=759230&r2=759231&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 Fri Mar 27 16:56:17 2009
@@ -119,16 +119,16 @@
public static Map<String, Object> sendNotification(DispatchContext ctx, Map<String, ? extends Object> context) {
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
Map bodyResult = prepareNotification(ctx, context);
-
+
// ensure the body was generated successfully
if (bodyResult.get(ModelService.RESPONSE_MESSAGE).equals(ModelService.RESPOND_SUCCESS)) {
body = (String) bodyResult.get("body");
@@ -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,7 +152,7 @@
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);
} else {
@@ -187,24 +187,24 @@
String templateName = (String) context.get("templateName");
Map templateData = (Map) context.get("templateData");
String webSiteId = (String) context.get("webSiteId");
-
+
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();
@@ -212,7 +212,7 @@
// extract the newly created body for the notification email
String notificationBody = writer.toString();
-
+
// generate the successfull reponse
result = ServiceUtil.returnSuccess("Message body generated successfully");
result.put("body", notificationBody);
@@ -253,9 +253,9 @@
if (!context.containsKey("baseUrl")) {
StringBuilder httpBase = null;
StringBuilder httpsBase = null;
-
+
String localServer = null;
-
+
String httpsPort = null;
String httpsServer = null;
String httpPort = null;
@@ -287,7 +287,7 @@
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)) {
httpsPort = UtilProperties.getPropertyValue("url.properties", "port.https", "443");
@@ -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,7 +324,7 @@
httpsBase.append(":");
httpsBase.append(httpsPort);
}
-
+
// set the base (secure) URL for any messages requiring it
context.put("baseSecureUrl", httpsBase.toString());
} else {
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=759231&r1=759230&r2=759231&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 Fri Mar 27 16:56:17 2009
@@ -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)) {
Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java?rev=759231&r1=759230&r2=759231&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java (original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java Fri Mar 27 16:56:17 2009
@@ -77,7 +77,7 @@
}
}
}
-
+
Map<String, Object> result = FastMap.newInstance();
GenericDelegator delegator = ctx.getDelegator();
boolean useEncryption = "true".equals(UtilProperties.getPropertyValue("security.properties", "password.encrypt"));
@@ -122,7 +122,7 @@
String encodedPassword = useEncryption ? HashCrypt.getDigestHash(password, getHashType()) : password;
String encodedPasswordOldFunnyHexEncode = useEncryption ? HashCrypt.getDigestHashOldFunnyHexEncode(password, getHashType()) : password;
String encodedPasswordUsingDbHashType = encodedPassword;
-
+
String currentPassword = userLogin.getString("currentPassword");
if (useEncryption && currentPassword != null && currentPassword.startsWith("{")) {
// get encode according to the type in the database
@@ -131,7 +131,7 @@
encodedPasswordUsingDbHashType = HashCrypt.getDigestHash(password, dbHashType);
}
}
-
+
String ldmStr = UtilProperties.getPropertyValue("security.properties", "login.disable.minutes");
long loginDisableMinutes = 30;
@@ -210,7 +210,7 @@
result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS);
} else {
Debug.logInfo("Entered password [" + encodedPassword + "], Entered password OldFunnyHexEncode [" + encodedPasswordOldFunnyHexEncode + "], db password [" + userLogin.getString("currentPassword") + "]", module);
-
+
// password is incorrect, but this may be the result of a stale cache entry,
// so lets clear the cache and try again if this is the first pass
if (isServiceAuth && passNumber <= 1) {
@@ -266,33 +266,33 @@
try {
beganTransaction = TransactionUtil.begin();
-
+
if (doStore) {
userLogin.store();
}
-
+
if ("true".equals(UtilProperties.getPropertyValue("security.properties", "store.login.history"))) {
boolean createHistory = true;
-
+
// only save info on service auth if option set to true to do so
if (isServiceAuth && !"true".equals(UtilProperties.getPropertyValue("security.properties", "store.login.history.on.service.auth"))) {
createHistory = false;
}
-
+
if (createHistory) {
Map<String, Object> ulhCreateMap = UtilMisc.toMap("userLoginId", username, "visitId", visitId,
"fromDate", UtilDateTime.nowTimestamp(), "successfulLogin", successfulLogin);
-
+
ModelEntity modelUserLogin = userLogin.getModelEntity();
if (modelUserLogin.isField("partyId")) {
ulhCreateMap.put("partyId", userLogin.get("partyId"));
}
-
+
// ONLY save the password if it was incorrect
if ("N".equals(successfulLogin) && !"false".equals(UtilProperties.getPropertyValue("security.properties", "store.login.history.incorrect.password"))) {
ulhCreateMap.put("passwordUsed", password);
}
-
+
//Debug.logInfo(new Exception(), "=================== Creating new UserLoginHistory at " + UtilDateTime.nowTimestamp(), module);
delegator.create("UserLoginHistory", ulhCreateMap);
}
@@ -308,7 +308,7 @@
} catch (GenericTransactionException e2) {
Debug.logError(e2, "Could not rollback nested transaction: " + e2.getMessage(), module);
}
-
+
// if doStore is true then this error should not be ignored and we shouldn't consider it a successful login if this happens as there is something very wrong lower down that will bite us again later
if (doStore) {
return ServiceUtil.returnError(geeErrMsg);
@@ -370,7 +370,7 @@
}
return result;
}
-
+
private static void createUserLoginPasswordHistory(GenericDelegator delegator,String userLoginId, String currentPassword) throws GenericEntityException{
int passwordChangeHistoryLimit = 0;
try {
@@ -383,7 +383,7 @@
// Not saving password history, so return from here.
return;
}
-
+
EntityFindOptions efo = new EntityFindOptions();
efo.setResultSetType(EntityFindOptions.TYPE_SCROLL_INSENSITIVE);
EntityListIterator eli = delegator.find("UserLoginPasswordHistory", EntityCondition.makeConditionMap("userLoginId", userLoginId), null, null, UtilMisc.toList("-fromDate"), efo);
@@ -403,14 +403,14 @@
}
}
eli.close();
-
+
// save this password in history
GenericValue userLoginPwdHistToCreate = delegator.makeValue("UserLoginPasswordHistory", UtilMisc.toMap("userLoginId", userLoginId,"fromDate", nowTimestamp));
boolean useEncryption = "true".equals(UtilProperties.getPropertyValue("security.properties", "password.encrypt"));
userLoginPwdHistToCreate.set("currentPassword", useEncryption ? HashCrypt.getDigestHash(currentPassword, getHashType()) : currentPassword);
userLoginPwdHistToCreate.create();
}
-
+
/** Creates a UserLogin
*@param ctx The DispatchContext that this service is operating in
*@param context Map containing the input parameters
@@ -746,7 +746,7 @@
errMsg = UtilProperties.getMessage(resource,"loginservices.could_not_change_password_userlogin_with_id_not_exist", messageMap, locale);
return ServiceUtil.returnError(errMsg);
}
-
+
boolean wasEnabled = !"N".equals(userLoginToUpdate.get("enabled"));
if (context.containsKey("enabled")) {
@@ -790,11 +790,11 @@
String errMsg = null;
if (!ignoreCurrentPassword) {
-
+
String encodedPassword = useEncryption ? HashCrypt.getDigestHash(currentPassword, getHashType()) : currentPassword;
String encodedPasswordOldFunnyHexEncode = useEncryption ? HashCrypt.getDigestHashOldFunnyHexEncode(currentPassword, getHashType()) : currentPassword;
String encodedPasswordUsingDbHashType = encodedPassword;
-
+
String oldPassword = userLogin.getString("currentPassword");
if (useEncryption && oldPassword != null && oldPassword.startsWith("{")) {
// get encode according to the type in the database
@@ -861,7 +861,7 @@
Map<String, String> messageMap = UtilMisc.toMap("errorMessage", e.getMessage());
errMsg = UtilProperties.getMessage(resource,"loginevents.error_accessing_password_change_history", messageMap, locale);
}
-
+
}
int minPasswordLength = 0;
@@ -896,7 +896,7 @@
Debug.logWarning("Password encrypt hash type is not specified in security.properties, use SHA", module);
hashType = "SHA";
}
-
+
return hashType;
}
}
Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/olap/CommonDimensionServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/olap/CommonDimensionServices.java?rev=759231&r1=759230&r2=759231&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/olap/CommonDimensionServices.java (original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/olap/CommonDimensionServices.java Fri Mar 27 16:56:17 2009
@@ -102,7 +102,7 @@
dateValue.set("dayOfMonth", new Long(calendar.get(Calendar.DAY_OF_MONTH)));
dateValue.set("dayOfYear", new Long(calendar.get(Calendar.DAY_OF_YEAR)));
dateValue.set("monthName", monthNameFormat.format(currentDate));
-
+
dateValue.set("monthOfYear", new Long(calendar.get(Calendar.MONTH) + 1));
dateValue.set("yearName", new Long(calendar.get(Calendar.YEAR)));
dateValue.set("weekOfMonth", new Long(calendar.get(Calendar.WEEK_OF_MONTH)));
@@ -110,7 +110,7 @@
dateValue.set("weekdayType", (dayOfWeek == 1 || dayOfWeek == 7? "Weekend": "Weekday"));
dateValue.set("yearMonthDay", yearMonthDayFormat.format(currentDate));
dateValue.set("yearAndMonth", yearMonthFormat.format(currentDate));
-
+
try {
if (newValue) {
dateValue.create();
Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/period/PeriodWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/period/PeriodWorker.java?rev=759231&r1=759230&r2=759231&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/period/PeriodWorker.java (original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/period/PeriodWorker.java Fri Mar 27 16:56:17 2009
@@ -31,7 +31,7 @@
public class PeriodWorker {
public static String module = PeriodWorker.class.getName();
-
+
/**
* Method to get a condition that checks that the given fieldName is in a given timePeriod.
*/
Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/status/StatusServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/status/StatusServices.java?rev=759231&r1=759230&r2=759231&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/status/StatusServices.java (original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/status/StatusServices.java Fri Mar 27 16:56:17 2009
@@ -37,16 +37,16 @@
* StatusServices
*/
public class StatusServices {
-
+
public static final String module = StatusServices.class.getName();
-
+
public static Map<String, Object> getStatusItems(DispatchContext ctx, Map<String, ?> context) {
GenericDelegator delegator = ctx.getDelegator();
List<String> statusTypes = checkList(context.get("statusTypeIds"), String.class);
if (statusTypes == null || statusTypes.size() == 0) {
return ServiceUtil.returnError("Parameter statusTypeIds can not be null and must contain at least one element");
}
-
+
List<GenericValue> statusItems = FastList.newInstance();
for (String statusTypeId: statusTypes) {
try {
Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/status/StatusWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/status/StatusWorker.java?rev=759231&r1=759230&r2=759231&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/status/StatusWorker.java (original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/status/StatusWorker.java Fri Mar 27 16:56:17 2009
@@ -34,9 +34,9 @@
* StatusWorker
*/
public class StatusWorker {
-
+
public static final String module = StatusWorker.class.getName();
-
+
public static void getStatusItems(PageContext pageContext, String attributeName, String statusTypeId) {
GenericDelegator delegator = (GenericDelegator) pageContext.getRequest().getAttribute("delegator");