|
Modified: ofbiz/branches/20111205EmailHandling/framework/common/config/TemporalExpressionUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/common/config/TemporalExpressionUiLabels.xml?rev=1305581&r1=1305580&r2=1305581&view=diff ============================================================================== --- ofbiz/branches/20111205EmailHandling/framework/common/config/TemporalExpressionUiLabels.xml (original) +++ ofbiz/branches/20111205EmailHandling/framework/common/config/TemporalExpressionUiLabels.xml Mon Mar 26 20:56:02 2012 @@ -20,6 +20,7 @@ --> <resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <property key="TemporalExpression"> + <value xml:lang="de">Zeitlicher Ausdruck</value> <value xml:lang="en">Temporal Expression</value> <value xml:lang="es">Expresión temporal</value> <value xml:lang="fr">Expression temporelle</value> @@ -29,6 +30,7 @@ <value xml:lang="zh_TW">æééç®å¼</value> </property> <property key="TemporalExpressionCollections"> + <value xml:lang="de">Ausdruckssammlung</value> <value xml:lang="en">Expression Collections</value> <value xml:lang="es">Colección de expresiones</value> <value xml:lang="fr">Collections d'expression</value> @@ -38,6 +40,7 @@ <value xml:lang="zh_TW">éç®å¼éå</value> </property> <property key="TemporalExpressionExclude"> + <value xml:lang="de">AusschlieÃen</value> <value xml:lang="en">Exclude</value> <value xml:lang="es">Excluir</value> <value xml:lang="fr">Exclure</value> @@ -47,6 +50,7 @@ <value xml:lang="zh_TW">æé¤</value> </property> <property key="TemporalExpressionFind"> + <value xml:lang="de">Suche Zeitliche Ausdrücke</value> <value xml:lang="en">Find Temporal Expression</value> <value xml:lang="es">Buscar expresión temporal</value> <value xml:lang="fr">Rechercher une expression temporelle</value> @@ -56,6 +60,7 @@ <value xml:lang="zh_TW">æ¥æ¾æééç®å¼</value> </property> <property key="TemporalExpressionFreqCount"> + <value xml:lang="de">Anzahl der Häufigkeit</value> <value xml:lang="en">Frequency Count</value> <value xml:lang="es">Número de ocurrencias</value> <value xml:lang="fr">Nombre d'occurrences</value> @@ -65,6 +70,7 @@ <value xml:lang="zh_TW">é »çè¨æ¸</value> </property> <property key="TemporalExpressionFreqType"> + <value xml:lang="de">Häufigkeitstyp</value> <value xml:lang="en">Frequency Type</value> <value xml:lang="es">Tipo de frecuencia</value> <value xml:lang="fr">Type de fréquence</value> @@ -74,6 +80,7 @@ <value xml:lang="zh_TW">é »çé¡å</value> </property> <property key="TemporalExpressionId"> + <value xml:lang="de">Ausdrucks-Id</value> <value xml:lang="en">Expression Id</value> <value xml:lang="es">Id de la expresión</value> <value xml:lang="fr">Réf. d'expression</value> @@ -83,6 +90,7 @@ <value xml:lang="zh_TW">ç®å¼ID</value> </property> <property key="TemporalExpressionInclude"> + <value xml:lang="de">EinschlieÃen</value> <value xml:lang="en">Include</value> <value xml:lang="es">Incluye</value> <value xml:lang="fr">Inclure</value> @@ -92,6 +100,7 @@ <value xml:lang="zh_TW">å å«</value> </property> <property key="TemporalExpressionMaintenance"> + <value xml:lang="de">Wartung des Zeitlichen Ausdrucks</value> <value xml:lang="en">Temporal Expression Maintenance</value> <value xml:lang="es">Mantenimiento de expresiones temporales</value> <value xml:lang="fr">maintenance d'expression temporelle</value> @@ -101,6 +110,7 @@ <value xml:lang="zh_TW">æééç®å¼ç¶è·</value> </property> <property key="TemporalExpressionOccurrence"> + <value xml:lang="de">Auftreten</value> <value xml:lang="en">Occurrence</value> <value xml:lang="es">Ocurrencia</value> <value xml:lang="fr">Occurrence</value> @@ -110,6 +120,7 @@ <value xml:lang="zh_TW">忥</value> </property> <property key="TemporalExpressionTimeFormat"> + <value xml:lang="de">hh:mm:ss</value> <value xml:lang="en">hh:mm:ss</value> <value xml:lang="es">hh:mm:ss</value> <value xml:lang="fr">hh:mm:ss</value> @@ -117,6 +128,7 @@ <value xml:lang="pt_BR">hh:mm:ss</value> </property> <property key="TemporalExpressionType"> + <value xml:lang="de">Ausdruckstyp</value> <value xml:lang="en">Expression Type</value> <value xml:lang="es">Tipo de expresión</value> <value xml:lang="fr">Type d'expression</value> @@ -126,6 +138,7 @@ <value xml:lang="zh_TW">éç®å¼é¡å</value> </property> <property key="TemporalExpression_DATE_RANGE"> + <value xml:lang="de">Datumsauswahl</value> <value xml:lang="en">Date Range</value> <value xml:lang="es">Intervalo de fechas</value> <value xml:lang="fr">Intervalle entre 2 dates</value> @@ -135,6 +148,7 @@ <value xml:lang="zh_TW">æ¥æç¯å</value> </property> <property key="TemporalExpression_DAY_IN_MONTH"> + <value xml:lang="de">Tag im Monat</value> <value xml:lang="en">Day In Month</value> <value xml:lang="es">DÃa del mes</value> <value xml:lang="fr">Jour du mois</value> @@ -144,6 +158,7 @@ <value xml:lang="zh_TW">æä¸ç天</value> </property> <property key="TemporalExpression_DAY_OF_MONTH_RANGE"> + <value xml:lang="de">Tag im Monat Auswahl</value> <value xml:lang="en">Day Of Month Range</value> <value xml:lang="es">Intervalo de dÃas del mes</value> <value xml:lang="fr">Intervalle entre 2 jours du mois</value> @@ -153,6 +168,7 @@ <value xml:lang="zh_TW">æä¸å¤©çç¯å</value> </property> <property key="TemporalExpression_DAY_OF_WEEK_RANGE"> + <value xml:lang="de">Wochentagsauswahl</value> <value xml:lang="en">Day Of Week Range</value> <value xml:lang="es">Intervalo de dÃas de la semana</value> <value xml:lang="fr">Intervalle entre 2 jour de la semaine</value> @@ -162,6 +178,7 @@ <value xml:lang="zh_TW">å¨ä¸å¤©çç¯å</value> </property> <property key="TemporalExpression_DIFFERENCE"> + <value xml:lang="de">Unterschied</value> <value xml:lang="en">Difference</value> <value xml:lang="es">Diferencia</value> <value xml:lang="fr">Différence</value> @@ -171,6 +188,7 @@ <value xml:lang="zh_TW">å·®å¥</value> </property> <property key="TemporalExpression_FREQUENCY"> + <value xml:lang="de">Häufigkeit</value> <value xml:lang="en">Frequency</value> <value xml:lang="es">Frecuencia</value> <value xml:lang="fr">Fréquence</value> @@ -180,11 +198,13 @@ <value xml:lang="zh_TW">é »ç</value> </property> <property key="TemporalExpression_HOUR_RANGE"> + <value xml:lang="de">Stundenauswahl</value> <value xml:lang="en">Hour Range</value> <value xml:lang="es">Intervalo de horas</value> <value xml:lang="pt_BR">Intervalo de Hora</value> </property> <property key="TemporalExpression_INTERSECTION"> + <value xml:lang="de">Durchschnitt</value> <value xml:lang="en">Intersection</value> <value xml:lang="es">Intersección</value> <value xml:lang="fr">Intersection</value> @@ -194,11 +214,13 @@ <value xml:lang="zh_TW">交åé»</value> </property> <property key="TemporalExpression_MINUTE_RANGE"> + <value xml:lang="de">Minutenauswahl</value> <value xml:lang="en">Minute Range</value> <value xml:lang="es">Intervalo de minutos</value> <value xml:lang="pt_BR">Intervalo de Minutos</value> </property> <property key="TemporalExpression_MONTH_RANGE"> + <value xml:lang="de">Monatsauswahl</value> <value xml:lang="en">Month Range</value> <value xml:lang="es">Intervalo de meses</value> <value xml:lang="fr">Intervalle entre 2 mois</value> @@ -208,11 +230,13 @@ <value xml:lang="zh_TW">æçç¯å</value> </property> <property key="TemporalExpression_SUBSTITUTION"> + <value xml:lang="de">Ersetzung</value> <value xml:lang="en">Substitution</value> <value xml:lang="es">Sustitución</value> <value xml:lang="pt_BR">Substituição</value> </property> <property key="TemporalExpression_UNION"> + <value xml:lang="de">Vereinigung</value> <value xml:lang="en">Union</value> <value xml:lang="es">Unión</value> <value xml:lang="fr">Union</value> Modified: ofbiz/branches/20111205EmailHandling/framework/common/config/general.properties URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/common/config/general.properties?rev=1305581&r1=1305580&r2=1305581&view=diff ============================================================================== --- ofbiz/branches/20111205EmailHandling/framework/common/config/general.properties (original) +++ ofbiz/branches/20111205EmailHandling/framework/common/config/general.properties Mon Mar 26 20:56:02 2012 @@ -32,6 +32,9 @@ VISUAL_THEME=TOMAHAWK # -- the default decimal format for currency (used in UtilFormatOut.java) currency.decimal.format=#,##0.00 +# -- the default rounding for currency (used in OfbizCurrencyTransform.java) +currency.rounding.default=10 + # -- Properties fallback locale. Change this setting with caution. If you # start getting "resource not found" exceptions, then there are # properties missing in the locale you specified. This property does not Modified: ofbiz/branches/20111205EmailHandling/framework/common/data/CommonTypeData.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/common/data/CommonTypeData.xml?rev=1305581&r1=1305580&r2=1305581&view=diff ============================================================================== --- ofbiz/branches/20111205EmailHandling/framework/common/data/CommonTypeData.xml (original) +++ ofbiz/branches/20111205EmailHandling/framework/common/data/CommonTypeData.xml Mon Mar 26 20:56:02 2012 @@ -141,4 +141,15 @@ under the License. <ServerHitType description="Entity" hitTypeId="ENTITY"/> <ServerHitType description="Service" hitTypeId="SERVICE"/> + <!-- Keyword Type --> + <EnumerationType enumTypeId="KEYWORD_TYPE" hasTable="N" description="Keyword Type"/> + <Enumeration enumId="KWT_KEYWORD" enumTypeId="KEYWORD_TYPE" enumCode="KEYWORD" sequenceId="01" description="Keyword"/> + <Enumeration enumId="KWT_TAG" enumTypeId="KEYWORD_TYPE" enumCode="TAG" sequenceId="02" description="Tag"/> + + <!-- Keyword Status --> + <StatusType statusTypeId="KEYWORD_STATUS" hasTable="N" description="Keyword"/> + <StatusItem statusId="KW_APPROVED" statusTypeId="KEYWORD_STATUS" statusCode="APPROVED" sequenceId="01" description="Approved"/> + <StatusItem statusId="KW_PENDING" statusTypeId="KEYWORD_STATUS" statusCode="PENDING" sequenceId="02" description="Pending"/> + <StatusItem statusId="KW_DISAPPROVED" statusTypeId="KEYWORD_STATUS" statusCode="DISAPPROVED" sequenceId="03" description="Disapproved"/> + </entity-engine-xml> Modified: ofbiz/branches/20111205EmailHandling/framework/common/entitydef/entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/common/entitydef/entitymodel.xml?rev=1305581&r1=1305580&r2=1305581&view=diff ============================================================================== --- ofbiz/branches/20111205EmailHandling/framework/common/entitydef/entitymodel.xml (original) +++ ofbiz/branches/20111205EmailHandling/framework/common/entitydef/entitymodel.xml Mon Mar 26 20:56:02 2012 @@ -839,4 +839,17 @@ under the License. <key-map field-name="portalPageId"/> </view-link> </view-entity> + + <!-- ============================ --> + <!-- org.ofbiz.common.property --> + <!-- ============================ --> + + <entity entity-name="SystemProperty" package-name="org.ofbiz.common.property" title="Defines a System Property"> + <field name="systemResourceId" type="id-long-ne"></field> + <field name="systemPropertyId" type="id-long-ne"></field> + <field name="systemPropertyValue" type="value"></field> + <field name="description" type="description"></field> + <prim-key field="systemResourceId"/> + <prim-key field="systemPropertyId"/> + </entity> </entitymodel> Modified: ofbiz/branches/20111205EmailHandling/framework/common/ofbiz-component.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/common/ofbiz-component.xml?rev=1305581&r1=1305580&r2=1305581&view=diff ============================================================================== --- ofbiz/branches/20111205EmailHandling/framework/common/ofbiz-component.xml (original) +++ ofbiz/branches/20111205EmailHandling/framework/common/ofbiz-component.xml Mon Mar 26 20:56:02 2012 @@ -28,6 +28,7 @@ under the License. <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel_olap.xml"/> <entity-resource type="group" reader-name="main" loader="main" location="entitydef/entitygroup_olap.xml"/> <entity-resource type="data" reader-name="seed" loader="main" location="data/CommonSecurityData.xml"/> + <entity-resource type="data" reader-name="seed" loader="main" location="data/CommonSystemPropertyData.xml"/> <entity-resource type="data" reader-name="seed" loader="main" location="data/CommonTypeData.xml"/> <entity-resource type="data" reader-name="seed" loader="main" location="data/CountryCodeData.xml"/> <entity-resource type="data" reader-name="seed" loader="main" location="data/CurrencyData.xml"/> Modified: ofbiz/branches/20111205EmailHandling/framework/common/script/org/ofbiz/common/GroovyServiceTest.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/common/script/org/ofbiz/common/GroovyServiceTest.groovy?rev=1305581&r1=1305580&r2=1305581&view=diff ============================================================================== --- ofbiz/branches/20111205EmailHandling/framework/common/script/org/ofbiz/common/GroovyServiceTest.groovy (original) +++ ofbiz/branches/20111205EmailHandling/framework/common/script/org/ofbiz/common/GroovyServiceTest.groovy Mon Mar 26 20:56:02 2012 @@ -23,13 +23,47 @@ import org.ofbiz.base.util.Debug; Debug.logInfo("-=-=-=- TEST GROOVY SERVICE -=-=-=-", ""); result = ServiceUtil.returnSuccess(); if (context.message) { - message = context.message; - result.successMessage = "Got message [$message] and finished fine"; + String message = context.message; + result.successMessage = (String) "Got message [$message] and finished fine"; result.result = message; Debug.logInfo("----- Message is: $message -----", ""); } else { - result.successMessage = "Got no message but finished fine anyway"; - result.result = "[no message received]"; + result.successMessage = (String) "Got no message but finished fine anyway"; + result.result = (String) "[no message received]"; + Debug.logInfo("----- No message received -----", ""); } - return result; + +// GroovyEngine will invoke the no-arg method. +public Map testMethod() { + Debug.logInfo("----- no-arg testMethod invoked -----", ""); + result = ServiceUtil.returnSuccess(); + if (context.message) { + String message = context.message; + result.successMessage = (String) "Got message [$message] and finished fine"; + result.result = message; + Debug.logInfo("----- Message is: $message -----", ""); + } else { + result.successMessage = (String) "Got no message but finished fine anyway"; + result.result = (String) "[no message received]"; + Debug.logInfo("----- No message received -----", ""); + } + return result; +} + +// ScriptEngine (JSR-223) will invoke the arg method. +public Map testMethod(Map context) { + Debug.logInfo("----- arg testMethod invoked -----", ""); + result = ServiceUtil.returnSuccess(); + if (context.message) { + String message = context.message; + result.successMessage = (String) "Got message [$message] and finished fine"; + result.result = message; + Debug.logInfo("----- Message is: $message -----", ""); + } else { + result.successMessage = (String) "Got no message but finished fine anyway"; + result.result = (String) "[no message received]"; + Debug.logInfo("----- No message received -----", ""); + } + return result; +} Modified: ofbiz/branches/20111205EmailHandling/framework/common/script/org/ofbiz/common/email/EmailServices.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/common/script/org/ofbiz/common/email/EmailServices.xml?rev=1305581&r1=1305580&r2=1305581&view=diff ============================================================================== --- ofbiz/branches/20111205EmailHandling/framework/common/script/org/ofbiz/common/email/EmailServices.xml (original) +++ ofbiz/branches/20111205EmailHandling/framework/common/script/org/ofbiz/common/email/EmailServices.xml Mon Mar 26 20:56:02 2012 @@ -42,6 +42,14 @@ under the License. <fail-property resource="CommonUiLabels" property="CommonEmailNotValid"/> </add-error> <check-errors/> + <set field="getEmail.partyId" from-field="parameters.partyIdTo"/> + <call-service service-name="getPartyEmail" in-map-name="getEmail"> + <result-to-field result-name="emailAddress" field="parameters.sendTo"/> + </call-service> + <if-empty field="parameters.sendTo"> + <log level="info" message="PartyId: ${parameters.partyIdTo} has no valid email address, not sending email"></log> + <return/> + </if-empty> </if-empty> </if-empty> <entity-one entity-name="EmailTemplateSetting" value-field="emailTemplateSetting"/> Modified: ofbiz/branches/20111205EmailHandling/framework/common/script/org/ofbiz/common/permission/CommonPermissionServices.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/common/script/org/ofbiz/common/permission/CommonPermissionServices.xml?rev=1305581&r1=1305580&r2=1305581&view=diff ============================================================================== --- ofbiz/branches/20111205EmailHandling/framework/common/script/org/ofbiz/common/permission/CommonPermissionServices.xml (original) +++ ofbiz/branches/20111205EmailHandling/framework/common/script/org/ofbiz/common/permission/CommonPermissionServices.xml Mon Mar 26 20:56:02 2012 @@ -38,14 +38,14 @@ under the License. </if-empty> </if-empty> <check-errors/> - <log level="info" message="Checking for primary permission ${primaryPermission}_${mainAction}"/> + <log level="verbose" message="Checking for primary permission ${primaryPermission}_${mainAction}"/> <!-- allow alt permission to be set from outside methods or direct to the service --> <if-empty field="altPermission"> <set field="altPermission" from-field="parameters.altPermission"/> </if-empty> <if-not-empty field="altPermission"> - <log level="info" message="Checking for alternate permission ${altPermission}_${mainAction}"/> + <log level="verbose" message="Checking for alternate permission ${altPermission}_${mainAction}"/> <set field="altPermissionList" value=", ${altPermission}_${mainAction}, ${altPermission}_ADMIN"/> </if-not-empty> <!-- altPermission is not a required field; no need to add Error --> Modified: ofbiz/branches/20111205EmailHandling/framework/common/servicedef/services_test.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/common/servicedef/services_test.xml?rev=1305581&r1=1305580&r2=1305581&view=diff ============================================================================== --- ofbiz/branches/20111205EmailHandling/framework/common/servicedef/services_test.xml (original) +++ ofbiz/branches/20111205EmailHandling/framework/common/servicedef/services_test.xml Mon Mar 26 20:56:02 2012 @@ -158,12 +158,12 @@ under the License. invoke="GetGeoIPContext"> <attribute name="invoke" type="String" mode="IN" /> <attribute name="result" type="String" mode="OUT"/> - </service> - + </service> + <service name="testBsh" engine="bsh" location="component://common/script/org/ofbiz/common/BshServiceTest.bsh" invoke=""> <description>Test BeanShell Script Service</description> - <attribute name="message" type="String" mode="IN" optional="true"/> - <attribute name="result" type="String" mode="OUT"/> + <attribute name="message" type="String" mode="IN" optional="true" /> + <attribute name="result" type="String" mode="OUT" /> </service> <service name="testGroovy" engine="groovy" location="component://common/script/org/ofbiz/common/GroovyServiceTest.groovy" invoke=""> @@ -172,6 +172,43 @@ under the License. <attribute name="result" type="String" mode="OUT"/> </service> + <service name="testGroovyMethod" engine="groovy" location="component://common/script/org/ofbiz/common/GroovyServiceTest.groovy" invoke="testMethod"> + <description>Test Groovy Script Service Method Invocation</description> + <attribute name="message" type="String" mode="IN" optional="true"/> + <attribute name="result" type="String" mode="OUT"/> + </service> + + <service name="testScriptEngineBsh" engine="script" location="component://common/script/org/ofbiz/common/BshServiceTest.bsh" invoke=""> + <description>Test BeanShell Script Service</description> + <attribute name="message" type="String" mode="IN" optional="true"/> + <attribute name="result" type="String" mode="OUT"/> + </service> + + <service name="testScriptEngineGroovy" engine="script" location="component://common/script/org/ofbiz/common/GroovyServiceTest.groovy" invoke=""> + <description>Test Script Engine With Groovy Script</description> + <attribute name="message" type="String" mode="IN" optional="true"/> + <attribute name="result" type="String" mode="OUT"/> + </service> + + <service name="testScriptEngineGroovyMethod" engine="script" location="component://common/script/org/ofbiz/common/GroovyServiceTest.groovy" invoke="testMethod"> + <description>Test Script Engine With Groovy Script Method Invocation</description> + <attribute name="message" type="String" mode="IN" optional="true"/> + <attribute name="result" type="String" mode="OUT"/> + </service> + + <service name="testScriptEngineJavaScript" engine="script" location="component://common/script/org/ofbiz/common/JavaScriptTest.js" invoke=""> + <description>Test Script Engine With JavaScript</description> + <attribute name="message" type="String" mode="IN" optional="true"/> + <attribute name="exampleId" type="String" mode="IN" optional="true"/> + <attribute name="result" type="String" mode="OUT"/> + </service> + + <service name="testScriptEngineJavaScriptFunction" engine="script" location="component://common/script/org/ofbiz/common/JavaScriptTest.js" invoke="testFunction"> + <description>Test Script Engine With JavaScript Function Invocation</description> + <attribute name="message" type="String" mode="IN" optional="true"/> + <attribute name="result" type="String" mode="OUT"/> + </service> + <service name="testJMSQueue" engine="jms" location="serviceMessenger" invoke="testScv"> <description>Test JMS Queue service</description> <attribute name="message" type="String" mode="IN"/> Modified: ofbiz/branches/20111205EmailHandling/framework/common/src/org/ofbiz/common/CommonServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/common/src/org/ofbiz/common/CommonServices.java?rev=1305581&r1=1305580&r2=1305581&view=diff ============================================================================== --- ofbiz/branches/20111205EmailHandling/framework/common/src/org/ofbiz/common/CommonServices.java (original) +++ ofbiz/branches/20111205EmailHandling/framework/common/src/org/ofbiz/common/CommonServices.java Mon Mar 26 20:56:02 2012 @@ -184,7 +184,7 @@ public class CommonServices { partyId = userLogin.getString("partyId"); } - Map<String, String> fields = UtilMisc.toMap("noteId", noteId, "noteName", noteName, "noteInfo", note, + Map<String, Object> fields = UtilMisc.toMap("noteId", noteId, "noteName", noteName, "noteInfo", note, "noteParty", partyId, "noteDateTime", noteDate); try { Modified: ofbiz/branches/20111205EmailHandling/framework/common/src/org/ofbiz/common/CommonWorkers.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/common/src/org/ofbiz/common/CommonWorkers.java?rev=1305581&r1=1305580&r2=1305581&view=diff ============================================================================== --- ofbiz/branches/20111205EmailHandling/framework/common/src/org/ofbiz/common/CommonWorkers.java (original) +++ ofbiz/branches/20111205EmailHandling/framework/common/src/org/ofbiz/common/CommonWorkers.java Mon Mar 26 20:56:02 2012 @@ -34,6 +34,7 @@ import org.ofbiz.entity.condition.Entity import org.ofbiz.entity.condition.EntityExpr; import org.ofbiz.entity.condition.EntityOperator; import org.ofbiz.entity.util.EntityTypeUtil; +import org.ofbiz.entity.util.EntityUtilProperties; /** * Common Workers @@ -44,7 +45,7 @@ public class CommonWorkers { public static List<GenericValue> getCountryList(Delegator delegator) { List<GenericValue> geoList = FastList.newInstance(); - String defaultCountry = UtilProperties.getPropertyValue("general.properties", "country.geo.id.default"); + String defaultCountry = EntityUtilProperties.getPropertyValue("general.properties", "country.geo.id.default", delegator); GenericValue defaultGeo = null; if (UtilValidate.isNotEmpty(defaultCountry)) { try { @@ -110,7 +111,7 @@ public class CommonWorkers { public static List<GenericValue> getAssociatedStateList(Delegator delegator, String country, String listOrderBy) { if (UtilValidate.isEmpty(country)) { // Load the system default country - country = UtilProperties.getPropertyValue("general.properties", "country.geo.id.default"); + country = EntityUtilProperties.getPropertyValue("general.properties", "country.geo.id.default", delegator); } if (UtilValidate.isEmpty(listOrderBy)) { Modified: ofbiz/branches/20111205EmailHandling/framework/common/src/org/ofbiz/common/UrlServletHelper.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/common/src/org/ofbiz/common/UrlServletHelper.java?rev=1305581&r1=1305580&r2=1305581&view=diff ============================================================================== --- ofbiz/branches/20111205EmailHandling/framework/common/src/org/ofbiz/common/UrlServletHelper.java (original) +++ ofbiz/branches/20111205EmailHandling/framework/common/src/org/ofbiz/common/UrlServletHelper.java Mon Mar 26 20:56:02 2012 @@ -55,7 +55,6 @@ public class UrlServletHelper extends Co // get tenant delegator by domain name String serverName = request.getServerName(); try { - // if tenant was specified, replace delegator with the new per-tenant delegator and set tenantId to session attribute delegator = getDelegator(servletContext); List<GenericValue> tenants = delegator.findList("Tenant", EntityCondition.makeCondition("domainName", serverName), null, UtilMisc.toList("-createdStamp"), null, false); Modified: ofbiz/branches/20111205EmailHandling/framework/common/src/org/ofbiz/common/email/EmailServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/common/src/org/ofbiz/common/email/EmailServices.java?rev=1305581&r1=1305580&r2=1305581&view=diff ============================================================================== --- ofbiz/branches/20111205EmailHandling/framework/common/src/org/ofbiz/common/email/EmailServices.java (original) +++ ofbiz/branches/20111205EmailHandling/framework/common/src/org/ofbiz/common/email/EmailServices.java Mon Mar 26 20:56:02 2012 @@ -66,7 +66,9 @@ import org.ofbiz.base.util.UtilPropertie import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.collections.MapStack; import org.ofbiz.base.util.string.FlexibleStringExpander; +import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityUtilProperties; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.LocalDispatcher; @@ -98,6 +100,7 @@ public class EmailServices { *@return Map with the result of the service, the output parameters */ public static Map<String, Object> sendMail(DispatchContext ctx, Map<String, ? extends Object> context) { + Delegator delegator = ctx.getDelegator(); String communicationEventId = (String) context.get("communicationEventId"); String orderId = (String) context.get("orderId"); Locale locale = (Locale) context.get("locale"); @@ -162,31 +165,31 @@ public class EmailServices { if (sendType == null || sendType.equals("mail.smtp.host")) { sendType = "mail.smtp.host"; if (UtilValidate.isEmpty(sendVia)) { - sendVia = UtilProperties.getPropertyValue("general.properties", "mail.smtp.relay.host", "localhost"); + sendVia = EntityUtilProperties.getPropertyValue("general.properties", "mail.smtp.relay.host", "localhost", delegator); } if (UtilValidate.isEmpty(authUser)) { - authUser = UtilProperties.getPropertyValue("general.properties", "mail.smtp.auth.user"); + authUser = EntityUtilProperties.getPropertyValue("general.properties", "mail.smtp.auth.user", delegator); } if (UtilValidate.isEmpty(authPass)) { - authPass = UtilProperties.getPropertyValue("general.properties", "mail.smtp.auth.password"); + authPass = EntityUtilProperties.getPropertyValue("general.properties", "mail.smtp.auth.password", delegator); } if (UtilValidate.isNotEmpty(authUser)) { useSmtpAuth = true; } if (UtilValidate.isEmpty(port)) { - port = UtilProperties.getPropertyValue("general.properties", "mail.smtp.port"); + port = EntityUtilProperties.getPropertyValue("general.properties", "mail.smtp.port", delegator); } if (UtilValidate.isEmpty(socketFactoryPort)) { - socketFactoryPort = UtilProperties.getPropertyValue("general.properties", "mail.smtp.socketFactory.port"); + socketFactoryPort = EntityUtilProperties.getPropertyValue("general.properties", "mail.smtp.socketFactory.port", delegator); } if (UtilValidate.isEmpty(socketFactoryClass)) { - socketFactoryClass = UtilProperties.getPropertyValue("general.properties", "mail.smtp.socketFactory.class"); + socketFactoryClass = EntityUtilProperties.getPropertyValue("general.properties", "mail.smtp.socketFactory.class", delegator); } if (UtilValidate.isEmpty(socketFactoryFallback)) { - socketFactoryFallback = UtilProperties.getPropertyValue("general.properties", "mail.smtp.socketFactory.fallback", "false"); + socketFactoryFallback = EntityUtilProperties.getPropertyValue("general.properties", "mail.smtp.socketFactory.fallback", "false", delegator); } if (sendPartial == null) { - sendPartial = UtilProperties.propertyValueEqualsIgnoreCase("general.properties", "mail.smtp.sendpartial", "true") ? true : false; + sendPartial = EntityUtilProperties.propertyValueEqualsIgnoreCase("general.properties", "mail.smtp.sendpartial", "true", delegator) ? true : false; } } else if (sendVia == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "CommonEmailSendMissingParameterSendVia", locale)); @@ -298,7 +301,7 @@ public class EmailServices { } // check to see if sending mail is enabled - String mailEnabled = UtilProperties.getPropertyValue("general.properties", "mail.notifications.enabled", "N"); + String mailEnabled = EntityUtilProperties.getPropertyValue("general.properties", "mail.notifications.enabled", "N", delegator); if (!"Y".equalsIgnoreCase(mailEnabled)) { // no error; just return as if we already processed Debug.logImportant("Mail notifications disabled in general.properties; mail with subject [" + subject + "] not sent to addressee [" + sendTo + "]", module); Modified: ofbiz/branches/20111205EmailHandling/framework/common/src/org/ofbiz/common/uom/UomWorker.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/common/src/org/ofbiz/common/uom/UomWorker.java?rev=1305581&r1=1305580&r2=1305581&view=diff ============================================================================== --- ofbiz/branches/20111205EmailHandling/framework/common/src/org/ofbiz/common/uom/UomWorker.java (original) +++ ofbiz/branches/20111205EmailHandling/framework/common/src/org/ofbiz/common/uom/UomWorker.java Mon Mar 26 20:56:02 2012 @@ -39,6 +39,8 @@ public class UomWorker { public static final String module = UomWorker.class.getName(); + private UomWorker () {} + public static int[] uomTimeToCalTime(String uomId) { if ("TF_ms".equals(uomId)) { return new int[] { Calendar.MILLISECOND, 1 }; Modified: ofbiz/branches/20111205EmailHandling/framework/common/webcommon/WEB-INF/common-controller.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/common/webcommon/WEB-INF/common-controller.xml?rev=1305581&r1=1305580&r2=1305581&view=diff ============================================================================== --- ofbiz/branches/20111205EmailHandling/framework/common/webcommon/WEB-INF/common-controller.xml (original) +++ ofbiz/branches/20111205EmailHandling/framework/common/webcommon/WEB-INF/common-controller.xml Mon Mar 26 20:56:02 2012 @@ -34,13 +34,7 @@ under the License. <handler name="simple" type="request" class="org.ofbiz.webapp.event.SimpleEventHandler"/> <handler name="groovy" type="request" class="org.ofbiz.webapp.event.GroovyEventHandler"/> <handler name="rome" type="request" class="org.ofbiz.webapp.event.RomeEventHandler"/> - <!-- These event handlers have been deprecated, if you need to send json responses then chain - the json request from this controller after calling your event - <handler name="jsonservice" type="request" class="org.ofbiz.webapp.event.JSONServiceEventHandler"/> - <handler name="jsonservice-multi" type="request" class="org.ofbiz.webapp.event.JSONServiceMultiEventHandler"/> - <handler name="jsonsimple" type="request" class="org.ofbiz.webapp.event.JSONSimpleEventHandler"/> - <handler name="jsonjava" type="request" class="org.ofbiz.webapp.event.JSONJavaEventHandler"/> - --> + <handler name="script" type="request" class="org.ofbiz.webapp.event.ScriptEventHandler"/> <!-- view handlers --> <handler name="screen" type="view" class="org.ofbiz.widget.screen.MacroScreenViewHandler"/> Modified: ofbiz/branches/20111205EmailHandling/framework/common/webcommon/includes/ajaxAutocompleteOptions.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/common/webcommon/includes/ajaxAutocompleteOptions.ftl?rev=1305581&r1=1305580&r2=1305581&view=diff ============================================================================== --- ofbiz/branches/20111205EmailHandling/framework/common/webcommon/includes/ajaxAutocompleteOptions.ftl (original) +++ ofbiz/branches/20111205EmailHandling/framework/common/webcommon/includes/ajaxAutocompleteOptions.ftl Mon Mar 26 20:56:02 2012 @@ -33,8 +33,8 @@ under the License. </#if> <#else> <script type="text/javascript"> - <#if autocompleteOptions?exists> - var autocomp = [ +var autocomp = [ + <#if autocompleteOptions?has_content> <#if !displayReturnField?exists> <#assign displayReturnField = Static["org.ofbiz.base.util.UtilProperties"].getPropertyValue("widget.properties", "widget.autocompleter.displayReturnField")> </#if> @@ -55,12 +55,18 @@ under the License. <#if ("Y" == displayReturnField)> <#assign displayString = displayString + "[" + returnField + "]"> </#if> - "id": " ${returnField}", + "id": "${returnField}", "label": "<#if (displayString?trim?has_content )>${displayString?trim}<#else>${returnField}</#if>", "value": "${returnField}" }<#if autocompleteOption_has_next>,</#if> </#list> - ]; + <#else> + { + "id": "", + "label": "${uiLabelMap.CommonNoRecordFound}", + "value": "" + } </#if> + ]; </script> </#if> Modified: ofbiz/branches/20111205EmailHandling/framework/common/webcommon/includes/listVisualThemes.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/common/webcommon/includes/listVisualThemes.ftl?rev=1305581&r1=1305580&r2=1305581&view=diff ============================================================================== --- ofbiz/branches/20111205EmailHandling/framework/common/webcommon/includes/listVisualThemes.ftl (original) +++ ofbiz/branches/20111205EmailHandling/framework/common/webcommon/includes/listVisualThemes.ftl Mon Mar 26 20:56:02 2012 @@ -34,11 +34,11 @@ margin: 1em; 'hideOnContentClick': true }); $("a.group").fancybox({ - 'transitionIn' : 'elastic', - 'transitionOut' : 'elastic', - 'speedIn' : 600, - 'speedOut' : 200, - 'overlayShow' : false + 'transitionIn' : 'elastic', + 'transitionOut' : 'elastic', + 'speedIn' : 600, + 'speedOut' : 200, + 'overlayShow' : false }); }); </script> Modified: ofbiz/branches/20111205EmailHandling/framework/common/webcommon/includes/lookup.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/common/webcommon/includes/lookup.ftl?rev=1305581&r1=1305580&r2=1305581&view=diff ============================================================================== --- ofbiz/branches/20111205EmailHandling/framework/common/webcommon/includes/lookup.ftl (original) +++ ofbiz/branches/20111205EmailHandling/framework/common/webcommon/includes/lookup.ftl Mon Mar 26 20:56:02 2012 @@ -27,7 +27,20 @@ under the License. <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <title>${title?if_exists}</title> - <script language="javascript" src="<@ofbizContentUrl>/images/jquery/jquery-1.7.min.js</@ofbizContentUrl>" type="text/javascript"></script> + <#-- the trick "<scr" + "ipt below is because browsers should not parse the contents of CDATA elements, but apparently they do. --> + <script language="JavaScript" type="text/javascript">//<![CDATA[ + var jQueryLibLoaded = false; + function initJQuery() { + if (typeof(jQuery) == 'undefined') { + if (!jQueryLibLoaded) { + jQueryLibLoaded = true; + document.write("<scr" + "ipt type=\"text/javascript\" src=\"<@ofbizContentUrl>/images/jquery/jquery-1.7.min.js</@ofbizContentUrl>\"></scr" + "ipt>"); + } + setTimeout("initJQuery()", 50); + } + } + initJQuery(); + //]]></script> <script language="javascript" src="<@ofbizContentUrl>/images/selectall.js</@ofbizContentUrl>" type="text/javascript"></script> <#if layoutSettings.javaScripts?has_content> <#--layoutSettings.javaScripts is a list of java scripts. --> Modified: ofbiz/branches/20111205EmailHandling/framework/common/widget/CommonScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/common/widget/CommonScreens.xml?rev=1305581&r1=1305580&r2=1305581&view=diff ============================================================================== --- ofbiz/branches/20111205EmailHandling/framework/common/widget/CommonScreens.xml (original) +++ ofbiz/branches/20111205EmailHandling/framework/common/widget/CommonScreens.xml Mon Mar 26 20:56:02 2012 @@ -406,6 +406,7 @@ under the License. <fail-widgets> <section> <actions> + <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/> <set field="searchType" from-field="parameters.searchType" default-value="${searchType}"/> <script location="component://common/webcommon/WEB-INF/actions/includes/FindAutocompleteOptions.groovy"/> </actions> @@ -523,6 +524,9 @@ under the License. <screen name="login"> <section> + <actions> + <set field="titleProperty" value="PageTitleLogin" /> + </actions> <widgets> <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}"> <decorator-section name="body"> @@ -540,7 +544,7 @@ under the License. <widgets> <decorator-screen name="LookupDecorator"> <decorator-section name="body"> - <label>${uiLabelMap.CommonSessionTimeoutPleaseLogIn}</label> + <link target="checkLogin" text="${uiLabelMap.CommonSessionTimeoutPleaseLogIn}"/> </decorator-section> </decorator-screen> </widgets> Modified: ofbiz/branches/20111205EmailHandling/framework/common/widget/HelpScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/common/widget/HelpScreens.xml?rev=1305581&r1=1305580&r2=1305581&view=diff ============================================================================== --- ofbiz/branches/20111205EmailHandling/framework/common/widget/HelpScreens.xml (original) +++ ofbiz/branches/20111205EmailHandling/framework/common/widget/HelpScreens.xml Mon Mar 26 20:56:02 2012 @@ -76,10 +76,17 @@ under the License. <if-empty field="parameters.portalPageId"/> </condition> <actions> - <entity-and entity-name="ContentAssoc" list="contentAssocs"> - <field-map field-name="mapKey" from-field="parameters.helpTopic"/> + <entity-condition entity-name="ContentAssoc" list="contentAssocs"> + <condition-list> + <condition-expr field-name="mapKey" from-field="parameters.helpTopic"/> + <condition-expr field-name="fromDate" operator="less-equals" from-field="nowTimestamp"/> + <condition-list combine="or"> + <condition-expr field-name="thruDate" operator="greater-equals" from-field="nowTimestamp"/> + <condition-expr field-name="thruDate" operator="equals" from-field="nullField"/> + </condition-list> + </condition-list> <order-by field-name="sequenceNum"/> - </entity-and> + </entity-condition> <set field="contentId" from-field="contentAssocs[0].contentIdTo"/> <entity-one entity-name="Content" value-field="content"/> </actions> @@ -168,11 +175,18 @@ under the License. <section> <actions> <set field="titleProperty" value="PageTitleNavigateContent"/> - <entity-and entity-name="ContentAssoc" list="contentAssoc"> - <field-map field-name="contentId" value="HELP_ROOT"/> - <field-map field-name="contentAssocTypeId" value="TREE_CHILD"/> + <entity-condition entity-name="ContentAssoc" list="contentAssoc"> + <condition-list> + <condition-expr field-name="contentId" value="HELP_ROOT"/> + <condition-expr field-name="contentAssocTypeId" value="TREE_CHILD"/> + <condition-expr field-name="fromDate" operator="less-equals" from-field="nowTimestamp"/> + <condition-list combine="or"> + <condition-expr field-name="thruDate" operator="greater-equals" from-field="nowTimestamp"/> + <condition-expr field-name="thruDate" operator="equals" from-field="nullField"/> + </condition-list> + </condition-list> <order-by field-name="sequenceNum"/> - </entity-and> + </entity-condition> <set field="contentId" from-field="parameters.contentId" default-value="HELP_ROOT"/> </actions> <widgets> Propchange: ofbiz/branches/20111205EmailHandling/framework/common/widget/HelpScreens.xml ------------------------------------------------------------------------------ Merged /ofbiz/trunk/framework/common/widget/HelpScreens.xml:r1210494-1305499 Modified: ofbiz/branches/20111205EmailHandling/framework/common/widget/PortalPageScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/common/widget/PortalPageScreens.xml?rev=1305581&r1=1305580&r2=1305581&view=diff ============================================================================== --- ofbiz/branches/20111205EmailHandling/framework/common/widget/PortalPageScreens.xml (original) +++ ofbiz/branches/20111205EmailHandling/framework/common/widget/PortalPageScreens.xml Mon Mar 26 20:56:02 2012 @@ -101,9 +101,9 @@ under the License. <decorator-section name="body"> <screenlet id="PortalPagesList" title="${uiLabelMap.CommonPortalPagesForApplication}: ${parameters.parentPortalPageId}" collapsible="true"> <container style="button-bar"> - <link target="NewPortalPage" text="${uiLabelMap.CommonNewPortalPage}" style="buttontext create"> - <parameter param-name="parentPortalPageId" from-field="parameters.parentPortalPageId"/> - </link> + <link target="NewPortalPage" text="${uiLabelMap.CommonNewPortalPage}" style="buttontext create"> + <parameter param-name="parentPortalPageId" from-field="parameters.parentPortalPageId"/> + </link> </container> <include-form name="ListPortalPages" location="component://common/widget/PortalPageForms.xml"/> </screenlet> Modified: ofbiz/branches/20111205EmailHandling/framework/component-load.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/component-load.xml?rev=1305581&r1=1305580&r2=1305581&view=diff ============================================================================== --- ofbiz/branches/20111205EmailHandling/framework/component-load.xml (original) +++ ofbiz/branches/20111205EmailHandling/framework/component-load.xml Mon Mar 26 20:56:02 2012 @@ -32,6 +32,7 @@ under the License. <load-component component-location="common"/> <load-component component-location="service"/> <load-component component-location="entityext"/> + <load-component component-location="jcr"/> <load-component component-location="bi"/> <load-component component-location="birt"/> <load-component component-location="webapp"/> @@ -40,7 +41,6 @@ under the License. <load-component component-location="appserver"/> <load-component component-location="testtools"/> <load-component component-location="webtools"/> - <load-component component-location="webslinger"/> <load-component component-location="images"/> <load-component component-location="example"/> <load-component component-location="exampleext"/> Modified: ofbiz/branches/20111205EmailHandling/framework/datafile/src/org/ofbiz/datafile/ModelDataFileReader.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/datafile/src/org/ofbiz/datafile/ModelDataFileReader.java?rev=1305581&r1=1305580&r2=1305581&view=diff ============================================================================== --- ofbiz/branches/20111205EmailHandling/framework/datafile/src/org/ofbiz/datafile/ModelDataFileReader.java (original) +++ ofbiz/branches/20111205EmailHandling/framework/datafile/src/org/ofbiz/datafile/ModelDataFileReader.java Mon Mar 26 20:56:02 2012 @@ -18,174 +18,53 @@ *******************************************************************************/ package org.ofbiz.datafile; - -import java.io.IOException; import java.net.URL; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Map; -import javax.xml.parsers.ParserConfigurationException; - import org.ofbiz.base.util.Debug; -import org.ofbiz.base.util.UtilTimer; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.UtilXml; import org.ofbiz.base.util.cache.UtilCache; import org.w3c.dom.Document; import org.w3c.dom.Element; -import org.w3c.dom.Node; import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; - /** * Flat File definition reader */ -public class ModelDataFileReader { +public final class ModelDataFileReader { public static final String module = ModelDataFileReader.class.getName(); + private static UtilCache<URL, ModelDataFileReader> readers = UtilCache.createUtilCache("ModelDataFile", true); - public static UtilCache<URL, ModelDataFileReader> readers = UtilCache.createUtilCache("ModelDataFile", 0, 0); - - public URL readerURL = null; - public Map<String, ModelDataFile> modelDataFiles = null; - - public static ModelDataFileReader getModelDataFileReader(URL readerURL) { - ModelDataFileReader reader = null; - - reader = readers.get(readerURL); - if (reader == null) { // don't want to block here - synchronized (ModelDataFileReader.class) { - // must check if null again as one of the blocked threads can still enter - reader = readers.get(readerURL); - if (reader == null) { - if (Debug.infoOn()) Debug.logInfo("[ModelDataFileReader.getModelDataFileReader] : creating reader.", module); - reader = new ModelDataFileReader(readerURL); - readers.put(readerURL, reader); - } - } - } - if (reader != null && UtilValidate.isEmpty(reader.modelDataFiles)) { - readers.remove(readerURL); - return null; + public static ModelDataFileReader getModelDataFileReader(URL readerURL) throws DataFileException { + ModelDataFileReader reader = readers.get(readerURL); + if (reader == null) { + if (Debug.infoOn()) + Debug.logInfo("[ModelDataFileReader.getModelDataFileReader] : creating reader for " + readerURL, module); + reader = new ModelDataFileReader(readerURL); + readers.putIfAbsent(readerURL, reader); } - if (Debug.infoOn()) Debug.logInfo("[ModelDataFileReader.getModelDataFileReader] : returning reader.", module); + if (Debug.infoOn()) + Debug.logInfo("[ModelDataFileReader.getModelDataFileReader] : returning reader for " + readerURL, module); return reader; } - public ModelDataFileReader(URL readerURL) { - this.readerURL = readerURL; - - // preload models... - getModelDataFiles(); - } - - public Map<String, ModelDataFile> getModelDataFiles() { - if (modelDataFiles == null) { // don't want to block here - synchronized (ModelDataFileReader.class) { - // must check if null again as one of the blocked threads can still enter - if (modelDataFiles == null) { // now it's safe - modelDataFiles = new HashMap<String, ModelDataFile>(); - - UtilTimer utilTimer = new UtilTimer(); - - utilTimer.timerString("Before getDocument in file " + readerURL); - Document document = getDocument(readerURL); - - if (document == null) { - modelDataFiles = null; - return null; - } - - utilTimer.timerString("Before getDocumentElement in file " + readerURL); - Element docElement = document.getDocumentElement(); - - if (docElement == null) { - modelDataFiles = null; - return null; - } - docElement.normalize(); - Node curChild = docElement.getFirstChild(); - - int i = 0; - - if (curChild != null) { - utilTimer.timerString("Before start of dataFile loop in file " + readerURL); - do { - if (curChild.getNodeType() == Node.ELEMENT_NODE && "data-file".equals(curChild.getNodeName())) { - i++; - Element curDataFile = (Element) curChild; - String dataFileName = UtilXml.checkEmpty(curDataFile.getAttribute("name")); - - // check to see if dataFile with same name has already been read - if (modelDataFiles.containsKey(dataFileName)) { - Debug.logWarning("WARNING: DataFile " + dataFileName + - " is defined more than once, most recent will over-write previous definition(s)", module); - } - - // utilTimer.timerString(" After dataFileName -- " + i + " --"); - ModelDataFile dataFile = createModelDataFile(curDataFile); - - // utilTimer.timerString(" After createModelDataFile -- " + i + " --"); - if (dataFile != null) { - modelDataFiles.put(dataFileName, dataFile); - // utilTimer.timerString(" After modelDataFiles.put -- " + i + " --"); - if (Debug.infoOn()) Debug.logInfo("-- getModelDataFile: #" + i + " Loaded dataFile: " + dataFileName, module); - } else - Debug.logWarning("-- -- SERVICE ERROR:getModelDataFile: Could not create dataFile for dataFileName: " + dataFileName, module); - - } - } while ((curChild = curChild.getNextSibling()) != null); - } else { - Debug.logWarning("No child nodes found.", module); - } - utilTimer.timerString("Finished file " + readerURL + " - Total Flat File Defs: " + i + " FINISHED"); - } - } - } - return modelDataFiles; - } - - /** Gets an DataFile object based on a definition from the specified XML DataFile descriptor file. - * @param dataFileName The dataFileName of the DataFile definition to use. - * @return An DataFile object describing the specified dataFile of the specified descriptor file. - */ - public ModelDataFile getModelDataFile(String dataFileName) { - Map<String, ModelDataFile> ec = getModelDataFiles(); - - if (ec != null) { - return ec.get(dataFileName); - } else { - return null; - } - } - - /** Creates a Iterator with the dataFileName of each DataFile defined in the specified XML DataFile Descriptor file. - * @return A Iterator of dataFileName Strings - */ - public Iterator<String> getDataFileNamesIterator() { - Collection<String> collection = getDataFileNames(); - - if (collection != null) { - return collection.iterator(); - } else { - return null; - } - } - - /** Creates a Collection with the dataFileName of each DataFile defined in the specified XML DataFile Descriptor file. - * @return A Collection of dataFileName Strings - */ - public Collection<String> getDataFileNames() { - Map<String, ModelDataFile> ec = getModelDataFiles(); + private final URL readerURL; + private final Map<String, ModelDataFile> modelDataFiles; - return ec.keySet(); + public ModelDataFileReader(URL readerURL) throws DataFileException { + this.readerURL = readerURL; + this.modelDataFiles = Collections.unmodifiableMap(createModelDataFiles()); } - protected ModelDataFile createModelDataFile(Element dataFileElement) { + private ModelDataFile createModelDataFile(Element dataFileElement) { ModelDataFile dataFile = new ModelDataFile(); String tempStr; @@ -224,7 +103,7 @@ public class ModelDataFileReader { } } - for (ModelRecord modelRecord: dataFile.records) { + for (ModelRecord modelRecord : dataFile.records) { if (modelRecord.parentName.length() > 0) { ModelRecord parentRecord = dataFile.getModelRecord(modelRecord.parentName); @@ -241,7 +120,89 @@ public class ModelDataFileReader { return dataFile; } - protected ModelRecord createModelRecord(Element recordElement) { + private Map<String, ModelDataFile> createModelDataFiles() throws DataFileException { + Document document = null; + Element docElement = null; + try { + document = UtilXml.readXmlDocument(this.readerURL); + } catch (Exception e) { + Debug.logWarning(e, "Error while reading " + this.readerURL + ": ", module); + throw new DataFileException("Error while reading " + this.readerURL, e); + } + if (document != null) { + docElement = document.getDocumentElement(); + } + if (docElement == null) { + Debug.logWarning("Document element not found in " + this.readerURL, module); + throw new DataFileException("Document element not found in " + this.readerURL); + } + docElement.normalize(); + List<? extends Element> dataFileElements = UtilXml.childElementList(docElement, "data-file"); + if (dataFileElements.size() == 0) { + Debug.logWarning("No <data-file> elements found in " + this.readerURL, module); + throw new DataFileException("No <data-file> elements found in " + this.readerURL); + } + Map<String, ModelDataFile> result = new HashMap<String, ModelDataFile>(); + for (Element curDataFile : dataFileElements) { + String dataFileName = UtilXml.checkEmpty(curDataFile.getAttribute("name")); + if (result.containsKey(dataFileName)) { + Debug.logWarning("DataFile " + dataFileName + " is defined more than once, most recent will over-write previous definition(s)", module); + } + ModelDataFile dataFile = createModelDataFile(curDataFile); + if (dataFile != null) { + result.put(dataFileName, dataFile); + if (Debug.verboseOn()) { + Debug.logVerbose("Loaded dataFile: " + dataFileName, module); + } + } else { + Debug.logWarning("Could not create dataFile for dataFileName " + dataFileName, module); + throw new DataFileException("Could not create dataFile for " + dataFileName + " defined in " + this.readerURL); + } + } + return result; + } + + private ModelField createModelField(Element fieldElement) { + ModelField field = new ModelField(); + String tempStr; + + field.name = UtilXml.checkEmpty(fieldElement.getAttribute("name")); + + tempStr = UtilXml.checkEmpty(fieldElement.getAttribute("position")); + if (UtilValidate.isNotEmpty(tempStr)) { + field.position = Integer.parseInt(tempStr); + } + tempStr = UtilXml.checkEmpty(fieldElement.getAttribute("length")); + if (UtilValidate.isNotEmpty(tempStr)) { + field.length = Integer.parseInt(tempStr); + } + + field.type = UtilXml.checkEmpty(fieldElement.getAttribute("type")); + field.format = UtilXml.checkEmpty(fieldElement.getAttribute("format")); + field.validExp = UtilXml.checkEmpty(fieldElement.getAttribute("valid-exp")); + field.description = UtilXml.checkEmpty(fieldElement.getAttribute("description")); + field.defaultValue = UtilXml.checkEmpty(fieldElement.getAttribute("default-value")); + field.refField = UtilXml.checkEmpty(fieldElement.getAttribute("ref-field")); + + tempStr = UtilXml.checkEmpty(fieldElement.getAttribute("prim-key")); + if (UtilValidate.isNotEmpty(tempStr)) { + field.isPk = Boolean.parseBoolean(tempStr); + } + + tempStr = UtilXml.checkEmpty(fieldElement.getAttribute("ignored")); + if (UtilValidate.isNotEmpty(tempStr)) { + field.ignored = Boolean.parseBoolean(tempStr); + } + + tempStr = UtilXml.checkEmpty(fieldElement.getAttribute("expression")); + if (UtilValidate.isNotEmpty(tempStr)) { + field.expression = Boolean.parseBoolean(tempStr); + } + + return field; + } + + private ModelRecord createModelRecord(Element recordElement) { ModelRecord record = new ModelRecord(); String tempStr; @@ -249,9 +210,11 @@ public class ModelDataFileReader { record.typeCode = UtilXml.checkEmpty(recordElement.getAttribute("type-code")); record.tcMin = UtilXml.checkEmpty(recordElement.getAttribute("tc-min")); - if (record.tcMin.length() > 0) record.tcMinNum = Long.parseLong(record.tcMin); + if (record.tcMin.length() > 0) + record.tcMinNum = Long.parseLong(record.tcMin); record.tcMax = UtilXml.checkEmpty(recordElement.getAttribute("tc-max")); - if (record.tcMax.length() > 0) record.tcMaxNum = Long.parseLong(record.tcMax); + if (record.tcMax.length() > 0) + record.tcMaxNum = Long.parseLong(record.tcMax); tempStr = UtilXml.checkEmpty(recordElement.getAttribute("tc-isnum")); if (UtilValidate.isNotEmpty(tempStr)) { @@ -278,7 +241,8 @@ public class ModelDataFileReader { Element fieldElement = (Element) fList.item(i); ModelField modelField = createModelField(fieldElement); - // if the position is not specified, assume the start position based on last entry + // if the position is not specified, assume the start position based on last + // entry if ((i > 0) && (modelField.position == -1)) { modelField.position = priorEnd; } @@ -294,69 +258,40 @@ public class ModelDataFileReader { return record; } - protected ModelField createModelField(Element fieldElement) { - ModelField field = new ModelField(); - String tempStr; - - field.name = UtilXml.checkEmpty(fieldElement.getAttribute("name")); - - tempStr = UtilXml.checkEmpty(fieldElement.getAttribute("position")); - if (UtilValidate.isNotEmpty(tempStr)) { - field.position = Integer.parseInt(tempStr); - } - tempStr = UtilXml.checkEmpty(fieldElement.getAttribute("length")); - if (UtilValidate.isNotEmpty(tempStr)) { - field.length = Integer.parseInt(tempStr); - } - - field.type = UtilXml.checkEmpty(fieldElement.getAttribute("type")); - field.format = UtilXml.checkEmpty(fieldElement.getAttribute("format")); - field.validExp = UtilXml.checkEmpty(fieldElement.getAttribute("valid-exp")); - field.description = UtilXml.checkEmpty(fieldElement.getAttribute("description")); - field.defaultValue = UtilXml.checkEmpty(fieldElement.getAttribute("default-value")); - field.refField = UtilXml.checkEmpty(fieldElement.getAttribute("ref-field")); - - tempStr = UtilXml.checkEmpty(fieldElement.getAttribute("prim-key")); - if (UtilValidate.isNotEmpty(tempStr)) { - field.isPk = Boolean.parseBoolean(tempStr); - } - - tempStr = UtilXml.checkEmpty(fieldElement.getAttribute("ignored")); - if (UtilValidate.isNotEmpty(tempStr)) { - field.ignored = Boolean.parseBoolean(tempStr); - } - - tempStr = UtilXml.checkEmpty(fieldElement.getAttribute("expression")); - if (UtilValidate.isNotEmpty(tempStr)) { - field.expression = Boolean.parseBoolean(tempStr); - } - - return field; + /** + * Creates a Collection with the dataFileName of each DataFile defined in the + * specified XML DataFile Descriptor file. + * + * @return A Collection of dataFileName Strings + */ + public Collection<String> getDataFileNames() { + return this.modelDataFiles.keySet(); } - protected Document getDocument(URL url) { - if (url == null) - return null; - Document document = null; - - try { - document = UtilXml.readXmlDocument(url); - } catch (SAXException sxe) { - // Error generated during parsing) - Exception x = sxe; + /** + * Creates a Iterator with the dataFileName of each DataFile defined in the specified + * XML DataFile Descriptor file. + * + * @return A Iterator of dataFileName Strings + */ + public Iterator<String> getDataFileNamesIterator() { + return this.modelDataFiles.keySet().iterator(); + } - if (sxe.getException() != null) { - x = sxe.getException(); - } - x.printStackTrace(); - } catch (ParserConfigurationException pce) { - // Parser with specified options can't be built - pce.printStackTrace(); - } catch (IOException ioe) { - ioe.printStackTrace(); - } + /** + * Gets an DataFile object based on a definition from the specified XML DataFile + * descriptor file. + * + * @param dataFileName + * The dataFileName of the DataFile definition to use. + * @return An DataFile object describing the specified dataFile of the specified + * descriptor file. + */ + public ModelDataFile getModelDataFile(String dataFileName) { + return this.modelDataFiles.get(dataFileName); + } - return document; + public Map<String, ModelDataFile> getModelDataFiles() { + return this.modelDataFiles; } } - Modified: ofbiz/branches/20111205EmailHandling/framework/documents/DataFiles.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/documents/DataFiles.xml?rev=1305581&r1=1305580&r2=1305581&view=diff ============================================================================== --- ofbiz/branches/20111205EmailHandling/framework/documents/DataFiles.xml (original) +++ ofbiz/branches/20111205EmailHandling/framework/documents/DataFiles.xml Mon Mar 26 20:56:02 2012 @@ -46,9 +46,9 @@ <title>How to use the "Work With Data Files" screen in the Webtools application</title>_Prerequisites_: a definition file (containing the fields' definition of the data file) and a data file (containing the data you want to parse/import) should be available in the OFBiz server.Steps: - <step performance="required"> + <step performance="required"> <para> - connect to the Webtools application + connect to the Webtools application </para> </step> <step performance="required"> @@ -98,9 +98,9 @@ enter a path for it in the "Save to enti </section> <section>The field.name attribute must contain the name of the entity field in which the records will be imported - (for example<programlisting><![CDATA[:<field name="productId" type="String"> - </field> - ]]></programlisting> + (for example<programlisting><![CDATA[:<field name="productId" type="String"> + </field> + ]]></programlisting> </section> <section> <title>Examples</title> @@ -136,52 +136,52 @@ enter a path for it in the "Save to enti </record> </data-file> </data-files> - ]]></programlisting> + ]]></programlisting> </example> - The types listed in this sample are simple String's but the usual types are available such as Date, Long etc + The types listed in this sample are simple String's but the usual types are available such as Date, Long etc </section> <section> <example> <title>Another example reading fixed record little endian binary files</title> <programlisting><![CDATA[ - <data-files xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/datafiles.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <data-file name="stockdata" separator-style="fixed-record" type-code="text" record-length="768"> - <record name="stockdataitem" limit="many"> - <field name="barcode" type="NullTerminatedString" length="12" position="0"> - </field> - <field name="prodCode" type="NullTerminatedString" length="12" position="68"> - </field> - <field name="price" type="LEInteger" length="4" position="80"> - </field> - <field name="name" type="NullTerminatedString" length="30" position="16"> - </field> - </record> - </data-file> - </data-files> - ]]></programlisting> + <data-files xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/datafiles.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <data-file name="stockdata" separator-style="fixed-record" type-code="text" record-length="768"> + <record name="stockdataitem" limit="many"> + <field name="barcode" type="NullTerminatedString" length="12" position="0"> + </field> + <field name="prodCode" type="NullTerminatedString" length="12" position="68"> + </field> + <field name="price" type="LEInteger" length="4" position="80"> + </field> + <field name="name" type="NullTerminatedString" length="30" position="16"> + </field> + </record> + </data-file> + </data-files> + ]]></programlisting> </example> <procedure> <title>In the interface enter something like:</title> - <step performance="required"> + <step performance="required"> <para> - Definition Filename or URL: posschema.xml + Definition Filename or URL: posschema.xml </para> </step> <step performance="required"> <para> - Data File Definition Name: posreport + Data File Definition Name: posreport </para> </step> <step performance="required"> <para> - Data Filename or URL: posreport.csv + Data Filename or URL: posreport.csv </para> </step> - + </procedure> </section> </section> @@ -190,51 +190,50 @@ enter a path for it in the "Save to enti <title>Sample xml definition file for importing select columns posschema.xml:</title> <programlisting><![CDATA[ - <data-files xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/datafiles.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <data-file name="posreport" separator-style="fixed-length" type-code="text"> - <record name="tillentry" limit="many"> - <field name="tillCode" type="String" length="16" position="0"> - </field> - <field name="name" type="String" length="32" position="17"> - </field> - <field name="prodCode" type="String" length="12" position="63"> - </field> - <field name="quantity" type="String" length="8" position="76"> - </field> - <field name="totalPrice" type="String" length="8" position="85"> - </field> - </record> - </data-file> - </data-files> - ]]></programlisting> + <data-files xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/datafiles.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <data-file name="posreport" separator-style="fixed-length" type-code="text"> + <record name="tillentry" limit="many"> + <field name="tillCode" type="String" length="16" position="0"> + </field> + <field name="name" type="String" length="32" position="17"> + </field> + <field name="prodCode" type="String" length="12" position="63"> + </field> + <field name="quantity" type="String" length="8" position="76"> + </field> + <field name="totalPrice" type="String" length="8" position="85"> + </field> + </record> + </data-file> + </data-files> + ]]></programlisting> </example> - - In the interface enter something like:* Definition Filename or URL: posschema.xml* Data File Definition Name: posreport* Data Filename or URL: posreport.csvThe types listed in this sample are simple String's but the usual types are available such as Date, Long etc. + + In the interface enter something like:* Definition Filename or URL: posschema.xml* Data File Definition Name: posreport* Data Filename or URL: posreport.csvThe types listed in this sample are simple String's but the usual types are available such as Date, Long etc. </section> <section> <example> <title> Another example reading fixed record little endian binary files</title> <programlisting><![CDATA[ - <data-files xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/datafiles.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <data-file name="stockdata" separator-style="fixed-record" type-code="text" record-length="768"> - <record name="stockdataitem" limit="many"> - <field name="barcode" type="NullTerminatedString" length="12" position="0"> - </field> - <field name="prodCode" type="NullTerminatedString" length="12" position="68"> - </field> - <field name="price" type="LEInteger" length="4" position="80"> - </field> - <field name="name" type="NullTerminatedString" length="30" position="16"> - </field> - </record> - </data-file> - </data-files> - ]]></programlisting> + <data-files xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/datafiles.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <data-file name="stockdata" separator-style="fixed-record" type-code="text" record-length="768"> + <record name="stockdataitem" limit="many"> + <field name="barcode" type="NullTerminatedString" length="12" position="0"> + </field> + <field name="prodCode" type="NullTerminatedString" length="12" position="68"> + </field> + <field name="price" type="LEInteger" length="4" position="80"> + </field> + <field name="name" type="NullTerminatedString" length="30" position="16"> + </field> + </record> + </data-file> + </data-files> + ]]></programlisting> </example> </section> </section> </chapter> - Modified: ofbiz/branches/20111205EmailHandling/framework/documents/UnitTest.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/documents/UnitTest.xml?rev=1305581&r1=1305580&r2=1305581&view=diff ============================================================================== --- ofbiz/branches/20111205EmailHandling/framework/documents/UnitTest.xml (original) +++ ofbiz/branches/20111205EmailHandling/framework/documents/UnitTest.xml Mon Mar 26 20:56:02 2012 @@ -233,38 +233,23 @@ <para> A Cobertura error message can show because of the test system requires a cobertura library that calculates the percentage of code accessed by tests like this: <programlisting> - [java] java.lang.ClassNotFoundException: org.ofbiz.base.config.CoberturaInstrumenter - [java] at java.net.URLClassLoader$1.run(URLClassLoader.java:200) - [java] at java.security.AccessController.doPrivileged(Native Method) - [java] at java.net.URLClassLoader.findClass(URLClassLoader.java:188) - [java] at java.lang.ClassLoader.loadClass(ClassLoader.java:307) - [java] at java.lang.ClassLoader.loadClass(ClassLoader.java:252) - [java] at org.ofbiz.base.start.InstrumenterWorker.instrument(InstrumenterWorker.java:39) - [java] at org.ofbiz.base.start.Classpath.instrument(Classpath.java:92) - [java] at org.ofbiz.base.start.Start.initClasspath(Start.java:228) - [java] at org.ofbiz.base.start.Start.init(Start.java:87) - [java] at org.ofbiz.base.start.Start.main(Start.java:410) + [java] InstrumenterWorker.instrument - Code instrumentation has been disabled, unable to find instrumenter class org.ofbiz.base.config.CoberturaInstrumenter </programlisting> If you want to use cobertura, you have to install it: <orderedlist> <listitem> <para> - download the library from <link xl:href="http://cobertura.sourceforge.net/">the Cobertura website</link>. + Execute the download-cobertura ant task </para> </listitem> <listitem> <para> - Put cobertura.jar in 'framework/base/lib' directory. - </para> - </listitem> - <listitem> - <para> - Comment cobertura excluding in 'framework/base/build.xml' file. + Re-compile source code. </para> </listitem> <listitem> <para> - Re-compile source code. + Execute the run-tests ant task </para> </listitem> </orderedlist> Modified: ofbiz/branches/20111205EmailHandling/framework/entity/config/entityengine.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/entity/config/entityengine.xml?rev=1305581&r1=1305580&r2=1305581&view=diff ============================================================================== --- ofbiz/branches/20111205EmailHandling/framework/entity/config/entityengine.xml (original) +++ ofbiz/branches/20111205EmailHandling/framework/entity/config/entityengine.xml Mon Mar 26 20:56:02 2012 @@ -49,6 +49,8 @@ access. For a detailed description see t <!-- the connection factory class to use, one is needed for obtaining connections/pools for defined resources --> <connection-factory class="org.ofbiz.entity.connection.DBCPConnectionFactory"/> + <debug-xa-resources value="false" /> <!-- see https://issues.apache.org/jira/browse/OFBIZ-4282 for more --> + <delegator name="default" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main" distributed-cache-clear-enabled="false"> <group-map group-name="org.ofbiz" datasource-name="localderby"/> <group-map group-name="org.ofbiz.olap" datasource-name="localderbyolap"/> @@ -84,7 +86,7 @@ access. For a detailed description see t <group-map group-name="org.ofbiz.olap" datasource-name="localpostolap"/> <group-map group-name="org.ofbiz.tenant" datasource-name="localposttenant"/> --> </delegator> - + <!-- need to at least define a name for each component to use --> <entity-model-reader name="main"/> @@ -125,7 +127,7 @@ access. For a detailed description see t <field-type name="firebird" loader="fieldfile" location="fieldtypefirebird.xml"/> <field-type name="mssql" loader="fieldfile" location="fieldtypemssql.xml"/> <field-type name="advantage" loader="fieldfile" location="fieldtypeadvantage.xml"/> - + <!-- For DAO/JDBC Helper: Tries: 1. JNDI Datasource IF jdbc.jndi.name, context.provider, etc are specified Modified: ofbiz/branches/20111205EmailHandling/framework/entity/dtd/entity-config.xsd URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/entity/dtd/entity-config.xsd?rev=1305581&r1=1305580&r2=1305581&view=diff ============================================================================== --- ofbiz/branches/20111205EmailHandling/framework/entity/dtd/entity-config.xsd (original) +++ ofbiz/branches/20111205EmailHandling/framework/entity/dtd/entity-config.xsd Mon Mar 26 20:56:02 2012 @@ -25,6 +25,7 @@ under the License. <xs:element maxOccurs="unbounded" ref="resource-loader"/> <xs:element ref="transaction-factory"/> <xs:element ref="connection-factory"/> + <xs:element ref="debug-xa-resources"/> <xs:element maxOccurs="unbounded" ref="delegator"/> <xs:element maxOccurs="unbounded" ref="entity-model-reader"/> <xs:element maxOccurs="unbounded" ref="entity-group-reader"/> @@ -84,6 +85,14 @@ under the License. <xs:attributeGroup name="attlist.connection-factory"> <xs:attribute type="xs:string" name="class" use="required"/> </xs:attributeGroup> + <xs:element name="debug-xa-resources"> + <xs:complexType> + <xs:attributeGroup ref="attlist.debug-xa-resources"/> + </xs:complexType> + </xs:element> + <xs:attributeGroup name="attlist.debug-xa-resources"> + <xs:attribute type="xs:string" name="value" use="required"/> + </xs:attributeGroup> <xs:element name="delegator"> <xs:complexType> <xs:sequence> Modified: ofbiz/branches/20111205EmailHandling/framework/entity/src/org/ofbiz/entity/GenericEntity.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/entity/src/org/ofbiz/entity/GenericEntity.java?rev=1305581&r1=1305580&r2=1305581&view=diff ============================================================================== --- ofbiz/branches/20111205EmailHandling/framework/entity/src/org/ofbiz/entity/GenericEntity.java (original) +++ ofbiz/branches/20111205EmailHandling/framework/entity/src/org/ofbiz/entity/GenericEntity.java Mon Mar 26 20:56:02 2012 @@ -461,7 +461,7 @@ public class GenericEntity extends Obser } boolean isNullString = false; - if ("null".equals(value)) { + if ("null".equals(value) || "[null-field]".equals(value)) { // count this as a null too, but only for numbers and stuff, not for Strings isNullString = true; } @@ -840,8 +840,10 @@ public class GenericEntity extends Obser } // read value with modelEntity name of pkNames for (String pkName : pkNamesToUse) { - keyBuffer.append('.'); - keyBuffer.append(this.get(pkName)); + if (this.containsKey(pkName)) { + keyBuffer.append('.'); + keyBuffer.append(this.get(pkName)); + } } } else { Iterator<ModelField> iter = modelEntity.getPksIterator(); @@ -1076,6 +1078,8 @@ public class GenericEntity extends Obser } else { element.setAttribute(name, value); } + } else { + element.setAttribute(name, GenericEntity.NULL_FIELD.toString()); } } Modified: ofbiz/branches/20111205EmailHandling/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java?rev=1305581&r1=1305580&r2=1305581&view=diff ============================================================================== --- ofbiz/branches/20111205EmailHandling/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java (original) +++ ofbiz/branches/20111205EmailHandling/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java Mon Mar 26 20:56:02 2012 @@ -48,6 +48,10 @@ public class EntityConfigUtil { private final String txFactoryTxMgrJndiName; private final String txFactoryTxMgrJndiServerName; private final String connFactoryClass; + /** + * Create Begin stacktrace when enlisting transactions + */ + private final Boolean debugXAResources; private final Map<String, ResourceLoaderInfo> resourceLoaderInfos = new HashMap<String, ResourceLoaderInfo>(); private final Map<String, DelegatorInfo> delegatorInfos = new HashMap<String, DelegatorInfo>(); @@ -122,6 +126,12 @@ public class EntityConfigUtil { connFactoryClass = connectionFactoryElement.getAttribute("class"); + Element debugXaResourcesElement = UtilXml.firstChildElement(rootElement, "debug-xa-resources"); + if (debugXaResourcesElement == null) { // This should not be since debug-xa-resources is required, but safer... + debugXAResources = false; + } else { + debugXAResources = "true".equals(debugXaResourcesElement.getAttribute("value")); + } // not load all of the maps... // resource-loader - resourceLoaderInfos @@ -188,6 +198,13 @@ public class EntityConfigUtil { public static String getTxFactoryTxMgrJndiName() { return configRef.get().txFactoryTxMgrJndiName; } + + /** + * @return true Create Begin stacktrace when enlisting transactions + */ + public static boolean isDebugXAResource() { + return configRef.get().debugXAResources; + } public static String getTxFactoryTxMgrJndiServerName() { return configRef.get().txFactoryTxMgrJndiServerName; |
| Free forum by Nabble | Edit this page |
