svn commit: r1238993 - in /ofbiz/trunk/framework: common/entitydef/entitymodel.xml common/ofbiz-component.xml entity/testdef/entitytests.xml minilang/src/org/ofbiz/minilang/method/otherops/PropertyToField.java

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

svn commit: r1238993 - in /ofbiz/trunk/framework: common/entitydef/entitymodel.xml common/ofbiz-component.xml entity/testdef/entitytests.xml minilang/src/org/ofbiz/minilang/method/otherops/PropertyToField.java

hansbak-2
Author: hansbak
Date: Wed Feb  1 08:14:53 2012
New Revision: 1238993

URL: http://svn.apache.org/viewvc?rev=1238993&view=rev
Log:
make <property-to-field/> in minilanguage first look in the newly created SystemProperty entity to be able to override the system properties defined in the properties files

Modified:
    ofbiz/trunk/framework/common/entitydef/entitymodel.xml
    ofbiz/trunk/framework/common/ofbiz-component.xml
    ofbiz/trunk/framework/entity/testdef/entitytests.xml
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/PropertyToField.java

Modified: ofbiz/trunk/framework/common/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/entitydef/entitymodel.xml?rev=1238993&r1=1238992&r2=1238993&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/framework/common/entitydef/entitymodel.xml Wed Feb  1 08:14:53 2012
@@ -839,4 +839,15 @@ 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="systemPropertyId" type="id-long-ne"></field>
+        <field name="systemPropertyValue" type="value"></field>
+        <field name="description" type="description"></field>
+        <prim-key field="systemPropertyId"/>
+    </entity>
 </entitymodel>

Modified: ofbiz/trunk/framework/common/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/ofbiz-component.xml?rev=1238993&r1=1238992&r2=1238993&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/ofbiz-component.xml (original)
+++ ofbiz/trunk/framework/common/ofbiz-component.xml Wed Feb  1 08:14:53 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/trunk/framework/entity/testdef/entitytests.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/testdef/entitytests.xml?rev=1238993&r1=1238992&r2=1238993&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/testdef/entitytests.xml (original)
+++ ofbiz/trunk/framework/entity/testdef/entitytests.xml Wed Feb  1 08:14:53 2012
@@ -22,4 +22,7 @@ under the License.
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/test-suite.xsd">
     <test-case case-name="entity-tests"><junit-test-suite class-name="org.ofbiz.entity.test.EntityTestSuite"/></test-case>
+    <test-case case-name="entity-util-properties-tests">
+        <simple-method-test location="component://entity/script/org/ofbiz/entity/test/EntityUtilPropertiesTests.xml"/>
+    </test-case>
 </test-suite>

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/PropertyToField.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/PropertyToField.java?rev=1238993&r1=1238992&r2=1238993&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/PropertyToField.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/PropertyToField.java Wed Feb  1 08:14:53 2012
@@ -24,6 +24,7 @@ import java.util.*;
 import org.w3c.dom.*;
 import javolution.util.FastMap;
 import org.ofbiz.base.util.*;
+import org.ofbiz.entity.util.EntityUtilProperties;
 import org.ofbiz.minilang.*;
 import org.ofbiz.minilang.method.*;
 
@@ -71,9 +72,9 @@ public class PropertyToField extends Met
 
         String value = null;
         if (noLocale) {
-            value = UtilProperties.getPropertyValue(resource, property);
+            value = EntityUtilProperties.getPropertyValue(resource, property, methodContext.getDelegator());
         } else {
-            value = UtilProperties.getMessage(resource, property, methodContext.getLocale());
+            value = EntityUtilProperties.getMessage(resource, property, methodContext.getLocale(), methodContext.getDelegator());
         }
         if (UtilValidate.isEmpty(value)) {
             value = defaultVal;