ofbiz-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mrisal...@apache.org
Subject svn commit: r1066909 - in /ofbiz/trunk/framework: entityext/config/ entityext/src/org/ofbiz/entityext/data/ entityext/src/org/ofbiz/entityext/synchronization/ webtools/config/ webtools/src/org/ofbiz/webtools/
Date Thu, 03 Feb 2011 18:59:47 GMT
Author: mrisaliti
Date: Thu Feb  3 18:59:46 2011
New Revision: 1066909

URL: http://svn.apache.org/viewvc?rev=1066909&view=rev
Log:
Internationalization of return messages of java services of entityext/webtools component (OFBIZ-4091)

Added:
    ofbiz/trunk/framework/entityext/config/
    ofbiz/trunk/framework/entityext/config/EntityExtUiLabels.xml   (with props)
Modified:
    ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataServices.java
    ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncServices.java
    ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.xml
    ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java

Added: ofbiz/trunk/framework/entityext/config/EntityExtUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entityext/config/EntityExtUiLabels.xml?rev=1066909&view=auto
==============================================================================
--- ofbiz/trunk/framework/entityext/config/EntityExtUiLabels.xml (added)
+++ ofbiz/trunk/framework/entityext/config/EntityExtUiLabels.xml Thu Feb  3 18:59:46 2011
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+-->
+<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    <property key="EntityExtCannotDoEntitySyncPush">
+        <value xml:lang="en">Cannot do Entity Sync Push because entitySyncId [] is set for Pull Only.</value>
+        <value xml:lang="it">Non è possibile fare Entity Sync Push perchè entitySyncId [] è impostato in Pull Only.</value>
+    </property>
+    <property key="EntityExtCannotFindDelegator">
+        <value xml:lang="en">Could not find delegator with specified name ${overrideDelegatorName}</value>
+        <value xml:lang="it">Could not find delegator with specified name ${overrideDelegatorName}</value>
+    </property>
+    <property key="EntityExtEntitySyncXMLDocumentIsNotValid">
+        <value xml:lang="en">EntitySync XML document ${fileName} is not valid!</value>
+        <value xml:lang="it">EntitySync XML documento ${fileName} non è valido!</value>
+    </property>
+    <property key="EntityExtErrorCallingRemotePull">
+        <value xml:lang="en">Error calling remote pull and report EntitySync service with name: ${remotePullAndReportEntitySyncDataName}</value>
+        <value xml:lang="it">Errore durante la chiamata del pull remoto e report EntitySync servizio con il nome: ${remotePullAndReportEntitySyncDataName}</value>
+    </property>
+    <property key="EntityExtErrorCallingService">
+        <value xml:lang="en">Error calling service to store data locally</value>
+        <value xml:lang="it">Errore durante la chiamata del servizio di registrazione locale dei dati</value>
+    </property>
+    <property key="EntityExtErrorCleaningEntitySyncRemove">
+        <value xml:lang="en">Error cleaning out EntitySyncRemove info: ${errorString}</value>
+        <value xml:lang="it">Error cleaning out EntitySyncRemove info: ${errorString}</value>
+    </property>
+    <property key="EntityExtErrorGettingListOfEntityInGroup">
+        <value xml:lang="en">Error getting list of entities in group: ${errorString}</value>
+        <value xml:lang="it">Errore ad ottenere la lista delle entità nel gruppo: ${errorString}</value>
+    </property>
+    <property key="EntityExtErrorUnwrappingRecords">
+        <value xml:lang="en">Error unwrapping ByteWrapper records: ${errorString}</value>
+        <value xml:lang="it">Errore unwrapping ByteWrapper records: ${errorString}</value>
+    </property>
+    <property key="EntityExtErrorSavingEntitySyncData">
+        <value xml:lang="en">Error saving Entity Sync Data for entitySyncId ${entitySyncId}: ${errorString}</value>
+        <value xml:lang="it">Errore durante il salvataggio Entity Sync Data per entitySyncId ${entitySyncId}: ${errorString}</value>
+    </property>
+    <property key="EntityExtExceptionSavingEntitySyncData">
+        <value xml:lang="en">Exception saving Entity Sync Data for entitySyncId ${entitySyncId}: ${errorString}</value>
+        <value xml:lang="it">Eccezione durante il salvataggio Entity Sync Data per entitySyncId ${entitySyncId}: ${errorString}</value>
+    </property>
+    <property key="EntityExtFileNotFound">
+        <value xml:lang="en">File not found: ${fileName}</value>
+        <value xml:lang="it">File non trovato: ${fileName}</value>
+    </property>
+    <property key="EntityExtNoFileAvailableInTheRootDirectory">
+        <value xml:lang="en">No files available for reading in this root directory: ${rootDirectory}</value>
+        <value xml:lang="it">Nessun file disponibile da leggere nella directory principale: ${rootDirectory}</value>
+    </property>
+    <property key="EntityExtOfflineXMLFileNotFound">
+        <value xml:lang="en">Offline EntitySync XML file not found (${fileName})</value>
+        <value xml:lang="it">File Offline EntitySync XML non trovato (${fileName})</value>
+    </property>
+    <property key="EntityExtProblemReadingFile">
+        <value xml:lang="en">Problem reading file: ${fileName}</value>
+        <value xml:lang="it">Problema durante la lettura del file: ${fileName}</value>
+    </property>
+    <property key="EntityExtRootDirectoryDoesNotExists">
+        <value xml:lang="en">Root directory does not exist or is not readable.</value>
+        <value xml:lang="it">Directory principale non esiste o non è leggibile.</value>
+    </property>
+    <property key="EntityExtServicePermissionNotGranted">
+        <value xml:lang="en">You do not have permission to run this service.</value>
+        <value xml:lang="it">Tu non hai il permesso di eseguire questo servizio.</value>
+    </property>
+    <property key="EntityExtThisServiceIsNotYetImplemented">
+        <value xml:lang="en">This service is not implemented yet.</value>
+        <value xml:lang="it">Questo servizio non è ancora implementato.</value>
+    </property>
+    <property key="EntityExtUnableToLoadXMLDocument">
+        <value xml:lang="en">Unable to load EntitySync XML ${entitySyncId} - Problem at '${startTime}' Error: ${errorString}</value>
+        <value xml:lang="it">Non è possibile caricare il EntitySync XML ${entitySyncId} - Problema alle '${startTime}' Errore: ${errorString}</value>
+    </property>
+    <property key="EntityExtUnableToLocateRootDirectory">
+        <value xml:lang="en">Unable to locate root directory ${rootDirectory}</value>
+        <value xml:lang="it">Non è possibile localizzare la directory principale ${rootDirectory}</value>
+    </property>
+    <property key="EntityExtUnableToLocateRootDirectoryURI">
+        <value xml:lang="en">Unable to get root directory URI</value>
+        <value xml:lang="it">Non è possibile localizzare la directory principale URI</value>
+    </property>
+</resource>

