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 10:42:33 UTC
svn commit: r1817998 [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=1817998&r1=1817997&r2=1817998&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/SetLocaleFromBrowser.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/SetLocaleFromBrowser.groovy Wed Dec 13 10:42:32 2017
@@ -17,11 +17,13 @@
* 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 = from("UserLogin").where("userLoginId", parameters.userLogin.userLoginId).queryFirst();
+ userLogin = EntityQuery.use(delegator).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=1817998&r1=1817997&r2=1817998&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 10:42:32 2017
@@ -31,7 +31,6 @@ 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;
@@ -55,7 +54,7 @@ public class PerformFindTests extends OF
}
private void prepareData() throws Exception {
- if (EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").cache().queryOne() == null) {
+ if (delegator.findOne("TestingType", false, "testingTypeId", "PERFOMFINDTEST") == 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");
@@ -112,7 +111,7 @@ public class PerformFindTests extends OF
}
private void performFindConditionFieldEquals() throws Exception {
- GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").cache().queryOne();
+ GenericValue userLogin = delegator.findOne("UserLogin", true, "userLoginId", "system");
prepareData();
Map<String, Object> inputFields = new HashMap<String, Object>();
@@ -149,7 +148,7 @@ public class PerformFindTests extends OF
}
private void performFindConditionFieldLike() throws Exception {
- GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").cache().queryOne();
+ GenericValue userLogin = delegator.findOne("UserLogin", true, "userLoginId", "system");
prepareData();
//first test like condition
@@ -186,7 +185,7 @@ public class PerformFindTests extends OF
}
private void performFindConditionDistinct() throws Exception {
- GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").cache().queryOne();
+ GenericValue userLogin = delegator.findOne("UserLogin", true, "userLoginId", "system");
prepareData();
//first test without distinct condition
@@ -207,7 +206,7 @@ public class PerformFindTests extends OF
}
private void performFindFilterByDate() throws Exception {
- GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").cache().queryOne();
+ GenericValue userLogin = delegator.findOne("UserLogin", true, "userLoginId", "system");
prepareData();
//first test without filterDate condition
@@ -227,7 +226,7 @@ public class PerformFindTests extends OF
}
private void performFindFilterByDateWithDedicateDateField() throws Exception {
- GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").cache().queryOne();
+ GenericValue userLogin = delegator.findOne("UserLogin", true, "userLoginId", "system");
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=1817998&r1=1817997&r2=1817998&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 10:42:32 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 = EntityQuery.use(delegator).from("TestingType").where("testingTypeId", "queryOne-2").queryOne();
+ GenericValue findOneByEntityEngine = delegator.findOne("TestingType", false, UtilMisc.toMap("testingTypeId", "queryOne-2"));
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=1817998&r1=1817997&r2=1817998&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 10:42:32 2017
@@ -32,7 +32,6 @@ 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;
@@ -136,7 +135,7 @@ public final class EntityEcaRule impleme
if(!fieldsToLoad.isEmpty()) {
Delegator delegator = dctx.getDelegator();
- GenericValue oldValue = EntityQuery.use(delegator).from(entityName).where(value.getPrimaryKey()).queryOne();
+ GenericValue oldValue = delegator.findOne(entityName, value.getPrimaryKey(), false);
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=1817998&r1=1817997&r2=1817998&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 10:42:32 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 = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").cache().queryOne();
+ GenericValue userLogin = delegator.findOne("UserLogin", true, "userLoginId", "system");
//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=1817998&r1=1817997&r2=1817998&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 10:42:32 2017
@@ -38,7 +38,6 @@ 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;
@@ -185,7 +184,7 @@ public class ExternalLoginKeysManager {
GenericValue currentUserLogin = (GenericValue) session.getAttribute("userLogin");
try {
- GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", externalServerUserLoginId).queryOne();
+ GenericValue userLogin = delegator.findOne("UserLogin", false, "userLoginId", externalServerUserLoginId);
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=1817998&r1=1817997&r2=1817998&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 10:42:32 2017
@@ -33,7 +33,7 @@ if (security.hasPermission("ENTITY_MAINT
calls = 1000
startTime = System.currentTimeMillis()
for (int i = 0; i < calls; i++) {
- dummy = from("JobSandbox").where("jobId", "PURGE_OLD_JOBS").queryOne();
+ dummy = delegator.findOne("JobSandbox", [jobId : "PURGE_OLD_JOBS"], false)
}
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 = from("JobSandbox").where("jobId", "PURGE_OLD_JOBS").cache().queryOne();
+ dummy = delegator.findOne("JobSandbox", [jobId : "PURGE_OLD_JOBS"], true)
}
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 = from("DataSourceType").where("dataSourceTypeId", "ADMIN_ENTRY").queryOne();
+ dummy = delegator.findOne("DataSourceType", [dataSourceTypeId : "ADMIN_ENTRY"], false)
}
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 = from("DataSourceType").where("dataSourceTypeId", "ADMIN_ENTRY").cache().queryOne()
+ dummy = delegator.findOne("DataSourceType", [dataSourceTypeId : "ADMIN_ENTRY"], true)
}
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=1817998&r1=1817997&r2=1817998&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 10:42:32 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 = from("findByPK.getEntityName()").where(findByPK).queryOne();
+ value = delegator.findOne(findByPK.getEntityName(), findByPK, false)
}
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=1817998&r1=1817997&r2=1817998&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 10:42:32 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 = EntityQuery.use(delegator).from("PartyContent").where("partyId", person.partyId!, "partyContentTypeId", "LGOIMGURL").queryList()!>
+<#assign avatarList = delegator.findByAnd("PartyContent", {"partyId" : person.partyId, "partyContentTypeId" : "LGOIMGURL"}, null, false)>
<#if avatarList?has_content>
<#assign avatar = Static["org.apache.ofbiz.entity.util.EntityUtil"].getFirst(avatarList)>
- <#assign avatarDetail = EntityQuery.use(delegator).from("PartyContentDetail").where("partyId", person.partyId!, "contentId", avatar.contentId!).queryFirst()!>
+ <#assign avatarDetail = Static["org.apache.ofbiz.entity.util.EntityUtil"].getFirst(delegator.findByAnd("PartyContentDetail", {"partyId" : person.partyId, "contentId" : avatar.contentId}, null, false))>
</#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=1817998&r1=1817997&r2=1817998&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 10:42:32 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 = EntityQuery.use(delegator).from("PartyContent").where("partyId", person.partyId!, "partyContentTypeId", "LGOIMGURL").queryList()!>
+ <#assign avatarList = delegator.findByAnd("PartyContent", {"partyId" : person.partyId, "partyContentTypeId" : "LGOIMGURL"}, null, false)>
<#if avatarList?has_content>
<#assign avatar = Static["org.apache.ofbiz.entity.util.EntityUtil"].getFirst(avatarList)>
- <#assign avatarDetail = EntityQuery.use(delegator).from("PartyContentDetail").where("partyId", person.partyId!, "contentId", avatar.contentId!).queryFirst()!>
+ <#assign avatarDetail = Static["org.apache.ofbiz.entity.util.EntityUtil"].getFirst(delegator.findByAnd("PartyContentDetail", {"partyId" : person.partyId, "contentId" : avatar.contentId}, null, false))>
</#if>
</#if>
<body>