Class SalesDocumentImpl

    • Field Detail

      • alreadyInitialized

        protected boolean alreadyInitialized
      • externalToOrder

        protected boolean externalToOrder
      • checkCatalogNecessary

        protected boolean checkCatalogNecessary
      • redemptionValue

        protected java.lang.String redemptionValue
        redemption value
      • determinationRequired

        protected boolean determinationRequired
      • grossValueAvailable

        protected boolean grossValueAvailable
      • netValueAvailable

        protected boolean netValueAvailable
      • pricesTraced

        protected boolean pricesTraced
      • itemsWithAlternativeProductList

        protected final java.util.List<TechKey> itemsWithAlternativeProductList
        This list stores items with alternative products. For these items events should only be fired when a product is selected (see int msg 385863 2010).
    • Constructor Detail

      • SalesDocumentImpl

        public SalesDocumentImpl()
    • Method Detail

      • isCheckCatalogNecessary

        public boolean isCheckCatalogNecessary()
        Description copied from interface: SalesDocument
        Does the document require that the items are checked against the catalog?
        Specified by:
        isCheckCatalogNecessary in interface SalesDocument
        Returns:
        true if check is required
      • setCheckCatalogNecessary

        public void setCheckCatalogNecessary​(boolean checkCatalogNecessary)
        Description copied from interface: SalesDocument
        Indicates whether a check of the items against the catalog is required
        Specified by:
        setCheckCatalogNecessary in interface SalesDocument
        Parameters:
        checkCatalogNecessary - if check is required
      • adaptHeaderDocumentType

        protected void adaptHeaderDocumentType()
                                        throws CommunicationException
        Sets the document type on the document header depending on the Java class instance of the Sales Document (evaluated with instanceof ).
        Throws:
        CommunicationException
      • addShipTo

        public void addShipTo​(ShipTo shipTo)
        Adds a shipTo to the shipTo list
        Parameters:
        shipTo - shipTo to add
      • destroyContent

        public void destroyContent()
                            throws CommunicationException
        Description copied from interface: SalesDocument
        Destroy the data of the document (items and header) in the backend representation. After a call to this method, the object is in an undefined state. You have to call init() before you can use it again.
        This method is normally called before removing the BO-representation of the object using the BOM.
        Specified by:
        destroyContent in interface SalesDocument
        Throws:
        CommunicationException - in case back-end error
      • getBackendService

        protected abstract SalesDocumentBackend getBackendService()
                                                           throws BackendException
        Method retrieving the backend object for the object. This method is abstract because every concrete subclass of SalesDocument may use its own implementation of a backend object.
        Returns:
        Backend object to be used
        Throws:
        BackendException
      • getTransactionConfiguration

        public TransactionConfiguration getTransactionConfiguration()
        Description copied from interface: SalesDocument
        Returns the transaction configuration. The transaction configuration provides access to sales-specific settings (e.g. sales organisation)
        Specified by:
        getTransactionConfiguration in interface SalesDocument
        Returns:
        TransactionConfiguration to access the sales-related configuration
      • init

        public void init​(PartnerList partnerList)
                  throws CommunicationException
        Description copied from interface: SalesDocument
        Initializes the sales document with the given arguments and creates and instance in back-end application memory.
        Specified by:
        init in interface SalesDocument
        Parameters:
        partnerList - any partners maintained will be added to the sales document in the same partner function
        Throws:
        CommunicationException - in case back-end error
      • init

        public void init​(SalesDocument source,
                         java.lang.String processType)
                  throws BusinessObjectException
        Description copied from interface: SalesDocument
        Initializes an empty instance of this object with the data coming from the provided document. The former state of this document is dropped and lost, the fields of the other document are copied into the fields of this document. To do this the clone() method of the fields is used to get an shallow copy and minimise interference between the new and the old object. The creation date of the old document is not copied to the new one but the original date is left as it is. A back-end representation of the new object is created and filled with the data retrieved by the copy operation.
        Specified by:
        init in interface SalesDocument
        Parameters:
        source - The SalesDocument to retrieve data from
        processType - process type for the new SalesDocument (optional)
        Throws:
        BusinessObjectException - in case back-end error
      • processItems

        protected java.lang.StringBuilder processItems​(SalesDocument source)
        Parameters:
        source -
        Returns:
      • isExistingInBackend

        public boolean isExistingInBackend()
        Description copied from interface: SalesDocument
        Checks if the document exists in the backend storage
        Specified by:
        isExistingInBackend in interface SalesDocument
        Returns:
        does the document exist in backend?
      • isDeterminationRequired

        public boolean isDeterminationRequired()
        Description copied from interface: SalesDocumentBase
        Determines if manual Product-, Campaign-, ... Determination is necessary for at least one top level item.
        Specified by:
        isDeterminationRequired in interface SalesDocumentBase<ItemList,​Item,​Header>
        Returns:
        boolean true if there is at least on item that needs manual determination for products, camapigns, etc.
      • isExternalToOrder

        public boolean isExternalToOrder()
        Description copied from interface: SalesDocument
        Indicates whether or not the order has to be maintained as an external document to this one. (e.g. java basket is external to crm backend order)
        Specified by:
        isExternalToOrder in interface SalesDocument
        Returns:
        true indicates that the order is maintained external to this document, false indicates that the order lies on the same system.
      • isGrossValueAvailable

        public boolean isGrossValueAvailable()
        Description copied from interface: SalesDocument
        Indicates whether or not the sales document can provide the Gross value.
        Specified by:
        isGrossValueAvailable in interface SalesDocument
        Returns:
        true indicates that the sales document can provide the gross value. false indicates that the sales document can not deliver the gross value.
      • isNetValueAvailable

        public boolean isNetValueAvailable()
        Description copied from interface: SalesDocument
        Indicates whether or not the sales document can provide a net value.
        Specified by:
        isNetValueAvailable in interface SalesDocument
        Returns:
        true indicates that the sales document can provide the net value false indicates that the sales document can not deliver the net value.
      • isUpdateMissing

        public boolean isUpdateMissing()
        Description copied from interface: SalesDocument
        Check whether its required to Update the object
        Specified by:
        isUpdateMissing in interface SalesDocument
        Returns:
        true, only if the object has to be updated
      • mergeIdenticalProducts

        protected boolean mergeIdenticalProducts()
                                          throws CommunicationException
        Merges identical products (this is told from the product ID) and states whether changes have been done
        Returns:
        did we do changes?
        Throws:
        CommunicationException
      • mergingItem

        protected void mergingItem​(java.util.List<Item> mergeItems,
                                   Item merged,
                                   double sumQty,
                                   int discarded)
        Parameters:
        mergeItems -
        merged -
        sumQty -
        discarded -
      • getDublicatesForItems

        protected java.util.Map<java.lang.String,​java.util.List<Item>> getDublicatesForItems()
      • createItemKey

        protected java.lang.String createItemKey​(Item toCheck)
      • read

        public void read​(boolean force)
                  throws CommunicationException
        Description copied from interface: SalesDocument
        Reads the sales document. The backend call happens if considered as necessary or if forced.
        Specified by:
        read in interface SalesDocument
        Parameters:
        force - If true, then read even if not considered as necessary
        Throws:
        CommunicationException - in case back-end error
      • readForUpdate

        public void readForUpdate​(boolean force)
                           throws CommunicationException
        Description copied from interface: SalesDocument
        Reads the sales document for update (tried to get a lock). The backend call happens if considered as necessary or if forced.
        Specified by:
        readForUpdate in interface SalesDocument
        Parameters:
        force - If true, then read even if not considered as necessary
        Throws:
        CommunicationException - in case back-end error
      • setDeterminationRequired

        public void setDeterminationRequired​(boolean isDeterminationRequired)
        Description copied from interface: SalesDocumentBase
        Sets the isDeterminationRequired flag
        Specified by:
        setDeterminationRequired in interface SalesDocumentBase<ItemList,​Item,​Header>
        Parameters:
        isDeterminationRequired - true if there are items that need manual determination either for camapigns, substitution products or something similar
      • setExternalToOrder

        public void setExternalToOrder​(boolean isExternalToOrder)
        Description copied from interface: SalesDocument
        Sets whether or not the order has to be maintained as an external document to this one. (e.g. a java basket is an external document to crm backend order)
        Specified by:
        setExternalToOrder in interface SalesDocument
        Parameters:
        isExternalToOrder - true indicates that the order is maintained external to this document, false indicates that the order lies on the same system.
      • setGrossValueAvailable

        public void setGrossValueAvailable​(boolean isGrossValueAvailable)
        Description copied from interface: SalesDocument
        Sets the property grossValueAvailable
        Specified by:
        setGrossValueAvailable in interface SalesDocument
        Parameters:
        isGrossValueAvailable - true indicates that the sales document can provide the gross value false indicates that the sales document can not provide the gross value.
      • setNetValueAvailable

        public void setNetValueAvailable​(boolean isNetValueAvailable)
        Description copied from interface: SalesDocument
        Sets the property netValueAvailable
        Specified by:
        setNetValueAvailable in interface SalesDocument
        Parameters:
        isNetValueAvailable - true indicates that the sales document can deliver the net value false indicates that the sales document can not deliver the net value.
      • setShipToList

        public void setShipToList​(java.util.List<ShipTo> shipToList)
        Description copied from interface: SalesDocument
        Sets shipTo list
        Specified by:
        setShipToList in interface SalesDocument
        Parameters:
        shipToList - list of ShipTo's
      • setBillToList

        public void setBillToList​(java.util.List<BillTo> billToList)
        Description copied from interface: SalesDocument
        Sets BillTo list
        Specified by:
        setBillToList in interface SalesDocument
        Parameters:
        billToList - list of BillTo's
      • setTransactionConfiguration

        public void setTransactionConfiguration​(TransactionConfiguration transConf)
        Description copied from interface: SalesDocument
        The transaction configuration provides access to sales-specific settings (e.g. sales organisation)
        Specified by:
        setTransactionConfiguration in interface SalesDocument
        Parameters:
        transConf - API to access the configuration and documents
      • setUpdateMissing

        public void setUpdateMissing​(boolean updateMissing)
        Description copied from interface: SalesDocument
        Sets whether update before save is required. Has to be set to true for initial objects to ensure that update is called at least once before save.
        Specified by:
        setUpdateMissing in interface SalesDocument
        Parameters:
        updateMissing - set to true to force an update before next save
      • determineConfigurableItemsToRelease

        protected java.util.List<TechKey> determineConfigurableItemsToRelease()
      • prepareItemsWithChangedProducts

        protected void prepareItemsWithChangedProducts()
      • setSoldToGuid

        public void setSoldToGuid​(TechKey techKeySoldTo,
                                  java.lang.String soldToId)
        Specified by:
        setSoldToGuid in interface SalesDocument
        Parameters:
        techKeySoldTo - the guid of the soldto
        soldToId - the partner id of the soldto
      • hasPredecessorOfSpecificType

        public boolean hasPredecessorOfSpecificType​(DocumentType docType)
        Description copied from interface: SalesDocument
        Scans list of predecessors for given document type.
        Specified by:
        hasPredecessorOfSpecificType in interface SalesDocument
        Parameters:
        docType - to be searched for in predecessors
        Returns:
        true if predecessor list contains given doc type
      • setInitialized

        public void setInitialized​(boolean b)
        Description copied from interface: SalesDocument
        Indicates whether a sales document could be initialized
        Specified by:
        setInitialized in interface SalesDocument
        Parameters:
        b - true if initialization was not possible
      • isInitialized

        public boolean isInitialized()
        Description copied from interface: SalesDocument
        Does the document carry an initialization error?
        Specified by:
        isInitialized in interface SalesDocument
        Returns:
        true if initialization was not possible
      • isItemBasedAvailability

        public boolean isItemBasedAvailability()
        Description copied from interface: SalesDocument
        Checks if availability is compiled only based on item information.
        Specified by:
        isItemBasedAvailability in interface SalesDocument
        Returns:
        Availability is compiled only based item on information?
      • setConverter

        public void setConverter​(Converter converter)
        Specified by:
        setConverter in interface SalesDocument
        Parameters:
        converter - access object for unit related conversions
      • afterDeleteItemInBackend

        protected void afterDeleteItemInBackend​(java.util.List<TechKey> itemsToDelete)
        Releases configuration sessions for all items provided
        Parameters:
        itemsToDelete - List of item TechKeys
      • afterUpdateItemInBackend

        protected void afterUpdateItemInBackend​(java.util.List<TechKey> itemsToDelete)
        Releases configuration sessions for all items provided
        Parameters:
        itemsToDelete - List of item TechKeys
      • afterDeleteItemInBackend

        public void afterDeleteItemInBackend()
        Description copied from interface: SalesDocument
        Releases all configuration sessions attached to this sales document
        Specified by:
        afterDeleteItemInBackend in interface SalesDocument
      • isBackendDown

        public boolean isBackendDown()
        Specified by:
        isBackendDown in interface SalesDocument
        Returns:
        Is back end down for a planned downtime?
      • getSessionService

        public SessionService getSessionService()
        Returns:
        the sessionService
      • setSessionService

        public void setSessionService​(SessionService sessionService)
        Parameters:
        sessionService - the sessionService to set
      • getSalesDocumentHooks

        public java.util.List<SalesDocumentHook> getSalesDocumentHooks()
        Returns:
        the salesDocumentHooks
      • setSalesDocumentHooks

        public void setSalesDocumentHooks​(java.util.List<SalesDocumentHook> salesDocumentHooks)
        Parameters:
        salesDocumentHooks - the salesDocumentHooks to set