DEPRECATION: specialpurpose/ecommerce: findByAnd variants replaced with findByAnd that takes a boolean useCache parameter.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk/specialpurpose@1338415 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Adam Heath
2012-05-14 21:02:45 +00:00
parent 3309ac43e3
commit c1028c2d0b
21 changed files with 35 additions and 35 deletions
@@ -39,7 +39,7 @@ if (parameters.add_product_id) { // check if a parameter is passed
}
// get all the possible gift wrap options
allgiftWraps = delegator.findByAnd("ProductFeature", [productFeatureTypeId : "GIFT_WRAP"], ["defaultSequenceNum"]);
allgiftWraps = delegator.findByAnd("ProductFeature", [productFeatureTypeId : "GIFT_WRAP"], ["defaultSequenceNum"], false);
context.allgiftWraps = allgiftWraps;
// get the shopping lists for the logged in user
@@ -56,7 +56,7 @@ context.index = ProductSearchSession.getCategoryCostraintIndex(session);
searchConstraintList = ProductSearchSession.getProductSearchOptions(session).getConstraintList();
if (searchCategoryId) {
productCategoryRollups = delegator.findByAnd("ProductCategoryRollup", [productCategoryId: searchCategoryId]);
productCategoryRollups = delegator.findByAnd("ProductCategoryRollup", [productCategoryId: searchCategoryId], null, false);
productCategoryRollups = EntityUtil.filterByDate(productCategoryRollups);
previousCategoryId = null;
if (productCategoryRollups) {
@@ -44,7 +44,7 @@ productKeywords = delegator.findList("ProductKeyword", keywordConditions, keywor
if (UtilValidate.isNotEmpty(productKeywords)) {
productKeywords.each { productKeyword ->
productTags = delegator.findByAnd("ProductKeyword", ["keyword": productKeyword.keyword, "keywordTypeId" : "KWT_TAG", "statusId" : "KW_APPROVED"]);
productTags = delegator.findByAnd("ProductKeyword", ["keyword": productKeyword.keyword, "keywordTypeId" : "KWT_TAG", "statusId" : "KW_APPROVED"], null, false);
searchResult = [:];
searchResult.tag = productKeyword.keyword;
searchResult.countTag = productTags.size();
@@ -36,7 +36,7 @@ List fillTree(rootCat ,CatLvl, parentCategoryId) {
rootCat.sort{ it.productCategoryId }
def listTree = FastList.newInstance();
for(root in rootCat) {
preCatChilds = delegator.findByAnd("ProductCategoryRollup", ["parentProductCategoryId": root.productCategoryId]);
preCatChilds = delegator.findByAnd("ProductCategoryRollup", ["parentProductCategoryId": root.productCategoryId], null, false);
catChilds = EntityUtil.getRelated("CurrentProductCategory",preCatChilds);
def childList = FastList.newInstance();
@@ -51,7 +51,7 @@ List fillTree(rootCat ,CatLvl, parentCategoryId) {
childList = fillTree(catChilds,CatLvl+1, parentCategoryId+'/'+root.productCategoryId);
}
productsInCat = delegator.findByAnd("ProductCategoryAndMember", ["productCategoryId": root.productCategoryId]);
productsInCat = delegator.findByAnd("ProductCategoryAndMember", ["productCategoryId": root.productCategoryId], null, false);
// Display the category if this category containing products or contain the category that's containing products
if(productsInCat || childList) {
@@ -28,7 +28,7 @@ import org.ofbiz.product.store.ProductStoreWorker;
import org.ofbiz.webapp.website.WebSiteWorker;
import org.ofbiz.accounting.payment.PaymentWorker;
/*publicEmailContactLists = delegator.findByAnd("ContactList", [isPublic : "Y", contactMechTypeId : "EMAIL_ADDRESS"], ["contactListName"]);
/*publicEmailContactLists = delegator.findByAnd("ContactList", [isPublic : "Y", contactMechTypeId : "EMAIL_ADDRESS"], ["contactListName"], false);
context.publicEmailContactLists = publicEmailContactLists;*/
webSiteId = WebSiteWorker.getWebSiteId(request);
@@ -54,7 +54,7 @@ webSiteContactList.each { webSiteContactList ->
context.publicEmailContactLists = publicEmailContactLists;
if (userLogin) {
partyAndContactMechList = delegator.findByAnd("PartyAndContactMech", [partyId : partyId, contactMechTypeId : "EMAIL_ADDRESS"], ["-fromDate"]);
partyAndContactMechList = delegator.findByAnd("PartyAndContactMech", [partyId : partyId, contactMechTypeId : "EMAIL_ADDRESS"], ["-fromDate"], false);
partyAndContactMechList = EntityUtil.filterByDate(partyAndContactMechList);
context.partyAndContactMechList = partyAndContactMechList;
}
@@ -31,7 +31,7 @@ if (userLogin) {
contactMech = EntityUtil.getFirst(ContactHelper.getContactMech(party, "PRIMARY_PHONE", "TELECOM_NUMBER", false));
if (contactMech) {
partyContactMech = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("PartyContactMech", [partyId : party.partyId, contactMechId : contactMech.contactMechId])));
partyContactMech = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("PartyContactMech", [partyId : party.partyId, contactMechId : contactMech.contactMechId], null, false)));
if (partyContactMech) {
telecomNumber = partyContactMech.getRelatedOne("TelecomNumber");
context.phoneContactMechId = telecomNumber.contactMechId;
@@ -65,7 +65,7 @@ if (userLogin) {
context.messages = messages;
context.profileMessages = true;
partyContent = delegator.findByAnd("ContentRole", [partyId : partyId, roleTypeId : "OWNER"]);
partyContent = delegator.findByAnd("ContentRole", [partyId : partyId, roleTypeId : "OWNER"], null, false);
partyContent = EntityUtil.filterByDate(partyContent);
context.partyContent = partyContent;
@@ -83,14 +83,14 @@ if (userLogin) {
context.totalSubRemainingAmount = result.totalSubRemainingAmount;
context.totalOrders = result.totalOrders;
contactListPartyList = delegator.findByAnd("ContactListParty", [partyId : partyId], ["-fromDate"]);
contactListPartyList = delegator.findByAnd("ContactListParty", [partyId : partyId], ["-fromDate"], false);
// show all, including history, ie don't filter: contactListPartyList = EntityUtil.filterByDate(contactListPartyList, true);
context.contactListPartyList = contactListPartyList;
publicContactLists = delegator.findByAnd("ContactList", [isPublic : "Y"], ["contactListName"]);
publicContactLists = delegator.findByAnd("ContactList", [isPublic : "Y"], ["contactListName"], false);
context.publicContactLists = publicContactLists;
partyAndContactMechList = delegator.findByAnd("PartyAndContactMech", [partyId : partyId], ["-fromDate"]);
partyAndContactMechList = delegator.findByAnd("PartyAndContactMech", [partyId : partyId], ["-fromDate"], false);
partyAndContactMechList = EntityUtil.filterByDate(partyAndContactMechList);
context.partyAndContactMechList = partyAndContactMechList;
}
@@ -54,7 +54,7 @@ contentIdTo = ContentManagementWorker.getFromSomewhere("forumId", paramMap, requ
context.contentIdTo = contentIdTo;
//Debug.logInfo("in contentaddprep, contentIdTo:" + contentIdTo,"");
//Debug.logInfo("in contentaddprep, paramMap:" + paramMap,"");
attrList = delegator.findByAndCache("ContentAttribute", [contentId : contentIdTo, attrName : "publishOperation"]);
attrList = delegator.findByAnd("ContentAttribute", [contentId : contentIdTo, attrName : "publishOperation"], null, true);
publishOperation = null;
if (attrList) {
contentAttribute = attrList.get(0);
@@ -62,7 +62,7 @@ if (parameters.useShipAddr && cart.getShippingContactMechId()) {
context.postalFields = postalAddress;
if (postalAddress && partyId) {
partyContactMechs = delegator.findByAnd("PartyContactMech", [partyId : partyId, contactMechId : postalAddress.contactMechId], ["-fromDate"]);
partyContactMechs = delegator.findByAnd("PartyContactMech", [partyId : partyId, contactMechId : postalAddress.contactMechId], ["-fromDate"], false);
partyContactMechs = EntityUtil.filterByDate(partyContactMechs);
partyContactMech = EntityUtil.getFirst(partyContactMechs);
context.partyContactMech = partyContactMech;
@@ -69,7 +69,7 @@ if (partyId) {
// get the Email Address
emailPartyContactDetail = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("PartyContactDetailByPurpose",
[partyId : partyId, contactMechPurposeTypeId : "PRIMARY_EMAIL"])));
[partyId : partyId, contactMechPurposeTypeId : "PRIMARY_EMAIL"], null, false)));
if (emailPartyContactDetail) {
parameters.emailContactMechId = emailPartyContactDetail.contactMechId;
parameters.emailAddress = emailPartyContactDetail.infoString;
@@ -78,7 +78,7 @@ if (partyId) {
// get the Phone Numbers
homePhonePartyContactDetail = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("PartyContactDetailByPurpose",
[partyId : partyId, contactMechPurposeTypeId : "PHONE_HOME"])));
[partyId : partyId, contactMechPurposeTypeId : "PHONE_HOME"], null, false)));
if (homePhonePartyContactDetail) {
parameters.homePhoneContactMechId = homePhonePartyContactDetail.contactMechId;
parameters.homeCountryCode = homePhonePartyContactDetail.countryCode;
@@ -89,7 +89,7 @@ if (partyId) {
}
workPhonePartyContactDetail = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("PartyContactDetailByPurpose",
[partyId : partyId, contactMechPurposeTypeId : "PHONE_WORK"])));
[partyId : partyId, contactMechPurposeTypeId : "PHONE_WORK"], null, false)));
if (workPhonePartyContactDetail) {
parameters.workPhoneContactMechId = workPhonePartyContactDetail.contactMechId;
parameters.workCountryCode = workPhonePartyContactDetail.countryCode;
@@ -26,7 +26,7 @@ partyRole = delegator.findOne("PartyRole", [partyId : userLogin.partyId, roleTyp
if (partyRole) {
if ("SUPPLIER".equals(partyRole.roleTypeId)) {
/** drop shipper or supplier **/
porderRoleCollection = delegator.findByAnd("OrderRole", [partyId : userLogin.partyId, roleTypeId : "SUPPLIER_AGENT"]);
porderRoleCollection = delegator.findByAnd("OrderRole", [partyId : userLogin.partyId, roleTypeId : "SUPPLIER_AGENT"], null, false);
porderHeaderList = EntityUtil.orderBy(EntityUtil.filterByAnd(EntityUtil.getRelated("OrderHeader", porderRoleCollection),
[EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"),
EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "PURCHASE_ORDER")]),
@@ -34,11 +34,11 @@ if (partyRole) {
context.porderHeaderList = porderHeaderList;
}
}
orderRoleCollection = delegator.findByAnd("OrderRole", [partyId : userLogin.partyId, roleTypeId : "PLACING_CUSTOMER"]);
orderRoleCollection = delegator.findByAnd("OrderRole", [partyId : userLogin.partyId, roleTypeId : "PLACING_CUSTOMER"], null, false);
orderHeaderList = EntityUtil.orderBy(EntityUtil.filterByAnd(EntityUtil.getRelated("OrderHeader", orderRoleCollection),
[EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED")]), ["orderDate DESC"]);
context.orderHeaderList = orderHeaderList;
downloadOrderRoleAndProductContentInfoList = delegator.findByAnd("OrderRoleAndProductContentInfo",
[partyId : userLogin.partyId, roleTypeId : "PLACING_CUSTOMER", productContentTypeId : "DIGITAL_DOWNLOAD", statusId : "ITEM_COMPLETED"]);
[partyId : userLogin.partyId, roleTypeId : "PLACING_CUSTOMER", productContentTypeId : "DIGITAL_DOWNLOAD", statusId : "ITEM_COMPLETED"], null, false);
context.downloadOrderRoleAndProductContentInfoList = downloadOrderRoleAndProductContentInfoList;
@@ -99,7 +99,7 @@ if (orderId) {
// check OrderRole to make sure the user can view this order. This check must be done for any order which is not anonymously placed and
// any anonymous order when the allowAnonymousView security flag (see above) is not set to Y, to prevent peeking
if (orderHeader && (!"anonymous".equals(orderHeader.createdBy) || ("anonymous".equals(orderHeader.createdBy) && !"Y".equals(allowAnonymousView)))) {
orderRole = EntityUtil.getFirst(delegator.findByAnd("OrderRole", [orderId : orderId, partyId : partyId, roleTypeId : roleTypeId]));
orderRole = EntityUtil.getFirst(delegator.findByAnd("OrderRole", [orderId : orderId, partyId : partyId, roleTypeId : roleTypeId], null, false));
if (!userLogin || !orderRole) {
context.remove("orderHeader");
@@ -127,7 +127,7 @@ if (orderHeader) {
orderTaxTotal = OrderReadHelper.getAllOrderItemsAdjustmentsTotal(orderItems, orderAdjustments, false, true, false);
orderTaxTotal = orderTaxTotal.add(OrderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, false, true, false));
placingCustomerOrderRoles = delegator.findByAnd("OrderRole", [orderId : orderId, roleTypeId : roleTypeId]);
placingCustomerOrderRoles = delegator.findByAnd("OrderRole", [orderId : orderId, roleTypeId : roleTypeId], null, false);
placingCustomerOrderRole = EntityUtil.getFirst(placingCustomerOrderRoles);
placingCustomerPerson = placingCustomerOrderRole == null ? null : delegator.findOne("Person", [partyId : placingCustomerOrderRole.partyId], false);
@@ -215,6 +215,6 @@ if (orderHeader) {
context.orderShipmentInfoSummaryList = orderShipmentInfoSummaryList;
context.customerPoNumberSet = customerPoNumberSet;
orderItemChangeReasons = delegator.findByAnd("Enumeration", [enumTypeId : "ODR_ITM_CH_REASON"], ["sequenceId"]);
orderItemChangeReasons = delegator.findByAnd("Enumeration", [enumTypeId : "ODR_ITM_CH_REASON"], ["sequenceId"], false);
context.orderItemChangeReasons = orderItemChangeReasons;
}
@@ -52,7 +52,7 @@ if (parameters.useShipAddr && cart.getShippingContactMechId()) {
context.postalAddress = postalAddress;
if (postalAddress && partyId) {
partyContactMechs = delegator.findByAnd("PartyContactMech", [partyId : partyId, contactMechId : postalAddress.contactMechId], ["-fromDate"]);
partyContactMechs = delegator.findByAnd("PartyContactMech", [partyId : partyId, contactMechId : postalAddress.contactMechId], ["-fromDate"], false);
partyContactMechs = EntityUtil.filterByDate(partyContactMechs);
partyContactMech = EntityUtil.getFirst(partyContactMechs);
context.partyContactMech = partyContactMech;
@@ -53,7 +53,7 @@ if (partyId) {
// get the Email Address
emailPartyContactDetail = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("PartyContactDetailByPurpose",
[partyId : partyId, contactMechPurposeTypeId : "PRIMARY_EMAIL"])));
[partyId : partyId, contactMechPurposeTypeId : "PRIMARY_EMAIL"], null, false)));
if (emailPartyContactDetail) {
parameters.emailContactMechId = emailPartyContactDetail.contactMechId;
parameters.emailAddress = emailPartyContactDetail.infoString;
@@ -62,7 +62,7 @@ if (partyId) {
// get the Phone Numbers
homePhonePartyContactDetail = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("PartyContactDetailByPurpose",
[partyId : partyId, contactMechPurposeTypeId : "PHONE_HOME"])));
[partyId : partyId, contactMechPurposeTypeId : "PHONE_HOME"], null, false)));
if (homePhonePartyContactDetail) {
parameters.homePhoneContactMechId = homePhonePartyContactDetail.contactMechId;
parameters.homeCountryCode = homePhonePartyContactDetail.countryCode;
@@ -73,7 +73,7 @@ if (partyId) {
}
workPhonePartyContactDetail = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("PartyContactDetailByPurpose",
[partyId : partyId, contactMechPurposeTypeId : "PHONE_WORK"])));
[partyId : partyId, contactMechPurposeTypeId : "PHONE_WORK"], null, false)));
if (workPhonePartyContactDetail) {
parameters.workPhoneContactMechId = workPhonePartyContactDetail.contactMechId;
parameters.workCountryCode = workPhonePartyContactDetail.countryCode;
@@ -104,7 +104,7 @@ if (cartPartyId && !cartPartyId.equals("_NA_")) {
if (cart && cart.getShippingContactMechId()) {
shippingContactMechId = cart.getShippingContactMechId();
shippingPartyContactDetail = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("PartyContactDetailByPurpose",
[partyId : cartPartyId, contactMechId : shippingContactMechId])));
[partyId : cartPartyId, contactMechId : shippingContactMechId], null, false)));
parameters.shippingContactMechId = shippingPartyContactDetail.contactMechId;
context.callSubmitForm = true;
parameters.shipToName = shippingPartyContactDetail.toName;
@@ -40,7 +40,7 @@ if (orderId) {
context.orderHeader = orderHeader;
}
returnItemTypeMap = delegator.findByAnd("ReturnItemTypeMap", [returnHeaderTypeId : "CUSTOMER_RETURN"]);
returnItemTypeMap = delegator.findByAnd("ReturnItemTypeMap", [returnHeaderTypeId : "CUSTOMER_RETURN"], null, false);
typeMap = new HashMap();
returnItemTypeMap.each { value -> typeMap[value.returnItemMapKey] = value.returnItemTypeId }
context.returnItemTypeMap = typeMap;
@@ -41,7 +41,7 @@ if (partyId && !partyId.equals("_NA_")) {
if (cart?.getShippingContactMechId()) {
shippingContactMechId = cart.getShippingContactMechId();
shippingPartyContactDetail = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("PartyContactDetailByPurpose",
[partyId : partyId, contactMechId : shippingContactMechId])));
[partyId : partyId, contactMechId : shippingContactMechId], null, false)));
parameters.shippingContactMechId = shippingPartyContactDetail.contactMechId;
context.callSubmitForm = true;
@@ -26,7 +26,7 @@ import org.ofbiz.entity.util.*;
shipmentId = parameters.shipmentId;
if (shipmentId) {
shipment = delegator.findOne("Shipment", [shipmentId : shipmentId], false);
shipmentItems = delegator.findByAnd("ShipmentItem", [shipmentId : shipmentId]);
shipmentItems = delegator.findByAnd("ShipmentItem", [shipmentId : shipmentId], null, false);
// get Shipment tracking info
osisCond = EntityCondition.makeCondition([shipmentId : shipmentId], EntityOperator.AND);
@@ -159,7 +159,7 @@ if (shoppingListId) {
context.shoppingListType = shoppingListType;
// get the child shopping lists of the current list for the logged in user
childShoppingLists = delegator.findByAndCache("ShoppingList", [partyId : userLogin.partyId, parentShoppingListId : shoppingListId], ["listName"]);
childShoppingLists = delegator.findByAnd("ShoppingList", [partyId : userLogin.partyId, parentShoppingListId : shoppingListId], ["listName"], true);
// now get prices for each child shopping list...
if (childShoppingLists) {
childShoppingListDatas = new ArrayList(childShoppingLists.size());
@@ -33,7 +33,7 @@ under the License.
</#if>
<#assign productCategoryId = productCategory.productCategoryId/>
<#assign categoryImageUrl = "/images/defaultImage.jpg">
<#assign productCategoryMembers = delegator.findByAnd("ProductCategoryAndMember", Static["org.ofbiz.base.util.UtilMisc"].toMap("productCategoryId", productCategoryId), Static["org.ofbiz.base.util.UtilMisc"].toList("-quantity"))>
<#assign productCategoryMembers = delegator.findByAnd("ProductCategoryAndMember", Static["org.ofbiz.base.util.UtilMisc"].toMap("productCategoryId", productCategoryId), Static["org.ofbiz.base.util.UtilMisc"].toList("-quantity"), false)>
<#if productCategory.categoryImageUrl?has_content>
<#assign categoryImageUrl = productCategory.categoryImageUrl/>
<#elseif productCategoryMembers?has_content>
+1 -1
View File
@@ -24,7 +24,7 @@ under the License.
<%
ServletContext context = pageContext.getServletContext();
String webSiteId = (String) context.getAttribute("webSiteId");
List<GenericValue> webAnalytics = delegator.findByAnd("WebAnalyticsConfig", UtilMisc.toMap("webSiteId", webSiteId));
List<GenericValue> webAnalytics = delegator.findByAnd("WebAnalyticsConfig", UtilMisc.toMap("webSiteId", webSiteId), null, false);
%>
<html>
<head>
@@ -41,7 +41,7 @@ under the License.
<td><@ofbizCurrency amount=orderHeader.grandTotal isoCode=orderHeader.currencyUom /></td>
<td>${status.get("description",locale)}</td>
<#-- invoices -->
<#assign invoices = delegator.findByAnd("OrderItemBilling", Static["org.ofbiz.base.util.UtilMisc"].toMap("orderId", "${orderHeader.orderId}"), Static["org.ofbiz.base.util.UtilMisc"].toList("invoiceId")) />
<#assign invoices = delegator.findByAnd("OrderItemBilling", Static["org.ofbiz.base.util.UtilMisc"].toMap("orderId", "${orderHeader.orderId}"), Static["org.ofbiz.base.util.UtilMisc"].toList("invoiceId"), false) />
<#assign distinctInvoiceIds = Static["org.ofbiz.entity.util.EntityUtil"].getFieldListFromEntityList(invoices, "invoiceId", true)>
<#if distinctInvoiceIds?has_content>
<td>