Propchange: ofbiz/trunk/framework/entityext/config/EntityExtUiLabels.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/framework/entityext/config/EntityExtUiLabels.xml
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/framework/entityext/config/EntityExtUiLabels.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataServices.java?rev=1066909&r1=1066908&r2=1066909&view=diff
==============================================================================
--- ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataServices.java (original)
+++ ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataServices.java Thu Feb  3 18:59:46 2011
@@ -36,11 +36,13 @@ import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.FileUtil;
 import org.ofbiz.base.util.UtilURL;
 import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.base.util.UtilValidate;
 
 import javolution.util.FastList;
 
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.io.BufferedReader;
 import java.io.File;
@@ -58,26 +60,29 @@ import java.net.URISyntaxException;
 public class EntityDataServices {
 
     public static final String module = EntityDataServices.class.getName();
+    public static final String resource = "EntityExtUiLabels";
 
     public static Map<String, Object> exportDelimitedToDirectory(DispatchContext dctx, Map<String, Object> context) {
-        return ServiceUtil.returnError("This service is not implemented yet.");
+        Locale locale = (Locale) context.get("locale");
+        return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityExtThisServiceIsNotYetImplemented", locale));
     }
 
     public static Map<String, Object> importDelimitedFromDirectory(DispatchContext dctx, Map<String, Object> context) {
         LocalDispatcher dispatcher = dctx.getDispatcher();
         Security security = dctx.getSecurity();
+        Locale locale = (Locale) context.get("locale");
 
         // check permission
          GenericValue userLogin = (GenericValue) context.get("userLogin");
         if (!security.hasPermission("ENTITY_MAINT", userLogin)) {
-            return ServiceUtil.returnError("You do not have permission to run this service.");
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityExtServicePermissionNotGranted", locale));
         }
 
         // get the directory & delimiter
         String rootDirectory = (String) context.get("rootDirectory");
         URL rootDirectoryUrl = UtilURL.fromResource(rootDirectory);
         if (rootDirectoryUrl == null) {
-            return ServiceUtil.returnError("Unable to locate root directory : " + rootDirectory);
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityExtUnableToLocateRootDirectory", UtilMisc.toMap("rootDirectory", rootDirectory), locale));
         }
 
         String delimiter = (String) context.get("delimiter");
@@ -90,11 +95,11 @@ public class EntityDataServices {
         try {
             root = new File(new URI(rootDirectoryUrl.toExternalForm()));
         } catch (URISyntaxException e) {
-            return ServiceUtil.returnError("Unable to get root directory URI");
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityExtUnableToLocateRootDirectoryURI", locale));
         }
 
         if (!root.exists() || !root.isDirectory() || !root.canRead()) {
-            return ServiceUtil.returnError("Root directory does not exist or is not readable.");
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityExtRootDirectoryDoesNotExists", locale));
         }
 
         // get the file list
@@ -109,7 +114,7 @@ public class EntityDataServices {
                 }
             }
         } else {
-            return ServiceUtil.returnError("No files available for reading in this root directory : " + rootDirectory);
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityExtNoFileAvailableInTheRootDirectory", UtilMisc.toMap("rootDirectory", rootDirectory), locale));
         }
 
         return ServiceUtil.returnSuccess();
@@ -118,11 +123,12 @@ public class EntityDataServices {
     public static Map<String, Object> importDelimitedFile(DispatchContext dctx, Map<String, Object> context) {
         Delegator delegator = dctx.getDelegator();
         Security security = dctx.getSecurity();
+        Locale locale = (Locale) context.get("locale");
 
         // check permission
          GenericValue userLogin = (GenericValue) context.get("userLogin");
         if (!security.hasPermission("ENTITY_MAINT", userLogin)) {
-            return ServiceUtil.returnError("You do not have permission to run this service.");
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityExtServicePermissionNotGranted", locale));
         }
 
         String delimiter = (String) context.get("delimiter");
@@ -140,10 +146,10 @@ public class EntityDataServices {
         } catch (GeneralException e) {
             return ServiceUtil.returnError(e.getMessage());
         } catch (FileNotFoundException e) {
-            return ServiceUtil.returnError("File not found : " + file.getName());
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityExtFileNotFound", UtilMisc.toMap("fileName", file.getName()), locale));
         } catch (IOException e) {
             Debug.logError(e, module);
-            return ServiceUtil.returnError("Problem reading file : " + file.getName());
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityExtProblemReadingFile", UtilMisc.toMap("fileName", file.getName()), locale));
         }
 
         long endTime = System.currentTimeMillis();
@@ -333,11 +339,12 @@ public class EntityDataServices {
     public static Map<String, Object> rebuildAllIndexesAndKeys(DispatchContext dctx, Map<String, Object> context) {
         Delegator delegator = dctx.getDelegator();
         Security security = dctx.getSecurity();
+        Locale locale = (Locale) context.get("locale");
 
         // check permission
          GenericValue userLogin = (GenericValue) context.get("userLogin");
         if (!security.hasPermission("ENTITY_MAINT", userLogin)) {
-            return ServiceUtil.returnError("You do not have permission to run this service.");
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityExtServicePermissionNotGranted", locale));
         }
 
         String groupName = (String) context.get("groupName");
@@ -351,9 +358,8 @@ public class EntityDataServices {
         try {
             modelEntities = delegator.getModelEntityMapByGroup(groupName);
         } catch (GenericEntityException e) {
-            String errorMessage = "Error getting list of entities in group: " + e.toString();
-            Debug.logError(e, errorMessage, module);
-            return ServiceUtil.returnError(errorMessage);
+            Debug.logError(e, "Error getting list of entities in group: " + e.toString(), module);
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityExtErrorGettingListOfEntityInGroup", UtilMisc.toMap("errorString", e.toString()), locale));
         }
 
         // step 1 - remove FK indices
@@ -431,7 +437,7 @@ public class EntityDataServices {
         Delegator delegator = dctx.getDelegator();
         String entityName = (String) context.get("entityName");
         String fieldName = (String) context.get("fieldName");
-
+        Locale locale = (Locale) context.get("locale");
         EntityListIterator eli = null;
         try {
             eli = delegator.find(entityName, null, null, null, null, null);
@@ -444,9 +450,8 @@ public class EntityDataServices {
                 }
             }
         } catch (GenericEntityException e) {
-            String errMsg = "Error unwrapping ByteWrapper records: " + e.toString();
-            Debug.logError(e, errMsg, module);
-            return ServiceUtil.returnError(errMsg);
+            Debug.logError(e, "Error unwrapping ByteWrapper records: " + e.toString(), module);
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityExtErrorUnwrappingRecords", UtilMisc.toMap("errorString", e.toString()), locale));
         } finally {
             if (eli != null) {
                 try {

Modified: ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncServices.java?rev=1066909&r1=1066908&r2=1066909&view=diff
==============================================================================
--- ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncServices.java (original)
+++ ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncServices.java Thu Feb  3 18:59:46 2011
@@ -28,6 +28,7 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Date;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 
 import javax.xml.parsers.ParserConfigurationException;
@@ -37,6 +38,7 @@ import javolution.util.FastMap;
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.UtilGenerics;
 import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.base.util.UtilURL;
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.base.util.UtilXml;
@@ -68,6 +70,7 @@ import com.ibm.icu.util.Calendar;
 public class EntitySyncServices {
 
     public static final String module = EntitySyncServices.class.getName();
+    public static final String resource = "EntityExtUiLabels";
 
     /**
      * Run an Entity Sync (checks to see if other already running, etc)
@@ -76,11 +79,12 @@ public class EntitySyncServices {
      *@return Map with the result of the service, the output parameters
      */
     public static Map<String, Object> runEntitySync(DispatchContext dctx, Map<String, ? extends Object> context) {
+        Locale locale = (Locale) context.get("locale");
         EntitySyncContext esc = null;
         try {
             esc = new EntitySyncContext(dctx, context);
             if ("Y".equals(esc.entitySync.get("forPullOnly"))) {
-                return ServiceUtil.returnError("Cannot do Entity Sync Push because entitySyncId [] is set for Pull Only.");
+                return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityExtCannotDoEntitySyncPush", locale));
             }
 
             esc.runPushStartRunning();
@@ -132,10 +136,11 @@ public class EntitySyncServices {
     public static Map<String, Object> storeEntitySyncData(DispatchContext dctx, Map<String, Object> context) {
         Delegator delegator = dctx.getDelegator();
         String overrideDelegatorName = (String) context.get("delegatorName");
+        Locale locale = (Locale) context.get("locale");
         if (UtilValidate.isNotEmpty(overrideDelegatorName)) {
             delegator = DelegatorFactory.getDelegator(overrideDelegatorName);
             if (delegator == null) {
-                return ServiceUtil.returnError("Could not find delegator with specified name " + overrideDelegatorName);
+                return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityExtCannotFindDelegator", UtilMisc.toMap("overrideDelegatorName", overrideDelegatorName), locale));
             }
         }
         //LocalDispatcher dispatcher = dctx.getDispatcher();
@@ -240,13 +245,11 @@ public class EntitySyncServices {
             if (Debug.infoOn()) Debug.logInfo("Finisching storeEntitySyncData (" + entitySyncId + ") - [" + keysToRemove.size() + "] to remove. Actually removed: " + toRemoveDeleted  + " already removed: " + toRemoveAlreadyDeleted, module);
             return result;
         } catch (GenericEntityException e) {
-            String errorMsg = "Exception saving Entity Sync Data for entitySyncId [" + entitySyncId + "]: " + e.toString();
-            Debug.logError(e, errorMsg, module);
-            return ServiceUtil.returnError(errorMsg);
+            Debug.logError(e, "Exception saving Entity Sync Data for entitySyncId [" + entitySyncId + "]: " + e.toString(), module);
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityExtExceptionSavingEntitySyncData", UtilMisc.toMap("entitySyncId", entitySyncId, "errorString", e.toString()), locale));
         } catch (Throwable t) {
-            String errorMsg = "Error saving Entity Sync Data for entitySyncId [" + entitySyncId + "]: " + t.toString();
-            Debug.logError(t, errorMsg, module);
-            return ServiceUtil.returnError(errorMsg);
+            Debug.logError(t, "Error saving Entity Sync Data for entitySyncId [" + entitySyncId + "]: " + t.toString(), module);
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityExtErrorSavingEntitySyncData", UtilMisc.toMap("entitySyncId", entitySyncId, "errorString", t.toString()), locale));
         }
     }
 
@@ -258,7 +261,7 @@ public class EntitySyncServices {
      */
     public static Map<String, Object> runPullEntitySync(DispatchContext dctx, Map<String, Object> context) {
         LocalDispatcher dispatcher = dctx.getDispatcher();
-
+        Locale locale = (Locale) context.get("locale");
         String entitySyncId = (String) context.get("entitySyncId");
         String remotePullAndReportEntitySyncDataName = (String) context.get("remotePullAndReportEntitySyncDataName");
 
@@ -299,8 +302,7 @@ public class EntitySyncServices {
             try {
                 Map<String, Object> result = dispatcher.runSync(remotePullAndReportEntitySyncDataName, remoteCallContext);
                 if (ServiceUtil.isError(result)) {
-                    String errMsg = "Error calling remote pull and report EntitySync service with name: " + remotePullAndReportEntitySyncDataName;
-                    return ServiceUtil.returnError(errMsg, null, null, result);
+                    return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityExtErrorCallingRemotePull", UtilMisc.toMap("remotePullAndReportEntitySyncDataName", remotePullAndReportEntitySyncDataName), locale), null, null, result);
                 }
 
                 startDate = (Timestamp) result.get("startDate");
@@ -331,8 +333,7 @@ public class EntitySyncServices {
                         callLocalStoreContext.put("userLogin", context.get("userLogin"));
                         Map<String, Object> storeResult = dispatcher.runSync("storeEntitySyncData", callLocalStoreContext);
                         if (ServiceUtil.isError(storeResult)) {
-                            String errMsg = "Error calling service to store data locally";
-                            return ServiceUtil.returnError(errMsg, null, null, storeResult);
+                            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityExtErrorCallingService", locale), null, null, storeResult);
                         }
 
                         // get results for next pass
@@ -346,18 +347,15 @@ public class EntitySyncServices {
                         toRemoveAlreadyDeleted = (Long) storeResult.get("toRemoveAlreadyDeleted");
                     }
                 } catch (GenericServiceException e) {
-                    String errMsg = "Error calling service to store data locally: " + e.toString();
-                    Debug.logError(e, errMsg, module);
-                    return ServiceUtil.returnError(errMsg);
+                    Debug.logError(e, "Error calling service to store data locally: " + e.toString(), module);
+                    return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityExtErrorCallingService", locale) + e.toString());
                 }
             } catch (GenericServiceException e) {
-                String errMsg = "Exception calling remote pull and report EntitySync service with name: " + remotePullAndReportEntitySyncDataName + "; " + e.toString();
-                Debug.logError(e, errMsg, module);
-                return ServiceUtil.returnError(errMsg);
+                Debug.logError(e, "Exception calling remote pull and report EntitySync service with name: " + remotePullAndReportEntitySyncDataName + "; " + e.toString(), module);
+                return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityExtErrorCallingRemotePull", UtilMisc.toMap("remotePullAndReportEntitySyncDataName", remotePullAndReportEntitySyncDataName), locale) + e.toString());
             } catch (Throwable t) {
-                String errMsg = "Error calling remote pull and report EntitySync service with name: " + remotePullAndReportEntitySyncDataName + "; " + t.toString();
-                Debug.logError(t, errMsg, module);
-                return ServiceUtil.returnError(errMsg);
+                Debug.logError(t, "Error calling remote pull and report EntitySync service with name: " + remotePullAndReportEntitySyncDataName + "; " + t.toString(), module);
+                return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityExtErrorCallingRemotePull", UtilMisc.toMap("remotePullAndReportEntitySyncDataName", remotePullAndReportEntitySyncDataName), locale) + t.toString());
             }
         }
 
@@ -372,13 +370,14 @@ public class EntitySyncServices {
      */
     public static Map<String, Object> pullAndReportEntitySyncData(DispatchContext dctx, Map<String, ? extends Object> context) {
         EntitySyncContext esc = null;
+        Locale locale = (Locale) context.get("locale");
         try {
             esc = new EntitySyncContext(dctx, context);
 
             Debug.logInfo("Doing pullAndReportEntitySyncData for entitySyncId=" + esc.entitySyncId + ", currentRunStartTime=" + esc.currentRunStartTime + ", currentRunEndTime=" + esc.currentRunEndTime, module);
 
             if ("Y".equals(esc.entitySync.get("forPushOnly"))) {
-                return ServiceUtil.returnError("Cannot do Entity Sync Pull because entitySyncId [] is set for Push Only.");
+                return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityExtCannotDoEntitySyncPush", locale));
             }
 
             // Part 1: if any results are passed, store the results for the given startDate, update EntitySync, etc
@@ -523,7 +522,7 @@ public class EntitySyncServices {
         Delegator delegator = dctx.getDelegator();
         GenericValue userLogin = (GenericValue) context.get("userLogin");
         String fileName = (String) context.get("xmlFileName");
-
+        Locale locale = (Locale) context.get("locale");
         URL xmlFile = UtilURL.fromResource(fileName);
         if (xmlFile != null) {
             Document xmlSyncDoc = null;
@@ -537,7 +536,7 @@ public class EntitySyncServices {
                 Debug.logError(e, module);
             }
             if (xmlSyncDoc == null) {
-                return ServiceUtil.returnError("EntitySync XML document (" + fileName + ") is not valid!");
+                return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityExtEntitySyncXMLDocumentIsNotValid", UtilMisc.toMap("fileName", fileName), locale));
             }
 
             List<? extends Element> syncElements = UtilXml.childElementList(xmlSyncDoc.getDocumentElement());
@@ -567,20 +566,20 @@ public class EntitySyncServices {
 
                         // TODO create a response document to send back to the initial sync machine
                     } catch (Exception e) {
-                        return ServiceUtil.returnError("Unable to load EntitySync XML [" + entitySyncId + "] - Problem at '" +
-                                    startTime + "' Error: " + e.getMessage());
+                        return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityExtUnableToLoadXMLDocument", UtilMisc.toMap("entitySyncId", entitySyncId, "startTime", startTime, "errorString", e.getMessage()), locale));
                     }
                 }
             }
         } else {
-            return ServiceUtil.returnError("Offline EntitySync XML file not found (" + fileName + ")");
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityExtOfflineXMLFileNotFound", UtilMisc.toMap("fileName", fileName), locale));
         }
 
         return ServiceUtil.returnSuccess();
     }
 
     public static Map<String, Object> updateOfflineEntitySync(DispatchContext dctx, Map<String, Object> context) {
-        return ServiceUtil.returnError("Service not yet implemented.");
+        Locale locale = (Locale) context.get("locale");
+        return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityExtThisServiceIsNotYetImplemented", locale));
     }
 
     /**
@@ -592,6 +591,7 @@ public class EntitySyncServices {
     public static Map<String, Object> cleanSyncRemoveInfo(DispatchContext dctx, Map<String, ? extends Object> context) {
         Debug.logInfo("Running cleanSyncRemoveInfo", module);
         Delegator delegator = dctx.getDelegator();
+        Locale locale = (Locale) context.get("locale");
 
         try {
             // find the largest keepRemoveInfoHours value on an EntitySyncRemove and kill everything before that, if none found default to 10 days (240 hours)
@@ -621,9 +621,8 @@ public class EntitySyncServices {
 
             return ServiceUtil.returnSuccess();
         } catch (GenericEntityException e) {
-            String errorMsg = "Error cleaning out EntitySyncRemove info: " + e.toString();
-            Debug.logError(e, errorMsg, module);
-            return ServiceUtil.returnError(errorMsg);
+            Debug.logError(e, "Error cleaning out EntitySyncRemove info: " + e.toString(), module);
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityExtErrorCleaningEntitySyncRemove", UtilMisc.toMap("errorString", e.toString()), locale));
         }
     }
 }

Modified: ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.xml?rev=1066909&r1=1066908&r2=1066909&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.xml (original)
+++ ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.xml Thu Feb  3 18:59:46 2011
@@ -1372,6 +1372,66 @@
         <value xml:lang="zh">实体引擎工具</value>
         <value xml:lang="zh_TW">實體引擎工具</value>
     </property>
+    <property key="EntityImportDeletFile">
+        <value xml:lang="en">Deleting ${fileName}</value>
+        <value xml:lang="it">Stò cancellando il file ${fileName}</value>
+    </property>
+    <property key="EntityImportErrorRetrievingEntityNames">
+        <value xml:lang="en">Error retrieving entity names.</value>
+        <value xml:lang="it">Errore nell'ottenere i nome delle entità.</value>
+    </property>
+    <property key="EntityImportFailedNumberFile">
+        <value xml:lang="en">Failed: ${failed} of ${total}</value>
+        <value xml:lang="it">Failed: ${failed} di ${total}</value>
+    </property>
+    <property key="EntityImportFailedFile">
+        <value xml:lang="en">Failed ${fileName} adding to retry list for next pass</value>
+        <value xml:lang="it">Fallita ${fileName} aggiunta alla lista di riprova al successivo passaggio</value>
+    </property>
+    <property key="EntityImportFailedFileList">
+        <value xml:lang="en">Failed Files:</value>
+        <value xml:lang="it">Lista file che hanno avuto fallimento:</value>
+    </property>
+    <property key="EntityImportNoDataSourceSpecified">
+        <value xml:lang="en">Unable to locate the datasource helper for the group ${groupNameToUse}</value>
+        <value xml:lang="it">Non è possibile localizzare la sorgente dati per il gruppo ${groupNameToUse}</value>
+    </property>
+    <property key="EntityImportNoXmlFileOrTextSpecified">
+        <value xml:lang="en">No entity xml file or text specified</value>
+        <value xml:lang="it">Nessun file xml entità o testo specificato</value>
+    </property>
+    <property key="EntityImportNoXmlFileSpecified">
+        <value xml:lang="en">No filename/URL or complete XML document specified, doing nothing.</value>
+        <value xml:lang="it">Nessun nome file/URL o documento XML completo specificato, nientre verrà fatto.</value>
+    </property>
+    <property key="EntityImportNumberOfEntityToBeProcessed">
+        <value xml:lang="en">Got ${numberRead} entities from ${fileName}</value>
+        <value xml:lang="it">Ottenute ${numberRead} entità da ${fileName}</value>
+    </property>
+    <property key="EntityImportParsingError">
+        <value xml:lang="en">ERROR parsing Entity Xml file: ${errorString}</value>
+        <value xml:lang="it">ERRORE di parsing file entità XML: ${errorString}</value>
+    </property>
+    <property key="EntityImportPathNotFound">
+        <value xml:lang="en">path not found or can't be read</value>
+        <value xml:lang="it">path non trovato o non può essere letto</value>
+    </property>
+    <property key="EntityImportPathNotSpecified">
+        <value xml:lang="en">No path specified, doing nothing.</value>
+        <value xml:lang="it">Nessun path specificato, non verrà fatto niente.</value>
+    </property>
+    <property key="EntityImportPassedFile">
+        <value xml:lang="en">Pass ${passes} complete</value>
+        <value xml:lang="it">Passati ${passes} completati</value>
+    </property>
+    <property key="EntityImportRowProcessed">
+        <value xml:lang="en">Got ${numberRead} entities to write to the datasource.</value>
+        <value xml:lang="it">Ottenute ${numberRead} entità da scrivere sulla sorgente dati.</value>
+    </property>
+    <property key="EntityImportSucceededNumberFile">
+        <value xml:lang="en">Succeeded: ${succeeded} of ${total}</value>
+        <value xml:lang="it">Successo: ${succeeded} di ${total}</value>
+    </property>
     <property key="WebtoolsEntityName">
         <value xml:lang="de">Entität</value>
         <value xml:lang="en">Entity Name</value>
@@ -1515,6 +1575,30 @@
         <value xml:lang="it">Nome var. amb.</value>
         <value xml:lang="pt">Nome de Env</value>
     </property>
+    <property key="WebtoolsEomodelErrorGettingEntityNames">
+        <value xml:lang="en">ERROR: getting entity names: ${errorString}</value>
+        <value xml:lang="it">ERRORE: ottenendo i nomi delle entità: ${errorString}</value>
+    </property>
+    <property key="WebtoolsEomodelExported">
+        <value xml:lang="en">Exported eomodeld file for ${entityNamesSize} entities to: ${eomodeldFullPath}</value>
+        <value xml:lang="it">Esportato file eomodeld per ${entityNamesSize} entità in: ${eomodeldFullPath}</value>
+    </property>
+    <property key="WebtoolsEomodelFileOrDirectoryNotFound">
+        <value xml:lang="en">ERROR: file/directory not found: ${errorString}</value>
+        <value xml:lang="it">ERRORE: file/directory non trovata: ${errorString}</value>
+    </property>
+    <property key="WebtoolsEomodelFullPathIsNotADirectory">
+        <value xml:lang="en">eomodel Full Path is not a directory: ${eomodeldFullPath}</value>
+        <value xml:lang="it">eomodel path completo non è una directory: ${eomodeldFullPath}</value>
+    </property>
+    <property key="WebtoolsEomodelFullPathIsNotWriteable">
+        <value xml:lang="en">eomodel Full Path is not write-able: ${eomodeldFullPath}</value>
+        <value xml:lang="it">eomodel path completo non è scrivibile: ${eomodeldFullPath}</value>
+    </property>
+    <property key="WebtoolsEomodelSavingFileError">
+        <value xml:lang="en">ERROR saving file: ${errorString}</value>
+        <value xml:lang="it">ERRORE durante il salvataggio del file: ${errorString}</value>
+    </property>
     <property key="WebtoolsErrorLogLevel">
         <value xml:lang="de">Fehler</value>
         <value xml:lang="en">Error</value>
@@ -1537,6 +1621,22 @@
         <value xml:lang="zh">错误级别会指出那些仍然允许应用程序继续执行的错误事件。</value>
         <value xml:lang="zh_TW">錯誤級別會指出那些仍然允許應用程式繼續執行的錯誤事件。</value>
     </property>
+    <property key="WebtoolsErrrorParsingFile">
+        <value xml:lang="en">ERROR: parsing file: ${errorString}</value>
+        <value xml:lang="it">ERRORE: errore di parsing file: ${errorString}</value>
+    </property>
+    <property key="WebtoolsErrrorProcessingTemplateFile">
+        <value xml:lang="en">ERROR: processing template file ${filename}: ${errorString}</value>
+        <value xml:lang="it">ERRORE: errore di esecuzione template file ${filename}: ${errorString}</value>
+    </property>
+    <property key="WebtoolsErrrorReadingFileName">
+        <value xml:lang="en">ERROR: reading file name ${filename}: ${errorString}</value>
+        <value xml:lang="it">ERRORE: errore di lettura file ${filename}: ${errorString}</value>
+    </property>
+    <property key="WebtoolsErrrorReadingTemplateFile">
+        <value xml:lang="en">ERROR: reading template file ${filename}: ${errorString}</value>
+        <value xml:lang="it">ERRORE: errore di lettura template file ${filename}: ${errorString}</value>
+    </property>
     <property key="WebtoolsEventName">
         <value xml:lang="de">Ereignisname</value>
         <value xml:lang="en">Event name</value>
@@ -2037,6 +2137,10 @@
         <value xml:lang="zh">间隔</value>
         <value xml:lang="zh_TW">間隔</value>
     </property>
+    <property key="WebtoolsInvalidFileName">
+        <value xml:lang="en">ERROR: invalid file name ${filename}: ${errorString}</value>
+        <value xml:lang="it">ERRORE: nome file invalido ${filename}: ${errorString}</value>
+    </property>
     <property key="WebtoolsInvoke">
         <value xml:lang="de">Aufrufen</value>
         <value xml:lang="en">Invoke</value>

Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java?rev=1066909&r1=1066908&r2=1066909&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java (original)
+++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java Thu Feb  3 18:59:46 2011
@@ -99,11 +99,12 @@ import freemarker.template.TemplateHashM
 public class WebToolsServices {
 
     public static final String module = WebToolsServices.class.getName();
+    public static final String resource = "WebtoolsUiLabels";
 
     public static Map<String, Object> entityImport(DispatchContext dctx, Map<String, ? extends Object> context) {
         GenericValue userLogin = (GenericValue) context.get("userLogin");
         LocalDispatcher dispatcher = dctx.getDispatcher();
-
+        Locale locale = (Locale) context.get("locale");
         List<String> messages = FastList.newInstance();
 
         String filename = (String)context.get("filename");
@@ -129,9 +130,9 @@ public class WebToolsServices {
             try {
                 url = isUrl?FlexibleLocation.resolveLocation(filename):UtilURL.fromFilename(filename);
             } catch (MalformedURLException mue) {
-                return ServiceUtil.returnError("ERROR: invalid file name (" + filename + "): " + mue.getMessage());
+                return ServiceUtil.returnError(UtilProperties.getMessage(resource, "WebtoolsInvalidFileName", UtilMisc.toMap("filename", filename, "errorString", mue.getMessage()), locale));
             } catch (Exception exc) {
-                return ServiceUtil.returnError("ERROR: reading file name (" + filename + "): " + exc.getMessage());
+                return ServiceUtil.returnError(UtilProperties.getMessage(resource, "WebtoolsErrrorReadingFileName", UtilMisc.toMap("filename", filename, "errorString", exc.getMessage()), locale));
             }
         }
 
@@ -143,7 +144,7 @@ public class WebToolsServices {
             try {
                 templateReader = new FileReader(fmfilename);
             } catch (FileNotFoundException e) {
-                return ServiceUtil.returnError("ERROR reading template file (" + fmfilename + "): " + e.getMessage());
+                return ServiceUtil.returnError(UtilProperties.getMessage(resource, "WebtoolsErrrorReadingTemplateFile", UtilMisc.toMap("filename", fmfilename, "errorString", e.getMessage()), locale));
             }
 
             StringWriter outWriter = new StringWriter();
@@ -174,7 +175,7 @@ public class WebToolsServices {
                 template.process(fmcontext, outWriter);
                 fulltext = outWriter.toString();
             } catch (Exception ex) {
-                return ServiceUtil.returnError("ERROR processing template file (" + fmfilename + "): " + ex.getMessage());
+                return ServiceUtil.returnError(UtilProperties.getMessage(resource, "WebtoolsErrrorProcessingTemplateFile", UtilMisc.toMap("filename", fmfilename, "errorString", ex.getMessage()), locale));
             }
         }
 
@@ -196,16 +197,16 @@ public class WebToolsServices {
                 }
                 Map<String, Object> outputMap = dispatcher.runSync("parseEntityXmlFile", inputMap);
                 if (ServiceUtil.isError(outputMap)) {
-                    return ServiceUtil.returnError("ERROR: " + ServiceUtil.getErrorMessage(outputMap));
+                    return ServiceUtil.returnError(UtilProperties.getMessage(resource, "WebtoolsErrrorParsingFile", UtilMisc.toMap("errorString", ServiceUtil.getErrorMessage(outputMap)), locale));
                 } else {
                     Long numberRead = (Long)outputMap.get("rowProcessed");
-                    messages.add("Got " + numberRead.longValue() + " entities to write to the datasource.");
+                    messages.add(UtilProperties.getMessage(resource, "EntityImportRowProcessed", UtilMisc.toMap("numberRead", numberRead.toString()), locale));
                 }
             } catch (Exception ex) {
-                return ServiceUtil.returnError("ERROR parsing Entity Xml file: " + ex.getMessage());
+                return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityImportParsingError", UtilMisc.toMap("errorString", ex.getMessage()), locale));
             }
         } else {
-            messages.add("No filename/URL or complete XML document specified, doing nothing.");
+            messages.add(UtilProperties.getMessage(resource, "EntityImportNoXmlFileSpecified", locale));
         }
 
         // send the notification
@@ -216,7 +217,7 @@ public class WebToolsServices {
     public static Map<String, Object> entityImportDir(DispatchContext dctx, Map<String, ? extends Object> context) {
         GenericValue userLogin = (GenericValue) context.get("userLogin");
         LocalDispatcher dispatcher = dctx.getDispatcher();
-
+        Locale locale = (Locale) context.get("locale");
         List<String> messages = FastList.newInstance();
 
         String path = (String) context.get("path");
@@ -270,14 +271,14 @@ public class WebToolsServices {
                             parseEntityXmlFileArgs.put("url", furl);
                             Map<String, Object> outputMap = dispatcher.runSync("parseEntityXmlFile", parseEntityXmlFileArgs);
                             Long numberRead = (Long) outputMap.get("rowProcessed");
-                            messages.add("Got " + numberRead.longValue() + " entities from " + f);
+                            messages.add(UtilProperties.getMessage(resource, "EntityImportNumberOfEntityToBeProcessed", UtilMisc.toMap("numberRead", numberRead.toString(), "fileName", f.getName()), locale));
                             if (deleteFiles) {
-                                messages.add("Deleting " + f);
+                                messages.add(UtilProperties.getMessage(resource, "EntityImportDeletFile", UtilMisc.toMap("fileName", f.getName()), locale));
                                 f.delete();
                             }
                         } catch (Exception e) {
                             unprocessedFiles.add(f);
-                            messages.add("Failed " + f + " adding to retry list for next pass");
+                            messages.add(UtilProperties.getMessage(resource, "EntityImportFailedFile", UtilMisc.toMap("fileName", f.getName()), locale));
                         }
                         // pause in between files
                         if (pauseLong > 0) {
@@ -291,23 +292,23 @@ public class WebToolsServices {
                     }
                     files = unprocessedFiles;
                     passes++;
-                    messages.add("Pass " + passes + " complete");
+                    messages.add(UtilProperties.getMessage(resource, "EntityImportPassedFile", UtilMisc.toMap("passes", passes), locale));
                     Debug.logInfo("Pass " + passes + " complete", module);
                 }
                 lastUnprocessedFilesCount=unprocessedFiles.size();
                 messages.add("---------------------------------------");
-                messages.add("Succeeded: " + (initialListSize-lastUnprocessedFilesCount) + " of " + initialListSize);
-                messages.add("Failed:    " + lastUnprocessedFilesCount + " of " + initialListSize);
+                messages.add(UtilProperties.getMessage(resource, "EntityImportSucceededNumberFile", UtilMisc.toMap("succeeded", (initialListSize-lastUnprocessedFilesCount), "total", initialListSize), locale));
+                messages.add(UtilProperties.getMessage(resource, "EntityImportFailedNumberFile", UtilMisc.toMap("failed", lastUnprocessedFilesCount, "total", initialListSize), locale));
                 messages.add("---------------------------------------");
-                messages.add("Failed Files:");
+                messages.add(UtilProperties.getMessage(resource, "EntityImportFailedFileList", locale));
                 for (File file: unprocessedFiles) {
                     messages.add(file.toString());
                 }
             } else {
-                messages.add("path not found or can't be read");
+                messages.add(UtilProperties.getMessage(resource, "EntityImportPathNotFound", locale));
             }
         } else {
-            messages.add("No path specified, doing nothing.");
+            messages.add(UtilProperties.getMessage(resource, "EntityImportPathNotSpecified", locale));
         }
         // send the notification
         Map<String, Object> resp = UtilMisc.toMap("messages", (Object) messages);
@@ -322,7 +323,7 @@ public class WebToolsServices {
         boolean maintainTxs = "true".equals(context.get("maintainTimeStamps"));
         boolean tryInserts = "true".equals(context.get("mostlyInserts"));
         boolean checkDataOnly = "true".equals(context.get("checkDataOnly"));
-
+        Locale locale = (Locale) context.get("locale");
         Integer txTimeoutInt = (Integer) context.get("txTimeout");
         int txTimeout = txTimeoutInt != null ? txTimeoutInt.intValue() : -1;
 
@@ -349,7 +350,7 @@ public class WebToolsServices {
 
         String helperName = delegator.getGroupHelperName(groupNameToUse);
         if (helperName == null) {
-            return ServiceUtil.returnError("Unable to locate the datasource helper for the group [" + groupNameToUse + "]");
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityImportNoDataSourceSpecified", UtilMisc.toMap("groupNameToUse", groupNameToUse), locale));
         }
 
         // get the reader name URLs first
@@ -427,12 +428,12 @@ public class WebToolsServices {
 
     public static Map<String, Object> parseEntityXmlFile(DispatchContext dctx, Map<String, ? extends Object> context) {
         Delegator delegator = dctx.getDelegator();
-
+        Locale locale = (Locale) context.get("locale");
         URL url = (URL) context.get("url");
         String xmltext = (String) context.get("xmltext");
 
         if (url == null && xmltext == null) {
-            return ServiceUtil.returnError("No entity xml file or text specified");
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityImportNoXmlFileOrTextSpecified", locale));
         }
         boolean mostlyInserts = (String) context.get("mostlyInserts") != null;
         boolean maintainTimeStamps = (String) context.get("maintainTimeStamps") != null;
@@ -456,7 +457,7 @@ public class WebToolsServices {
             long numberRead = (url != null ? reader.parse(url) : reader.parse(xmltext));
             rowProcessed = numberRead;
         } catch (Exception ex) {
-            return ServiceUtil.returnError("Error parsing entity xml file: " + ex.toString());
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityImportParsingError", UtilMisc.toMap("errorString", ex.toString()), locale));
         }
         // send the notification
         Map<String, Object> resp = UtilMisc.<String, Object>toMap("rowProcessed", rowProcessed);
@@ -465,7 +466,7 @@ public class WebToolsServices {
 
     public static Map<String, Object> entityExportAll(DispatchContext dctx, Map<String, ? extends Object> context) {
         Delegator delegator = dctx.getDelegator();
-
+        Locale locale = (Locale) context.get("locale");
         String outpath = (String)context.get("outpath"); // mandatory
         Integer txTimeout = (Integer)context.get("txTimeout");
         if (txTimeout == null) {
@@ -486,7 +487,7 @@ public class WebToolsServices {
                     Collection<String> ec = reader.getEntityNames();
                     passedEntityNames = new TreeSet<String>(ec);
                 } catch (Exception exc) {
-                    return ServiceUtil.returnError("Error retrieving entity names.");
+                    return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityImportErrorRetrievingEntityNames", locale));
                 }
                 int fileNumber = 1;
 
@@ -638,7 +639,7 @@ public class WebToolsServices {
                 entities.add(eName);
             }
         } catch (GenericEntityException e) {
-            return ServiceUtil.returnError("ERROR: getting entity names: " + e.getMessage());
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityImportErrorRetrievingEntityNames", locale) + e.getMessage());
         }
 
         String search = (String) context.get("search");
@@ -768,7 +769,7 @@ public class WebToolsServices {
                 packagesList.add(packageMap);
             }
         } catch (GenericEntityException e) {
-            return ServiceUtil.returnError("ERROR: getting entity info: " + e.getMessage());
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityImportErrorRetrievingEntityNames", locale) + e.getMessage());
         }
 
         resultMap.put("packagesList", packagesList);
@@ -781,7 +782,7 @@ public class WebToolsServices {
         String entityGroupId = (String) context.get("entityGroupId");
         String datasourceName = (String) context.get("datasourceName");
         String entityNamePrefix = (String) context.get("entityNamePrefix");
-
+        Locale locale = (Locale) context.get("locale");
         if (datasourceName == null) datasourceName = "localderby";
 
         ModelReader reader = dctx.getDelegator().getModelReader();
@@ -796,10 +797,10 @@ public class WebToolsServices {
                 outdir.mkdir();
             }
             if (!outdir.isDirectory()) {
-                return ServiceUtil.returnError("eomodel Full Path is not a directory: " + eomodeldFullPath);
+                return ServiceUtil.returnError(UtilProperties.getMessage(resource, "WebtoolsEomodelFullPathIsNotADirectory", UtilMisc.toMap("eomodeldFullPath", eomodeldFullPath), locale));
             }
             if (!outdir.canWrite()) {
-                return ServiceUtil.returnError("eomodel Full Path is not write-able: " + eomodeldFullPath);
+                return ServiceUtil.returnError(UtilProperties.getMessage(resource, "WebtoolsEomodelFullPathIsNotWriteable", UtilMisc.toMap("eomodeldFullPath", eomodeldFullPath), locale));
             }
 
             Set<String> entityNames = new TreeSet<String>();
@@ -849,14 +850,14 @@ public class WebToolsServices {
                 ModelEntity modelEntity = reader.getModelEntity(curEntityName);
                 UtilPlist.writePlistFile(modelEntity.createEoModelMap(entityNamePrefix, datasourceName, entityNames, reader), eomodeldFullPath, curEntityName +".plist", true);
             }
-
-            return ServiceUtil.returnSuccess("Exported eomodeld file for " + entityNames.size() + " entities to: " + eomodeldFullPath);
+            Integer entityNamesSize = new Integer(entityNames.size());
+            return ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, "WebtoolsEomodelExported", UtilMisc.toMap("entityNamesSize", entityNamesSize.toString(), "eomodeldFullPath", eomodeldFullPath), locale));
         } catch (UnsupportedEncodingException e) {
-            return ServiceUtil.returnError("ERROR saving file: " + e.toString());
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "WebtoolsEomodelSavingFileError", UtilMisc.toMap("errorString", e.toString()), locale));
         } catch (FileNotFoundException e) {
-            return ServiceUtil.returnError("ERROR: file/directory not found: " + e.toString());
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "WebtoolsEomodelFileOrDirectoryNotFound", UtilMisc.toMap("errorString", e.toString()), locale));
         } catch (GenericEntityException e) {
-            return ServiceUtil.returnError("ERROR: getting entity names: " + e.toString());
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "WebtoolsEomodelErrorGettingEntityNames", UtilMisc.toMap("errorString", e.toString()), locale));
         }
     }
 
@@ -875,7 +876,7 @@ public class WebToolsServices {
             resultMap = ServiceUtil.returnSuccess();
             resultMap.put("hasPermission", true);
         } else {
-            resultMap = ServiceUtil.returnFailure(UtilProperties.getMessage("WebtoolsUiLabels", "WebtoolsPermissionError", locale));
+            resultMap = ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "WebtoolsPermissionError", locale));
             resultMap.put("hasPermission", false);
         }
         return resultMap;
@@ -885,6 +886,7 @@ public class WebToolsServices {
     public static Map<String, Object> exportServiceEoModelBundle(DispatchContext dctx, Map<String, ? extends Object> context) {
         String eomodeldFullPath = (String) context.get("eomodeldFullPath");
         String serviceName = (String) context.get("serviceName");
+        Locale locale = (Locale) context.get("locale");
 
         if (eomodeldFullPath.endsWith("/")) {
             eomodeldFullPath = eomodeldFullPath + serviceName + ".eomodeld";
@@ -899,10 +901,10 @@ public class WebToolsServices {
             outdir.mkdir();
         }
         if (!outdir.isDirectory()) {
-            return ServiceUtil.returnError("eomodel Full Path is not a directory: " + eomodeldFullPath);
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "WebtoolsEomodelFullPathIsNotADirectory", UtilMisc.toMap("eomodeldFullPath", eomodeldFullPath), locale));
         }
         if (!outdir.canWrite()) {
-            return ServiceUtil.returnError("eomodel Full Path is not write-able: " + eomodeldFullPath);
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "WebtoolsEomodelFullPathIsNotWriteable", UtilMisc.toMap("eomodeldFullPath", eomodeldFullPath), locale));
         }
 
         try {
@@ -911,11 +913,11 @@ public class WebToolsServices {
             serviceInfo.writeServiceCallGraphEoModel(eomodeldFullPath);
         } catch (GeneralException e) {
             Debug.logError(e, module);
-            return ServiceUtil.returnError("Error getting service info: " + e.toString());
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "WebtoolsEomodelErrorGettingEntityNames", UtilMisc.toMap("errorString", e.toString()), locale));
         } catch (UnsupportedEncodingException e) {
-            return ServiceUtil.returnError("ERROR saving file: " + e.toString());
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "WebtoolsEomodelSavingFileError", UtilMisc.toMap("errorString", e.toString()), locale));
         } catch (FileNotFoundException e) {
-            return ServiceUtil.returnError("ERROR: file/directory not found: " + e.toString());
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "WebtoolsEomodelFileOrDirectoryNotFound", UtilMisc.toMap("errorString", e.toString()), locale));
         }
 
         return ServiceUtil.returnSuccess();



Mime
View raw message