diff --git a/applications/product/data/ProductTypeData.xml b/applications/product/data/ProductTypeData.xml
index 283c5de768..26e5fcd719 100644
--- a/applications/product/data/ProductTypeData.xml
+++ b/applications/product/data/ProductTypeData.xml
@@ -138,7 +138,6 @@ under the License.
-
diff --git a/applications/product/src/org/ofbiz/product/product/ProductSearchEvents.java b/applications/product/src/org/ofbiz/product/product/ProductSearchEvents.java
index 713b48ca04..f6efec9140 100644
--- a/applications/product/src/org/ofbiz/product/product/ProductSearchEvents.java
+++ b/applications/product/src/org/ofbiz/product/product/ProductSearchEvents.java
@@ -455,99 +455,6 @@ public class ProductSearchEvents {
return "success";
}
- public static String searchExportProductListToGoogle(HttpServletRequest request, HttpServletResponse response) {
- LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
- Locale locale = UtilHttp.getLocale(request);
- GenericValue userLogin = (GenericValue) request.getSession().getAttribute("userLogin");
- String selectResult = (String) request.getParameter("selectResult");
- List productExportList = new ArrayList();
- String errMsg = null;
-
- try {
- boolean beganTransaction = TransactionUtil.begin(DEFAULT_TX_TIMEOUT);
- try {
- if (UtilValidate.isEmpty(selectResult)) {
- // If the passed list of product ids is empty, get the list from the search parameters in the request
- EntityListIterator eli = getProductSearchResults(request);
- if (eli == null) {
- errMsg = UtilProperties.getMessage(resource,"productsearchevents.no_results_found_probably_error_constraints", UtilHttp.getLocale(request));
- Debug.logError(errMsg, module);
- request.setAttribute("_ERROR_MESSAGE_", errMsg);
- return "error";
- }
-
- GenericValue searchResultView = null;
- while ((searchResultView = (GenericValue) eli.next()) != null) {
- productExportList.add(searchResultView.getString("mainProductId"));
- }
- eli.close();
- } else {
- if (selectResult.startsWith("[")) {
- productExportList = StringUtil.toList(selectResult);
- } else {
- productExportList.add(selectResult);
- }
- }
- String webSiteUrl = (String) request.getParameter("webSiteUrl");
- String imageUrl = (String) request.getParameter("imageUrl");
- String actionType = (String) request.getParameter("actionType");
- String statusId = (String) request.getParameter("statusId");
- String testMode = (String) request.getParameter("testMode");
- String trackingCodeId = (String) request.getParameter("trackingCodeId");
-
- // Export all or selected products to Google Base
- try {
- Map inMap = UtilMisc.toMap("selectResult", productExportList,
- "webSiteUrl", webSiteUrl,
- "imageUrl", imageUrl,
- "actionType", actionType,
- "statusId", statusId,
- "testMode", testMode);
- inMap.put("trackingCodeId", trackingCodeId);
- inMap.put("userLogin", userLogin);
- Map exportResult = dispatcher.runSync("exportToGoogle", inMap);
- if (ServiceUtil.isError(exportResult)) {
- List errorMessages = (List)exportResult.get(ModelService.ERROR_MESSAGE_LIST);
- if (UtilValidate.isNotEmpty(errorMessages)) {
- request.setAttribute("_ERROR_MESSAGE_LIST_", errorMessages);
- } else {
- request.setAttribute("_ERROR_MESSAGE_", ServiceUtil.getErrorMessage(exportResult));
- }
- return "error";
- } else if (ServiceUtil.isFailure(exportResult)) {
- List eventMessages = (List)exportResult.get(ModelService.ERROR_MESSAGE_LIST);
- if (UtilValidate.isNotEmpty(eventMessages)) {
- request.setAttribute("_EVENT_MESSAGE_LIST_", eventMessages);
- } else {
- request.setAttribute("_EVENT_MESSAGE_", ServiceUtil.getErrorMessage(exportResult));
- }
- } else {
- request.setAttribute("_EVENT_MESSAGE_", exportResult.get("successMessage"));
- }
- } catch (GenericServiceException e) {
- errMsg = UtilProperties.getMessage(resource, "productsearchevents.exceptionCallingExportToGoogle", locale);
- Debug.logError(e, errMsg, module);
- request.setAttribute("_ERROR_MESSAGE_", errMsg);
- return "error";
- }
- } catch (GenericEntityException e) {
- errMsg = UtilProperties.getMessage(resource, "productsearchevents.error_getting_search_results", locale);
- Debug.logError(e, errMsg, module);
- request.setAttribute("_ERROR_MESSAGE_", errMsg);
- return "error";
- } finally {
- TransactionUtil.commit(beganTransaction);
- }
- } catch (GenericTransactionException e) {
- errMsg = UtilProperties.getMessage(resource, "productsearchevents.error_getting_search_results", locale);
- Debug.logError(e, errMsg, module);
- request.setAttribute("_ERROR_MESSAGE_", errMsg);
- return "error";
- }
-
- return "success";
- }
-
public static EntityListIterator getProductSearchResults(HttpServletRequest request) {
HttpSession session = request.getSession();
GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator");
diff --git a/specialpurpose/googlebase/build.xml b/specialpurpose/googlebase/build.xml
index 47f6009151..9f1d59bdea 100644
--- a/specialpurpose/googlebase/build.xml
+++ b/specialpurpose/googlebase/build.xml
@@ -1,21 +1,21 @@
diff --git a/specialpurpose/googlebase/config/GoogleBaseUiLabels.properties b/specialpurpose/googlebase/config/GoogleBaseUiLabels.properties
index ebb07a58aa..6c35e839de 100644
--- a/specialpurpose/googlebase/config/GoogleBaseUiLabels.properties
+++ b/specialpurpose/googlebase/config/GoogleBaseUiLabels.properties
@@ -18,11 +18,13 @@
#####################################################################
GoogleBaseApplication=Google Base Integration
GoogleBaseCompanyName=Ofbiz
+GoogleBaseExportToGoogle=Export To Google Base
GoogleBaseExportDeactivated=Deactivated
GoogleBaseExportPublish=Publish
GoogleBaseExportPublishDraft=Publish Draft
GoogleBaseExportTestMode=(Yes=Validate the xml document request to Google Base, No=Send the xml document request to Google Base)
GoogleBaseExportNoTrackingRequested=Not Requested
+GoogleBaseViewPermissionError=You do not have permission to view this page. ("GOOGLEBASE_VIEW" needed)
FormFieldTitle_webSiteUrl=Web Site Url
FormFieldTitle_trackingCodeId=Tracking Code Id
@@ -41,3 +43,7 @@ productsExportToGoogle.exceptionReadingResponseFromGoogle=Exception reading resp
productsExportToGoogle.missingParameterProductCategoryId=Missing parameter productCategoryId
productsExportToGoogle.noProductsAvailableInProductCategory=No products available in the selected productCategoryId
productsExportToGoogle.productItemsSentCorrecltyToGoogle=Product items sent correclty to Google Base
+
+googlebasesearchevents.no_results_found_probably_error_constraints=No results found, probably because there was an error or were no constraints.
+googlebasesearchevents.exceptionCallingExportToGoogle=Exception during exporting product to Google Base.
+googlebasesearchevents.error_getting_search_results=Error getting search results: ${errSearchResult}.
diff --git a/specialpurpose/googlebase/config/GoogleBaseUiLabels_it.properties b/specialpurpose/googlebase/config/GoogleBaseUiLabels_it.properties
index 8d543c893e..1f70f64af9 100644
--- a/specialpurpose/googlebase/config/GoogleBaseUiLabels_it.properties
+++ b/specialpurpose/googlebase/config/GoogleBaseUiLabels_it.properties
@@ -18,11 +18,13 @@
#####################################################################
GoogleBaseApplication=Applicazione Per Esportare i Prodotti Su Google Base
GoogleBaseCompanyName=Ofbiz
+GoogleBaseExportToGoogle=Esporta Su Google Base
GoogleBaseExportDeactivated=Disattiva
GoogleBaseExportPublish=Pubblica
GoogleBaseExportPublishDraft=Pubblica come Bozza
GoogleBaseExportTestMode=(Si=Valida la richiesta del documento xml su Google Base, No=Invia la richiesta del documento xml a Google Base)
GoogleBaseExportNoTrackingRequested=Non Richiesto
+GoogleBaseViewPermissionError=Tu non sei autorizzato per vedere questa pagina. (necessario permesso "GOOGLEBASE_VIEW")
FormFieldTitle_webSiteUrl=Url Sito Web
FormFieldTitle_trackingCodeId=Codice Tracciatura
@@ -40,4 +42,8 @@ productsExportToGoogle.exceptionInExportToGoogle=Eccezione in exportToGoogle
productsExportToGoogle.exceptionReadingResponseFromGoogle=Eccezione leggendo la risposta da Google
productsExportToGoogle.missingParameterProductCategoryId=Parametro productCategoryId mancante
productsExportToGoogle.noProductsAvailableInProductCategory=Nessun prodotto disponibile nella categoria prodotto selezionata
-productsExportToGoogle.productItemsSentCorrecltyToGoogle=Prodotti inviati correttamente su Google Base
\ No newline at end of file
+productsExportToGoogle.productItemsSentCorrecltyToGoogle=Prodotti inviati correttamente su Google Base
+
+googlebasesearchevents.no_results_found_probably_error_constraints=No results found, probably because there was an error or were no constraints.
+googlebasesearchevents.exceptionCallingExportToGoogle=Exception during exporting product to Google Base.
+googlebasesearchevents.error_getting_search_results=Error getting search results: ${errSearchResult}.
diff --git a/specialpurpose/googlebase/data/GoogleBaseSecurityData.xml b/specialpurpose/googlebase/data/GoogleBaseSecurityData.xml
new file mode 100644
index 0000000000..47bf820719
--- /dev/null
+++ b/specialpurpose/googlebase/data/GoogleBaseSecurityData.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/specialpurpose/googlebase/ofbiz-component.xml b/specialpurpose/googlebase/ofbiz-component.xml
index 5466ca1e47..9667237c48 100644
--- a/specialpurpose/googlebase/ofbiz-component.xml
+++ b/specialpurpose/googlebase/ofbiz-component.xml
@@ -1,21 +1,21 @@
+
@@ -33,7 +34,7 @@
title="Google Base"
server="default-server"
location="webapp/googlebase"
- base-permission="OFBTOOLS"
+ base-permission="OFBTOOLS,GOOGLEBASE"
mount-point="/googlebase"
app-bar-display="true"/>
diff --git a/specialpurpose/googlebase/src/org/ofbiz/googlebase/GoogleBaseSearchEvents.java b/specialpurpose/googlebase/src/org/ofbiz/googlebase/GoogleBaseSearchEvents.java
new file mode 100644
index 0000000000..5cbafde20c
--- /dev/null
+++ b/specialpurpose/googlebase/src/org/ofbiz/googlebase/GoogleBaseSearchEvents.java
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ * 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.googlebase;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.StringUtil;
+import org.ofbiz.base.util.UtilHttp;
+import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilProperties;
+import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.entity.GenericEntityException;
+import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.transaction.GenericTransactionException;
+import org.ofbiz.entity.transaction.TransactionUtil;
+import org.ofbiz.entity.util.EntityListIterator;
+import org.ofbiz.product.product.ProductSearchEvents;
+import org.ofbiz.service.GenericServiceException;
+import org.ofbiz.service.LocalDispatcher;
+import org.ofbiz.service.ModelService;
+import org.ofbiz.service.ServiceUtil;
+
+public class GoogleBaseSearchEvents {
+
+ public static final String module = GoogleBaseSearchEvents.class.getName();
+ public static final String resource = "GoogleBaseUiLabels";
+ public static final int DEFAULT_TX_TIMEOUT = 600;
+
+ public static String searchExportProductListToGoogle(HttpServletRequest request, HttpServletResponse response) {
+ LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
+ Locale locale = UtilHttp.getLocale(request);
+ GenericValue userLogin = (GenericValue) request.getSession().getAttribute("userLogin");
+ String selectResult = (String) request.getParameter("selectResult");
+ List productExportList = new ArrayList();
+ String errMsg = null;
+
+ try {
+ boolean beganTransaction = TransactionUtil.begin(DEFAULT_TX_TIMEOUT);
+ try {
+ if (UtilValidate.isEmpty(selectResult)) {
+ // If the passed list of product ids is empty, get the list from the search parameters in the request
+ EntityListIterator eli = ProductSearchEvents.getProductSearchResults(request);
+ if (eli == null) {
+ errMsg = UtilProperties.getMessage(resource,"googlebasesearchevents.no_results_found_probably_error_constraints", UtilHttp.getLocale(request));
+ Debug.logError(errMsg, module);
+ request.setAttribute("_ERROR_MESSAGE_", errMsg);
+ return "error";
+ }
+
+ GenericValue searchResultView = null;
+ while ((searchResultView = (GenericValue) eli.next()) != null) {
+ productExportList.add(searchResultView.getString("mainProductId"));
+ }
+ eli.close();
+ } else {
+ if (selectResult.startsWith("[")) {
+ productExportList = StringUtil.toList(selectResult);
+ } else {
+ productExportList.add(selectResult);
+ }
+ }
+ String webSiteUrl = (String) request.getParameter("webSiteUrl");
+ String imageUrl = (String) request.getParameter("imageUrl");
+ String actionType = (String) request.getParameter("actionType");
+ String statusId = (String) request.getParameter("statusId");
+ String testMode = (String) request.getParameter("testMode");
+ String trackingCodeId = (String) request.getParameter("trackingCodeId");
+
+ // Export all or selected products to Google Base
+ try {
+ Map inMap = UtilMisc.toMap("selectResult", productExportList,
+ "webSiteUrl", webSiteUrl,
+ "imageUrl", imageUrl,
+ "actionType", actionType,
+ "statusId", statusId,
+ "testMode", testMode);
+ inMap.put("trackingCodeId", trackingCodeId);
+ inMap.put("userLogin", userLogin);
+ Map exportResult = dispatcher.runSync("exportToGoogle", inMap);
+ if (ServiceUtil.isError(exportResult)) {
+ List errorMessages = (List)exportResult.get(ModelService.ERROR_MESSAGE_LIST);
+ if (UtilValidate.isNotEmpty(errorMessages)) {
+ request.setAttribute("_ERROR_MESSAGE_LIST_", errorMessages);
+ } else {
+ request.setAttribute("_ERROR_MESSAGE_", ServiceUtil.getErrorMessage(exportResult));
+ }
+ return "error";
+ } else if (ServiceUtil.isFailure(exportResult)) {
+ List eventMessages = (List)exportResult.get(ModelService.ERROR_MESSAGE_LIST);
+ if (UtilValidate.isNotEmpty(eventMessages)) {
+ request.setAttribute("_EVENT_MESSAGE_LIST_", eventMessages);
+ } else {
+ request.setAttribute("_EVENT_MESSAGE_", ServiceUtil.getErrorMessage(exportResult));
+ }
+ } else {
+ request.setAttribute("_EVENT_MESSAGE_", exportResult.get("successMessage"));
+ }
+ } catch (GenericServiceException e) {
+ errMsg = UtilProperties.getMessage(resource, "googlebasesearchevents.exceptionCallingExportToGoogle", locale);
+ Debug.logError(e, errMsg, module);
+ request.setAttribute("_ERROR_MESSAGE_", errMsg);
+ return "error";
+ }
+ } catch (GenericEntityException e) {
+ errMsg = UtilProperties.getMessage(resource, "googlebasesearchevents.error_getting_search_results", locale);
+ Debug.logError(e, errMsg, module);
+ request.setAttribute("_ERROR_MESSAGE_", errMsg);
+ return "error";
+ } finally {
+ TransactionUtil.commit(beganTransaction);
+ }
+ } catch (GenericTransactionException e) {
+ errMsg = UtilProperties.getMessage(resource, "googlebasesearchevents.error_getting_search_results", locale);
+ Debug.logError(e, errMsg, module);
+ request.setAttribute("_ERROR_MESSAGE_", errMsg);
+ return "error";
+ }
+ return "success";
+ }
+}
diff --git a/specialpurpose/googlebase/webapp/googlebase/WEB-INF/controller.xml b/specialpurpose/googlebase/webapp/googlebase/WEB-INF/controller.xml
index c53a285041..df0a12acd2 100644
--- a/specialpurpose/googlebase/webapp/googlebase/WEB-INF/controller.xml
+++ b/specialpurpose/googlebase/webapp/googlebase/WEB-INF/controller.xml
@@ -1,21 +1,21 @@
-
+
diff --git a/specialpurpose/googlebase/webapp/googlebase/WEB-INF/web.xml b/specialpurpose/googlebase/webapp/googlebase/WEB-INF/web.xml
index fce4801a17..73915d04c4 100644
--- a/specialpurpose/googlebase/webapp/googlebase/WEB-INF/web.xml
+++ b/specialpurpose/googlebase/webapp/googlebase/WEB-INF/web.xml
@@ -1,22 +1,22 @@
diff --git a/specialpurpose/googlebase/webapp/googlebase/find/googleExportLink.ftl b/specialpurpose/googlebase/webapp/googlebase/find/googleExportLink.ftl
index ccabe6f10b..cde9ff1060 100644
--- a/specialpurpose/googlebase/webapp/googlebase/find/googleExportLink.ftl
+++ b/specialpurpose/googlebase/webapp/googlebase/find/googleExportLink.ftl
@@ -25,5 +25,5 @@ under the License.
<#if productIds?has_content>
- ${uiLabelMap.ProductExportToGoogle}
+ ${uiLabelMap.GoogleBaseExportToGoogle}
#if>
diff --git a/specialpurpose/googlebase/widget/GoogleBaseForms.xml b/specialpurpose/googlebase/widget/GoogleBaseForms.xml
index 9fa8f614d8..d1c3368e32 100644
--- a/specialpurpose/googlebase/widget/GoogleBaseForms.xml
+++ b/specialpurpose/googlebase/widget/GoogleBaseForms.xml
@@ -1,21 +1,21 @@
-
+
diff --git a/specialpurpose/googlebase/widget/GoogleBaseMenus.xml b/specialpurpose/googlebase/widget/GoogleBaseMenus.xml
index f525ca8485..6c2d505009 100644
--- a/specialpurpose/googlebase/widget/GoogleBaseMenus.xml
+++ b/specialpurpose/googlebase/widget/GoogleBaseMenus.xml
@@ -20,7 +20,7 @@ under the License.