當前位置: 首頁>>代碼示例>>Java>>正文


Java ContactHelper類代碼示例

本文整理匯總了Java中org.ofbiz.party.contact.ContactHelper的典型用法代碼示例。如果您正苦於以下問題:Java ContactHelper類的具體用法?Java ContactHelper怎麽用?Java ContactHelper使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ContactHelper類屬於org.ofbiz.party.contact包,在下文中一共展示了ContactHelper類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getOrderEmailList

import org.ofbiz.party.contact.ContactHelper; //導入依賴的package包/類
/**
 * SCIPIO: Gets all emails that are OR are to be associated with the order, including
 * party's to-be-associated emails and order additional emails.
 * <p>
 * WARN: This is not guaranteed to match the final order! The party's
 * emails are not stored in cart.
 * <p>
 * This attempts to emulate {@link OrderReadHelper#getOrderEmailList()}.
 */
public List<String> getOrderEmailList() {
    List<String> emailList = new ArrayList<String>();
    // WARN: This must match what is done in CheckOutHelper!
    String partyId = this.getPlacingCustomerPartyId();
    if (UtilValidate.isNotEmpty(partyId)) {
        GenericValue party;
        try {
            party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne();
            Collection<GenericValue> contactMechList = ContactHelper.getContactMechByType(party, "EMAIL_ADDRESS", false);
            for(GenericValue contactMech : contactMechList) {
                emailList.add(contactMech.getString("infoString"));
            }
        } catch (GenericEntityException e) {
            Debug.logError("Could not get order emails for party '" + partyId + "'", module);
        }
    }
    // WARN: This must match waht is done in CheckOutHelper!
    List<String> addEmailList = StringUtil.split(this.getOrderAdditionalEmails(), ",");
    if (UtilValidate.isNotEmpty(addEmailList)) {
        emailList.addAll(addEmailList);
    }
    return emailList;
}
 
開發者ID:ilscipio,項目名稱:scipio-erp,代碼行數:33,代碼來源:ShoppingCart.java

示例2: setDefaultCheckoutOptions

import org.ofbiz.party.contact.ContactHelper; //導入依賴的package包/類
public void setDefaultCheckoutOptions(LocalDispatcher dispatcher) {
    // skip the add party screen
    this.setAttribute("addpty", "Y");
    if (getOrderType().equals("SALES_ORDER")) {
        // checkout options for sales orders
        // set as the default shipping location the first from the list of available shipping locations
        if (this.getPartyId() != null && !this.getPartyId().equals("_NA_")) {
            try {
                GenericValue orderParty = this.getDelegator().findOne("Party", UtilMisc.toMap("partyId", this.getPartyId()), false);
                Collection<GenericValue> shippingContactMechList = ContactHelper.getContactMech(orderParty, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false);
                if (UtilValidate.isNotEmpty(shippingContactMechList)) {
                    GenericValue shippingContactMech = (shippingContactMechList.iterator()).next();
                    this.setAllShippingContactMechId(shippingContactMech.getString("contactMechId"));
                }
            } catch (GenericEntityException e) {
                Debug.logError(e, "Error setting shippingContactMechId in setDefaultCheckoutOptions() method.", module);
            }
        }
        // set the default shipment method
        ShippingEstimateWrapper shipEstimateWrapper = org.ofbiz.order.shoppingcart.shipping.ShippingEstimateWrapper.getWrapper(dispatcher, this, 0);
        GenericValue carrierShipmentMethod = EntityUtil.getFirst(shipEstimateWrapper.getShippingMethods());
        if (carrierShipmentMethod != null) {
            this.setAllShipmentMethodTypeId(carrierShipmentMethod.getString("shipmentMethodTypeId"));
            this.setAllCarrierPartyId(carrierShipmentMethod.getString("partyId"));
        }
    } else {
        // checkout options for purchase orders
        // TODO: should we select a default agreement? For now we don't do this.
        // skip the order terms selection step
        this.setOrderTermSet(true);
        // set as the default shipping location the first from the list of available shipping locations
        String companyId = this.getBillToCustomerPartyId();
        if (companyId != null) {
            // the facilityId should be set prior to triggering default options, otherwise we do not set up facility information
            String defaultFacilityId = getFacilityId();
            if (defaultFacilityId != null) {
                GenericValue facilityContactMech = ContactMechWorker.getFacilityContactMechByPurpose(this.getDelegator(), facilityId, UtilMisc.toList("SHIPPING_LOCATION", "PRIMARY_LOCATION"));
                if (facilityContactMech != null) {
                    this.setShippingContactMechId(0, facilityContactMech.getString("contactMechId"));
                }
            }
        }
        // shipping options
        this.setAllShipmentMethodTypeId("NO_SHIPPING");
        this.setAllCarrierPartyId("_NA_");
        this.setAllShippingInstructions("");
        this.setAllGiftMessage("");
        this.setAllMaySplit(Boolean.TRUE);
        this.setAllIsGift(Boolean.FALSE);
        //this.setInternalCode(internalCode);
    }
}
 
開發者ID:ilscipio,項目名稱:scipio-erp,代碼行數:53,代碼來源:ShoppingCart.java


注:本文中的org.ofbiz.party.contact.ContactHelper類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。