|
Modified: ofbiz/branches/webhelp-2012-12-07/applications/product/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/webhelp-2012-12-07/applications/product/entitydef/entitymodel.xml?rev=1452030&r1=1452029&r2=1452030&view=diff ============================================================================== --- ofbiz/branches/webhelp-2012-12-07/applications/product/entitydef/entitymodel.xml (original) +++ ofbiz/branches/webhelp-2012-12-07/applications/product/entitydef/entitymodel.xml Sun Mar 3 12:00:12 2013 @@ -3758,6 +3758,7 @@ under the License. <field name="showTaxIsExempt" type="indicator"><description>default Y; if set to N do not show isExempt checkbox for PartyTaxAuthInfo, always force to N</description></field> <field name="vatTaxAuthGeoId" type="id"></field> <field name="vatTaxAuthPartyId" type="id"></field> + <field name="calcTaxAfterPromotion" type="indicator"><description>For execute promotions and price rules before running taxation rules</description></field> <field name="enableAutoSuggestionList" type="indicator"><description>The auto-suggestion list is a special ShoppingList that the addSuggestionsToShoppingList service will maintain for cross-sells of ordered items.</description></field> <field name="enableDigProdUpload" type="indicator"></field> <field name="prodSearchExcludeVariants" type="indicator"><description>default Y; if set to Y an additional constraint will of isVariant!=Y will be added to all product searches for the store</description></field> Modified: ofbiz/branches/webhelp-2012-12-07/applications/product/src/org/ofbiz/product/category/CatalogUrlFilter.java URL: http://svn.apache.org/viewvc/ofbiz/branches/webhelp-2012-12-07/applications/product/src/org/ofbiz/product/category/CatalogUrlFilter.java?rev=1452030&r1=1452029&r2=1452030&view=diff ============================================================================== --- ofbiz/branches/webhelp-2012-12-07/applications/product/src/org/ofbiz/product/category/CatalogUrlFilter.java (original) +++ ofbiz/branches/webhelp-2012-12-07/applications/product/src/org/ofbiz/product/category/CatalogUrlFilter.java Sun Mar 3 12:00:12 2013 @@ -35,9 +35,9 @@ import javolution.util.FastList; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.StringUtil; +import org.ofbiz.base.util.StringUtil.StringWrapper; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilValidate; -import org.ofbiz.base.util.StringUtil.StringWrapper; import org.ofbiz.common.UrlServletHelper; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; @@ -342,7 +342,7 @@ public class CatalogUrlFilter extends Co GenericValue productCategory = delegator.findOne("ProductCategory", UtilMisc.toMap("productCategoryId", productCategoryId), true); CategoryContentWrapper wrapper = new CategoryContentWrapper(productCategory, request); List<String> trail = CategoryWorker.getTrail(request); - return makeCategoryUrl(delegator, wrapper, trail, request.getSession().getServletContext().getContextPath(), previousCategoryId, productCategoryId, productId, viewSize, viewIndex, viewSort, searchString); + return makeCategoryUrl(delegator, wrapper, trail, request.getContextPath(), previousCategoryId, productCategoryId, productId, viewSize, viewIndex, viewSort, searchString); } catch (GenericEntityException e) { Debug.logWarning(e, "Cannot create category's URL for: " + productCategoryId, module); return redirectUrl; @@ -417,7 +417,7 @@ public class CatalogUrlFilter extends Co GenericValue product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), true); ProductContentWrapper wrapper = new ProductContentWrapper(product, request); List<String> trail = CategoryWorker.getTrail(request); - url = makeProductUrl(delegator, wrapper, trail, request.getSession().getServletContext().getContextPath(), previousCategoryId, productCategoryId, productId); + url = makeProductUrl(delegator, wrapper, trail, request.getContextPath(), previousCategoryId, productCategoryId, productId); } catch (GenericEntityException e) { Debug.logWarning(e, "Cannot create product's URL for: " + productId, module); return redirectUrl; Modified: ofbiz/branches/webhelp-2012-12-07/applications/product/src/org/ofbiz/product/category/OfbizCatalogUrlTransform.java URL: http://svn.apache.org/viewvc/ofbiz/branches/webhelp-2012-12-07/applications/product/src/org/ofbiz/product/category/OfbizCatalogUrlTransform.java?rev=1452030&r1=1452029&r2=1452030&view=diff ============================================================================== --- ofbiz/branches/webhelp-2012-12-07/applications/product/src/org/ofbiz/product/category/OfbizCatalogUrlTransform.java (original) +++ ofbiz/branches/webhelp-2012-12-07/applications/product/src/org/ofbiz/product/category/OfbizCatalogUrlTransform.java Sun Mar 3 12:00:12 2013 @@ -47,34 +47,33 @@ public class OfbizCatalogUrlTransform im @Override @SuppressWarnings("unchecked") - public Writer getWriter(final Writer out, final Map args) - throws TemplateModelException, IOException { + public Writer getWriter(final Writer out, final Map args) throws TemplateModelException, IOException { final StringBuilder buf = new StringBuilder(); return new Writer(out) { - + @Override public void write(char[] cbuf, int off, int len) throws IOException { buf.append(cbuf, off, len); } - + @Override public void flush() throws IOException { out.flush(); } - + @Override public void close() throws IOException { try { - Environment env = Environment.getCurrentEnvironment(); - BeanModel req = (BeanModel) env.getVariable("request"); - if (req != null) { - String productId = getStringArg(args, "productId"); - String currentCategoryId = getStringArg(args, "currentCategoryId"); - String previousCategoryId = getStringArg(args, "previousCategoryId"); - HttpServletRequest request = (HttpServletRequest) req.getWrappedObject(); - String catalogUrl = CatalogUrlServlet.makeCatalogUrl(request, productId, currentCategoryId, previousCategoryId); - out.write(catalogUrl); - } + Environment env = Environment.getCurrentEnvironment(); + BeanModel req = (BeanModel) env.getVariable("request"); + if (req != null) { + String productId = getStringArg(args, "productId"); + String currentCategoryId = getStringArg(args, "currentCategoryId"); + String previousCategoryId = getStringArg(args, "previousCategoryId"); + HttpServletRequest request = (HttpServletRequest) req.getWrappedObject(); + String catalogUrl = CatalogUrlServlet.makeCatalogUrl(request, productId, currentCategoryId, previousCategoryId); + out.write(catalogUrl); + } } catch (TemplateModelException e) { throw new IOException(e.getMessage()); } Modified: ofbiz/branches/webhelp-2012-12-07/applications/product/webapp/facility/facility/EditContactMech.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/webhelp-2012-12-07/applications/product/webapp/facility/facility/EditContactMech.ftl?rev=1452030&r1=1452029&r2=1452030&view=diff ============================================================================== --- ofbiz/branches/webhelp-2012-12-07/applications/product/webapp/facility/facility/EditContactMech.ftl (original) +++ ofbiz/branches/webhelp-2012-12-07/applications/product/webapp/facility/facility/EditContactMech.ftl Sun Mar 3 12:00:12 2013 @@ -215,7 +215,7 @@ under the License. </tr> <tr> <td> </td> - <td>[${uiLabelMap.PartyCountryCode}] [${uiLabelMap.PartyAreaCode}] [${uiLabelMap.PartyContactNumber}] [${uiLabelMap.PartyExtension}]</td> + <td>[${uiLabelMap.CommonCountryCode}] [${uiLabelMap.PartyAreaCode}] [${uiLabelMap.PartyContactNumber}] [${uiLabelMap.PartyExtension}]</td> </tr> <#elseif "EMAIL_ADDRESS" = mechMap.contactMechTypeId?if_exists> <tr> Modified: ofbiz/branches/webhelp-2012-12-07/applications/product/webapp/facility/shipment/EditShipmentRouteSegments.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/webhelp-2012-12-07/applications/product/webapp/facility/shipment/EditShipmentRouteSegments.ftl?rev=1452030&r1=1452029&r2=1452030&view=diff ============================================================================== --- ofbiz/branches/webhelp-2012-12-07/applications/product/webapp/facility/shipment/EditShipmentRouteSegments.ftl (original) +++ ofbiz/branches/webhelp-2012-12-07/applications/product/webapp/facility/shipment/EditShipmentRouteSegments.ftl Sun Mar 3 12:00:12 2013 @@ -35,7 +35,7 @@ under the License. <div>${uiLabelMap.ProductOriginDestinationPhoneId}</div> <div>${uiLabelMap.ProductShipmentThirdPartyAccountNumber}</div> <div>${uiLabelMap.ProductShipmentThirdPartyPostalCode}</div> - <div>${uiLabelMap.ProductShipmentThirdPartyCountryCode}</div> + <div>${uiLabelMap.ProductShipmentThirdCommonCountryCode}</div> </td> <td valign="top"> <div>${uiLabelMap.ProductShipmentFedexHomeDeliveryTypeDate}</div> Modified: ofbiz/branches/webhelp-2012-12-07/applications/product/widget/catalog/ProductStoreForms.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/webhelp-2012-12-07/applications/product/widget/catalog/ProductStoreForms.xml?rev=1452030&r1=1452029&r2=1452030&view=diff ============================================================================== --- ofbiz/branches/webhelp-2012-12-07/applications/product/widget/catalog/ProductStoreForms.xml (original) +++ ofbiz/branches/webhelp-2012-12-07/applications/product/widget/catalog/ProductStoreForms.xml Sun Mar 3 12:00:12 2013 @@ -276,6 +276,9 @@ </field> <field name="vatTaxAuthGeoId"><lookup target-form-name="LookupGeo"/></field> <field name="vatTaxAuthPartyId"><lookup target-form-name="LookupPartyName"/></field> + <field name="calcTaxAfterPromotion"> + <drop-down allow-empty="false" no-current-selected-key="N"><option key="Y" description="${uiLabelMap.CommonY}"/><option key="N" description="${uiLabelMap.CommonN}"/></drop-down> + </field> <field name="prodSearchExcludeVariants"> <drop-down allow-empty="false" no-current-selected-key="Y"><option key="Y" description="${uiLabelMap.CommonY}"/><option key="N" description="${uiLabelMap.CommonN}"/></drop-down> </field> @@ -402,6 +405,7 @@ <sort-field name="showTaxIsExempt"/> <sort-field name="vatTaxAuthGeoId"/> <sort-field name="vatTaxAuthPartyId"/> + <sort-field name="calcTaxAfterPromotion"/> </field-group> <field-group title="${uiLabelMap.CommonVisitors}" collapsible="true" initially-collapsed="true"> <sort-field name="autoApproveReviews"/> Modified: ofbiz/branches/webhelp-2012-12-07/framework/common/config/CommonUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/webhelp-2012-12-07/framework/common/config/CommonUiLabels.xml?rev=1452030&r1=1452029&r2=1452030&view=diff ============================================================================== --- ofbiz/branches/webhelp-2012-12-07/framework/common/config/CommonUiLabels.xml (original) +++ ofbiz/branches/webhelp-2012-12-07/framework/common/config/CommonUiLabels.xml Sun Mar 3 12:00:12 2013 @@ -2071,6 +2071,56 @@ <value xml:lang="zh-CN">å½å®¶</value> <value xml:lang="zh-TW">åå®¶</value> </property> + <property key="CommonCountryCode"> + <value xml:lang="cs">Mezinárodnà pÅedvolba</value> + <value xml:lang="de">Landesvorwahl</value> + <value xml:lang="en">Country Code</value> + <value xml:lang="es">Código de paÃs</value> + <value xml:lang="fr">Code pays</value> + <value xml:lang="hi_IN">दà¥à¤¶ à¤à¥à¤¡</value> + <value xml:lang="it">Codice paese</value> + <value xml:lang="ja">å½ã³ã¼ã</value> + <value xml:lang="nl">Land Kode</value> + <value xml:lang="pt_BR">Código do paÃs</value> + <value xml:lang="pt_PT">Código do PaÃs</value> + <value xml:lang="ro">Cod Tara</value> + <value xml:lang="ru">Ðод ÑÑÑанÑ</value> + <value xml:lang="th">รหัสà¸à¸£à¸°à¹à¸à¸¨</value> + <value xml:lang="vi">Mã nưá»c</value> + <value xml:lang="zh">å½å®¶ä»£ç </value> + <value xml:lang="zh_TW">å碼</value> + </property> + <property key="CommonCountryCodeMissing"> + <value xml:lang="de">Landesvorwahl fehlt</value> + <value xml:lang="en">Country code is Missing</value> + <value xml:lang="fr">Le code pays manque</value> + <value xml:lang="hi_IN">दà¥à¤¶ à¤à¥à¤¡ à¤à¤¾à¤¯à¤¬ हà¥</value> + <value xml:lang="it">Codice paese è mancante</value> + <value xml:lang="ja">å½ã³ã¼ããæ£ããããã¾ãã</value> + <value xml:lang="pt_BR">Código do paÃs está em branco</value> + <value xml:lang="vi">Mã nưá»c chưa ÄÆ°á»£c nháºp</value> + <value xml:lang="zh">æ¾ä¸å°å½å®¶ä»£ç </value> + <value xml:lang="zh_TW">æ²æå碼</value> + </property> + <property key="CommonCountryMissing"> + <value xml:lang="cs">Chybà zemÄ</value> + <value xml:lang="de">Land fehlt</value> + <value xml:lang="en">Country is Missing</value> + <value xml:lang="es">Falta el PaÃs</value> + <value xml:lang="fr">Pays absent</value> + <value xml:lang="hi_IN">दà¥à¤¶ नहॠहà¥</value> + <value xml:lang="it">Paese mancante</value> + <value xml:lang="ja">å½ãæ£ããããã¾ãã</value> + <value xml:lang="nl">Naam van het land mist</value> + <value xml:lang="pt_BR">PaÃs está em branco</value> + <value xml:lang="pt_PT">PaÃs em falta</value> + <value xml:lang="ro">Tara lipseste </value> + <value xml:lang="ru">СÑÑана не Ñказана</value> + <value xml:lang="th">à¹à¸¡à¹à¹à¸à¹à¹à¸ªà¹à¸à¸£à¸°à¹à¸à¸¨</value> + <value xml:lang="vi">Thông tin Äất nưá»c chưa ÄÆ°á»£c nháºp</value> + <value xml:lang="zh">æ¾ä¸å°å½å®¶</value> + <value xml:lang="zh_TW">æ²æåå®¶</value> + </property> <property key="CommonCounty"> <value xml:lang="ar">ÙÙØ§ÙØ©</value> <value xml:lang="de">Kreis/Bezirk</value> Modified: ofbiz/branches/webhelp-2012-12-07/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java URL: http://svn.apache.org/viewvc/ofbiz/branches/webhelp-2012-12-07/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java?rev=1452030&r1=1452029&r2=1452030&view=diff ============================================================================== --- ofbiz/branches/webhelp-2012-12-07/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java (original) +++ ofbiz/branches/webhelp-2012-12-07/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java Sun Mar 3 12:00:12 2013 @@ -49,6 +49,7 @@ import org.ofbiz.entity.transaction.Gene import org.ofbiz.entity.transaction.TransactionUtil; import org.ofbiz.entity.util.EntityFindOptions; import org.ofbiz.entity.util.EntityListIterator; +import org.ofbiz.entity.util.EntitySaxReader; public class EntityTestSuite extends EntityTestCase { @@ -696,4 +697,121 @@ public class EntityTestSuite extends Ent Debug.logError(e, module); } }*/ + + /* + * Tests EntitySaxReader, verification loading data with tag create, create-update, create-replace, delete + */ + public void testEntitySaxReaderCreation() throws Exception { + String xmlContentLoad = + "<TestingType testingTypeId=\"JUNIT-TEST\" description=\"junit test\"/>" + + "<create>" + + " <TestingType testingTypeId=\"JUNIT-TEST2\" description=\"junit test\"/>" + + " <Testing testingId=\"T1\" testingTypeId=\"JUNIT-TEST\" testingName=\"First test\" testingSize=\"10\" testingDate=\"2010-01-01 00:00:00\"/>" + + "</create>" + + "<Testing testingId=\"T2\" testingTypeId=\"JUNIT-TEST2\" testingName=\"Second test\" testingSize=\"20\" testingDate=\"2010-02-01 00:00:00\"/>"; + EntitySaxReader reader = new EntitySaxReader(delegator); + long numberLoaded = reader.parse(xmlContentLoad); + assertEquals("Create Entity loaded ", numberLoaded, 4); + GenericValue t1 = delegator.findOne("Testing", UtilMisc.toMap("testingId", "T1"), false); + GenericValue t2 = delegator.findOne("Testing", UtilMisc.toMap("testingId", "T2"), true); + assertNotNull("Create Testing(T1)", t1); + assertEquals("Create Testing(T1).testingTypeId", "JUNIT-TEST", t1.getString("testingTypeId")); + assertEquals("Create Testing(T1).testingName", "First test", t1.getString("testingName")); + assertEquals("Create Testing(T1).testingSize", Long.valueOf(10), t1.getLong("testingSize")); + assertEquals("Create Testing(T1).testingDate", UtilDateTime.toTimestamp("01/01/2010 00:00:00"), t1.getTimestamp("testingDate")); + + assertNotNull("Create Testing(T2)", t2); + assertEquals("Create Testing(T2).testingTypeId", "JUNIT-TEST2", t2.getString("testingTypeId")); + assertEquals("Create Testing(T2).testingName", "Second test", t2.getString("testingName")); + assertEquals("Create Testing(T2).testingSize", Long.valueOf(20), t2.getLong("testingSize")); + assertEquals("Create Testing(T2).testingDate", UtilDateTime.toTimestamp("02/01/2010 00:00:00"), t2.getTimestamp("testingDate")); + } + + public void testEntitySaxReaderCreateSkip() throws Exception { + String xmlContentLoad = + "<create>" + + " <Testing testingId=\"T1\" testingName=\"First test update\" testingSize=\"20\"/>" + + "</create>"; + EntitySaxReader reader = new EntitySaxReader(delegator); + long numberLoaded = reader.parse(xmlContentLoad); + assertEquals("Create Skip Entity loaded ", numberLoaded, 1); + GenericValue t1 = delegator.findOne("Testing", UtilMisc.toMap("testingId", "T1"), false); + assertNotNull("Create Skip Testing(T1)", t1); + assertEquals("Create Skip Testing(T1).testingTypeId", "JUNIT-TEST", t1.getString("testingTypeId")); + assertEquals("Create Skip Testing(T1).testingName", "First test", t1.getString("testingName")); + assertEquals("Create Skip Testing(T1).testingSize", Long.valueOf(10), t1.getLong("testingSize")); + assertEquals("Create Skip Testing(T1).testingDate", UtilDateTime.toTimestamp("01/01/2010 00:00:00"), t1.getTimestamp("testingDate")); + } + + public void testEntitySaxReaderUpdate() throws Exception { + String xmlContentLoad = + "<create-update>" + + " <Testing testingId=\"T1\" testingName=\"First test update\" testingSize=\"20\"/>" + + " <Testing testingId=\"T3\" testingTypeId=\"JUNIT-TEST\" testingName=\"Third test\" testingSize=\"30\" testingDate=\"2010-03-01 00:00:00\"/>" + + "</create-update>"; + EntitySaxReader reader = new EntitySaxReader(delegator); + long numberLoaded = reader.parse(xmlContentLoad); + assertEquals("Update Entity loaded ", numberLoaded, 2); + GenericValue t1 = delegator.findOne("Testing", UtilMisc.toMap("testingId", "T1"), false); + GenericValue t3 = delegator.findOne("Testing", UtilMisc.toMap("testingId", "T3"), false); + assertNotNull("Update Testing(T1)", t1); + assertEquals("Update Testing(T1).testingTypeId", "JUNIT-TEST", t1.getString("testingTypeId")); + assertEquals("Update Testing(T1).testingName", "First test update", t1.getString("testingName")); + assertEquals("Update Testing(T1).testingSize", Long.valueOf(20), t1.getLong("testingSize")); + assertEquals("Update Testing(T1).testingDate", UtilDateTime.toTimestamp("01/01/2010 00:00:00"), t1.getTimestamp("testingDate")); + + assertNotNull("Update Testing(T3)", t3); + assertEquals("Update Testing(T3).testingTypeId", "JUNIT-TEST", t3.getString("testingTypeId")); + assertEquals("Update Testing(T3).testingName", "Third test", t3.getString("testingName")); + assertEquals("Update Testing(T3).testingSize", Long.valueOf(30), t3.getLong("testingSize")); + assertEquals("Update Testing(T3).testingDate", UtilDateTime.toTimestamp("03/01/2010 00:00:00"), t3.getTimestamp("testingDate")); + } + + public void testEntitySaxReaderReplace() throws Exception { + String xmlContentLoad = + "<create-replace>" + + " <Testing testingTypeId=\"JUNIT-TEST\" testingId=\"T1\" testingName=\"First test replace\" />" + + "</create-replace>" + + "<Testing testingId=\"T2\" testingName=\"Second test update\"/>"; + EntitySaxReader reader = new EntitySaxReader(delegator); + long numberLoaded = reader.parse(xmlContentLoad); + assertEquals("Replace Entity loaded ", numberLoaded, 2); + GenericValue t1 = delegator.findOne("Testing", UtilMisc.toMap("testingId", "T1"), false); + GenericValue t2 = delegator.findOne("Testing", UtilMisc.toMap("testingId", "T2"), false); + assertNotNull("Replace Testing(T1)", t1); + assertEquals("Replace Testing(T1).testingTypeId", "JUNIT-TEST", t1.getString("testingTypeId")); + assertEquals("Replace Testing(T1).testingName", "First test replace", t1.getString("testingName")); + assertNull("Replace Testing(T1).testingSize", t1.getLong("testingSize")); + assertNull("Replace Testing(T1).testingDate", t1.getTimestamp("testingDate")); + + assertNotNull("Replace Testing(T2)", t2); + assertEquals("Replace Testing(T2).testingTypeId", "JUNIT-TEST2", t2.getString("testingTypeId")); + assertEquals("Replace Testing(T2).testingName", "Second test update", t2.getString("testingName")); + assertEquals("Replace Testing(T2).testingSize", Long.valueOf(20), t2.getLong("testingSize")); + assertEquals("Replace Testing(T2).testingDate", UtilDateTime.toTimestamp("02/01/2010 00:00:00"), t2.getTimestamp("testingDate")); + } + + public void testEntitySaxReaderDelete() throws Exception { + String xmlContentLoad = + "<delete>" + + " <Testing testingId=\"T1\"/>" + + " <Testing testingId=\"T2\"/>" + + " <Testing testingId=\"T3\"/>" + + " <TestingType testingTypeId=\"JUNIT-TEST\"/>" + + " <TestingType testingTypeId=\"JUNIT-TEST2\"/>" + + "</delete>"; + EntitySaxReader reader = new EntitySaxReader(delegator); + long numberLoaded = reader.parse(xmlContentLoad); + assertEquals("Delete Entity loaded ", numberLoaded, 5); + GenericValue t1 = delegator.findOne("Testing", UtilMisc.toMap("testingId", "T1"), false); + GenericValue t2 = delegator.findOne("Testing", UtilMisc.toMap("testingId", "T2"), false); + GenericValue t3 = delegator.findOne("Testing", UtilMisc.toMap("testingId", "T2"), false); + assertNull("Delete Testing(T1)", t1); + assertNull("Delete Testing(T2)", t2); + assertNull("Delete Testing(T3)", t3); + GenericValue testType = delegator.findOne("TestingType", UtilMisc.toMap("testingTypeId", "JUNIT-TEST"), false); + assertNull("Delete TestingType 1", testType); + testType = delegator.findOne("TestingType", UtilMisc.toMap("testingTypeId", "JUNIT-TEST2"), false); + assertNull("Delete TestingType 2", testType); + } } Modified: ofbiz/branches/webhelp-2012-12-07/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaAction.java URL: http://svn.apache.org/viewvc/ofbiz/branches/webhelp-2012-12-07/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaAction.java?rev=1452030&r1=1452029&r2=1452030&view=diff ============================================================================== --- ofbiz/branches/webhelp-2012-12-07/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaAction.java (original) +++ ofbiz/branches/webhelp-2012-12-07/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaAction.java Sun Mar 3 12:00:12 2013 @@ -22,7 +22,6 @@ import java.util.Map; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilMisc; -import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.GenericEntity; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; @@ -38,19 +37,17 @@ import org.w3c.dom.Element; * EntityEcaAction */ @SuppressWarnings("serial") -public class EntityEcaAction implements java.io.Serializable { +public final class EntityEcaAction implements java.io.Serializable { public static final String module = EntityEcaAction.class.getName(); - protected String serviceName = null; - protected String serviceMode = null; - protected String runAsUser = null; - protected String valueAttr = null; - protected boolean resultToValue = true; - protected boolean abortOnError = false; - protected boolean rollbackOnError = false; - protected boolean persist = false; - - protected EntityEcaAction() {} + private final String serviceName; + private final String serviceMode; + private final String runAsUser; + private final String valueAttr; + private final boolean resultToValue; + private final boolean abortOnError; + private final boolean rollbackOnError; + private final boolean persist; public EntityEcaAction(Element action) { this.serviceName = action.getAttribute("service"); @@ -65,14 +62,16 @@ public class EntityEcaAction implements this.valueAttr = action.getAttribute("value-attr"); } - public void runAction(DispatchContext dctx, Map<String, ? extends Object> context, GenericEntity newValue) throws GenericEntityException { - Map<String, Object> actionResult = null; + public String getServiceName() { + return this.serviceName; + } + public void runAction(DispatchContext dctx, Map<String, ? extends Object> context, GenericEntity newValue) throws GenericEntityException { try { // pull out context parameters needed for this service. Map<String, Object> actionContext = dctx.getModelService(serviceName).makeValid(context, ModelService.IN_PARAM); // if value-attr is specified, insert the value object in that attr name - if (UtilValidate.isNotEmpty(valueAttr)) { + if (!valueAttr.isEmpty()) { actionContext.put(valueAttr, newValue); } @@ -81,7 +80,7 @@ public class EntityEcaAction implements // setup the run-as-user GenericValue userLoginToRunAs = null; - if (UtilValidate.isNotEmpty(this.runAsUser)) { + if (!this.runAsUser.isEmpty()) { userLoginToRunAs = dctx.getDelegator().findOne("UserLogin", UtilMisc.toMap("userLoginId", this.runAsUser), true); if (userLoginToRunAs != null) { actionContext.put("userLogin", userLoginToRunAs); @@ -90,10 +89,14 @@ public class EntityEcaAction implements LocalDispatcher dispatcher = dctx.getDispatcher(); if ("sync".equals(this.serviceMode)) { - actionResult = dispatcher.runSync(this.serviceName, actionContext); + Map<String, Object> actionResult = dispatcher.runSync(this.serviceName, actionContext); if (ServiceUtil.isError(actionResult)) { throw new GenericServiceException("Error running Entity ECA action service: " + ServiceUtil.getErrorMessage(actionResult)); } + // use the result to update the context fields. + if (resultToValue) { + newValue.setNonPKFields(actionResult); + } } else if ("async".equals(this.serviceMode)) { dispatcher.runAsync(serviceName, actionContext, persist); } @@ -111,10 +114,5 @@ public class EntityEcaAction implements Debug.logError(e, "Error running Entity ECA action service", module); } } - - // use the result to update the context fields. - if (resultToValue) { - newValue.setNonPKFields(actionResult); - } } } Modified: ofbiz/branches/webhelp-2012-12-07/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaCondition.java URL: http://svn.apache.org/viewvc/ofbiz/branches/webhelp-2012-12-07/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaCondition.java?rev=1452030&r1=1452029&r2=1452030&view=diff ============================================================================== --- ofbiz/branches/webhelp-2012-12-07/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaCondition.java (original) +++ ofbiz/branches/webhelp-2012-12-07/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaCondition.java Sun Mar 3 12:00:12 2013 @@ -33,36 +33,27 @@ import org.w3c.dom.Element; * EntityEcaCondition */ @SuppressWarnings("serial") -public class EntityEcaCondition implements java.io.Serializable { +public final class EntityEcaCondition implements java.io.Serializable { public static final String module = EntityEcaCondition.class.getName(); - protected String lhsValueName, rhsValueName; - protected String operator; - protected String compareType; - protected String format; - protected boolean constant = false; - - protected EntityEcaCondition() {} + private final String lhsValueName, rhsValueName; + private final String operator; + private final String compareType; + private final String format; + private final boolean constant; public EntityEcaCondition(Element condition, boolean constant) { this.lhsValueName = condition.getAttribute("field-name"); - this.constant = constant; if (constant) { this.rhsValueName = condition.getAttribute("value"); } else { this.rhsValueName = condition.getAttribute("to-field-name"); } - this.operator = condition.getAttribute("operator"); this.compareType = condition.getAttribute("type"); this.format = condition.getAttribute("format"); - - if (lhsValueName == null) - lhsValueName = ""; - if (rhsValueName == null) - rhsValueName = ""; } public boolean eval(DispatchContext dctx, GenericEntity value) throws GenericEntityException { @@ -100,6 +91,21 @@ public class EntityEcaCondition implemen } } + public String getLValue() { + return this.lhsValueName; + } + + public String getRValue() { + if (constant && !rhsValueName.isEmpty()) { + return "\"".concat(this.rhsValueName).concat("\""); + } + return this.rhsValueName; + } + + public String getOperator() { + return this.operator; + } + @Override public String toString() { StringBuilder buf = new StringBuilder(); Modified: ofbiz/branches/webhelp-2012-12-07/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaRule.java URL: http://svn.apache.org/viewvc/ofbiz/branches/webhelp-2012-12-07/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaRule.java?rev=1452030&r1=1452029&r2=1452030&view=diff ============================================================================== --- ofbiz/branches/webhelp-2012-12-07/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaRule.java (original) +++ ofbiz/branches/webhelp-2012-12-07/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaRule.java Sun Mar 3 12:00:12 2013 @@ -18,12 +18,12 @@ *******************************************************************************/ package org.ofbiz.entityext.eca; -import java.util.HashSet; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Set; -import javolution.util.FastList; import javolution.util.FastMap; import org.ofbiz.base.util.Debug; @@ -34,54 +34,47 @@ import org.ofbiz.service.DispatchContext import org.w3c.dom.Element; /** - * EntityEcaRule + * Entity event-condition-action rule. */ @SuppressWarnings("serial") public final class EntityEcaRule implements java.io.Serializable { public static final String module = EntityEcaRule.class.getName(); - private static final Set<String> nameSet = new HashSet<String>(2); - static { - nameSet.add("set"); - nameSet.add("action"); - } - - protected final String entityName; - protected final String operationName; - protected final String eventName; - protected final boolean runOnError; - protected final List<EntityEcaCondition> conditions = FastList.newInstance(); - protected final List<Object> actionsAndSets = FastList.newInstance(); - protected boolean enabled = true; + private final String entityName; + private final String operationName; + private final String eventName; + private final boolean runOnError; + private final List<EntityEcaCondition> conditions; + private final List<Object> actionsAndSets; + private boolean enabled = true; public EntityEcaRule(Element eca) { this.entityName = eca.getAttribute("entity"); this.operationName = eca.getAttribute("operation"); this.eventName = eca.getAttribute("event"); this.runOnError = "true".equals(eca.getAttribute("run-on-error")); - - for (Element element: UtilXml.childElementList(eca, "condition")) { - conditions.add(new EntityEcaCondition(element, true)); - } - - for (Element element: UtilXml.childElementList(eca, "condition-field")) { - conditions.add(new EntityEcaCondition(element, false)); - } - - if (Debug.verboseOn()) { - Debug.logVerbose("Conditions: " + conditions, module); - } - - for (Element actionOrSetElement: UtilXml.childElementList(eca, nameSet)) { - if ("action".equals(actionOrSetElement.getNodeName())) { - this.actionsAndSets.add(new EntityEcaAction(actionOrSetElement)); + ArrayList<EntityEcaCondition> conditions = new ArrayList<EntityEcaCondition>(); + ArrayList<Object> actionsAndSets = new ArrayList<Object>(); + for (Element element: UtilXml.childElementList(eca)) { + if ("condition".equals(element.getNodeName())) { + conditions.add(new EntityEcaCondition(element, true)); + } else if ("condition-field".equals(element.getNodeName())) { + conditions.add(new EntityEcaCondition(element, false)); + } else if ("action".equals(element.getNodeName())) { + actionsAndSets.add(new EntityEcaAction(element)); + } else if ("set".equals(element.getNodeName())) { + actionsAndSets.add(new EntityEcaSetField(element)); } else { - this.actionsAndSets.add(new EntityEcaSetField(actionOrSetElement)); + Debug.logWarning("Invalid eca child element " + element.getNodeName(), module); } } - + conditions.trimToSize(); + this.conditions = Collections.unmodifiableList(conditions); + actionsAndSets.trimToSize(); + this.actionsAndSets = Collections.unmodifiableList(actionsAndSets); if (Debug.verboseOn()) { + Debug.logVerbose("Conditions: " + conditions, module); Debug.logVerbose("actions and sets (intermixed): " + actionsAndSets, module); } } @@ -102,6 +95,14 @@ public final class EntityEcaRule impleme return this.runOnError; } + public List<Object> getActionsAndSets() { + return this.actionsAndSets; + } + + public List<EntityEcaCondition> getConditions() { + return this.conditions; + } + public void eval(String currentOperation, DispatchContext dctx, GenericEntity value, boolean isError, Set<String> actionsRun) throws GenericEntityException { if (!enabled) { Debug.logInfo("Entity ECA [" + this.entityName + "] on [" + this.eventName + "] is disabled; not running.", module); @@ -134,9 +135,9 @@ public final class EntityEcaRule impleme EntityEcaAction ea = (EntityEcaAction) actionOrSet; // in order to enable OR logic without multiple calls to the given service, //only execute a given service name once per service call phase - if (actionsRun.add(ea.serviceName)) { + if (actionsRun.add(ea.getServiceName())) { if (Debug.infoOn()) { - Debug.logInfo("Running Entity ECA Service: " + ea.serviceName + ", triggered by rule on Entity: " + value.getEntityName(), module); + Debug.logInfo("Running Entity ECA Service: " + ea.getServiceName() + ", triggered by rule on Entity: " + value.getEntityName(), module); } ea.runAction(dctx, context, value); } @@ -148,6 +149,10 @@ public final class EntityEcaRule impleme } } + /** + * @deprecated Not thread-safe, no replacement. + * @param enabled + */ public void setEnabled(boolean enabled) { this.enabled = enabled; } Modified: ofbiz/branches/webhelp-2012-12-07/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaSetField.java URL: http://svn.apache.org/viewvc/ofbiz/branches/webhelp-2012-12-07/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaSetField.java?rev=1452030&r1=1452029&r2=1452030&view=diff ============================================================================== --- ofbiz/branches/webhelp-2012-12-07/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaSetField.java (original) +++ ofbiz/branches/webhelp-2012-12-07/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaSetField.java Sun Mar 3 12:00:12 2013 @@ -30,14 +30,14 @@ import java.util.Map; /** * ServiceEcaSetField */ -public class EntityEcaSetField { +public final class EntityEcaSetField { public static final String module = EntityEcaSetField.class.getName(); - protected String fieldName = null; - protected String envName = null; - protected String value = null; - protected String format = null; + private final String fieldName; + private final String envName; + private final String value; + private final String format; public EntityEcaSetField(Element set) { this.fieldName = set.getAttribute("field-name"); @@ -47,29 +47,17 @@ public class EntityEcaSetField { } public void eval(Map<String, Object> context) { - if (fieldName != null) { - // try to expand the envName - if (UtilValidate.isEmpty(value)) { - if (UtilValidate.isNotEmpty(envName) && envName.startsWith("${")) { - FlexibleStringExpander exp = FlexibleStringExpander.getInstance(envName); - String s = exp.expandString(context); - if (UtilValidate.isNotEmpty(s)) { - value = s; - } - Debug.logInfo("Expanded String: " + s, module); - } - } - - // process the context changes - if (UtilValidate.isNotEmpty(value)) { - context.put(fieldName, this.format(value, context)); - } else if (UtilValidate.isNotEmpty(envName) && context.get(envName) != null) { + if (!fieldName.isEmpty()) { + String valueExpanded = FlexibleStringExpander.expandString(value, context); + if (!valueExpanded.isEmpty()) { + context.put(fieldName, this.format(valueExpanded, context)); + } else if (!envName.isEmpty() && context.get(envName) != null) { context.put(fieldName, this.format((String) context.get(envName), context)); } } } - protected Object format(String s, Map<String, ? extends Object> c) { + private Object format(String s, Map<String, ? extends Object> c) { if (UtilValidate.isEmpty(s) || UtilValidate.isEmpty(format)) { return s; } @@ -116,4 +104,15 @@ public class EntityEcaSetField { Debug.logWarning("Format function not found [" + format + "] return string unchanged - " + s, module); return s; } + + public String getFieldName() { + return this.fieldName; + } + + public String getRValue() { + if (!this.value.isEmpty()) { + return "\"".concat(this.value).concat("\""); + } + return this.envName; + } } Modified: ofbiz/branches/webhelp-2012-12-07/framework/service/config/ServiceErrorUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/webhelp-2012-12-07/framework/service/config/ServiceErrorUiLabels.xml?rev=1452030&r1=1452029&r2=1452030&view=diff ============================================================================== --- ofbiz/branches/webhelp-2012-12-07/framework/service/config/ServiceErrorUiLabels.xml (original) +++ ofbiz/branches/webhelp-2012-12-07/framework/service/config/ServiceErrorUiLabels.xml Sun Mar 3 12:00:12 2013 @@ -101,130 +101,156 @@ <value xml:lang="en">Error doing entity-auto operation for entity ${entityName} in service ${serviceName}: ${errorString}</value> <value xml:lang="it">Errore mentre faceva l'operazione entity-auto per l'entità ${entityName} nel servizio ${serviceName}: ${errorString}</value> <value xml:lang="ja">ãµã¼ãã¹ ${serviceName} ã§ãã¨ã³ãã£ã㣠${entityName} ã«ã¨ã³ãã£ãã£èªåæä½å®è¡ä¸ã«ã¨ã©ã¼: ${errorString}</value> + <value xml:lang="zh">è¿è¡å®ä½èªå¨æä½æ¶åºéï¼å®ä½ ${entityName}ãæå¡ ${serviceName}ï¼${errorString}</value> </property> <property key="ServiceParameterValueNotValid"> <value xml:lang="en">The ID value in the parameter ${parameterName} was not valid: ${errorDetails}</value> <value xml:lang="it">Il valore ID nel parametro ${parameterName} non è valido: ${errorDetails}</value> <value xml:lang="ja">ãã©ã¡ã¼ã¿ ${parameterName} ã®ä¸ã®IDãæ£ããããã¾ãã: ${errorDetails}</value> + <value xml:lang="zh">åæ° ${parameterName} ä¸çæ è¯ï¼IDï¼å¼æ æï¼${errorDetails}</value> </property> <property key="ServiceTestDeadLockError"> <value xml:lang="en">Error running deadlock test services: ${errorString}</value> <value xml:lang="it">Errore durante il test del servizio deadlock: ${errorString}</value> <value xml:lang="ja">ãããããã¯ãã¹ããµã¼ãã¹å®è¡ä¸ã«ã¨ã©ã¼: ${errorString}</value> + <value xml:lang="zh">è¿è¡æ»éæµè¯æå¡æ¶åºéï¼${errorString}</value> </property> <property key="ServiceTestDeadLockRetry"> <value xml:lang="en">Error(s) running sub-services in testServiceDeadLockRetry</value> <value xml:lang="it">Errore(i) durante l'esecuzione dei sotto-servizi in testServiceDeadLockRetry</value> <value xml:lang="ja">testServiceDeadLockRetryã®ä¸ã®ãµããµã¼ãã¹å®è¡ä¸ã«ã¨ã©ã¼</value> + <value xml:lang="zh">è¿è¡æµè¯æå¡æ»ééè¯ï¼testServiceDeadLockRetryï¼ä¸çåæå¡æ¶åºé</value> </property> <property key="ServiceTestDeadLockThreadA"> <value xml:lang="en">Error running testServiceDeadLockRetryThreadA: ${errorString}</value> <value xml:lang="it">Errore durante l'esecuzione di testServiceDeadLockRetryThreadA: ${errorString}</value> <value xml:lang="ja">testServiceDeadLockRetryThreadAã®å®è¡ä¸ã«ã¨ã©ã¼: ${errorString}</value> + <value xml:lang="zh">è¿è¡æµè¯æå¡æ»ééè¯çº¿ç¨Aï¼testServiceDeadLockRetryThreadAï¼æ¶åºéï¼${errorString}</value> </property> <property key="ServiceTestDeadLockThreadB"> <value xml:lang="en">Error running testServiceDeadLockRetryThreadB: ${errorString}</value> <value xml:lang="it">Errore durante l'esecuzione di testServiceDeadLockRetryThreadB: ${errorString}</value> <value xml:lang="ja">testServiceDeadLockRetryThreadBã®å®è¡ä¸ã«ã¨ã©ã¼: ${errorString}</value> + <value xml:lang="zh">è¿è¡æµè¯æå¡æ»ééè¯çº¿ç¨Bï¼testServiceDeadLockRetryThreadBï¼æ¶åºéï¼${errorString}</value> </property> <property key="ServiceTestEntityEngineError"> <value xml:lang="en">Entity Engine Exception: ${errorString}</value> <value xml:lang="it">Eccezione Entity Engine: ${errorString}</value> <value xml:lang="ja">ã¨ã³ãã£ãã£ã¨ã³ã¸ã³ä¾å¤: ${errorString}</value> + <value xml:lang="zh">å®ä½å¼æåºç°å¼å¸¸ï¼${errorString}</value> </property> <property key="ServiceTestEntityEngineExceptionThreadA"> <value xml:lang="en">Entity Engine Exception running dead lock test thread A: ${errorString}</value> <value xml:lang="it">Eccezione Entity Engine durante l'esecuzione del test dead lock thread A: ${errorString}</value> <value xml:lang="ja">ãããããã¯ãã¹ãã¹ã¬ããAå®è¡ä¸ã«ã¨ã³ãã£ãã£ã¨ã³ã¸ã³ä¾å¤: ${errorString}</value> + <value xml:lang="zh">è¿è¡æ»éæµè¯çº¿ç¨Aæ¶åçå®ä½å¼æå¼å¸¸ï¼${errorString}</value> </property> <property key="ServiceTestEntityEngineExceptionThreadB"> <value xml:lang="en">Entity Engine Exception running dead lock test thread B: ${errorString}</value> <value xml:lang="it">Eccezione Entity Engine durante l'esecuzione del test dead lock thread B: ${errorString}</value> <value xml:lang="ja">ãããããã¯ãã¹ãã¹ã¬ããBå®è¡ä¸ã«ã¨ã³ãã£ãã£ã¨ã³ã¸ã³ä¾å¤: ${errorString}</value> + <value xml:lang="zh">è¿è¡æ»éæµè¯çº¿ç¨Bæ¶åçå®ä½å¼æå¼å¸¸ï¼${errorString}</value> </property> <property key="ServiceTestEntityEngineWaitInterruptedExceptionThreadA"> <value xml:lang="en">Entity Engine Exception running dead lock test thread A: ${errorString}</value> <value xml:lang="it">Eccezione Entity Engine durante l'esecuzione del test dead lock thread A: ${errorString}</value> <value xml:lang="ja">ãããããã¯ãã¹ãã¹ã¬ããAå®è¡ä¸ã«ã¨ã³ãã£ãã£ã¨ã³ã¸ã³ä¾å¤: ${errorString}</value> + <value xml:lang="zh">è¿è¡æ»éæµè¯çº¿ç¨Aæ¶åçå®ä½å¼æå¼å¸¸ï¼${errorString}</value> </property> <property key="ServiceTestEntityEngineWaitInterruptedExceptionThreadB"> <value xml:lang="en">Entity Engine Exception running dead lock test thread B: ${errorString}</value> <value xml:lang="it">Eccezione Entity Engine durante l'esecuzione del test dead lock thread B: ${errorString}</value> <value xml:lang="ja">ãããããã¯ãã¹ãã¹ã¬ããBå®è¡ä¸ã«ã¨ã³ãã£ãã£ã¨ã³ã¸ã³ä¾å¤: ${errorString}</value> + <value xml:lang="zh">è¿è¡æ»éæµè¯çº¿ç¨Bæ¶åçå®ä½å¼æå¼å¸¸ï¼${errorString}</value> </property> <property key="ServiceTestLockWaitTimeoutRetry"> <value xml:lang="en">Error(s) running sub-services in testServiceLockWaitTimeoutRetry</value> <value xml:lang="it">Errore(i) durante l'esecuzione dei sotto-servizi in testServiceLockWaitTimeoutRetry</value> <value xml:lang="ja">testServiceLockWaitTimeoutRetryã®ä¸ã®ãµããµã¼ãã¹å®è¡ä¸ã«ã¨ã©ã¼</value> + <value xml:lang="zh">è¿è¡æµè¯æå¡éçå¾ è¶ æ¶éè¯ï¼testServiceLockWaitTimeoutRetryï¼æå¡æ¶åºé</value> </property> <property key="ServiceTestLockWaitTimeoutRetryGrabber"> <value xml:lang="en">Entity Engine Exception running lock wait timeout test Grabber thread: ${errorString}</value> <value xml:lang="it">Eccezione Entity Engine durante l'esecuzione del lock wait timeout test Grabber thread: ${errorString}</value> <value xml:lang="ja">ããã¯å¾ ã¿ã¤ã ã¢ã¦ããã¹ãç²å¾ã¹ã¬ããå®è¡ä¸ã«ã¨ã³ãã£ãã£ã¨ã³ã¸ã³ä¾å¤: ${errorString}</value> + <value xml:lang="zh">è¿è¡éçå¾ è¶ æ¶æµè¯ééç¨åºçº¿ç¨æ¶åçå®ä½å¼ææå¤ï¼${errorString}</value> </property> <property key="ServiceTestLockWaitTimeoutRetryWaiter"> <value xml:lang="en">Entity Engine Exception running lock wait timeout test Grabber thread: ${errorString}</value> <value xml:lang="it">Eccezione Entity Engine durante l'esecuzione del lock wait timeout test Grabber thread: ${errorString}</value> <value xml:lang="ja">ããã¯å¾ ã¿ã¤ã ã¢ã¦ããã¹ãå¾ æ©ã¹ã¬ããå®è¡ä¸ã«ã¨ã³ãã£ãã£ã¨ã³ã¸ã³ä¾å¤: ${errorString}</value> + <value xml:lang="zh">è¿è¡éçå¾ è¶ æ¶æµè¯ééç¨åºçº¿ç¨æ¶åçå®ä½å¼ææå¤ï¼${errorString}</value> </property> <property key="ServiceTestLockInterruptedExceptionRetryGrabber"> <value xml:lang="en">Wait Interrupted Exception running lock wait timeout test Grabber thread: ${errorString}</value> <value xml:lang="it">Eccezione Wait Interrupted Exception durante l'esecuzione del lock wait timeout test Grabber thread: ${errorString}</value> <value xml:lang="ja">ããã¯å¾ ã¿ã¤ã ã¢ã¦ããã¹ãç²å¾ã¹ã¬ããå®è¡ä¸ã«ã¦ã§ã¤ãå²è¾¼ä¾å¤: ${errorString}</value> + <value xml:lang="zh">è¿è¡éçå¾ è¶ æ¶æµè¯ééç¨åºçº¿ç¨æ¶åççå¾ ä¸ææå¤ï¼${errorString}</value> </property> <property key="ServiceTestLockInterruptedExceptionRetryWaiter"> <value xml:lang="en">Wait Interrupted Exception running lock wait timeout test Waiter thread: ${errorString}</value> <value xml:lang="it">Eccezione Wait Interrupted Exception durante l'esecuzione del lock wait timeout test Waiter thread: ${errorString}</value> <value xml:lang="ja">ããã¯å¾ ã¿ã¤ã ã¢ã¦ããã¹ãå¾ æ©ã¹ã¬ããå®è¡ä¸ã«ã¦ã§ã¤ãå²è¾¼ä¾å¤: ${errorString}</value> + <value xml:lang="zh">è¿è¡éçå¾ è¶ æ¶æµè¯çå¾ ç¨åºçº¿ç¨æ¶åççå¾ ä¸ææå¤ï¼${errorString}</value> </property> <property key="ServiceTestLockWaitTimeoutRetryCantRecoverWaiter"> <value xml:lang="en">Error running testServiceLockWaitTimeoutRetryCantRecoverWaiter</value> <value xml:lang="it">Errore durante l'esecuzione di testServiceLockWaitTimeoutRetryCantRecoverWaiter</value> <value xml:lang="ja">testServiceLockWaitTimeoutRetryCantRecoverWaiterå®è¡ä¸ã«ã¨ã©ã¼</value> + <value xml:lang="zh">è¿è¡æµè¯æå¡éçå¾ ç¨åºè¶ æ¶éè¯ä¸è½æ¢å¤çå¾ ï¼testServiceLockWaitTimeoutRetryCantRecoverWaiterï¼æ¶åºé</value> </property> <property key="ServiceTestOwnTxError"> <value xml:lang="en">Error running sub-service with own tx: ${errorString}</value> <value xml:lang="it">Errore durante l'esecuzione del sotto-servizio con proprie transazione: ${errorString}</value> <value xml:lang="ja">èªTxã§ãµããµã¼ãã¹å®è¡ä¸ã«ã¨ã©ã¼: ${errorString}</value> + <value xml:lang="zh">è¿è¡å¸¦æäºå¡å¤ççåæå¡æ¶åºéï¼${errorString}</value> </property> <property key="ServiceTestOwnTxSubServiceAfterSetRollbackOnlyInParentErrorCatchWrapper"> <value xml:lang="en">Error running ServiceTestOwnTxSubServiceAfterSetRollbackOnlyInParentErrorCatchWrapper</value> <value xml:lang="it">Errore durante l'esecuzione di ServiceTestOwnTxSubServiceAfterSetRollbackOnlyInParentErrorCatchWrapper</value> <value xml:lang="ja">ServiceTestOwnTxSubServiceAfterSetRollbackOnlyInParentErrorCatchWrapperå®è¡ä¸ã«ã¨ã©ã¼</value> + <value xml:lang="zh">è¿è¡å¨ä¸çº§é误æè·ç¨åºä¸å¨è®¾ç½®äºä» åæ»åç带æäºå¡å¤çåæå¡çæå¡æµè¯ï¼ServiceTestOwnTxSubServiceAfterSetRollbackOnlyInParentErrorCatchWrapperï¼æ¶åºé</value> </property> <property key="ServiceTestOwnTxSubServiceAfterSetRollbackOnlyInParent"> <value xml:lang="en">Error running sub-service in testServiceOwnTxSubServiceAfterSetRollbackOnlyInParent</value> <value xml:lang="it">Errore durante l'esecuzione di testServiceOwnTxSubServiceAfterSetRollbackOnlyInParent</value> <value xml:lang="ja">testServiceOwnTxSubServiceAfterSetRollbackOnlyInParentã®ä¸ã®ãµããµã¼ãã¹å®è¡ä¸ã«ã¨ã©ã¼</value> + <value xml:lang="zh">è¿è¡å¨ä¸çº§æå¡ä¸è®¾ç½®äºä» åæ»åç带æäºå¡å¤çåæå¡çæµè¯æå¡ï¼testServiceOwnTxSubServiceAfterSetRollbackOnlyInParentï¼ä¸çåæå¡æ¶åºé</value> </property> <property key="ServiceTestRollback"> <value xml:lang="en">Intentional rollback to test global-rollback</value> <value xml:lang="it">Rollback intenzionale per testare il global-rollback</value> <value xml:lang="ja">ã°ãã¼ãã«ã»ãã¼ã«ããã¯ã®ãã¹ãã®ããæå³çãªãã¼ã«ããã¯</value> + <value xml:lang="zh">æ æåæ»ä»¥æµè¯å ¨å±åæ»</value> </property> <property key="ServiceTestSubServiceError"> <value xml:lang="en">Error calling sub-service, it should return an error but not throw an exception, so something went wrong: ${errorString}</value> <value xml:lang="it">Errore durante l'esecuzione del sotto-servizio, dovrebbe restituire un'errore ma non generare un'eccezione, così qualcosa è andato male: ${errorString}</value> <value xml:lang="ja">ãµããµã¼ãã¹å¼ã³åºãä¸ã«ã¨ã©ã¼ãã¨ã©ã¼ãæ»ãã¾ãããä¾å¤ãã¹ãã¼ããã¾ããã§ããããªã«ã誤ããããã¾ã: ${errorString}</value> + <value xml:lang="zh">è°ç¨åæå¡æ¶åºéï¼å®åºè¯¥è¿åä¸ä¸ªé误ï¼è䏿¯æåºä¸ä¸ªæå¤ï¼å æ¤åçäºé误ï¼${errorString}</value> </property> <property key="ServiceTestXmlRpcCalculationOK"> <value xml:lang="en">adding integer 125 to 365 yields </value> <value xml:lang="it">aggiungere intero 125 a 365 yields </value> <value xml:lang="ja">æ´æ° 125 ï½ 365 ã®å ç®ãçãã¾ã </value> + <value xml:lang="zh">ææ´æ°125å å°365ï¼çæ</value> </property> <property key="ServiceTestXmlRpcCalculationKO"> <value xml:lang="en">calcul is wrong ! Why ?</value> <value xml:lang="it">calcolo è errato ! Perchè ?</value> <value xml:lang="ja">è¨ç®ã«èª¤ããããã¾ã!ãªã?</value> + <value xml:lang="zh">计ç®é误ï¼ä¸ºä»ä¹ï¼</value> </property> <property key="ServiceTestXmlRpcMissingParameters"> <value xml:lang="en">missing parameters</value> <value xml:lang="it">parametri mancanti</value> <value xml:lang="ja">ãã©ã¡ã¼ã¿ãæ£ããããã¾ãã</value> + <value xml:lang="zh">缺å°åæ°</value> </property> <property key="ServiceValueNotFound"> <value xml:lang="en">Value not found, cannot update</value> <value xml:lang="it">Valore non troavato, non è possibile aggiornare</value> <value xml:lang="ja">å¤ãè¦ã¤ããã¾ãããæ´æ°ã§ãã¾ãã</value> + <value xml:lang="zh">æ²¡ææ¾å°å¼ï¼æ æ³æ´æ°</value> </property> </resource> Modified: ofbiz/branches/webhelp-2012-12-07/framework/service/src/org/ofbiz/service/ServiceUtil.java URL: http://svn.apache.org/viewvc/ofbiz/branches/webhelp-2012-12-07/framework/service/src/org/ofbiz/service/ServiceUtil.java?rev=1452030&r1=1452029&r2=1452030&view=diff ============================================================================== --- ofbiz/branches/webhelp-2012-12-07/framework/service/src/org/ofbiz/service/ServiceUtil.java (original) +++ ofbiz/branches/webhelp-2012-12-07/framework/service/src/org/ofbiz/service/ServiceUtil.java Sun Mar 3 12:00:12 2013 @@ -20,11 +20,11 @@ package org.ofbiz.service; import java.math.BigDecimal; import java.sql.Timestamp; -import com.ibm.icu.util.Calendar; import java.util.LinkedList; import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.TimeZone; import javax.servlet.http.HttpServletRequest; import javax.transaction.Transaction; @@ -51,6 +51,8 @@ import org.ofbiz.entity.util.EntityListI import org.ofbiz.security.Security; import org.ofbiz.service.config.ServiceConfigUtil; +import com.ibm.icu.util.Calendar; + /** * Generic Service Utility Class */ @@ -466,7 +468,7 @@ public class ServiceUtil { noMoreResults = true; } } - + // Now JobSandbox data is cleaned up. Now process Runtime data and remove the whole data in single shot that is of no need. boolean beganTx3 = false; GenericValue runtimeData = null; @@ -476,7 +478,7 @@ public class ServiceUtil { try { // begin this transaction beganTx3 = TransactionUtil.begin(); - + runTimeDataIt = delegator.find("RuntimeData", null, null, UtilMisc.toSet("runtimeDataId"), null, null); try { while ((runtimeData = runTimeDataIt.next()) != null) { @@ -685,4 +687,40 @@ public class ServiceUtil { return ServiceUtil.returnSuccess(); } + + /** + * Checks all incoming service attributes and look for fields with the same + * name in the incoming map and copy those onto the outgoing map. Also + * includes a userLogin if service requires one. + * + * @param dispatcher + * @param serviceName + * @param fromMap + * @param userLogin + * (optional) - will be added to the map if is required + * @param timeZone + * @param locale + * @return filled Map or null on error + * @throws GeneralServiceException + */ + public static Map<String, Object> setServiceFields(LocalDispatcher dispatcher, String serviceName, Map<String, Object> fromMap, GenericValue userLogin, + TimeZone timeZone, Locale locale) throws GeneralServiceException { + Map<String, Object> outMap = FastMap.newInstance(); + + ModelService modelService = null; + try { + modelService = dispatcher.getDispatchContext().getModelService(serviceName); + } catch (GenericServiceException e) { + String errMsg = "Could not get service definition for service name [" + serviceName + "]: "; + Debug.logError(e, errMsg, module); + throw new GeneralServiceException(e); + } + outMap.putAll(modelService.makeValid(fromMap, "IN", true, null, timeZone, locale)); + + if (userLogin != null && modelService.auth) { + outMap.put("userLogin", userLogin); + } + + return outMap; + } } Modified: ofbiz/branches/webhelp-2012-12-07/framework/start/src/org/ofbiz/base/start/both.properties URL: http://svn.apache.org/viewvc/ofbiz/branches/webhelp-2012-12-07/framework/start/src/org/ofbiz/base/start/both.properties?rev=1452030&r1=1452029&r2=1452030&view=diff ============================================================================== --- ofbiz/branches/webhelp-2012-12-07/framework/start/src/org/ofbiz/base/start/both.properties (original) +++ ofbiz/branches/webhelp-2012-12-07/framework/start/src/org/ofbiz/base/start/both.properties Sun Mar 3 12:00:12 2013 @@ -39,7 +39,7 @@ #ofbiz.log.dir=runtime/logs # --- Location (relative to ofbiz.home) for (normal) container configuration -ofbiz.container.config=framework/base/config/both-containers.xml +#ofbiz.container.config=framework/base/config/ofbiz-containers.xml # -- StartupLoader implementation for Splash Screen ofbiz.start.loader1=org.ofbiz.base.splash.SplashLoader Modified: ofbiz/branches/webhelp-2012-12-07/framework/webapp/src/org/ofbiz/webapp/view/ApacheFopWorker.java URL: http://svn.apache.org/viewvc/ofbiz/branches/webhelp-2012-12-07/framework/webapp/src/org/ofbiz/webapp/view/ApacheFopWorker.java?rev=1452030&r1=1452029&r2=1452030&view=diff ============================================================================== --- ofbiz/branches/webhelp-2012-12-07/framework/webapp/src/org/ofbiz/webapp/view/ApacheFopWorker.java (original) +++ ofbiz/branches/webhelp-2012-12-07/framework/webapp/src/org/ofbiz/webapp/view/ApacheFopWorker.java Sun Mar 3 12:00:12 2013 @@ -43,10 +43,8 @@ import org.apache.fop.apps.MimeConstants import org.ofbiz.base.location.FlexibleLocation; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.FileUtil; +import org.ofbiz.base.util.UtilProperties; import org.ofbiz.base.util.UtilValidate; -import org.ofbiz.entity.Delegator; -import org.ofbiz.entity.DelegatorFactory; -import org.ofbiz.entity.util.EntityUtilProperties; /** * Apache FOP worker class. @@ -67,16 +65,6 @@ public class ApacheFopWorker { * @return FopFactory The FopFactory instance */ public static FopFactory getFactoryInstance() { - Delegator delegator = DelegatorFactory.getDelegator("default"); - return getFactoryInstance(delegator); - } - - /** Returns an instance of the FopFactory class. FOP documentation recommends - * the reuse of the factory instance because of the startup time. - * @param delegator the delegator - * @return FopFactory The FopFactory instance - */ - public static FopFactory getFactoryInstance(Delegator delegator) { if (fopFactory == null) { synchronized (ApacheFopWorker.class) { if (fopFactory != null) { @@ -89,15 +77,24 @@ public class ApacheFopWorker { fopFactory.setStrictValidation(false); try { - String fopPath = EntityUtilProperties.getPropertyValue("url.properties", "fop.path", delegator); + String ofbizHome = System.getProperty("ofbiz.home"); + String fopPath = UtilProperties.getPropertyValue("fop.properties", "fop.path", ofbizHome + "/framework/webapp/config"); File userConfigFile = FileUtil.getFile(fopPath + "/fop.xconf"); - fopFactory.setUserConfig(userConfigFile); - String fopFontBasePath = EntityUtilProperties.getPropertyValue("url.properties", "fop.font.base.path", delegator); - File fopFontBasePathFile = new File(fopFontBasePath); - URL fopFontBaseUrl = FlexibleLocation.resolveLocation(fopFontBasePathFile.toString()); - fopFactory.getFontManager().setFontBaseURL(fopFontBaseUrl.toString()); + if (userConfigFile.exists()) { + fopFactory.setUserConfig(userConfigFile); + } else { + Debug.logWarning("FOP configuration file not found: " + userConfigFile, module); + } + String fopFontBaseProperty = UtilProperties.getPropertyValue("fop.properties", "fop.font.base.url", ofbizHome + "/framework/webapp/config/"); + File fontBaseFile = FileUtil.getFile(fopFontBaseProperty); + if (fontBaseFile.isDirectory()) { + fopFactory.getFontManager().setFontBaseURL(fontBaseFile.toURI().toURL().toString()); + } else { + Debug.logWarning("FOP font base URL not found: " + fontBaseFile, module); + } + Debug.logInfo("FOP FontBaseURL: " + fopFactory.getFontManager().getFontBaseURL(), module); } catch (Exception e) { - Debug.logWarning("Error reading FOP configuration", module); + Debug.logWarning(e, "Error reading FOP configuration: ", module); } } } |
| Free forum by Nabble | Edit this page |
