Class OrderReadHelper


  • public class OrderReadHelper
    extends java.lang.Object
    Utility class for easily extracting important information from orders

    NOTE: in the current scheme order adjustments are never included in tax or shipping, but order item adjustments ARE included in tax and shipping calcs unless they are tax or shipping adjustments or the includeInTax or includeInShipping are set to N.

    • Constructor Detail

      • OrderReadHelper

        protected OrderReadHelper()
      • OrderReadHelper

        public OrderReadHelper​(GenericValue orderHeader,
                               java.util.List<GenericValue> adjustments,
                               java.util.List<GenericValue> orderItems)
        Instantiates a new Order read helper.
        Parameters:
        orderHeader - the order header
        adjustments - the adjustments
        orderItems - the order items
      • OrderReadHelper

        public OrderReadHelper​(GenericValue orderHeader)
        Instantiates a new Order read helper.
        Parameters:
        orderHeader - the order header
      • OrderReadHelper

        public OrderReadHelper​(java.util.List<GenericValue> adjustments,
                               java.util.List<GenericValue> orderItems)
        Instantiates a new Order read helper.
        Parameters:
        adjustments - the adjustments
        orderItems - the order items
      • OrderReadHelper

        public OrderReadHelper​(Delegator delegator,
                               java.lang.String orderId)
        Instantiates a new Order read helper.
        Parameters:
        delegator - the delegator
        orderId - the order id
    • Method Detail

      • getOrderId

        public java.lang.String getOrderId()
        Gets order id.
        Returns:
        the order id
      • getWebSiteId

        public java.lang.String getWebSiteId()
        Gets web site id.
        Returns:
        the web site id
      • getProductStoreId

        public java.lang.String getProductStoreId()
        Gets product store id.
        Returns:
        the product store id
      • getProductStore

        public GenericValue getProductStore()
        Returns the ProductStore of this Order or null in case of Exception
        Returns:
        the product store
      • getOrderTypeId

        public java.lang.String getOrderTypeId()
        Gets order type id.
        Returns:
        the order type id
      • getCurrency

        public java.lang.String getCurrency()
        Gets currency.
        Returns:
        the currency
      • getOrderName

        public java.lang.String getOrderName()
        Gets order name.
        Returns:
        the order name
      • getAdjustments

        public java.util.List<GenericValue> getAdjustments()
        Gets adjustments.
        Returns:
        the adjustments
      • getPaymentPreferences

        public java.util.List<GenericValue> getPaymentPreferences()
        Gets payment preferences.
        Returns:
        the payment preferences
      • getReceivedPaymentTotalsByPaymentMethod

        public java.util.Map<java.lang.String,​java.math.BigDecimal> getReceivedPaymentTotalsByPaymentMethod()
        Returns a Map of paymentMethodId -> amount charged (BigDecimal) based on PaymentGatewayResponse.
        Returns:
        returns a Map of paymentMethodId -> amount charged (BigDecimal) based on PaymentGatewayResponse.
      • getReturnedTotalsByPaymentMethod

        public java.util.Map<java.lang.String,​java.math.BigDecimal> getReturnedTotalsByPaymentMethod()
        Returns a Map of paymentMethodId -> amount refunded
        Returns:
        returns a Map of paymentMethodId -> amount refunded
      • getOrderPayments

        public java.util.List<GenericValue> getOrderPayments()
        Gets order payments.
        Returns:
        the order payments
      • getOrderPayments

        public java.util.List<GenericValue> getOrderPayments​(GenericValue orderPaymentPreference)
        Gets order payments.
        Parameters:
        orderPaymentPreference - the order payment preference
        Returns:
        the order payments
      • getOrderStatuses

        public java.util.List<GenericValue> getOrderStatuses()
        Gets order statuses.
        Returns:
        the order statuses
      • getOrderTerms

        public java.util.List<GenericValue> getOrderTerms()
        Gets order terms.
        Returns:
        the order terms
      • getOrderTermNetDays

        public java.lang.Long getOrderTermNetDays()
        Return the number of days from termDays of first FIN_PAYMENT_TERM
        Returns:
        number of days from termDays of first FIN_PAYMENT_TERM
      • getShippingMethod

        public java.lang.String getShippingMethod​(java.lang.String shipGroupSeqId)
        Gets shipping method.
        Parameters:
        shipGroupSeqId - the ship group seq id
        Returns:
        the shipping method
      • getShippingMethodCode

        public java.lang.String getShippingMethodCode​(java.lang.String shipGroupSeqId)
        Gets shipping method code.
        Parameters:
        shipGroupSeqId - the ship group seq id
        Returns:
        the shipping method code
      • hasShippingAddress

        public boolean hasShippingAddress()
        Has shipping address boolean.
        Returns:
        the boolean
      • getOrderItemShipGroup

        public GenericValue getOrderItemShipGroup​(java.lang.String shipGroupSeqId)
        Gets order item ship group.
        Parameters:
        shipGroupSeqId - the ship group seq id
        Returns:
        the order item ship group
      • getOrderItemShipGroups

        public java.util.List<GenericValue> getOrderItemShipGroups()
        Gets order item ship groups.
        Returns:
        the order item ship groups
      • getShippingLocations

        public java.util.List<GenericValue> getShippingLocations()
        Gets shipping locations.
        Returns:
        the shipping locations
      • getShippingAddress

        public GenericValue getShippingAddress​(java.lang.String shipGroupSeqId)
        Gets shipping address.
        Parameters:
        shipGroupSeqId - the ship group seq id
        Returns:
        the shipping address
      • getShippingAddress

        @Deprecated
        public GenericValue getShippingAddress()
        Deprecated.
        Gets shipping address.
        Returns:
        the shipping address
      • getBillingLocations

        public java.util.List<GenericValue> getBillingLocations()
        Gets billing locations.
        Returns:
        the billing locations
      • getBillingAddress

        @Deprecated
        public GenericValue getBillingAddress()
        Deprecated.
        Gets billing address.
        Returns:
        the billing address
      • getOrderContactMechs

        public java.util.List<GenericValue> getOrderContactMechs​(java.lang.String purposeTypeId)
        Gets order contact mechs.
        Parameters:
        purposeTypeId - the purpose type id
        Returns:
        the order contact mechs
      • getEarliestShipByDate

        public java.sql.Timestamp getEarliestShipByDate()
        Gets earliest ship by date.
        Returns:
        the earliest ship by date
      • getLatestShipAfterDate

        public java.sql.Timestamp getLatestShipAfterDate()
        Gets latest ship after date.
        Returns:
        the latest ship after date
      • getCurrentStatusString

        public java.lang.String getCurrentStatusString()
        Gets current status string.
        Returns:
        the current status string
      • getStatusString

        public java.lang.String getStatusString​(java.util.Locale locale)
        Gets status string.
        Parameters:
        locale - the locale
        Returns:
        the status string
      • getBillingAccount

        public GenericValue getBillingAccount()
        Gets billing account.
        Returns:
        the billing account
      • getBillingAccountMaxAmount

        public java.math.BigDecimal getBillingAccountMaxAmount()
        Returns the OrderPaymentPreference.maxAmount for the billing account associated with the order, or 0 if there is no billing account or no max amount set
        Returns:
        the billing account max amount
      • getBillToParty

        public GenericValue getBillToParty()
        Returns party from OrderRole of BILL_TO_CUSTOMER
        Returns:
        the bill to party
      • getBillFromParty

        public GenericValue getBillFromParty()
        Returns party from OrderRole of BILL_FROM_VENDOR
        Returns:
        the bill from party
      • getShipToParty

        public GenericValue getShipToParty()
        Returns party from OrderRole of SHIP_TO_CUSTOMER
        Returns:
        the ship to party
      • getPlacingParty

        public GenericValue getPlacingParty()
        Returns party from OrderRole of PLACING_CUSTOMER
        Returns:
        the placing party
      • getEndUserParty

        public GenericValue getEndUserParty()
        Returns party from OrderRole of END_USER_CUSTOMER
        Returns:
        the end user party
      • getSupplierAgent

        public GenericValue getSupplierAgent()
        Returns party from OrderRole of SUPPLIER_AGENT
        Returns:
        the supplier agent
      • getPartyFromRole

        public GenericValue getPartyFromRole​(java.lang.String roleTypeId)
        Gets party from role.
        Parameters:
        roleTypeId - the role type id
        Returns:
        the party from role
      • getDistributorId

        public java.lang.String getDistributorId()
        Gets distributor id.
        Returns:
        the distributor id
      • getAffiliateId

        public java.lang.String getAffiliateId()
        Gets affiliate id.
        Returns:
        the affiliate id
      • getShippingTotal

        public java.math.BigDecimal getShippingTotal()
        Gets shipping total.
        Returns:
        the shipping total
      • getHeaderTaxTotal

        public java.math.BigDecimal getHeaderTaxTotal()
        Gets header tax total.
        Returns:
        the header tax total
      • getTaxTotal

        public java.math.BigDecimal getTaxTotal()
        Gets tax total.
        Returns:
        the tax total
      • getItemFeatureSet

        public java.util.Set<java.lang.String> getItemFeatureSet​(GenericValue item)
        Gets item feature set.
        Parameters:
        item - the item
        Returns:
        the item feature set
      • getFeatureIdQtyMap

        public java.util.Map<java.lang.String,​java.math.BigDecimal> getFeatureIdQtyMap​(java.lang.String shipGroupSeqId)
        Gets feature id qty map.
        Parameters:
        shipGroupSeqId - the ship group seq id
        Returns:
        the feature id qty map
      • shippingApplies

        public boolean shippingApplies()
        Shipping applies boolean.
        Returns:
        the boolean
      • taxApplies

        public boolean taxApplies()
        Tax applies boolean.
        Returns:
        the boolean
      • getShippableTotal

        public java.math.BigDecimal getShippableTotal​(java.lang.String shipGroupSeqId)
        Gets shippable total.
        Parameters:
        shipGroupSeqId - the ship group seq id
        Returns:
        the shippable total
      • getShippableQuantity

        public java.math.BigDecimal getShippableQuantity()
        Gets shippable quantity.
        Returns:
        the shippable quantity
      • getShippableQuantity

        public java.math.BigDecimal getShippableQuantity​(java.lang.String shipGroupSeqId)
        Gets shippable quantity.
        Parameters:
        shipGroupSeqId - the ship group seq id
        Returns:
        the shippable quantity
      • getShippableWeight

        public java.math.BigDecimal getShippableWeight​(java.lang.String shipGroupSeqId)
        Gets shippable weight.
        Parameters:
        shipGroupSeqId - the ship group seq id
        Returns:
        the shippable weight
      • getItemWeight

        public java.math.BigDecimal getItemWeight​(GenericValue item)
        Gets item weight.
        Parameters:
        item - the item
        Returns:
        the item weight
      • getShippableSizes

        public java.util.List<java.math.BigDecimal> getShippableSizes()
        Gets shippable sizes.
        Returns:
        the shippable sizes
      • getOrderPaymentPreferenceTotalByType

        public java.math.BigDecimal getOrderPaymentPreferenceTotalByType​(java.lang.String paymentMethodTypeId)
        Get the total payment preference amount by payment type. Specify null to get amount for all preference types. TODO: filter by status as well?
        Parameters:
        paymentMethodTypeId - the payment method type id
        Returns:
        the order payment preference total by type
      • getCreditCardPaymentPreferenceTotal

        public java.math.BigDecimal getCreditCardPaymentPreferenceTotal()
        Gets credit card payment preference total.
        Returns:
        the credit card payment preference total
      • getBillingAccountPaymentPreferenceTotal

        public java.math.BigDecimal getBillingAccountPaymentPreferenceTotal()
        Gets billing account payment preference total.
        Returns:
        the billing account payment preference total
      • getGiftCardPaymentPreferenceTotal

        public java.math.BigDecimal getGiftCardPaymentPreferenceTotal()
        Gets gift card payment preference total.
        Returns:
        the gift card payment preference total
      • getOrderPaymentReceivedTotalByType

        public java.math.BigDecimal getOrderPaymentReceivedTotalByType​(java.lang.String paymentMethodTypeId)
        Get the total payment received amount by payment type. Specify null to get amount over all types. This method works by going through all the PaymentAndApplications for all order Invoices that have status PMNT_RECEIVED.
        Parameters:
        paymentMethodTypeId - the payment method type id
        Returns:
        the order payment received total by type
      • getItemSize

        public java.math.BigDecimal getItemSize​(GenericValue item)
        Gets item size.
        Parameters:
        item - the item
        Returns:
        the item size
      • getItemPiecesIncluded

        public long getItemPiecesIncluded​(GenericValue item)
        Gets item pieces included.
        Parameters:
        item - the item
        Returns:
        the item pieces included
      • getShippableItemInfo

        public java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> getShippableItemInfo​(java.lang.String shipGroupSeqId)
        Gets shippable item info.
        Parameters:
        shipGroupSeqId - the ship group seq id
        Returns:
        the shippable item info
      • getItemInfoMap

        public java.util.Map<java.lang.String,​java.lang.Object> getItemInfoMap​(GenericValue item)
        Gets item info map.
        Parameters:
        item - the item
        Returns:
        the item info map
      • getOrderEmailString

        public java.lang.String getOrderEmailString()
        Gets order email string.
        Returns:
        the order email string
      • getOrderGrandTotal

        public java.math.BigDecimal getOrderGrandTotal()
        Gets order grand total.
        Returns:
        the order grand total
      • getOrderOpenAmount

        public java.math.BigDecimal getOrderOpenAmount()
                                                throws GenericEntityException
        Gets the amount open on the order that is not covered by the relevant OrderPaymentPreferences. This works by adding up the amount allocated to each unprocessed OrderPaymentPreference and the amounts received and refunded as payments for the settled ones.
        Returns:
        the order open amount
        Throws:
        GenericEntityException - the generic entity exception
      • getOrderHeaderAdjustments

        public java.util.List<GenericValue> getOrderHeaderAdjustments()
        Gets order header adjustments.
        Returns:
        the order header adjustments
      • getOrderHeaderAdjustments

        public java.util.List<GenericValue> getOrderHeaderAdjustments​(java.lang.String shipGroupSeqId)
        Gets order header adjustments.
        Parameters:
        shipGroupSeqId - the ship group seq id
        Returns:
        the order header adjustments
      • getOrderHeaderAdjustmentsTax

        public java.util.List<GenericValue> getOrderHeaderAdjustmentsTax​(java.lang.String shipGroupSeqId)
        Gets order header adjustments tax.
        Parameters:
        shipGroupSeqId - the ship group seq id
        Returns:
        the order header adjustments tax
      • getOrderHeaderAdjustmentsToShow

        public java.util.List<GenericValue> getOrderHeaderAdjustmentsToShow()
        Gets order header adjustments to show.
        Returns:
        the order header adjustments to show
      • getOrderHeaderStatuses

        public java.util.List<GenericValue> getOrderHeaderStatuses()
        Gets order header statuses.
        Returns:
        the order header statuses
      • getOrderAdjustmentsTotal

        public java.math.BigDecimal getOrderAdjustmentsTotal()
        Gets order adjustments total.
        Returns:
        the order adjustments total
      • getOrderAdjustmentTotal

        public java.math.BigDecimal getOrderAdjustmentTotal​(GenericValue adjustment)
        Gets order adjustment total.
        Parameters:
        adjustment - the adjustment
        Returns:
        the order adjustment total
      • hasSurvey

        public int hasSurvey()
        Has survey int.
        Returns:
        the int
      • getOrderItems

        public java.util.List<GenericValue> getOrderItems()
        Gets order items.
        Returns:
        the order items
      • getOrderItemAndShipGroupAssoc

        public java.util.List<GenericValue> getOrderItemAndShipGroupAssoc()
        Gets order item and ship group assoc.
        Returns:
        the order item and ship group assoc
      • getOrderItemAndShipGroupAssoc

        public java.util.List<GenericValue> getOrderItemAndShipGroupAssoc​(java.lang.String shipGroupSeqId)
        Gets order item and ship group assoc.
        Parameters:
        shipGroupSeqId - the ship group seq id
        Returns:
        the order item and ship group assoc
      • getValidOrderItems

        public java.util.List<GenericValue> getValidOrderItems()
        Gets valid order items.
        Returns:
        the valid order items
      • getPastEtaOrderItems

        public boolean getPastEtaOrderItems​(java.lang.String orderId)
        Gets past eta order items.
        Parameters:
        orderId - the order id
        Returns:
        the past eta order items
      • getRejectedOrderItems

        public boolean getRejectedOrderItems()
        Gets rejected order items.
        Returns:
        the rejected order items
      • getPartiallyReceivedItems

        public boolean getPartiallyReceivedItems()
        Gets partially received items.
        Returns:
        the partially received items
      • getValidOrderItems

        public java.util.List<GenericValue> getValidOrderItems​(java.lang.String shipGroupSeqId)
        Gets valid order items.
        Parameters:
        shipGroupSeqId - the ship group seq id
        Returns:
        the valid order items
      • getOrderItem

        public GenericValue getOrderItem​(java.lang.String orderItemSeqId)
        Gets order item.
        Parameters:
        orderItemSeqId - the order item seq id
        Returns:
        the order item
      • getValidDigitalItems

        public java.util.List<GenericValue> getValidDigitalItems()
        Gets valid digital items.
        Returns:
        the valid digital items
      • getOrderItemAdjustments

        public java.util.List<GenericValue> getOrderItemAdjustments​(GenericValue orderItem)
        Gets order item adjustments.
        Parameters:
        orderItem - the order item
        Returns:
        the order item adjustments
      • getCurrentOrderItemWorkEffort

        public java.lang.String getCurrentOrderItemWorkEffort​(GenericValue orderItem)
        Gets current order item work effort.
        Parameters:
        orderItem - the order item
        Returns:
        the current order item work effort
      • getCurrentItemStatus

        public java.lang.String getCurrentItemStatus​(GenericValue orderItem)
        Gets current item status.
        Parameters:
        orderItem - the order item
        Returns:
        the current item status
      • getOrderItemPriceInfos

        public java.util.List<GenericValue> getOrderItemPriceInfos​(GenericValue orderItem)
        Gets order item price infos.
        Parameters:
        orderItem - the order item
        Returns:
        the order item price infos
      • getOrderItemShipGroupAssocs

        public java.util.List<GenericValue> getOrderItemShipGroupAssocs​(GenericValue orderItem)
        Gets order item ship group assocs.
        Parameters:
        orderItem - the order item
        Returns:
        the order item ship group assocs
      • getOrderItemShipGrpInvResList

        public java.util.List<GenericValue> getOrderItemShipGrpInvResList​(GenericValue orderItem)
        Gets order item ship grp inv res list.
        Parameters:
        orderItem - the order item
        Returns:
        the order item ship grp inv res list
      • getOrderItemIssuances

        public java.util.List<GenericValue> getOrderItemIssuances​(GenericValue orderItem)
        Gets order item issuances.
        Parameters:
        orderItem - the order item
        Returns:
        the order item issuances
      • getOrderItemIssuances

        public java.util.List<GenericValue> getOrderItemIssuances​(GenericValue orderItem,
                                                                  java.lang.String shipmentId)
        Gets order item issuances.
        Parameters:
        orderItem - the order item
        shipmentId - the shipment id
        Returns:
        the order item issuances
      • getOrderProductIds

        public java.util.Collection<java.lang.String> getOrderProductIds()
        Get a set of productIds in the order. @return the order product ids
      • getOrderReturnItems

        public java.util.List<GenericValue> getOrderReturnItems()
        Gets order return items.
        Returns:
        the order return items
      • getOrderItemReturnedQuantities

        public java.util.Map<java.lang.String,​java.math.BigDecimal> getOrderItemReturnedQuantities()
        Get the quantity returned per order item. In other words, this method will count the ReturnItems related to each OrderItem.
        Returns:
        Map of returned quantities as BigDecimals keyed to the orderItemSeqId
      • getOrderReturnedQuantity

        public java.math.BigDecimal getOrderReturnedQuantity()
        Get the total quantity of returned items for an order. This will count only the ReturnItems that are directly correlated to an OrderItem.
        Returns:
        the order returned quantity
      • getOrderReturnedTotalByTypeBd

        public java.math.BigDecimal getOrderReturnedTotalByTypeBd​(java.lang.String returnTypeId,
                                                                  boolean includeAll)
        Get the returned total by return type (credit, refund, etc.). Specify returnTypeId = null to get sum over all return types. Specify includeAll = true to sum up over all return statuses except cancelled. Specify includeAll = false to sum up over ACCEPTED, RECEIVED And COMPLETED returns.
        Parameters:
        returnTypeId - the return type id
        includeAll - the include all
        Returns:
        the order returned total by type bd
      • getOrderReturnedCreditTotalBd

        public java.math.BigDecimal getOrderReturnedCreditTotalBd()
        Gets the total return credit for COMPLETED and RECEIVED returns. @return the order returned credit total bd
      • getOrderReturnedRefundTotalBd

        public java.math.BigDecimal getOrderReturnedRefundTotalBd()
        Gets the total return refunded for COMPLETED and RECEIVED returns. @return the order returned refund total bd
      • getOrderReturnedTotal

        public java.math.BigDecimal getOrderReturnedTotal()
        Gets the total return amount (all return types) for COMPLETED and RECEIVED returns. @return the order returned total
      • getOrderReturnedTotal

        public java.math.BigDecimal getOrderReturnedTotal​(boolean includeAll)
        Gets the total returned over all return types. Specify true to include all return statuses except cancelled. Specify false to include only COMPLETED and RECEIVED returns.
        Parameters:
        includeAll - the include all
        Returns:
        the order returned total
      • getOrderNonReturnedTaxAndShipping

        public java.math.BigDecimal getOrderNonReturnedTaxAndShipping()
        Gets order non returned tax and shipping.
        Returns:
        the order non returned tax and shipping
      • getBillingAccountReturnedTotalByTypeBd

        public java.math.BigDecimal getBillingAccountReturnedTotalByTypeBd​(java.lang.String returnTypeId)
        Gets the total refunded to the order billing account by type. Specify null to get total over all types.
        Parameters:
        returnTypeId - the return type id
        Returns:
        the billing account returned total by type bd
      • getBillingAccountReturnedCreditTotalBd

        public java.math.BigDecimal getBillingAccountReturnedCreditTotalBd()
        Get the total return credited to the order billing accounts @return the billing account returned credit total bd
      • getBillingAccountReturnedRefundTotalBd

        public java.math.BigDecimal getBillingAccountReturnedRefundTotalBd()
        Get the total return refunded to the order billing accounts @return the billing account returned refund total bd
      • getReturnedCreditTotalWithBillingAccountBd

        public java.math.BigDecimal getReturnedCreditTotalWithBillingAccountBd()
        Gets the total return credited amount with refunds and credits to the billing account figured in @return the returned credit total with billing account bd
      • getReturnedRefundTotalWithBillingAccountBd

        public java.math.BigDecimal getReturnedRefundTotalWithBillingAccountBd()
        Gets the total return refund amount with refunds and credits to the billing account figured in @return the returned refund total with billing account bd
      • getOrderBackorderQuantity

        public java.math.BigDecimal getOrderBackorderQuantity()
        Gets order backorder quantity.
        Returns:
        the order backorder quantity
      • getItemPickedQuantityBd

        public java.math.BigDecimal getItemPickedQuantityBd​(GenericValue orderItem)
        Gets item picked quantity bd.
        Parameters:
        orderItem - the order item
        Returns:
        the item picked quantity bd
      • getItemShippedQuantity

        public java.math.BigDecimal getItemShippedQuantity​(GenericValue orderItem)
        Gets item shipped quantity.
        Parameters:
        orderItem - the order item
        Returns:
        the item shipped quantity
      • getItemShipGroupAssocShippedQuantity

        public java.math.BigDecimal getItemShipGroupAssocShippedQuantity​(GenericValue orderItem,
                                                                         java.lang.String shipGroupSeqId)
        Gets item ship group assoc shipped quantity.
        Parameters:
        orderItem - the order item
        shipGroupSeqId - the ship group seq id
        Returns:
        the item ship group assoc shipped quantity
      • getItemReservedQuantity

        public java.math.BigDecimal getItemReservedQuantity​(GenericValue orderItem)
        Gets item reserved quantity.
        Parameters:
        orderItem - the order item
        Returns:
        the item reserved quantity
      • getItemBackorderedQuantity

        public java.math.BigDecimal getItemBackorderedQuantity​(GenericValue orderItem)
        Gets item backordered quantity.
        Parameters:
        orderItem - the order item
        Returns:
        the item backordered quantity
      • getItemPendingShipmentQuantity

        public java.math.BigDecimal getItemPendingShipmentQuantity​(GenericValue orderItem)
        Gets item pending shipment quantity.
        Parameters:
        orderItem - the order item
        Returns:
        the item pending shipment quantity
      • getItemCanceledQuantity

        public java.math.BigDecimal getItemCanceledQuantity​(GenericValue orderItem)
        Gets item canceled quantity.
        Parameters:
        orderItem - the order item
        Returns:
        the item canceled quantity
      • getTotalOrderItemsQuantity

        public java.math.BigDecimal getTotalOrderItemsQuantity()
        Gets total order items quantity.
        Returns:
        the total order items quantity
      • getTotalOrderItemsOrderedQuantity

        public java.math.BigDecimal getTotalOrderItemsOrderedQuantity()
        Gets total order items ordered quantity.
        Returns:
        the total order items ordered quantity
      • getOrderItemsSubTotal

        public java.math.BigDecimal getOrderItemsSubTotal()
        Gets order items sub total.
        Returns:
        the order items sub total
      • getOrderItemSubTotal

        public java.math.BigDecimal getOrderItemSubTotal​(GenericValue orderItem)
        Gets order item sub total.
        Parameters:
        orderItem - the order item
        Returns:
        the order item sub total
      • getOrderItemsTotal

        public java.math.BigDecimal getOrderItemsTotal()
        Gets order items total.
        Returns:
        the order items total
      • getOrderItemTotal

        public java.math.BigDecimal getOrderItemTotal​(GenericValue orderItem)
        Gets order item total.
        Parameters:
        orderItem - the order item
        Returns:
        the order item total
      • getOrderItemTax

        public java.math.BigDecimal getOrderItemTax​(GenericValue orderItem)
        Gets order item tax.
        Parameters:
        orderItem - the order item
        Returns:
        the order item tax
      • getOrderItemShipping

        public java.math.BigDecimal getOrderItemShipping​(GenericValue orderItem)
        Gets order item shipping.
        Parameters:
        orderItem - the order item
        Returns:
        the order item shipping
      • getOrderItemAdjustmentsTotal

        public java.math.BigDecimal getOrderItemAdjustmentsTotal​(GenericValue orderItem,
                                                                 boolean includeOther,
                                                                 boolean includeTax,
                                                                 boolean includeShipping)
        Gets order item adjustments total.
        Parameters:
        orderItem - the order item
        includeOther - the include other
        includeTax - the include tax
        includeShipping - the include shipping
        Returns:
        the order item adjustments total
      • getOrderItemAdjustmentsTotal

        public java.math.BigDecimal getOrderItemAdjustmentsTotal​(GenericValue orderItem)
        Gets order item adjustments total.
        Parameters:
        orderItem - the order item
        Returns:
        the order item adjustments total
      • getOrderItemAdjustmentTotal

        public java.math.BigDecimal getOrderItemAdjustmentTotal​(GenericValue orderItem,
                                                                GenericValue adjustment)
        Gets order item adjustment total.
        Parameters:
        orderItem - the order item
        adjustment - the adjustment
        Returns:
        the order item adjustment total
      • getAdjustmentType

        public java.lang.String getAdjustmentType​(GenericValue adjustment)
        Gets adjustment type.
        Parameters:
        adjustment - the adjustment
        Returns:
        the adjustment type
      • getOrderItemStatuses

        public java.util.List<GenericValue> getOrderItemStatuses​(GenericValue orderItem)
        Gets order item statuses.
        Parameters:
        orderItem - the order item
        Returns:
        the order item statuses
      • getCurrentItemStatusString

        public java.lang.String getCurrentItemStatusString​(GenericValue orderItem)
        Gets current item status string.
        Parameters:
        orderItem - the order item
        Returns:
        the current item status string
      • getOrderItemsByCondition

        public java.util.List<GenericValue> getOrderItemsByCondition​(EntityCondition entityCondition)
        Fetches the set of order items with the given EntityCondition. @param entityCondition the entity condition
        Returns:
        the order items by condition
      • getProductPromoCodesEntered

        public java.util.Set<java.lang.String> getProductPromoCodesEntered()
        Gets product promo codes entered.
        Returns:
        the product promo codes entered
      • getProductPromoUse

        public java.util.List<GenericValue> getProductPromoUse()
        Gets product promo use.
        Returns:
        the product promo use
      • hasPermission

        public boolean hasPermission​(Security security,
                                     GenericValue userLogin)
        Checks to see if this user has read permission on this order
        Parameters:
        security - the security
        userLogin - The UserLogin value object to check
        Returns:
        boolean True if we have read permission
      • getOrderHeader

        public GenericValue getOrderHeader()
        Getter for property orderHeader.
        Returns:
        Value of property orderHeader.
      • getOrderHeader

        public static GenericValue getOrderHeader​(Delegator delegator,
                                                  java.lang.String orderId)
        Gets order header.
        Parameters:
        delegator - the delegator
        orderId - the order id
        Returns:
        the order header
      • getOrderItemQuantity

        public static java.math.BigDecimal getOrderItemQuantity​(GenericValue orderItem)
        Gets order item quantity.
        Parameters:
        orderItem - the order item
        Returns:
        the order item quantity
      • getOrderItemShipGroupQuantity

        public static java.math.BigDecimal getOrderItemShipGroupQuantity​(GenericValue shipGroupAssoc)
        Gets order item ship group quantity.
        Parameters:
        shipGroupAssoc - the ship group assoc
        Returns:
        the order item ship group quantity
      • getProductStoreFromOrder

        public static GenericValue getProductStoreFromOrder​(Delegator delegator,
                                                            java.lang.String orderId)
        Gets product store from order.
        Parameters:
        delegator - the delegator
        orderId - the order id
        Returns:
        the product store from order
      • getProductStoreFromOrder

        public static GenericValue getProductStoreFromOrder​(GenericValue orderHeader)
        Gets product store from order.
        Parameters:
        orderHeader - the order header
        Returns:
        the product store from order
      • getOrderGrandTotal

        public static java.math.BigDecimal getOrderGrandTotal​(java.util.List<GenericValue> orderItems,
                                                              java.util.List<GenericValue> adjustments)
        Gets order grand total.
        Parameters:
        orderItems - the order items
        adjustments - the adjustments
        Returns:
        the order grand total
      • getOrderHeaderAdjustments

        public static java.util.List<GenericValue> getOrderHeaderAdjustments​(java.util.List<GenericValue> adjustments,
                                                                             java.lang.String shipGroupSeqId)
        Gets order header adjustments.
        Parameters:
        adjustments - the adjustments
        shipGroupSeqId - the ship group seq id
        Returns:
        the order header adjustments
      • getOrderHeaderStatuses

        public static java.util.List<GenericValue> getOrderHeaderStatuses​(java.util.List<GenericValue> orderStatuses)
        Gets order header statuses.
        Parameters:
        orderStatuses - the order statuses
        Returns:
        the order header statuses
      • getOrderAdjustmentsTotal

        public static java.math.BigDecimal getOrderAdjustmentsTotal​(java.util.List<GenericValue> orderItems,
                                                                    java.util.List<GenericValue> adjustments)
        Gets order adjustments total.
        Parameters:
        orderItems - the order items
        adjustments - the adjustments
        Returns:
        the order adjustments total
      • getOrderSurveyResponses

        public static java.util.List<GenericValue> getOrderSurveyResponses​(GenericValue orderHeader)
        Gets order survey responses.
        Parameters:
        orderHeader - the order header
        Returns:
        the order survey responses
      • getOrderItemSurveyResponse

        public static java.util.List<GenericValue> getOrderItemSurveyResponse​(GenericValue orderItem)
        Gets order item survey response.
        Parameters:
        orderItem - the order item
        Returns:
        the order item survey response
      • calcOrderAdjustments

        public static java.math.BigDecimal calcOrderAdjustments​(java.util.List<GenericValue> orderHeaderAdjustments,
                                                                java.math.BigDecimal subTotal,
                                                                boolean includeOther,
                                                                boolean includeTax,
                                                                boolean includeShipping)
        Calc order adjustments big decimal.
        Parameters:
        orderHeaderAdjustments - the order header adjustments
        subTotal - the sub total
        includeOther - the include other
        includeTax - the include tax
        includeShipping - the include shipping
        Returns:
        the big decimal
      • calcOrderAdjustment

        public static java.math.BigDecimal calcOrderAdjustment​(GenericValue orderAdjustment,
                                                               java.math.BigDecimal orderSubTotal)
        Calc order adjustment big decimal.
        Parameters:
        orderAdjustment - the order adjustment
        orderSubTotal - the order sub total
        Returns:
        the big decimal
      • getOrderItemsSubTotal

        public static java.math.BigDecimal getOrderItemsSubTotal​(java.util.List<GenericValue> orderItems,
                                                                 java.util.List<GenericValue> adjustments)
        Gets order items sub total.
        Parameters:
        orderItems - the order items
        adjustments - the adjustments
        Returns:
        the order items sub total
      • getOrderItemsSubTotal

        public static java.math.BigDecimal getOrderItemsSubTotal​(java.util.List<GenericValue> orderItems,
                                                                 java.util.List<GenericValue> adjustments,
                                                                 java.util.List<GenericValue> workEfforts)
        Gets order items sub total.
        Parameters:
        orderItems - the order items
        adjustments - the adjustments
        workEfforts - the work efforts
        Returns:
        the order items sub total
      • getOrderItemSubTotal

        public static java.math.BigDecimal getOrderItemSubTotal​(GenericValue orderItem,
                                                                java.util.List<GenericValue> adjustments)
        The passed adjustments can be all adjustments for the order, ie for all line items @param orderItem the order item
        Parameters:
        adjustments - the adjustments
        Returns:
        the order item sub total
      • getOrderItemSubTotal

        public static java.math.BigDecimal getOrderItemSubTotal​(GenericValue orderItem,
                                                                java.util.List<GenericValue> adjustments,
                                                                boolean forTax,
                                                                boolean forShipping)
        The passed adjustments can be all adjustments for the order, ie for all line items @param orderItem the order item
        Parameters:
        adjustments - the adjustments
        forTax - the for tax
        forShipping - the for shipping
        Returns:
        the order item sub total
      • getOrderItemsTotal

        public static java.math.BigDecimal getOrderItemsTotal​(java.util.List<GenericValue> orderItems,
                                                              java.util.List<GenericValue> adjustments)
        Gets order items total.
        Parameters:
        orderItems - the order items
        adjustments - the adjustments
        Returns:
        the order items total
      • getOrderItemTotal

        public static java.math.BigDecimal getOrderItemTotal​(GenericValue orderItem,
                                                             java.util.List<GenericValue> adjustments)
        Gets order item total.
        Parameters:
        orderItem - the order item
        adjustments - the adjustments
        Returns:
        the order item total
      • calcOrderPromoAdjustmentsBd

        public static java.math.BigDecimal calcOrderPromoAdjustmentsBd​(java.util.List<GenericValue> allOrderAdjustments)
        Calc order promo adjustments bd big decimal.
        Parameters:
        allOrderAdjustments - the all order adjustments
        Returns:
        the big decimal
      • getWorkEffortRentalLength

        public static java.math.BigDecimal getWorkEffortRentalLength​(GenericValue workEffort)
        Gets work effort rental length.
        Parameters:
        workEffort - the work effort
        Returns:
        the work effort rental length
      • getWorkEffortRentalQuantity

        public static java.math.BigDecimal getWorkEffortRentalQuantity​(GenericValue workEffort)
        Gets work effort rental quantity.
        Parameters:
        workEffort - the work effort
        Returns:
        the work effort rental quantity
      • getAllOrderItemsAdjustmentsTotal

        public static java.math.BigDecimal getAllOrderItemsAdjustmentsTotal​(java.util.List<GenericValue> orderItems,
                                                                            java.util.List<GenericValue> adjustments,
                                                                            boolean includeOther,
                                                                            boolean includeTax,
                                                                            boolean includeShipping)
        Gets all order items adjustments total.
        Parameters:
        orderItems - the order items
        adjustments - the adjustments
        includeOther - the include other
        includeTax - the include tax
        includeShipping - the include shipping
        Returns:
        the all order items adjustments total
      • getOrderItemAdjustmentsTotal

        public static java.math.BigDecimal getOrderItemAdjustmentsTotal​(GenericValue orderItem,
                                                                        java.util.List<GenericValue> adjustments,
                                                                        boolean includeOther,
                                                                        boolean includeTax,
                                                                        boolean includeShipping)
        The passed adjustments can be all adjustments for the order, ie for all line items @param orderItem the order item
        Parameters:
        adjustments - the adjustments
        includeOther - the include other
        includeTax - the include tax
        includeShipping - the include shipping
        Returns:
        the order item adjustments total
      • getOrderItemAdjustmentsTotal

        public static java.math.BigDecimal getOrderItemAdjustmentsTotal​(GenericValue orderItem,
                                                                        java.util.List<GenericValue> adjustments,
                                                                        boolean includeOther,
                                                                        boolean includeTax,
                                                                        boolean includeShipping,
                                                                        boolean forTax,
                                                                        boolean forShipping)
        The passed adjustments can be all adjustments for the order, ie for all line items @param orderItem the order item
        Parameters:
        adjustments - the adjustments
        includeOther - the include other
        includeTax - the include tax
        includeShipping - the include shipping
        forTax - the for tax
        forShipping - the for shipping
        Returns:
        the order item adjustments total
      • getOrderItemAdjustmentList

        public static java.util.List<GenericValue> getOrderItemAdjustmentList​(GenericValue orderItem,
                                                                              java.util.List<GenericValue> adjustments)
        Gets order item adjustment list.
        Parameters:
        orderItem - the order item
        adjustments - the adjustments
        Returns:
        the order item adjustment list
      • getOrderItemStatuses

        public static java.util.List<GenericValue> getOrderItemStatuses​(GenericValue orderItem,
                                                                        java.util.List<GenericValue> orderStatuses)
        Gets order item statuses.
        Parameters:
        orderItem - the order item
        orderStatuses - the order statuses
        Returns:
        the order item statuses
      • calcItemAdjustments

        public static java.math.BigDecimal calcItemAdjustments​(java.math.BigDecimal quantity,
                                                               java.math.BigDecimal unitPrice,
                                                               java.util.List<GenericValue> adjustments,
                                                               boolean includeOther,
                                                               boolean includeTax,
                                                               boolean includeShipping,
                                                               boolean forTax,
                                                               boolean forShipping)
        Calc item adjustments big decimal.
        Parameters:
        quantity - the quantity
        unitPrice - the unit price
        adjustments - the adjustments
        includeOther - the include other
        includeTax - the include tax
        includeShipping - the include shipping
        forTax - the for tax
        forShipping - the for shipping
        Returns:
        the big decimal
      • calcItemAdjustmentsRecurringBd

        public static java.math.BigDecimal calcItemAdjustmentsRecurringBd​(java.math.BigDecimal quantity,
                                                                          java.math.BigDecimal unitPrice,
                                                                          java.util.List<GenericValue> adjustments,
                                                                          boolean includeOther,
                                                                          boolean includeTax,
                                                                          boolean includeShipping,
                                                                          boolean forTax,
                                                                          boolean forShipping)
        Calc item adjustments recurring bd big decimal.
        Parameters:
        quantity - the quantity
        unitPrice - the unit price
        adjustments - the adjustments
        includeOther - the include other
        includeTax - the include tax
        includeShipping - the include shipping
        forTax - the for tax
        forShipping - the for shipping
        Returns:
        the big decimal
      • calcItemAdjustment

        public static java.math.BigDecimal calcItemAdjustment​(GenericValue itemAdjustment,
                                                              GenericValue item)
        Calc item adjustment big decimal.
        Parameters:
        itemAdjustment - the item adjustment
        item - the item
        Returns:
        the big decimal
      • calcItemAdjustment

        public static java.math.BigDecimal calcItemAdjustment​(GenericValue itemAdjustment,
                                                              java.math.BigDecimal quantity,
                                                              java.math.BigDecimal unitPrice)
        Calc item adjustment big decimal.
        Parameters:
        itemAdjustment - the item adjustment
        quantity - the quantity
        unitPrice - the unit price
        Returns:
        the big decimal
      • calcItemAdjustmentRecurringBd

        public static java.math.BigDecimal calcItemAdjustmentRecurringBd​(GenericValue itemAdjustment,
                                                                         java.math.BigDecimal quantity,
                                                                         java.math.BigDecimal unitPrice)
        Calc item adjustment recurring bd big decimal.
        Parameters:
        itemAdjustment - the item adjustment
        quantity - the quantity
        unitPrice - the unit price
        Returns:
        the big decimal
      • filterOrderAdjustments

        public static java.util.List<GenericValue> filterOrderAdjustments​(java.util.List<GenericValue> adjustments,
                                                                          boolean includeOther,
                                                                          boolean includeTax,
                                                                          boolean includeShipping,
                                                                          boolean forTax,
                                                                          boolean forShipping)
        Filter order adjustments list.
        Parameters:
        adjustments - the adjustments
        includeOther - the include other
        includeTax - the include tax
        includeShipping - the include shipping
        forTax - the for tax
        forShipping - the for shipping
        Returns:
        the list
      • getQuantityOnOrder

        public static java.math.BigDecimal getQuantityOnOrder​(Delegator delegator,
                                                              java.lang.String productId)
        Gets quantity on order.
        Parameters:
        delegator - the delegator
        productId - the product id
        Returns:
        the quantity on order
      • hasPermission

        public static boolean hasPermission​(Security security,
                                            GenericValue userLogin,
                                            GenericValue orderHeader)
        Checks to see if this user has read permission on the specified order
        Parameters:
        security - the security
        userLogin - The UserLogin value object to check
        orderHeader - The OrderHeader for the specified order
        Returns:
        boolean True if we have read permission
      • getHelper

        public static OrderReadHelper getHelper​(GenericValue orderHeader)
        Gets helper.
        Parameters:
        orderHeader - the order header
        Returns:
        the helper
      • getAvailableOrderHeaderAdjustments

        public java.util.List<GenericValue> getAvailableOrderHeaderAdjustments()
        Get orderAdjustments that have no corresponding returnAdjustment It also handles the case of partial adjustment amount. Check OFBIZ-11185 for details
        Returns:
        return the order adjustments that have no corresponding with return adjustment
      • getReturnAdjustmentTotal

        public static java.math.BigDecimal getReturnAdjustmentTotal​(Delegator delegator,
                                                                    java.util.Map<java.lang.String,​java.lang.Object> condition)
        Get the total return adjustments for a set of key -> value condition pairs. Done for code efficiency.
        Parameters:
        delegator - the delegator
        condition - a map of the conditions to use
        Returns:
        Get the total return adjustments
      • setScaleByType

        public static java.math.BigDecimal setScaleByType​(boolean isTax,
                                                          java.math.BigDecimal value)
        Sets scale by type.
        Parameters:
        isTax - the is tax
        value - the value
        Returns:
        the scale by type
      • getOrderItemInvoicedQuantity

        public static java.math.BigDecimal getOrderItemInvoicedQuantity​(GenericValue orderItem)
        Get the quantity of order items that have been invoiced @param orderItem the order item
        Returns:
        the order item invoiced quantity
      • getOrderPaymentStatuses

        public java.util.List<GenericValue> getOrderPaymentStatuses()
        Gets order payment statuses.
        Returns:
        the order payment statuses
      • getOrderPaymentStatuses

        public static java.util.List<GenericValue> getOrderPaymentStatuses​(java.util.List<GenericValue> orderStatuses)
        Gets order payment statuses.
        Parameters:
        orderStatuses - the order statuses
        Returns:
        the order payment statuses
      • getOrderItemAttribute

        public java.lang.String getOrderItemAttribute​(java.lang.String orderItemSeqId,
                                                      java.lang.String attributeName)
        When you call this function after a OrderReadHelper instantiation all OrderItemAttributes related to the orderHeader are load on local cache to optimize database call, after we just filter the cache with attributeName and orderItemSeqId wanted.
        Parameters:
        orderItemSeqId - the order item seq id
        attributeName - the attribute name
        Returns:
        order item attribute
      • getOrderItemAttribute

        public static java.lang.String getOrderItemAttribute​(GenericValue orderItem,
                                                             java.lang.String attributeName)
        Gets order item attribute.
        Parameters:
        orderItem - the order item
        attributeName - the attribute name
        Returns:
        the order item attribute
      • getOrderAttribute

        public java.lang.String getOrderAttribute​(java.lang.String attributeName)
        When you call this function after a OrderReadHelper instantiation all OrderAttributes related to the orderHeader are load on local cache to optimize database call, after we just filter the cache with attributeName wanted.
        Parameters:
        attributeName - the attribute name
        Returns:
        order attribute
      • getOrderTaxByTaxAuthGeoAndParty

        public static java.util.Map<java.lang.String,​java.lang.Object> getOrderTaxByTaxAuthGeoAndParty​(java.util.List<GenericValue> orderAdjustments)
        Gets order tax by tax auth geo and party.
        Parameters:
        orderAdjustments - the order adjustments
        Returns:
        the order tax by tax auth geo and party
      • getOrderItemTaxByTaxAuthGeoAndPartyForDisplay

        public static java.util.Map<java.lang.String,​java.lang.Object> getOrderItemTaxByTaxAuthGeoAndPartyForDisplay​(GenericValue orderItem,
                                                                                                                           java.util.List<GenericValue> orderAdjustmentsOriginal)
        Gets order item tax by tax auth geo and party for display.
        Parameters:
        orderItem - the order item
        orderAdjustmentsOriginal - the order adjustments original
        Returns:
        the order item tax by tax auth geo and party for display
      • getOrderTaxByTaxAuthGeoAndPartyForDisplay

        public static java.util.Map<java.lang.String,​java.lang.Object> getOrderTaxByTaxAuthGeoAndPartyForDisplay​(java.util.List<GenericValue> orderAdjustmentsOriginal)
        Gets order tax by tax auth geo and party for display.
        Parameters:
        orderAdjustmentsOriginal - the order adjustments original
        Returns:
        the order tax by tax auth geo and party for display
      • getBillingAccountBalance

        public static java.math.BigDecimal getBillingAccountBalance​(GenericValue billingAccount)
                                                             throws GenericEntityException
        Calculates the "available" balance of a billing account, which is the net balance minus amount of pending (not cancelled, rejected, or received) order payments. When looking at using a billing account for a new order, you should use this method.
        Parameters:
        billingAccount - the billing account record
        Returns:
        return the "available" balance of a billing account
        Throws:
        GenericEntityException - the generic entity exception
      • getAccountLimit

        public static java.math.BigDecimal getAccountLimit​(GenericValue billingAccount)
                                                    throws GenericEntityException
        Returns the accountLimit of the BillingAccount or BigDecimal ZERO if it is null
        Parameters:
        billingAccount - the billing account
        Returns:
        the account limit
        Throws:
        GenericEntityException - the generic entity exception
      • getShippableSizes

        public java.util.List<java.math.BigDecimal> getShippableSizes​(java.lang.String shipGrouSeqId)
        Gets shippable sizes.
        Parameters:
        shipGrouSeqId - the ship grou seq id
        Returns:
        the shippable sizes
      • getItemReceivedQuantity

        public java.math.BigDecimal getItemReceivedQuantity​(GenericValue orderItem)
        Gets item received quantity.
        Parameters:
        orderItem - the order item
        Returns:
        the item received quantity