Author: ashish
Date: Mon Dec 22 13:20:03 2014 New Revision: 1647310 URL: http://svn.apache.org/r1647310 Log: Applied patch from jira issue - OFBIZ-5893 - Use EntityQuery Builder methods in goovy files by replacing Entity Engine methods. Thanks Arun for the contribution. Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/FindCommEventContactMechs.groovy ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/GetMyCommunicationEventRole.groovy ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/ListCommunications.groovy ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/getPartyEmailFromCommEventInfo.groovy ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/recentVisitor.groovy ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/EditContactMech.groovy ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/EditShoppingList.groovy ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/FindMatches.groovy ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GetCurrentCart.groovy ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GetLoyaltyPoints.groovy ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GetMyCompany.groovy ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GetPaymentMethods.groovy ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancialHistory.groovy ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyGeoLocation.groovy ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/SetRoleVars.groovy ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/UnAppliedInvoicesForParty.groovy ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/UnAppliedPaymentsForParty.groovy ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/ViewProfile.groovy ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/visit/ShowVisits.groovy ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/visit/VisitDetails.groovy ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/content/WorkEffortContentWrapper.groovy ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/find/WorkEffortSearchOptions.groovy Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/FindCommEventContactMechs.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/FindCommEventContactMechs.groovy?rev=1647310&r1=1647309&r2=1647310&view=diff ============================================================================== --- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/FindCommEventContactMechs.groovy (original) +++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/FindCommEventContactMechs.groovy Mon Dec 22 13:20:03 2014 @@ -32,12 +32,10 @@ partyIdTo = context.partyIdTo; if (parameters.communicationEventTypeId) { if ("EMAIL_COMMUNICATION".equals(parameters.communicationEventTypeId)) { - userEmailAddresses = delegator.findByAnd("PartyContactWithPurpose", [contactMechTypeId : "EMAIL_ADDRESS" , partyId : partyIdFrom], null, false); - userEmailAddresses = EntityUtil.filterByDate(userEmailAddresses, UtilDateTime.nowTimestamp(), "contactFromDate", "contactThruDate", true); + userEmailAddresses = from("PartyContactWithPurpose").where("contactMechTypeId", "EMAIL_ADDRESS" , "partyId", partyIdFrom).filterByDate(UtilDateTime.nowTimestamp(), "contactFromDate", "contactThruDate").queryList(); context.userEmailAddresses = userEmailAddresses; - targetEmailAddresses = delegator.findByAnd("PartyContactWithPurpose", [contactMechTypeId : "EMAIL_ADDRESS", partyId : partyIdTo], null, false); - targetEmailAddresses = EntityUtil.filterByDate(targetEmailAddresses, UtilDateTime.nowTimestamp(), "contactFromDate", "contactThruDate", true); + targetEmailAddresses = from("PartyContactWithPurpose").where("contactMechTypeId", "EMAIL_ADDRESS", "partyId", partyIdTo).filterByDate(UtilDateTime.nowTimestamp(), "contactFromDate", "contactThruDate").queryList(); context.targetEmailAddresses = targetEmailAddresses; } } Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/GetMyCommunicationEventRole.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/GetMyCommunicationEventRole.groovy?rev=1647310&r1=1647309&r2=1647310&view=diff ============================================================================== --- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/GetMyCommunicationEventRole.groovy (original) +++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/GetMyCommunicationEventRole.groovy Mon Dec 22 13:20:03 2014 @@ -22,11 +22,9 @@ import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.base.component.ComponentConfig; if (parameters.communicationEventId) { - context.communicationEventRole = delegator.findOne("CommunicationEventRole", - ["communicationEventId" : parameters.communicationEventId, - "partyId" : parameters.partyId, - "roleTypeId" : parameters.roleTypeId - ], false); + context.communicationEventRole = from("CommunicationEventRole") + .where("communicationEventId", parameters.communicationEventId, "partyId", parameters.partyId, "roleTypeId", parameters.roleTypeId) + .queryOne(); context.projectMgrExists = ComponentConfig.componentExists("projectmgr"); } Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/ListCommunications.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/ListCommunications.groovy?rev=1647310&r1=1647309&r2=1647310&view=diff ============================================================================== --- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/ListCommunications.groovy (original) +++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/ListCommunications.groovy Mon Dec 22 13:20:03 2014 @@ -25,7 +25,7 @@ import javolution.util.FastList; partyId = parameters.partyId; context.partyId = partyId; -party = delegator.findOne("Party", [partyId : partyId], false); +party = from("Party").where("partyId", partyId).queryOne(); context.party = party; // get the sort field @@ -44,7 +44,7 @@ eventExprs.add(expr); expr = EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, "partyId"); eventExprs.add(expr); ecl = EntityCondition.makeCondition(eventExprs, EntityOperator.OR); -events = delegator.findList("CommunicationEvent", ecl, null, [sortField], null, false); +events = from("CommunicationEvent").where(ecl).orderBy(sortField).queryList(); context.eventList = events; context.eventListSize = events.size(); Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/getPartyEmailFromCommEventInfo.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/getPartyEmailFromCommEventInfo.groovy?rev=1647310&r1=1647309&r2=1647310&view=diff ============================================================================== --- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/getPartyEmailFromCommEventInfo.groovy (original) +++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/getPartyEmailFromCommEventInfo.groovy Mon Dec 22 13:20:03 2014 @@ -21,7 +21,7 @@ import org.ofbiz.base.util.*; import org.ofbiz.entity.util.EntityUtil; import javolution.util.FastList; -communicationEvent = delegator.findOne("CommunicationEvent", [communicationEventId : parameters.communicationEventId], true); +communicationEvent = from("CommunicationEvent").where("communicationEventId", parameters.communicationEventId).cache(true).queryOne(); if (!communicationEvent.note) return; nameString = "Sent from: "; Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/recentVisitor.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/recentVisitor.groovy?rev=1647310&r1=1647309&r2=1647310&view=diff ============================================================================== --- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/recentVisitor.groovy (original) +++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/recentVisitor.groovy Mon Dec 22 13:20:03 2014 @@ -22,8 +22,14 @@ import org.ofbiz.entity.util.* import org.ofbiz.base.util.*; lastDate = UtilDateTime.addDaysToTimestamp(UtilDateTime.nowTimestamp(), -21); // should be there the last 3 weeks. -searchCondition = EntityCondition.makeCondition("fromDate", EntityOperator.GREATER_THAN, lastDate); -partyIds = EntityUtil.getFieldListFromEntityList(select('partyId').distinct().from('Visit').where(searchCondition).queryList(), 'partyId', false) -searchCondition = EntityCondition.makeCondition('partyId', EntityOperator.IN, partyIds); -options = new EntityFindOptions(false, 0, 0, true); -context.recentParties = delegator.findList("PartyNameView", searchCondition, (Set)["partyId", "firstName", "middleName", "lastName", "groupName"], null, options, true); +visits = select('partyId') + .from('Visit') + .where(EntityCondition.makeCondition("fromDate", EntityOperator.GREATER_THAN, lastDate)) + .distinct() + .queryList() +partyIds = EntityUtil.getFieldListFromEntityList(visits, 'partyId', false) +context.recentParties = select("partyId", "firstName", "middleName", "lastName", "groupName") + .from("PartyNameView") + .where(EntityCondition.makeCondition('partyId', EntityOperator.IN, partyIds)) + .distinct() + .queryList(); Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/EditContactMech.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/EditContactMech.groovy?rev=1647310&r1=1647309&r2=1647310&view=diff ============================================================================== --- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/EditContactMech.groovy (original) +++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/EditContactMech.groovy Mon Dec 22 13:20:03 2014 @@ -32,7 +32,7 @@ context.paymentMethodId = parameters.pay cmNewPurposeTypeId = parameters.contactMechPurposeTypeId; if (cmNewPurposeTypeId) { - contactMechPurposeType = delegator.findOne("ContactMechPurposeType", [contactMechPurposeTypeId : cmNewPurposeTypeId], false); + contactMechPurposeType = from("ContactMechPurposeType").where("contactMechPurposeTypeId", cmNewPurposeTypeId).queryOne(); if (contactMechPurposeType) { context.contactMechPurposeType = contactMechPurposeType; } else { Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/EditShoppingList.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/EditShoppingList.groovy?rev=1647310&r1=1647309&r2=1647310&view=diff ============================================================================== --- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/EditShoppingList.groovy (original) +++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/EditShoppingList.groovy Mon Dec 22 13:20:03 2014 @@ -32,7 +32,7 @@ context.currencyUomId = currencyUomId; partyId = parameters.partyId ?:request.getAttribute("partyId"); -party = delegator.findOne("Party", [partyId : partyId], false); +party = from("Party").where("partyId", partyId).queryOne(); context.party = party; if (party) { context.lookupPerson = party.getRelatedOne("Person", false); @@ -43,18 +43,18 @@ shoppingListId = parameters.shoppingList //get the party for listid if it exists if (!partyId && shoppingListId) { - partyId = delegator.findOne("ShoppingList", [shoppingListId : shoppingListId], false).partyId; + partyId = from("ShoppingList").where("shoppingListId", shoppingListId).queryOne().partyId; } context.partyId = partyId; // get the top level shopping lists for the party -allShoppingLists = delegator.findByAnd("ShoppingList", [partyId : partyId], ["listName"], false); +allShoppingLists = from("ShoppingList").where("partyId", partyId).queryList(); shoppingLists = EntityUtil.filterByAnd(allShoppingLists, [parentShoppingListId : null]); context.allShoppingLists = allShoppingLists; context.shoppingLists = shoppingLists; // get all shoppingListTypes -shoppingListTypes = delegator.findList("ShoppingListType", null, null, ["description"], null, true); +shoppingListTypes = from("ShoppingListType").orderBy("description").cache(true).queryList(); context.shoppingListTypes = shoppingListTypes; // no passed shopping list id default to first list @@ -67,7 +67,7 @@ if (!shoppingListId) { // if we passed a shoppingListId get the shopping list info if (shoppingListId) { - shoppingList = delegator.findOne("ShoppingList", [shoppingListId : shoppingListId], false); + shoppingList = from("ShoppingList").where("shoppingListId", shoppingListId).queryOne(); context.shoppingList = shoppingList; context.shoppingListId = shoppingListId; @@ -123,7 +123,7 @@ if (shoppingListId) { context.shoppingListType = shoppingListType; // get the child shopping lists of the current list for the logged in user - childShoppingLists = delegator.findByAnd("ShoppingList", [partyId : partyId, parentShoppingListId : shoppingListId], ["listName"], true); + childShoppingLists = from("ShoppingList").where("partyId", partyId, "parentShoppingListId", shoppingListId).orderBy("listName").cache(true).queryList(); // now get prices for each child shopping list... if (childShoppingLists) { childShoppingListDatas = new ArrayList(childShoppingLists.size()); Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/FindMatches.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/FindMatches.groovy?rev=1647310&r1=1647309&r2=1647310&view=diff ============================================================================== --- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/FindMatches.groovy (original) +++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/FindMatches.groovy Mon Dec 22 13:20:03 2014 @@ -33,7 +33,7 @@ if (match) { postalCode = parameters.postalCode ?: null; if (state) { - context.currentStateGeo = delegator.findOne("Geo", [geoId : state], false); + context.currentStateGeo = from("Geo").where("geoId", state).queryOne(); } if (!firstName || !lastName || !address1 || !city || !postalCode) { Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GetCurrentCart.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GetCurrentCart.groovy?rev=1647310&r1=1647309&r2=1647310&view=diff ============================================================================== --- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GetCurrentCart.groovy (original) +++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GetCurrentCart.groovy Mon Dec 22 13:20:03 2014 @@ -21,8 +21,7 @@ import org.ofbiz.entity.util.EntityUtil; partyId = partyId ?: parameters.partyId; -savedCart = EntityUtil.getFirst(delegator.findByAnd("ShoppingList", [partyId : partyId, - shoppingListTypeId : "SLT_SPEC_PURP" , listName : "auto-save"], null, false)); +savedCart = from("ShoppingList").where("partyId", partyId, "shoppingListTypeId", "SLT_SPEC_PURP" , "listName", "auto-save").queryFirst(); if (savedCart) { context.savedCartListId = savedCart.shoppingListId; Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GetLoyaltyPoints.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GetLoyaltyPoints.groovy?rev=1647310&r1=1647309&r2=1647310&view=diff ============================================================================== --- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GetLoyaltyPoints.groovy (original) +++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GetLoyaltyPoints.groovy Mon Dec 22 13:20:03 2014 @@ -23,7 +23,7 @@ partyId = parameters.partyId ? parameter if (partyId) { // get the system user - system = delegator.findOne("UserLogin", [userLoginId : "system"], false); + system = from("UserLogin").where("userLoginId", "system").queryOne(); monthsToInclude = 12; Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GetMyCompany.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GetMyCompany.groovy?rev=1647310&r1=1647309&r2=1647310&view=diff ============================================================================== --- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GetMyCompany.groovy (original) +++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GetMyCompany.groovy Mon Dec 22 13:20:03 2014 @@ -18,10 +18,7 @@ */ if (userLogin) { - companies = delegator.findByAnd("PartyRelationship", - [partyIdTo: userLogin.partyId, - roleTypeIdTo: "CONTACT", - roleTypeIdFrom: "ACCOUNT"], null, false); + companies = from("PartyRelationship").where(partyIdTo: userLogin.partyId, roleTypeIdTo: "CONTACT", roleTypeIdFrom: "ACCOUNT").queryList(); if (companies) { company = companies[0]; context.myCompanyId = company.partyIdFrom; Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GetPaymentMethods.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GetPaymentMethods.groovy?rev=1647310&r1=1647309&r2=1647310&view=diff ============================================================================== --- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GetPaymentMethods.groovy (original) +++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GetPaymentMethods.groovy Mon Dec 22 13:20:03 2014 @@ -27,7 +27,7 @@ showOld = "true".equals(parameters.SHOW_ currencyUomId = null; billingAccounts = []; if (partyId) { - billingAccountAndRoles = delegator.findByAnd("BillingAccountAndRole", [partyId : partyId]); + billingAccountAndRoles = from("BillingAccountAndRole").where("partyId", partyId).queryList(); if (billingAccountAndRoles) currencyUomId = billingAccountAndRoles.first().accountCurrencyUomId; if (currencyUomId) billingAccounts = BillingAccountWorker.makePartyBillingAccountList(userLogin, currencyUomId, partyId, delegator, dispatcher); } Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancialHistory.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancialHistory.groovy?rev=1647310&r1=1647309&r2=1647310&view=diff ============================================================================== --- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancialHistory.groovy (original) +++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancialHistory.groovy Mon Dec 22 13:20:03 2014 @@ -35,7 +35,6 @@ actualCurrencyUomId = context.actualCurr if (!actualCurrencyUomId) { actualCurrencyUomId = context.defaultOrganizationPartyCurrencyUomId; } -findOpts = new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, true); //get total/unapplied/applied invoices separated by sales/purch amount: totalInvSaApplied = BigDecimal.ZERO; totalInvSaNotApplied = BigDecimal.ZERO; @@ -59,7 +58,7 @@ invExprs = ],EntityOperator.OR) ],EntityOperator.AND); -invIterator = delegator.find("InvoiceAndType", invExprs, null, null, null, findOpts); +invIterator = from("InvoiceAndType").where(invExprs).cursorScrollInsensitive().distinct().queryIterator(); while (invoice = invIterator.next()) { if ("PURCHASE_INVOICE".equals(invoice.parentTypeId)) { @@ -99,7 +98,7 @@ payExprs = ], EntityOperator.OR) ], EntityOperator.AND); -payIterator = delegator.find("PaymentAndType", payExprs, null, null, null, findOpts); +payIterator = from("PaymentAndType").where(payExprs).cursorScrollInsensitive().distinct().queryIterator(); while (payment = payIterator.next()) { if ("DISBURSEMENT".equals(payment.parentTypeId) || "TAX_PAYMENT".equals(payment.parentTypeId)) { Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyGeoLocation.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyGeoLocation.groovy?rev=1647310&r1=1647309&r2=1647310&view=diff ============================================================================== --- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyGeoLocation.groovy (original) +++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyGeoLocation.groovy Mon Dec 22 13:20:03 2014 @@ -27,7 +27,7 @@ partyId = parameters.partyId ?: paramete userLoginId = parameters.userlogin_id ?: parameters.userLoginId; if (!partyId && userLoginId) { - thisUserLogin = delegator.findOne("UserLogin", [userLoginId : userLoginId], false); + thisUserLogin = from("UserLogin").where("userLoginId", userLoginId).queryOne(); if (thisUserLogin) { partyId = thisUserLogin.partyId; } @@ -38,7 +38,7 @@ context.partyId = partyId; if (!geoPointId) { latestGeoPoint = GeoWorker.findLatestGeoPoint(delegator, "PartyAndGeoPoint", "partyId", partyId, null, null); } else { - latestGeoPoint = delegator.findOne("GeoPoint", [geoPointId : geoPointId], false); + latestGeoPoint = from("GeoPoint").where("geoPointId", geoPointId).queryOne(); } if (latestGeoPoint) { context.latestGeoPoint = latestGeoPoint; @@ -53,7 +53,7 @@ if (latestGeoPoint) { context.geoChart = geoChart; } if (latestGeoPoint && latestGeoPoint.elevationUomId) { - elevationUom = delegator.findOne("Uom", [uomId : latestGeoPoint.elevationUomId], false); + elevationUom = from("Uom").where("uomId", latestGeoPoint.elevationUomId).queryOne(); context.elevationUomAbbr = elevationUom.abbreviation; } } Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/SetRoleVars.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/SetRoleVars.groovy?rev=1647310&r1=1647309&r2=1647310&view=diff ============================================================================== --- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/SetRoleVars.groovy (original) +++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/SetRoleVars.groovy Mon Dec 22 13:20:03 2014 @@ -19,28 +19,28 @@ import org.ofbiz.entity.*; import org.ofbiz.entity.util.EntityUtil; - roleTypeAndParty = delegator.findByAnd("RoleTypeAndParty", ['partyId': parameters.partyId, 'roleTypeId': 'ACCOUNT'], null, false); + roleTypeAndParty = from("RoleTypeAndParty").where("partyId", parameters.partyId, "roleTypeId", "ACCOUNT").queryList(); if (roleTypeAndParty) { context.accountDescription = roleTypeAndParty[0].description; } - roleTypeAndParty = delegator.findByAnd("RoleTypeAndParty", ['partyId': parameters.partyId, 'roleTypeId': 'CONTACT'], null, false); + roleTypeAndParty = from("RoleTypeAndParty").where("partyId", parameters.partyId, "roleTypeId", "CONTACT").queryList(); if (roleTypeAndParty) { context.contactDescription = roleTypeAndParty.get(0).description; } - roleTypeAndParty = delegator.findByAnd("RoleTypeAndParty", ['partyId': parameters.partyId, 'roleTypeId': 'LEAD'], null, false); + roleTypeAndParty = from("RoleTypeAndParty").where("partyId", parameters.partyId, "roleTypeId", "LEAD").queryList(); if (roleTypeAndParty) { context.leadDescription = roleTypeAndParty.get(0).description; - partyRelationships = EntityUtil.filterByDate(delegator.findByAnd("PartyRelationship", ["partyIdTo": parameters.partyId, "roleTypeIdFrom": "ACCOUNT_LEAD", "roleTypeIdTo": "LEAD", "partyRelationshipTypeId": "EMPLOYMENT"], null, false)); + partyRelationships = from("PartyRelationship").where("partyIdTo", parameters.partyId, "roleTypeIdFrom", "ACCOUNT_LEAD", "roleTypeIdTo", "LEAD", "partyRelationshipTypeId", "EMPLOYMENT").filterByDate().queryList(); if (partyRelationships) { context.partyGroupId = partyRelationships.get(0).partyIdFrom; context.partyId = parameters.partyId; } } - roleTypeAndParty = delegator.findByAnd("RoleTypeAndParty", ['partyId': parameters.partyId, 'roleTypeId': 'ACCOUNT_LEAD'], null, false); + roleTypeAndParty = from("RoleTypeAndParty").where("partyId", parameters.partyId, "roleTypeId", "ACCOUNT_LEAD").queryList(); if (roleTypeAndParty) { context.leadDescription = roleTypeAndParty.get(0).description; - partyRelationships = EntityUtil.filterByDate(delegator.findByAnd("PartyRelationship", ["partyIdFrom": parameters.partyId, "roleTypeIdFrom": "ACCOUNT_LEAD", "roleTypeIdTo": "LEAD", "partyRelationshipTypeId": "EMPLOYMENT"], null, false)); + partyRelationships = from("PartyRelationship").where("partyIdFrom", parameters.partyId, "roleTypeIdFrom", "ACCOUNT_LEAD", "roleTypeIdTo", "LEAD", "partyRelationshipTypeId", "EMPLOYMENT").filterByDate().queryList(); if (partyRelationships) { context.partyGroupId = parameters.partyId; context.partyId = partyRelationships.get(0).partyIdTo; Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/UnAppliedInvoicesForParty.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/UnAppliedInvoicesForParty.groovy?rev=1647310&r1=1647309&r2=1647310&view=diff ============================================================================== --- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/UnAppliedInvoicesForParty.groovy (original) +++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/UnAppliedInvoicesForParty.groovy Mon Dec 22 13:20:03 2014 @@ -31,7 +31,6 @@ Boolean actualCurrency = new Boolean(con if (actualCurrency == null) { actualCurrency = true; } -findOpts = new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, true); invExprs = EntityCondition.makeCondition([ @@ -50,7 +49,7 @@ invExprs = ],EntityOperator.OR) ],EntityOperator.AND); -invIterator = delegator.find("InvoiceAndType", invExprs, null, null, null, findOpts); +invIterator = from("InvoiceAndType").where(invExprs).cursorScrollInsensitive().distinct().queryIterator(); invoiceList = []; while (invoice = invIterator.next()) { unAppliedAmount = InvoiceWorker.getInvoiceNotApplied(invoice, actualCurrency).setScale(2,BigDecimal.ROUND_HALF_UP); Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/UnAppliedPaymentsForParty.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/UnAppliedPaymentsForParty.groovy?rev=1647310&r1=1647309&r2=1647310&view=diff ============================================================================== --- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/UnAppliedPaymentsForParty.groovy (original) +++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/UnAppliedPaymentsForParty.groovy Mon Dec 22 13:20:03 2014 @@ -50,7 +50,7 @@ payExprs = ], EntityOperator.AND); paymentList = []; -payIterator = delegator.find("PaymentAndType", payExprs, null, null, null, findOpts); +payIterator = from("PaymentAndType").where(payExprs).cursorScrollInsensitive().distinct().queryIterator(); while (payment = payIterator.next()) { unAppliedAmount = PaymentWorker.getPaymentNotApplied(payment, actualCurrency).setScale(2,BigDecimal.ROUND_HALF_UP); Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/ViewProfile.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/ViewProfile.groovy?rev=1647310&r1=1647309&r2=1647310&view=diff ============================================================================== --- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/ViewProfile.groovy (original) +++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/ViewProfile.groovy Mon Dec 22 13:20:03 2014 @@ -23,7 +23,7 @@ partyId = parameters.partyId ?: paramete userLoginId = parameters.userlogin_id ?: parameters.userLoginId; if (!partyId && userLoginId) { - thisUserLogin = delegator.findOne("UserLogin", [userLoginId : userLoginId], false); + thisUserLogin = from("UserLogin").where("userLoginId", userLoginId).queryOne(); if (thisUserLogin) { partyId = thisUserLogin.partyId; parameters.partyId = partyId; @@ -32,5 +32,5 @@ if (!partyId && userLoginId) { context.showOld = "true".equals(parameters.SHOW_OLD); context.partyId = partyId; -context.party = delegator.findOne("Party", [partyId : partyId], false); +context.party = from("Party").where("partyId", partyId).queryOne(); context.nowStr = UtilDateTime.nowTimestamp().toString(); Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/visit/ShowVisits.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/visit/ShowVisits.groovy?rev=1647310&r1=1647309&r2=1647310&view=diff ============================================================================== --- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/visit/ShowVisits.groovy (original) +++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/visit/ShowVisits.groovy Mon Dec 22 13:20:03 2014 @@ -52,12 +52,12 @@ try { highIndex = viewIndex * viewSize; if (partyId) { - visitListIt = delegator.find("Visit", EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId), null, null, sortList, new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, -1, highIndex, true)); + visitListIt = from("Visit").where("partyId", partyId).orderBy(sortList).cursorScrollInsensitive().maxRows(highIndex).distinct().queryIterator(); } else if (showAll.equalsIgnoreCase("true")) { - visitListIt = delegator.find("Visit", null, null, null, sortList, new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, -1, highIndex, true)); + visitListIt = from("Visit").orderBy(sortList).cursorScrollInsensitive().maxRows(highIndex).distinct().queryIterator(); } else { // show active visits - visitListIt = delegator.find("Visit", EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null), null, null, sortList, new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, -1, highIndex, true)); + visitListIt = from("Visit").where("thruDate", null).orderBy(sortList).cursorScrollInsensitive().maxRows(highIndex).distinct().queryIterator(); } // get the partial list for this page Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/visit/VisitDetails.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/visit/VisitDetails.groovy?rev=1647310&r1=1647309&r2=1647310&view=diff ============================================================================== --- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/visit/VisitDetails.groovy (original) +++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/visit/VisitDetails.groovy Mon Dec 22 13:20:03 2014 @@ -23,9 +23,9 @@ visitId = parameters.visitId; visit = null; serverHits = null; if (visitId) { - visit = delegator.findOne("Visit", [visitId : visitId], false); + visit = from("Visit").where("visitId", visitId).queryOne(); if (visit) { - serverHits = delegator.findByAnd("ServerHit", [visitId : visitId], ["-hitStartDateTime"], false); + serverHits = from("ServerHit").where("visitId", visitId).orderBy("-hitStartDateTime").queryList(); } } Modified: ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/content/WorkEffortContentWrapper.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/content/WorkEffortContentWrapper.groovy?rev=1647310&r1=1647309&r2=1647310&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/content/WorkEffortContentWrapper.groovy (original) +++ ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/content/WorkEffortContentWrapper.groovy Mon Dec 22 13:20:03 2014 @@ -24,7 +24,7 @@ workEffort = context.get("workEffort"); if (workEffort == null && workEffortId != null) { - workEffort = delegator.findOne("WorkEffort", UtilMisc.toMap("workEffortId", workEffortId), true); + workEffort = from("WorkEffort").where("workEffortId", workEffortId).cache(true).queryOne(); } if (workEffort != null) { Modified: ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/find/WorkEffortSearchOptions.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/find/WorkEffortSearchOptions.groovy?rev=1647310&r1=1647309&r2=1647310&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/find/WorkEffortSearchOptions.groovy (original) +++ ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/find/WorkEffortSearchOptions.groovy Mon Dec 22 13:20:03 2014 @@ -53,8 +53,8 @@ context.put("thruDateStr", toStr); searchConstraintStrings = WorkEffortSearchSession.searchGetConstraintStrings(false, session, delegator); searchSortOrderString = WorkEffortSearchSession.searchGetSortOrderString(false, request); -workEffortAssocTypes=delegator.findList("WorkEffortAssocType", null, null, null, null, false); -roleTypes=delegator.findList("RoleType", null, null, null, null, false); +workEffortAssocTypes = from("WorkEffortAssocType").queryList(); +roleTypes = from("RoleType").queryList(); context.put("searchOperator", searchOperator); context.put("searchConstraintStrings", searchConstraintStrings); |
Free forum by Nabble | Edit this page |