svn commit: r759260 - in /ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase: GoogleBaseSearchEvents.java ProductsExportToGoogle.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r759260 - in /ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase: GoogleBaseSearchEvents.java ProductsExportToGoogle.java

doogie-3
Author: doogie
Date: Fri Mar 27 17:02:10 2009
New Revision: 759260

URL: http://svn.apache.org/viewvc?rev=759260&view=rev
Log:
Fix lines that *only* have whitespace.

Modified:
    ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/GoogleBaseSearchEvents.java
    ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java

Modified: ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/GoogleBaseSearchEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/GoogleBaseSearchEvents.java?rev=759260&r1=759259&r2=759260&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/GoogleBaseSearchEvents.java (original)
+++ ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/GoogleBaseSearchEvents.java Fri Mar 27 17:02:10 2009
@@ -56,7 +56,7 @@
         String selectResult = (String) request.getParameter("selectResult");
         List productExportList = new ArrayList();
         String errMsg = null;
-
+
         try {
             boolean beganTransaction = TransactionUtil.begin(DEFAULT_TX_TIMEOUT);
             try {
@@ -69,7 +69,7 @@
                         request.setAttribute("_ERROR_MESSAGE_", errMsg);
                         return "error";
                     }
-
+
                     GenericValue searchResultView = null;
                     while ((searchResultView = (GenericValue) eli.next()) != null) {
                         productExportList.add(searchResultView.getString("mainProductId"));
@@ -90,7 +90,7 @@
                 String trackingCodeId = (String) request.getParameter("trackingCodeId");
                 String webSiteMountPoint = (String) request.getParameter("webSiteMountPoint");
                 String countryCode = (String) request.getParameter("countryCode");
-
+
                 // Export all or selected products to Google Base
                 try {
                     Map inMap = UtilMisc.toMap("selectResult", productExportList,

Modified: ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java?rev=759260&r1=759259&r2=759260&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java (original)
+++ ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java Fri Mar 27 17:02:10 2009
@@ -56,7 +56,7 @@
 import org.w3c.dom.Element;
 
 public class ProductsExportToGoogle {
-
+
     private static final String resource = "GoogleBaseUiLabels";
     private static final String module = ProductsExportToGoogle.class.getName();
 
@@ -64,28 +64,28 @@
         Locale locale = (Locale) context.get("locale");
         GenericDelegator delegator = dctx.getDelegator();
         LocalDispatcher dispatcher = dctx.getDispatcher();
-
+
         Map result = null;
         try {
             String configString = "googleBaseExport.properties";
-
+
             // get the Developer Key
             String developerKey = UtilProperties.getPropertyValue(configString, "googleBaseExport.developerKey");
-
+
             // get the Authentication Url
             String authenticationUrl = UtilProperties.getPropertyValue(configString, "googleBaseExport.authenticationUrl");
-
+
             // get the Google Account Email
             String accountEmail = UtilProperties.getPropertyValue(configString, "googleBaseExport.accountEmail");
-
+
             // get the Google Account Password
             String accountPassword = UtilProperties.getPropertyValue(configString, "googleBaseExport.accountPassword");
-
+
             // get the Url to Post Items
             String postItemsUrl = UtilProperties.getPropertyValue(configString, "googleBaseExport.postItemsUrl");
-
+
             StringBuffer dataItemsXml = new StringBuffer();
-
+
             result = buildDataItemsXml(dctx, context, dataItemsXml);
             if (!ServiceUtil.isFailure(result)) {
                 String token = authenticate(authenticationUrl, accountEmail, accountPassword);
@@ -103,7 +103,7 @@
         }
         return result;
     }
-
+
     public static Map exportProductCategoryToGoogle(DispatchContext dctx, Map context) {
         LocalDispatcher dispatcher = dctx.getDispatcher();
         Locale locale = (Locale) context.get("locale");
@@ -115,22 +115,22 @@
         if (userLogin == null) {
             return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "productsExportToGoogle.cannotRetrieveUserLogin", locale));
         }
-
+
         try {
             if (UtilValidate.isNotEmpty(productCategoryId)) {
                 List productsList = FastList.newInstance();
                 Map result = dispatcher.runSync("getProductCategoryMembers", UtilMisc.toMap("categoryId", productCategoryId));
-
+
                 if (result.get("categoryMembers") != null) {
                     List productCategoryMembers = (List)result.get("categoryMembers");
                     if (productCategoryMembers != null) {
                         Iterator i = productCategoryMembers.iterator();
                         while (i.hasNext()) {
                             GenericValue prodCatMemb = (GenericValue) i.next();
-
+
                             if (prodCatMemb != null) {
                                 String productId = prodCatMemb.getString("productId");
-
+
                                 if (productId != null) {
                                     GenericValue prod = prodCatMemb.getRelatedOne("Product");
                                     Timestamp salesDiscontinuationDate = prod.getTimestamp("salesDiscontinuationDate");
@@ -143,7 +143,7 @@
                         }
                     }
                 }
-
+
                 if (productsList.size() == 0) {
                     return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "productsExportToGoogle.noProductsAvailableInProductCategory", locale));
                 } else {
@@ -156,7 +156,7 @@
                     paramIn.put("testMode", "N");
                     paramIn.put("userLogin", userLogin);
                     result = dispatcher.runSync("exportToGoogle", paramIn);
-
+
                     if (ServiceUtil.isError(result)) {
                         return ServiceUtil.returnFailure(ServiceUtil.getErrorMessage(result));
                     }
@@ -167,10 +167,10 @@
         } catch (Exception e) {
             return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "productsExportToGoogle.exceptionInExportProductCategoryToGoogle", locale));
         }
-
+
         return ServiceUtil.returnSuccess();
     }
-
+
     private static String authenticate(String authenticationUrl, String accountEmail, String accountPassword) {
         String postOutput = null;
         String token = null;
@@ -192,7 +192,7 @@
         // so all we need to do is look for "Auth" and get the token that comes after it
 
         StringTokenizer tokenizer = new StringTokenizer(postOutput, "=\n ");
-
+
         while (tokenizer.hasMoreElements()) {
             if ("Auth".equals(tokenizer.nextToken())) {
                 if (tokenizer.hasMoreElements()) {
@@ -211,14 +211,14 @@
         // Open connection
         URL url = new URL(authenticationUrl);
         HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
-
+
         // Set properties of the connection
         urlConnection.setRequestMethod("POST");
         urlConnection.setDoInput(true);
         urlConnection.setDoOutput(true);
         urlConnection.setUseCaches(false);
         urlConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
-
+
         // Form the POST parameters
         StringBuffer content = new StringBuffer();
         content.append("Email=").append(URLEncoder.encode(accountEmail, "UTF-8"));
@@ -229,7 +229,7 @@
         OutputStream outputStream = urlConnection.getOutputStream();
         outputStream.write(content.toString().getBytes("UTF-8"));
         outputStream.close();
-
+
         // Retrieve the output
         int responseCode = urlConnection.getResponseCode();
         InputStream inputStream;
@@ -238,10 +238,10 @@
         } else {
             inputStream = urlConnection.getErrorStream();
         }
-
+
         return toString(inputStream);
     }
-
+
     private static String toString(InputStream inputStream) throws IOException {
         String string;
         StringBuffer outputBuilder = new StringBuffer();
@@ -253,31 +253,31 @@
         }
         return outputBuilder.toString();
     }
-
+
     private static Map postItem(String token, String postItemsUrl, String developerKey, StringBuffer dataItems,
                                 Locale locale, String testMode, List newProductsInGoogle, List productsRemovedFromGoogle, LocalDispatcher dispatcher, GenericDelegator delegator) throws IOException {
         if (Debug.verboseOn()) {
             Debug.logVerbose("Request To Google Base :\n" + dataItems.toString(), module);
         }
-
+
         HttpURLConnection connection = (HttpURLConnection)(new URL(postItemsUrl)).openConnection();
-
+
         // Test Mode Yes (add the dry-run=true)
         if (UtilValidate.isNotEmpty(testMode) && "Y".equals(testMode)) {
             connection.setRequestProperty("dry-run", "true");
         }
-
+
         connection.setDoInput(true);
         connection.setDoOutput(true);
         connection.setRequestMethod("POST");
         connection.setRequestProperty("Content-Type", "application/atom+xml");
         connection.setRequestProperty("Authorization", "GoogleLogin auth=" + token);
         connection.setRequestProperty("X-Google-Key", "key=" + developerKey);
-
+
         OutputStream outputStream = connection.getOutputStream();
         outputStream.write(dataItems.toString().getBytes());
         outputStream.close();
-
+
         int responseCode = connection.getResponseCode();
         InputStream inputStream;
         Map result = FastMap.newInstance();
@@ -299,13 +299,13 @@
             response = toString(inputStream);
             result = ServiceUtil.returnFailure(response);
         }
-
+
         if (Debug.verboseOn()) {
             Debug.logVerbose("Response From Google Base :\n" + response, module);
         }
         return result;
     }
-
+
     private static Map buildDataItemsXml(DispatchContext dctx, Map context, StringBuffer dataItemsXml) {
         Locale locale = (Locale)context.get("locale");
         List newProductsInGoogle = FastList.newInstance();
@@ -508,7 +508,7 @@
         }
         return priceString;
     }
-
+
     private static Map readResponseFromGoogle(String msg, List newProductsInGoogle, List productsRemovedFromGoogle, LocalDispatcher dispatcher, GenericDelegator delegator, Locale locale) {
         List message = FastList.newInstance();
         // Debug.log("====get xml response from google: " + msg);
@@ -560,7 +560,7 @@
             Debug.logError("Exception reading response from Google: " + e.getMessage(), module);
             return ServiceUtil.returnError(UtilProperties.getMessage(resource, "productsExportToGoogle.exceptionReadingResponseFromGoogle", locale));
         }
-
+
         if (message.size() > 0) {
             return ServiceUtil.returnError(UtilProperties.getMessage(resource, "productsExportToGoogle.errorInTheResponseFromGoogle", locale), message);
         }