You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by de...@apache.org on 2017/12/13 09:21:34 UTC
svn commit: r1817989 [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...
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=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/SetLocaleFromBrowser.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/SetLocaleFromBrowser.groovy Wed Dec 13 09:21:33 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=1817989&r1=1817988&r2=1817989&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 09:21:33 2017
@@ -31,6 +31,7 @@ import org.apache.ofbiz.base.util.UtilVa
import org.apache.ofbiz.entity.GenericEntityException;
import org.apache.ofbiz.entity.GenericValue;
import org.apache.ofbiz.entity.util.EntityListIterator;
+import org.apache.ofbiz.entity.util.EntityQuery;
import org.apache.ofbiz.service.ServiceUtil;
import org.apache.ofbiz.service.testtools.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("UserLogin").where("userLoginId", "system").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=1817989&r1=1817988&r2=1817989&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 09:21:33 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=1817989&r1=1817988&r2=1817989&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 09:21:33 2017
@@ -32,6 +32,7 @@ import org.apache.ofbiz.entity.Delegator
import org.apache.ofbiz.entity.GenericEntity;
import org.apache.ofbiz.entity.GenericEntityException;
import org.apache.ofbiz.entity.GenericValue;
+import org.apache.ofbiz.entity.util.EntityQuery;
import org.apache.ofbiz.service.DispatchContext;
import org.w3c.dom.Element;
@@ -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=1817989&r1=1817988&r2=1817989&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 09:21:33 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=1817989&r1=1817988&r2=1817989&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 09:21:33 2017
@@ -38,6 +38,7 @@ import org.apache.ofbiz.entity.Delegator
import org.apache.ofbiz.entity.GenericEntityException;
import org.apache.ofbiz.entity.GenericValue;
import org.apache.ofbiz.entity.util.EntityUtilProperties;
+import org.apache.ofbiz.entity.util.EntityQuery;
import org.apache.ofbiz.service.LocalDispatcher;
import org.apache.ofbiz.webapp.WebAppUtil;
@@ -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=1817989&r1=1817988&r2=1817989&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 09:21:33 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=1817989&r1=1817988&r2=1817989&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 09:21:33 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=1817989&r1=1817988&r2=1817989&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 09:21:33 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=1817989&r1=1817988&r2=1817989&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 09:21:33 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>