svn commit: r1818003 [2/2] - in /ofbiz/ofbiz-framework/trunk: applications/accounting/groovyScripts/reports/ applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/ applications/accounting/template/finaccounttrans/ applications/commo...

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

svn commit: r1818003 [2/2] - in /ofbiz/ofbiz-framework/trunk: applications/accounting/groovyScripts/reports/ applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/ applications/accounting/template/finaccounttrans/ applications/commo...

Deepak Dixit-5
Modified: ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/SetLocaleFromBrowser.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/SetLocaleFromBrowser.groovy?rev=1818003&r1=1818002&r2=1818003&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/SetLocaleFromBrowser.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/SetLocaleFromBrowser.groovy Wed Dec 13 12:03:17 2017
@@ -17,13 +17,11 @@
  * under the License.
  *******************************************************************************/
 
-import org.apache.ofbiz.entity.util.EntityQuery
-import org.apache.ofbiz.service.GenericServiceException
 import org.apache.ofbiz.service.ServiceUtil
 
 public Map setLocaleFromBrowser() {
     Map results = ServiceUtil.returnSuccess()
-    userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", parameters.userLogin.userLoginId).queryFirst();
+    userLogin = from("UserLogin").where("userLoginId", parameters.userLogin.userLoginId).queryFirst();
     if (userLogin) {
         if (!userLogin.lastTimeZone || "null".equals(userLogin.lastTimeZone)) {
             userLogin.lastTimeZone = parameters.localeName

Modified: ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/test/PerformFindTests.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/test/PerformFindTests.java?rev=1818003&r1=1818002&r2=1818003&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/test/PerformFindTests.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/test/PerformFindTests.java Wed Dec 13 12:03:17 2017
@@ -33,6 +33,7 @@ import org.apache.ofbiz.entity.GenericVa
 import org.apache.ofbiz.entity.util.EntityListIterator;
 import org.apache.ofbiz.service.ServiceUtil;
 import org.apache.ofbiz.service.testtools.OFBizTestCase;
+import org.apache.ofbiz.entity.util.EntityQuery;
 
 public class PerformFindTests extends OFBizTestCase {
 
@@ -54,7 +55,7 @@ public class PerformFindTests extends OF
     }
 
     private void prepareData() throws Exception {
-        if (delegator.findOne("TestingType", false, "testingTypeId", "PERFOMFINDTEST") == null) {
+        if (EntityQuery.use(delegator).from("TestingType").where("testingTypeId", "PERFOMFINDTEST").cache().queryOne() == null) {
             delegator.create("TestingType", "testingTypeId", "PERFOMFINDTEST");
             delegator.create("Testing", "testingId", "PERF_TEST_1", "testingTypeId", "PERFOMFINDTEST", "testingName", "nice name one");
             delegator.create("Testing", "testingId", "PERF_TEST_2", "testingTypeId", "PERFOMFINDTEST", "testingName", "nice other name two");
@@ -111,7 +112,7 @@ public class PerformFindTests extends OF
     }
 
     private void performFindConditionFieldEquals() throws Exception {
-        GenericValue userLogin = delegator.findOne("UserLogin", true, "userLoginId", "system");
+        GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").cache().queryOne();
         prepareData();
 
         Map<String, Object> inputFields = new HashMap<String, Object>();
@@ -148,7 +149,7 @@ public class PerformFindTests extends OF
     }
 
     private void performFindConditionFieldLike() throws Exception {
-        GenericValue userLogin = delegator.findOne("UserLogin", true, "userLoginId", "system");
+        GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").cache().queryOne();
         prepareData();
 
         //first test like condition
@@ -185,7 +186,7 @@ public class PerformFindTests extends OF
     }
 
     private void performFindConditionDistinct() throws Exception {
-        GenericValue userLogin = delegator.findOne("UserLogin", true, "userLoginId", "system");
+        GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").cache().queryOne();
         prepareData();
 
         //first test without distinct condition
@@ -206,7 +207,7 @@ public class PerformFindTests extends OF
     }
 
     private void performFindFilterByDate() throws Exception {
-        GenericValue userLogin = delegator.findOne("UserLogin", true, "userLoginId", "system");
+        GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").cache().queryOne();
         prepareData();
 
         //first test without filterDate condition
@@ -226,7 +227,7 @@ public class PerformFindTests extends OF
     }
 
     private void performFindFilterByDateWithDedicateDateField() throws Exception {
-        GenericValue userLogin = delegator.findOne("UserLogin", true, "userLoginId", "system");
+        GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").cache().queryOne();
         prepareData();
 
         //first test without filterDate condition

Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/test/EntityQueryTestSuite.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/test/EntityQueryTestSuite.java?rev=1818003&r1=1818002&r2=1818003&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/test/EntityQueryTestSuite.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/test/EntityQueryTestSuite.java Wed Dec 13 12:03:17 2017
@@ -131,7 +131,7 @@ public class EntityQueryTestSuite extend
         testingTypes.add(delegator.makeValue("TestingType", "testingTypeId", "queryOne-3", "description", "query three"));
         delegator.storeAll(testingTypes);
 
-        GenericValue findOneByEntityEngine = delegator.findOne("TestingType", false, UtilMisc.toMap("testingTypeId", "queryOne-2"));
+        GenericValue findOneByEntityEngine = EntityQuery.use(delegator).from("TestingType").where("testingTypeId", "queryOne-2").queryOne();
         GenericValue queryOneByEntityQuery = EntityQuery.use(delegator).from("TestingType").where("testingTypeId", "queryOne-2").queryOne();
 
         assertEquals("queryOne(): Record matched = testingTypeId", findOneByEntityEngine.getString("testingTypeId"), queryOneByEntityQuery.getString("testingTypeId"));

Modified: ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/EntityEcaRule.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/EntityEcaRule.java?rev=1818003&r1=1818002&r2=1818003&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/EntityEcaRule.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/EntityEcaRule.java Wed Dec 13 12:03:17 2017
@@ -34,6 +34,7 @@ import org.apache.ofbiz.entity.GenericEn
 import org.apache.ofbiz.entity.GenericValue;
 import org.apache.ofbiz.service.DispatchContext;
 import org.w3c.dom.Element;
+import org.apache.ofbiz.entity.util.EntityQuery;
 
 /**
  * Entity event-condition-action rule.
@@ -135,7 +136,7 @@ public final class EntityEcaRule impleme
 
         if(!fieldsToLoad.isEmpty()) {
             Delegator delegator = dctx.getDelegator();
-            GenericValue oldValue =  delegator.findOne(entityName, value.getPrimaryKey(), false);
+            GenericValue oldValue =  EntityQuery.use(delegator).from(entityName).where(value.getPrimaryKey()).queryOne();
             if(UtilValidate.isNotEmpty(oldValue)) {
                 for (String fieldName : fieldsToLoad) {
                     value.put(fieldName, oldValue.get(fieldName));

Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/test/ServiceEntityAutoTests.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/test/ServiceEntityAutoTests.java?rev=1818003&r1=1818002&r2=1818003&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/test/ServiceEntityAutoTests.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/test/ServiceEntityAutoTests.java Wed Dec 13 12:03:17 2017
@@ -200,7 +200,7 @@ public class ServiceEntityAutoTests exte
         delegator.create("StatusType", "statusTypeId", "TESTINGSTATUS");
         delegator.create("StatusItem", "statusId", "TESTING_CREATE", "statusTypeId", "TESTINGSTATUS");
         delegator.create("StatusItem", "statusId", "TESTING_UPDATE", "statusTypeId", "TESTINGSTATUS");
-        GenericValue userLogin = delegator.findOne("UserLogin", true, "userLoginId", "system");
+        GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").cache().queryOne();
 
         //test create testingStatus with userlogin
         Map<String, Object> testingStatusCreateMap = UtilMisc.toMap("testingId", "TESTING_7", "statusId", "TESTING_CREATE", "userLogin", userLogin);

Modified: ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ExternalLoginKeysManager.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ExternalLoginKeysManager.java?rev=1818003&r1=1818002&r2=1818003&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ExternalLoginKeysManager.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ExternalLoginKeysManager.java Wed Dec 13 12:03:17 2017
@@ -45,6 +45,7 @@ import io.jsonwebtoken.Claims;
 import io.jsonwebtoken.JwtBuilder;
 import io.jsonwebtoken.Jwts;
 import io.jsonwebtoken.SignatureAlgorithm;
+import org.apache.ofbiz.entity.util.EntityQuery;
 
 /**
  * This class manages the authentication tokens that provide single sign-on authentication to the OFBiz applications.
@@ -184,7 +185,7 @@ public class ExternalLoginKeysManager {
         GenericValue currentUserLogin = (GenericValue) session.getAttribute("userLogin");
 
         try {
-            GenericValue userLogin = delegator.findOne("UserLogin", false, "userLoginId", externalServerUserLoginId);
+            GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", externalServerUserLoginId).queryOne();
             if (userLogin != null) {
                 //to check it's the right tenant
                 //in case username and password are the same in different tenants

Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/groovyScripts/entity/EntityPerformanceTest.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/groovyScripts/entity/EntityPerformanceTest.groovy?rev=1818003&r1=1818002&r2=1818003&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/webtools/groovyScripts/entity/EntityPerformanceTest.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/framework/webtools/groovyScripts/entity/EntityPerformanceTest.groovy Wed Dec 13 12:03:17 2017
@@ -33,7 +33,7 @@ if (security.hasPermission("ENTITY_MAINT
     calls = 1000
     startTime = System.currentTimeMillis()
     for (int i = 0; i < calls; i++) {
-        dummy = delegator.findOne("JobSandbox", [jobId : "PURGE_OLD_JOBS"], false)
+        dummy = from("JobSandbox").where("jobId", "PURGE_OLD_JOBS").queryOne();
     }
     totalTime = System.currentTimeMillis() - startTime
     callsPerSecond = calls / (totalTime/1000)
@@ -50,7 +50,7 @@ if (security.hasPermission("ENTITY_MAINT
     calls = 10000
     startTime = System.currentTimeMillis()
     for (int i = 0; i < calls; i++) {
-        dummy = delegator.findOne("JobSandbox", [jobId : "PURGE_OLD_JOBS"], true)
+        dummy = from("JobSandbox").where("jobId", "PURGE_OLD_JOBS").cache().queryOne();
     }
     totalTime = System.currentTimeMillis() - startTime
     callsPerSecond = calls / (totalTime / 1000)
@@ -67,7 +67,7 @@ if (security.hasPermission("ENTITY_MAINT
     calls = 1000
     startTime = System.currentTimeMillis()
     for (int i = 0; i < calls; i++) {
-        dummy = delegator.findOne("DataSourceType", [dataSourceTypeId : "ADMIN_ENTRY"], false)
+        dummy = from("DataSourceType").where("dataSourceTypeId", "ADMIN_ENTRY").queryOne();
     }
     totalTime = System.currentTimeMillis() - startTime
     callsPerSecond = calls / (totalTime / 1000)
@@ -84,7 +84,7 @@ if (security.hasPermission("ENTITY_MAINT
     calls = 10000
     startTime = System.currentTimeMillis()
     for (int i=0; i < calls; i++) {
-        dummy = delegator.findOne("DataSourceType", [dataSourceTypeId : "ADMIN_ENTRY"], true)
+        dummy = from("DataSourceType").where("dataSourceTypeId", "ADMIN_ENTRY").cache().queryOne()
     }
     totalTime = System.currentTimeMillis() - startTime
     callsPerSecond = calls / (totalTime / 1000)

Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/groovyScripts/entity/ViewGeneric.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/groovyScripts/entity/ViewGeneric.groovy?rev=1818003&r1=1818002&r2=1818003&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/webtools/groovyScripts/entity/ViewGeneric.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/framework/webtools/groovyScripts/entity/ViewGeneric.groovy Wed Dec 13 12:03:17 2017
@@ -81,7 +81,7 @@ context.put("curFindString", curFindStri
 GenericValue value = null
 //only try to find it if this is a valid primary key...
 if (findByPK.isPrimaryKey()) {
-    value = delegator.findOne(findByPK.getEntityName(), findByPK, false)
+    value = from("findByPK.getEntityName()").where(findByPK).queryOne();
 }
 context.put("value", value)
 

Modified: ofbiz/ofbiz-framework/trunk/themes/rainbowstone/template/includes/HomeMenu.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/themes/rainbowstone/template/includes/HomeMenu.ftl?rev=1818003&r1=1818002&r2=1818003&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/themes/rainbowstone/template/includes/HomeMenu.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/themes/rainbowstone/template/includes/HomeMenu.ftl Wed Dec 13 12:03:17 2017
@@ -23,10 +23,10 @@ under the License.
 <#assign contextPath = request.getContextPath()>
 <#assign displayApps = Static["org.apache.ofbiz.base.component.ComponentConfig"].getAppBarWebInfos(ofbizServerName, "main")>
 <#assign displaySecondaryApps = Static["org.apache.ofbiz.base.component.ComponentConfig"].getAppBarWebInfos(ofbizServerName, "secondary")>
-<#assign avatarList = delegator.findByAnd("PartyContent", {"partyId" : person.partyId, "partyContentTypeId" : "LGOIMGURL"}, null, false)>
+<#assign avatarList = EntityQuery.use(delegator).from("PartyContent").where("partyId", person.partyId!, "partyContentTypeId", "LGOIMGURL").queryList()!>
 <#if avatarList?has_content>
     <#assign avatar = Static["org.apache.ofbiz.entity.util.EntityUtil"].getFirst(avatarList)>
-    <#assign avatarDetail = Static["org.apache.ofbiz.entity.util.EntityUtil"].getFirst(delegator.findByAnd("PartyContentDetail", {"partyId" : person.partyId, "contentId" : avatar.contentId}, null, false))>
+    <#assign avatarDetail = EntityQuery.use(delegator).from("PartyContentDetail").where("partyId", person.partyId!, "contentId", avatar.contentId!).queryFirst()!>
 </#if>
 <body onpageshow="showHideFavorites()">
 <script type="text/javascript">

Modified: ofbiz/ofbiz-framework/trunk/themes/rainbowstone/template/includes/TopAppBar.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/themes/rainbowstone/template/includes/TopAppBar.ftl?rev=1818003&r1=1818002&r2=1818003&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/themes/rainbowstone/template/includes/TopAppBar.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/themes/rainbowstone/template/includes/TopAppBar.ftl Wed Dec 13 12:03:17 2017
@@ -23,10 +23,10 @@ under the License.
 <#assign displayApps = Static["org.apache.ofbiz.base.component.ComponentConfig"].getAppBarWebInfos(ofbizServerName, "main")>
 <#assign displaySecondaryApps = Static["org.apache.ofbiz.base.component.ComponentConfig"].getAppBarWebInfos(ofbizServerName, "secondary")>
 <#if person?has_content>
-    <#assign avatarList = delegator.findByAnd("PartyContent", {"partyId" : person.partyId, "partyContentTypeId" : "LGOIMGURL"}, null, false)>
+    <#assign avatarList = EntityQuery.use(delegator).from("PartyContent").where("partyId",  person.partyId!, "partyContentTypeId", "LGOIMGURL").queryList()!>
     <#if avatarList?has_content>
         <#assign avatar = Static["org.apache.ofbiz.entity.util.EntityUtil"].getFirst(avatarList)>
-        <#assign avatarDetail = Static["org.apache.ofbiz.entity.util.EntityUtil"].getFirst(delegator.findByAnd("PartyContentDetail", {"partyId" : person.partyId, "contentId" : avatar.contentId}, null, false))>
+        <#assign avatarDetail = EntityQuery.use(delegator).from("PartyContentDetail").where("partyId", person.partyId!, "contentId", avatar.contentId!).queryFirst()!>
     </#if>
 </#if>
 <body>